diff options
author | David Disseldorp <ddiss@samba.org> | 2013-04-17 10:39:12 -0700 |
---|---|---|
committer | Karolin Seeger <kseeger@samba.org> | 2013-04-22 09:39:49 +0200 |
commit | 389faceaa365d314ec49c9629b835d0418e6d222 (patch) | |
tree | 5bc7b0ecb16ff8cb76beb9d41e9a78074ce7db45 | |
parent | 376c36b61d2984b52cd7aaa5ef1513fe5464bb32 (diff) | |
download | samba-389faceaa365d314ec49c9629b835d0418e6d222.tar.gz |
Bug 9807 - wbinfo: fix segfault in wbinfo_pam_logon
wbinfo_pam_logon() incorrectly assumes that wbcLogonUser() always
returns an allocated wbcAuthErrorInfo struct on failure.
Signed-off-by: David Disseldorp <ddiss@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Wed Apr 17 21:29:29 CEST 2013 on sn-devel-104
-rw-r--r-- | nsswitch/wbinfo.c | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/nsswitch/wbinfo.c b/nsswitch/wbinfo.c index aee4004e57d..762382c776d 100644 --- a/nsswitch/wbinfo.c +++ b/nsswitch/wbinfo.c @@ -1736,7 +1736,7 @@ static bool wbinfo_pam_logon(char *username) { wbcErr wbc_status = WBC_ERR_UNKNOWN_FAILURE; struct wbcLogonUserParams params; - struct wbcAuthErrorInfo *error; + struct wbcAuthErrorInfo *error = NULL; char *s = NULL; char *p = NULL; TALLOC_CTX *frame = talloc_tos(); @@ -1787,16 +1787,15 @@ static bool wbinfo_pam_logon(char *username) d_printf("plaintext password authentication %s\n", WBC_ERROR_IS_OK(wbc_status) ? "succeeded" : "failed"); - if (!WBC_ERROR_IS_OK(wbc_status)) { + if (!WBC_ERROR_IS_OK(wbc_status) && (error != NULL)) { d_fprintf(stderr, "error code was %s (0x%x)\nerror message was: %s\n", error->nt_string, (int)error->nt_status, error->display_string); wbcFreeMemory(error); - return false; } - return true; + return WBC_ERROR_IS_OK(wbc_status); } /* Save creds with winbind */ |