s4-libsmb: Do not set empty password for gensec
authorAndreas Schneider <asn@samba.org>
Mon, 19 Sep 2016 12:38:54 +0000 (14:38 +0200)
committerStefan Metzmacher <metze@samba.org>
Mon, 18 Feb 2019 12:39:20 +0000 (13:39 +0100)
GENSEC expects NULL as no password. There are too many places which
set "" instead of NULL. We plan to pass down the cli_credentials
structure anyway so this workaround should be ok for now.

Signed-off-by: Andreas Schneider <asn@samba.org>
source3/libsmb/auth_generic.c

index 59560d677bc2aba7710d236828de8902e8137e9c..4ccb7acc1687d4d1ee32c369735f02c8d83974dd 100644 (file)
@@ -44,7 +44,9 @@ NTSTATUS auth_generic_set_domain(struct auth_generic_state *ans,
 NTSTATUS auth_generic_set_password(struct auth_generic_state *ans,
                                   const char *password)
 {
-       cli_credentials_set_password(ans->credentials, password, CRED_SPECIFIED);
+       if (password != NULL && password[0] != '\0') {
+               cli_credentials_set_password(ans->credentials, password, CRED_SPECIFIED);
+       }
        return NT_STATUS_OK;
 }