s3:libsmb: use password = NULL for anonymous connections
authorStefan Metzmacher <metze@samba.org>
Tue, 19 Apr 2016 05:31:50 +0000 (07:31 +0200)
committerStefan Metzmacher <metze@samba.org>
Thu, 28 Apr 2016 14:51:16 +0000 (16:51 +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>
source3/libsmb/cliconnect.c

index 2c351dda9c51238c006d1f45b64a5b3b63d5d79e..b8a8c7a0839e496ffbde2c5ddf8e3b4aa6ea521c 100644 (file)
@@ -1325,6 +1325,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);