[SCM] Samba Shared Repository - branch master updated

Jeremy Allison jra at samba.org
Tue Jul 20 10:53:05 MDT 2010


The branch, master has been updated
       via  6687449... Fixes pointed out by <david.kondrad at legrand.us>. Free memory if not being returned to caller. Remove unneeded asn1_tag_remaining() calls.
      from  f5def28... Fix warning - no return value for a non-void fn.

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


- Log -----------------------------------------------------------------
commit 668744964db9210d7b106dcaa27ea1152bd635cd
Author: Jeremy Allison <jra at samba.org>
Date:   Tue Jul 20 09:51:48 2010 -0700

    Fixes pointed out by <david.kondrad at legrand.us>. Free memory if not being
    returned to caller. Remove unneeded asn1_tag_remaining() calls.
    
    Jeremy.

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

Summary of changes:
 source3/libsmb/clispnego.c |   77 +++++++++++++++++++++----------------------
 1 files changed, 38 insertions(+), 39 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source3/libsmb/clispnego.c b/source3/libsmb/clispnego.c
index e1eb03b..891f080 100644
--- a/source3/libsmb/clispnego.c
+++ b/source3/libsmb/clispnego.c
@@ -4,7 +4,8 @@
    Copyright (C) Andrew Tridgell 2001
    Copyright (C) Jim McDonough <jmcd at us.ibm.com> 2002
    Copyright (C) Luke Howard     2003
-   
+   Copyright (C) Jeremy Allison 2010
+
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation; either version 3 of the License, or
@@ -144,50 +145,48 @@ bool spnego_parse_negTokenInit(DATA_BLOB blob,
 	  the next tag is ASN1_CONTEXT(3).
 	*/
 
-	if (asn1_tag_remaining(data) > 0) {
-		if (asn1_peek_tag(data, ASN1_CONTEXT(1))) {
-			uint8 flags;
+	if (asn1_peek_tag(data, ASN1_CONTEXT(1))) {
+		uint8 flags;
 
-			/* reqFlags [1] ContextFlags  OPTIONAL */
-			asn1_start_tag(data, ASN1_CONTEXT(1));
-			asn1_start_tag(data, ASN1_BIT_STRING);
-			while (asn1_tag_remaining(data) > 0) {
-				asn1_read_uint8(data, &flags);
-			}
-			asn1_end_tag(data);
-			asn1_end_tag(data);
+		/* reqFlags [1] ContextFlags  OPTIONAL */
+		asn1_start_tag(data, ASN1_CONTEXT(1));
+		asn1_start_tag(data, ASN1_BIT_STRING);
+		while (asn1_tag_remaining(data) > 0) {
+			asn1_read_uint8(data, &flags);
 		}
+		asn1_end_tag(data);
+		asn1_end_tag(data);
 	}
 
-	if (asn1_tag_remaining(data) > 0) {
-		if (asn1_peek_tag(data, ASN1_CONTEXT(2))) {
-			DATA_BLOB sblob = data_blob_null;
-			/* mechToken [2] OCTET STRING  OPTIONAL */
-			asn1_start_tag(data, ASN1_CONTEXT(2));
-			asn1_read_OctetString(data, talloc_autofree_context(),
-				&sblob);
-			asn1_end_tag(data);
-			if (secblob) {
-				*secblob = sblob;
-			}
+	if (asn1_peek_tag(data, ASN1_CONTEXT(2))) {
+		DATA_BLOB sblob = data_blob_null;
+		/* mechToken [2] OCTET STRING  OPTIONAL */
+		asn1_start_tag(data, ASN1_CONTEXT(2));
+		asn1_read_OctetString(data, talloc_autofree_context(),
+			&sblob);
+		asn1_end_tag(data);
+		if (secblob) {
+			*secblob = sblob;
+		} else {
+			data_blob_free(&sblob);
 		}
 	}
 
-	if (asn1_tag_remaining(data) > 0) {
-		if (asn1_peek_tag(data, ASN1_CONTEXT(3))) {
-			char *princ = NULL;
-			/* mechListMIC [3] OCTET STRING  OPTIONAL */
-			asn1_start_tag(data, ASN1_CONTEXT(3));
-			asn1_start_tag(data, ASN1_SEQUENCE(0));
-			asn1_start_tag(data, ASN1_CONTEXT(0));
-			asn1_read_GeneralString(data,talloc_autofree_context(),
-				&princ);
-			asn1_end_tag(data);
-			asn1_end_tag(data);
-			asn1_end_tag(data);
-			if (principal) {
-				*principal = princ;
-			}
+	if (asn1_peek_tag(data, ASN1_CONTEXT(3))) {
+		char *princ = NULL;
+		/* mechListMIC [3] OCTET STRING  OPTIONAL */
+		asn1_start_tag(data, ASN1_CONTEXT(3));
+		asn1_start_tag(data, ASN1_SEQUENCE(0));
+		asn1_start_tag(data, ASN1_CONTEXT(0));
+		asn1_read_GeneralString(data,talloc_autofree_context(),
+			&princ);
+		asn1_end_tag(data);
+		asn1_end_tag(data);
+		asn1_end_tag(data);
+		if (principal) {
+			*principal = princ;
+		} else {
+			TALLOC_FREE(princ);
 		}
 	}
 


-- 
Samba Shared Repository


More information about the samba-cvs mailing list