s3:ntlmssp: change get_challange() to return NTSTATUS
authorStefan Metzmacher <metze@samba.org>
Tue, 29 Dec 2009 10:57:28 +0000 (11:57 +0100)
committerStefan Metzmacher <metze@samba.org>
Tue, 29 Dec 2009 16:06:22 +0000 (17:06 +0100)
metze

source3/auth/auth_ntlmssp.c
source3/include/ntlmssp.h
source3/libsmb/ntlmssp.c

index f95a2359090330b2a0e12457c326d92de92d2024..4243a24ca72a5ac3a538c95dc598c3539888c79a 100644 (file)
  * @return an 8 byte random challenge
  */
 
-static void auth_ntlmssp_get_challenge(const struct ntlmssp_state *ntlmssp_state,
-                                      uint8_t chal[8])
+static NTSTATUS auth_ntlmssp_get_challenge(const struct ntlmssp_state *ntlmssp_state,
+                                          uint8_t chal[8])
 {
        AUTH_NTLMSSP_STATE *auth_ntlmssp_state =
                (AUTH_NTLMSSP_STATE *)ntlmssp_state->auth_context;
        auth_ntlmssp_state->auth_context->get_ntlm_challenge(
                auth_ntlmssp_state->auth_context, chal);
+       return NT_STATUS_OK;
 }
 
 /**
index f30b53f0946e6d93ad463641874d183b7e2b211e..d3de59835f0187590406cdfa1ca4e14bfa51417a 100644 (file)
@@ -74,8 +74,8 @@ struct ntlmssp_state
         * @return 8 bytes of challenge data, determined by the server to be the challenge for NTLM authentication
         *
         */
-       void (*get_challenge)(const struct ntlmssp_state *ntlmssp_state,
-                             uint8_t challenge[8]);
+       NTSTATUS (*get_challenge)(const struct ntlmssp_state *ntlmssp_state,
+                                 uint8_t challenge[8]);
 
        /**
         * Callback to find if the challenge used by NTLM authentication may be modified
index aaa5031951724234a8b752cad83e3b71a9d7c766..7fffe7cea30e3e3f9541e1666eb66e5a0db502a4 100644 (file)
@@ -112,10 +112,11 @@ void debug_ntlmssp_flags(uint32 neg_flags)
  *
  */
 
-static void get_challenge(const struct ntlmssp_state *ntlmssp_state,
-                         uint8_t chal[8])
+static NTSTATUS get_challenge(const struct ntlmssp_state *ntlmssp_state,
+                             uint8_t chal[8])
 {
        generate_random_buffer(chal, 8);
+       return NT_STATUS_OK;
 }
 
 /**
@@ -493,6 +494,7 @@ static NTSTATUS ntlmssp_server_negotiate(struct ntlmssp_state *ntlmssp_state,
        const char *target_name;
        struct NEGOTIATE_MESSAGE negotiate;
        struct CHALLENGE_MESSAGE challenge;
+       NTSTATUS status;
 
        /* parse the NTLMSSP packet */
 #if 0
@@ -525,7 +527,10 @@ static NTSTATUS ntlmssp_server_negotiate(struct ntlmssp_state *ntlmssp_state,
        ntlmssp_handle_neg_flags(ntlmssp_state, neg_flags, lp_lanman_auth());
 
        /* Ask our caller what challenge they would like in the packet */
-       ntlmssp_state->get_challenge(ntlmssp_state, cryptkey);
+       status = ntlmssp_state->get_challenge(ntlmssp_state, cryptkey);
+       if (!NT_STATUS_IS_OK(status)) {
+               return status;
+       }
 
        /* Check if we may set the challenge */
        if (!ntlmssp_state->may_set_challenge(ntlmssp_state)) {