pam_matrix calls smb_pam_conv() with resp=NULL in some situation,
we should not segfault...
BUG: https://bugzilla.samba.org/show_bug.cgi?id=9705
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
struct pam_response *reply = NULL;
struct smb_pam_userdata *udp = (struct smb_pam_userdata *)appdata_ptr;
- *resp = NULL;
+ if (resp != NULL) {
+ *resp = NULL;
+ }
if (num_msg <= 0)
return PAM_CONV_ERR;
return PAM_CONV_ERR;
}
}
- if (reply)
- *resp = reply;
+ if (reply != NULL) {
+ if (resp != NULL) {
+ *resp = reply;
+ } else {
+ SAFE_FREE(reply);
+ }
+ }
return PAM_SUCCESS;
}