Fix from Luke Howard <lukeh@PADL.COM> for incorrect early free().
authorJeremy Allison <jra@samba.org>
Wed, 7 Jan 2004 19:55:03 +0000 (19:55 +0000)
committerJeremy Allison <jra@samba.org>
Wed, 7 Jan 2004 19:55:03 +0000 (19:55 +0000)
Jeremy.
(This used to be commit e763a220f492bb8a9cacf31c07809c4866379bb6)

source3/smbd/sesssetup.c

index 2c38cd3eb3a93670add53310327a98506d58808f..80be9da53bfce6006f74abed4f53211e78dd959a 100644 (file)
@@ -241,11 +241,10 @@ static int reply_spnego_kerberos(connection_struct *conn,
        
        pw = smb_getpwnam( user );
        
-       SAFE_FREE(user);
-       SAFE_FREE(client);
-
        if (!pw) {
                DEBUG(1,("Username %s is invalid on this system\n",user));
+               SAFE_FREE(user);
+               SAFE_FREE(client);
                data_blob_free(&ap_rep);
                return ERROR_NT(NT_STATUS_LOGON_FAILURE);
        }
@@ -257,14 +256,17 @@ static int reply_spnego_kerberos(connection_struct *conn,
        
        if (!NT_STATUS_IS_OK(ret = make_server_info_pw(&server_info,pw))) {
                DEBUG(1,("make_server_info_from_pw failed!\n"));
+               SAFE_FREE(user);
+               SAFE_FREE(client);
                data_blob_free(&ap_rep);
                return ERROR_NT(ret);
        }
 
        /* register_vuid keeps the server info */
-       sess_vuid = register_vuid(server_info, session_key, nullblob, user);
+       sess_vuid = register_vuid(server_info, session_key, nullblob, client);
 
-       free(user);
+       SAFE_FREE(user);
+       SAFE_FREE(client);
 
        if (sess_vuid == -1) {
                ret = NT_STATUS_LOGON_FAILURE;