svn commit: samba r2587 - in branches/SAMBA_4_0/source/libcli: auth raw

tridge at samba.org tridge at samba.org
Fri Sep 24 06:51:21 GMT 2004


Author: tridge
Date: 2004-09-24 06:51:14 +0000 (Fri, 24 Sep 2004)
New Revision: 2587

WebSVN: http://websvn.samba.org/websvn/changeset.php?rep=samba&path=/branches/SAMBA_4_0/source/libcli&rev=2587&nolog=1

Log:
fixed a couple of authentication memory leaks. There are more to be
fixed - I'll commit a little test suite soon.


Modified:
   branches/SAMBA_4_0/source/libcli/auth/spnego.c
   branches/SAMBA_4_0/source/libcli/auth/spnego_parse.c
   branches/SAMBA_4_0/source/libcli/raw/clisession.c


Changeset:
Modified: branches/SAMBA_4_0/source/libcli/auth/spnego.c
===================================================================
--- branches/SAMBA_4_0/source/libcli/auth/spnego.c	2004-09-24 06:49:10 UTC (rev 2586)
+++ branches/SAMBA_4_0/source/libcli/auth/spnego.c	2004-09-24 06:51:14 UTC (rev 2587)
@@ -528,6 +528,7 @@
 			nt_status = gensec_set_target_principal(gensec_security, 
 								spnego.negTokenInit.targetPrincipal);
 			if (!NT_STATUS_IS_OK(nt_status)) {
+				spnego_free_data(&spnego);
 				return nt_status;
 			}
 		}
@@ -540,6 +541,7 @@
 							     &unwrapped_out);
 
 		if (!NT_STATUS_EQUAL(nt_status, NT_STATUS_MORE_PROCESSING_REQUIRED) && !NT_STATUS_IS_OK(nt_status)) {
+			spnego_free_data(&spnego);
 			return nt_status;
 		}
 

Modified: branches/SAMBA_4_0/source/libcli/auth/spnego_parse.c
===================================================================
--- branches/SAMBA_4_0/source/libcli/auth/spnego_parse.c	2004-09-24 06:49:10 UTC (rev 2586)
+++ branches/SAMBA_4_0/source/libcli/auth/spnego_parse.c	2004-09-24 06:51:14 UTC (rev 2587)
@@ -54,6 +54,10 @@
 					talloc_realloc(token->mechTypes, (i + 2) *
 						       sizeof(*token->mechTypes));
 				asn1_read_OID(asn1, token->mechTypes + i);
+				if (token->mechTypes[i]) {
+					talloc_steal(token->mechTypes, 
+						     token->mechTypes[i]);
+				}
 			}
 			token->mechTypes[i] = NULL;
 			

Modified: branches/SAMBA_4_0/source/libcli/raw/clisession.c
===================================================================
--- branches/SAMBA_4_0/source/libcli/raw/clisession.c	2004-09-24 06:49:10 UTC (rev 2586)
+++ branches/SAMBA_4_0/source/libcli/raw/clisession.c	2004-09-24 06:51:14 UTC (rev 2587)
@@ -446,8 +446,8 @@
 	}
 	
 	status = gensec_update(session->gensec, mem_ctx,
-				       session->transport->negotiate.secblob,
-				       &s2.spnego.in.secblob);
+			       session->transport->negotiate.secblob,
+			       &s2.spnego.in.secblob);
 
 	while(1) {
 		if (!NT_STATUS_EQUAL(status, NT_STATUS_MORE_PROCESSING_REQUIRED) && !NT_STATUS_IS_OK(status)) {
@@ -493,6 +493,7 @@
 		parms->generic.out.lanman = s2.spnego.out.lanman;
 		parms->generic.out.domain = s2.spnego.out.domain;
 	} else {
+		gensec_end(&session->gensec);
 		DEBUG(1, ("Failed to login with %s: %s\n", gensec_get_name_by_oid(chosen_oid), nt_errstr(status)));
 		return status;
 	}



More information about the samba-cvs mailing list