s3:libsmb: fix anonymous session setups against windows servers
authorStefan Metzmacher <metze@samba.org>
Mon, 16 Apr 2012 10:14:07 +0000 (12:14 +0200)
committerStefan Metzmacher <metze@samba.org>
Mon, 16 Apr 2012 10:54:54 +0000 (12:54 +0200)
Windows server doesn't set the SMB2_SESSION_FLAG_IS_GUEST nor
SMB2_SESSION_FLAG_IS_NULL flag.

This fix makes sure we don't try to verify a signature on the
final session setup response.

metze

source3/libsmb/cliconnect.c

index 9d4e4e1f9962eb517e47c5616f6d54a686fb7821..6e057a5fef487e2278ec432a22c72d558020f4f3 100644 (file)
@@ -1710,6 +1710,22 @@ static void cli_session_setup_ntlmssp_done(struct tevent_req *subreq)
 
                if (cli_state_protocol(state->cli) >= PROTOCOL_SMB2_02) {
                        struct smbXcli_session *session = state->cli->smb2.session;
+
+                       if (state->ntlmssp_state->nt_hash == NULL) {
+                               /*
+                                * Windows server does not set the
+                                * SMB2_SESSION_FLAG_IS_GUEST nor
+                                * SMB2_SESSION_FLAG_IS_NULL flag.
+                                *
+                                * This fix makes sure we do not try
+                                * to verify a signature on the final
+                                * session setup response.
+                                */
+                               TALLOC_FREE(state->ntlmssp_state);
+                               tevent_req_done(req);
+                               return;
+                       }
+
                        status = smb2cli_session_set_session_key(session,
                                                state->ntlmssp_state->session_key,
                                                recv_iov);