r3599: fixed a couple of memory errors in the rpc netlogon server
authorAndrew Tridgell <tridge@samba.org>
Sun, 7 Nov 2004 12:40:07 +0000 (12:40 +0000)
committerGerald (Jerry) Carter <jerry@samba.org>
Wed, 10 Oct 2007 18:05:37 +0000 (13:05 -0500)
(found with valgrind)
(This used to be commit 151dd4593d30c703b70099cd240784134fdb4e0f)

source4/auth/ntlm_check.c
source4/rpc_server/netlogon/dcerpc_netlogon.c

index e31424d8085c1668c16aaa522611d111a3290f2d..e6a8ce681fae833342944a4954b8cdc4197b55ad 100644 (file)
@@ -187,6 +187,13 @@ NTSTATUS ntlm_password_check(TALLOC_CTX *mem_ctx,
                         username));
        }
 
+       if (lm_sess_key) {
+               *lm_sess_key = data_blob(NULL, 0);
+       }
+       if (user_sess_key) {
+               *user_sess_key = data_blob(NULL, 0);
+       }
+
        if (nt_interactive_password && nt_interactive_password->length && nt_pw) { 
                if (nt_interactive_password->length != 16) {
                        DEBUG(3,("ntlm_password_check: Interactive logon: Invalid NT password length (%d) supplied for user %s\n", (int)nt_interactive_password->length,
index 5319705e32891c19e40bf4d2c5be044d7809674c..dcdcd7237cb19793b5286bee187b06bcfead3996 100644 (file)
@@ -548,11 +548,12 @@ static NTSTATUS netr_LogonSamLogonWithFlags(struct dcesrv_call_state *dce_call,
                                                      mem_ctx,
                                                      &server_info);
 
+       /* keep the auth_context for the life of this call */
+       talloc_steal(dce_call, auth_context);
+
        if (!NT_STATUS_IS_OK(nt_status)) {
-               free_auth_context(&auth_context);
                return nt_status;
        }
-       free_auth_context(&auth_context);
 
        sam = talloc_p(mem_ctx, struct netr_SamBaseInfo);