s3:libsmb: use password = NULL for anonymous connections
authorStefan Metzmacher <metze@samba.org>
Tue, 19 Apr 2016 05:31:50 +0000 (07:31 +0200)
committerKarolin Seeger <kseeger@samba.org>
Fri, 29 Apr 2016 10:06:25 +0000 (12:06 +0200)
BUG: https://bugzilla.samba.org/show_bug.cgi?id=11858

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Günther Deschner <gd@samba.org>
(cherry picked from commit 53be47410236ef7c90fe895f49f300e3fe47a8bf)

source3/libsmb/cliconnect.c

index 039fba2c71bd87e383b0a6f40f48201e9572a2f2..b518ab888f09360ed263c81dab81b3af5903d41f 100644 (file)
@@ -1343,6 +1343,17 @@ static struct tevent_req *cli_session_setup_gensec_send(
        talloc_set_destructor(
                state, cli_session_setup_gensec_state_destructor);
 
+       if (user == NULL || strlen(user) == 0) {
+               if (pass != NULL && strlen(pass) == 0) {
+                       /*
+                        * some callers pass "" as no password
+                        *
+                        * gensec only handles NULL as no password.
+                        */
+                       pass = NULL;
+               }
+       }
+
        status = auth_generic_client_prepare(state, &state->auth_generic);
        if (tevent_req_nterror(req, status)) {
                return tevent_req_post(req, ev);