s3:libsmb: don't finish the gensec handshake for guest logins
authorStefan Metzmacher <metze@samba.org>
Tue, 19 Apr 2016 05:20:28 +0000 (07:20 +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=11841

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 48f499c949b3d7f2c9b7eed9ac765ba37f8e8671..b984087e74883d314f6c1150c0539b35f3dd9e3c 100644 (file)
@@ -1572,6 +1572,27 @@ static void cli_session_setup_gensec_remote_done(struct tevent_req *subreq)
        }
 
        if (NT_STATUS_IS_OK(status)) {
+               struct smbXcli_session *session = NULL;
+               bool is_guest = false;
+
+               if (smbXcli_conn_protocol(state->cli->conn) >= PROTOCOL_SMB2_02) {
+                       session = state->cli->smb2.session;
+               } else {
+                       session = state->cli->smb1.session;
+               }
+
+               is_guest = smbXcli_session_is_guest(session);
+               if (is_guest) {
+                       /*
+                        * We can't finish the gensec handshake, we don't
+                        * have a negotiated session key.
+                        *
+                        * So just pretend we are completely done.
+                        */
+                       state->blob_in = data_blob_null;
+                       state->local_ready = true;
+               }
+
                state->remote_ready = true;
        }