pgpool2.git / summary / log / commit / refs

commit    3fa4d7eba7f0924ebec35353bf322649893cf103
Author:   Muhammad Usama <m.usama@gmail.com>
Date:     Fri Mar 31 15:15:22 2017 +0000

    Fix for [pgpool-general: 5396] pam ldap failure
    
    Do not use Palloc and friends to allocate memory for pam_response in the
    PAM conversation function, Since that memory is freed by PAM library who
    knows nothing about our MemoryManager and can cause the segmentation fault.


src/auth/pool_hba.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/auth/pool_hba.c b/src/auth/pool_hba.c index 6b393b88f..9ad0d45c6 100644 --- a/src/auth/pool_hba.c +++ b/src/auth/pool_hba.c @@ -1261,10 +1261,13 @@ static int pam_passwd_conv_proc(int num_msg, const struct pam_message ** msg, /* * PAM will free this memory in * pam_end() + * Do not use Palloc and freinds to allocate this memory, + * Since the PAM library will be freeing this memory who + * knowns nothing about our MemoryManager */ - *resp = palloc0(num_msg* sizeof(struct pam_response)); + *resp = calloc(num_msg, sizeof(struct pam_response)); - (*resp)[0].resp = pstrdup((char *) appdata_ptr); + (*resp)[0].resp = strdup((char *) appdata_ptr); (*resp)[0].resp_retcode = 0; return ((*resp)[0].resp ? PAM_SUCCESS : PAM_CONV_ERR); [parent: 3aea2e8319be]