windows-smb-free-lsa-response-20080901
authorJeffrey Altman <jaltman@secure-endpoints.com>
Mon, 1 Sep 2008 13:35:42 +0000 (13:35 +0000)
committerJeffrey Altman <jaltman@secure-endpoints.com>
Mon, 1 Sep 2008 13:35:42 +0000 (13:35 +0000)
LICENSE MIT

Whether or not LsaCallAuthenticationPackage succeeds, it may return
a response buffer.  If it does, free it.

src/WINNT/afsd/smb.c

index 1fd5636..3b8122f 100644 (file)
@@ -884,7 +884,6 @@ smb_vc_t *smb_FindVC(unsigned short lsn, int flags, int lana)
 
             if (ntsEx == STATUS_SUCCESS) {
                 memcpy(vcp->encKey, lsaResp->ChallengeToClient, MSV1_0_CHALLENGE_LENGTH);
-                LsaFreeReturnBuffer(lsaResp);
             } else {
                 /* 
                  * This will cause the subsequent authentication to fail but
@@ -893,6 +892,8 @@ smb_vc_t *smb_FindVC(unsigned short lsn, int flags, int lana)
                  */
                 memset(vcp->encKey, 0, MSV1_0_CHALLENGE_LENGTH);
             }
+            if (lsaResp)
+                LsaFreeReturnBuffer(lsaResp);
         }
         else
             memset(vcp->encKey, 0, MSV1_0_CHALLENGE_LENGTH);