auth/ntlmssp: don't crash when the backend give no challenge
authorStefan Metzmacher <metze@samba.org>
Fri, 1 Aug 2008 14:10:06 +0000 (16:10 +0200)
committerStefan Metzmacher <metze@samba.org>
Fri, 1 Aug 2008 14:10:59 +0000 (16:10 +0200)
metze

source/auth/ntlmssp/ntlmssp_server.c

index dfc5940d992f4204f584951e76af6985b9837912..838596ee988cdec2a2fe27472157654ad328a725 100644 (file)
@@ -157,6 +157,10 @@ NTSTATUS ntlmssp_server_negotiate(struct gensec_security *gensec_security,
 
        /* Ask our caller what challenge they would like in the packet */
        cryptkey = gensec_ntlmssp_state->get_challenge(gensec_ntlmssp_state);
+       if (!cryptkey) {
+               DEBUG(1, ("ntlmssp_server_negotiate: backend doesn't give a challenge\n"));
+               return NT_STATUS_INTERNAL_ERROR;
+       }
 
        /* Check if we may set the challenge */
        if (!gensec_ntlmssp_state->may_set_challenge(gensec_ntlmssp_state)) {
@@ -614,6 +618,8 @@ static const uint8_t *auth_ntlmssp_get_challenge(const struct gensec_ntlmssp_sta
 
        status = auth_get_challenge(gensec_ntlmssp_state->auth_context, &chal);
        if (!NT_STATUS_IS_OK(status)) {
+               DEBUG(1, ("auth_ntlmssp_get_challenge: failed to get challenge: %s\n",
+                       nt_errstr(status)));
                return NULL;
        }