The branch, master has been updated
       via  15297ee... s3: Fix some valgrind errors
      from  6227eac... smbtorture: Fixx off-by-one command line parsing.

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master


- Log -----------------------------------------------------------------
commit 15297eea0e6b1e95ddb9e2ccd25ff454a405c351
Author: Volker Lendecke <[email protected]>
Date:   Mon Jun 21 22:20:10 2010 +0200

    s3: Fix some valgrind errors
    
    With -d 10, there were a ton of uninitialized variables: The 
"NegotiateFlags"
    in the automatically parsed ntlmssp structures were not initialized.
    
    This also cleans up the talloc use a bit: do early TALLOC_FREE()
    
    Günther, please check!
    
    Thanks,
    
    Volker

-----------------------------------------------------------------------

Summary of changes:
 source3/libsmb/ntlmssp.c |   51 +++++++++++++++++++++++++++++----------------
 1 files changed, 33 insertions(+), 18 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source3/libsmb/ntlmssp.c b/source3/libsmb/ntlmssp.c
index 1d47517..870f6c5 100644
--- a/source3/libsmb/ntlmssp.c
+++ b/source3/libsmb/ntlmssp.c
@@ -395,8 +395,6 @@ static NTSTATUS ntlmssp_server_negotiate(struct 
ntlmssp_state *ntlmssp_state,
        uint32_t ntlmssp_command, chal_flags;
        uint8_t cryptkey[8];
        const char *target_name;
-       struct NEGOTIATE_MESSAGE negotiate;
-       struct CHALLENGE_MESSAGE challenge;
        NTSTATUS status;
 
        /* parse the NTLMSSP packet */
@@ -417,11 +415,16 @@ static NTSTATUS ntlmssp_server_negotiate(struct 
ntlmssp_state *ntlmssp_state,
                debug_ntlmssp_flags(neg_flags);
 
                if (DEBUGLEVEL >= 10) {
-                       if 
(NT_STATUS_IS_OK(ntlmssp_pull_NEGOTIATE_MESSAGE(&request,
-                                                      ntlmssp_state,
-                                                      &negotiate)))
-                       {
-                               NDR_PRINT_DEBUG(NEGOTIATE_MESSAGE, &negotiate);
+                       struct NEGOTIATE_MESSAGE *negotiate = talloc(
+                               talloc_tos(), struct NEGOTIATE_MESSAGE);
+                       if (negotiate != NULL) {
+                               status = ntlmssp_pull_NEGOTIATE_MESSAGE(
+                                       &request, negotiate, negotiate);
+                               if (NT_STATUS_IS_OK(status)) {
+                                       NDR_PRINT_DEBUG(NEGOTIATE_MESSAGE,
+                                                       negotiate);
+                               }
+                               TALLOC_FREE(negotiate);
                        }
                }
        }
@@ -514,11 +517,17 @@ static NTSTATUS ntlmssp_server_negotiate(struct 
ntlmssp_state *ntlmssp_state,
                data_blob_free(&version_blob);
 
                if (DEBUGLEVEL >= 10) {
-                       if 
(NT_STATUS_IS_OK(ntlmssp_pull_CHALLENGE_MESSAGE(reply,
-                                                      ntlmssp_state,
-                                                      &challenge)))
-                       {
-                               NDR_PRINT_DEBUG(CHALLENGE_MESSAGE, &challenge);
+                       struct CHALLENGE_MESSAGE *challenge = talloc(
+                               talloc_tos(), struct CHALLENGE_MESSAGE);
+                       if (challenge != NULL) {
+                               challenge->NegotiateFlags = chal_flags;
+                               status = ntlmssp_pull_CHALLENGE_MESSAGE(
+                                       reply, challenge, challenge);
+                               if (NT_STATUS_IS_OK(status)) {
+                                       NDR_PRINT_DEBUG(CHALLENGE_MESSAGE,
+                                                       challenge);
+                               }
+                               TALLOC_FREE(challenge);
                        }
                }
        }
@@ -548,7 +557,6 @@ static NTSTATUS ntlmssp_server_auth(struct ntlmssp_state 
*ntlmssp_state,
        DATA_BLOB session_key = data_blob_null;
        uint32_t ntlmssp_command, auth_flags;
        NTSTATUS nt_status = NT_STATUS_OK;
-       struct AUTHENTICATE_MESSAGE authenticate;
 
        /* used by NTLM2 */
        bool doing_ntlm2 = False;
@@ -617,11 +625,18 @@ static NTSTATUS ntlmssp_server_auth(struct ntlmssp_state 
*ntlmssp_state,
                ntlmssp_handle_neg_flags(ntlmssp_state, auth_flags, 
lp_lanman_auth());
 
        if (DEBUGLEVEL >= 10) {
-               if (NT_STATUS_IS_OK(ntlmssp_pull_AUTHENTICATE_MESSAGE(&request,
-                                                 ntlmssp_state,
-                                                 &authenticate)))
-               {
-                       NDR_PRINT_DEBUG(AUTHENTICATE_MESSAGE, &authenticate);
+               struct AUTHENTICATE_MESSAGE *authenticate = talloc(
+                       talloc_tos(), struct AUTHENTICATE_MESSAGE);
+               if (authenticate != NULL) {
+                       NTSTATUS status;
+                       authenticate->NegotiateFlags = auth_flags;
+                       status = ntlmssp_pull_AUTHENTICATE_MESSAGE(
+                               &request, authenticate, authenticate);
+                       if (NT_STATUS_IS_OK(status)) {
+                               NDR_PRINT_DEBUG(AUTHENTICATE_MESSAGE,
+                                               authenticate);
+                       }
+                       TALLOC_FREE(authenticate);
                }
        }
 


-- 
Samba Shared Repository

Reply via email to