fix confusing warning in spnego_gen_krb5_wrap()

Stefan Metzmacher metze at samba.org
Sun Jan 31 20:48:25 UTC 2016


Hi,

here's a patch for https://bugzilla.samba.org/show_bug.cgi?id=11702.

Please review and push:-)

Thanks!
metze
-------------- next part --------------
From ba40e6edba875276d0661f6e8b2c7e8a41357061 Mon Sep 17 00:00:00 2001
From: Stefan Metzmacher <metze at samba.org>
Date: Thu, 28 Jan 2016 15:50:06 +0100
Subject: [PATCH] s3:clispnego: fix confusing warning in spnego_gen_krb5_wrap()

asn1_extract_blob() stops further asn1 processing by setting has_error.

Don't call asn1_has_error() after asn1_extract_blob() has been successful
otherwise we get an "Failed to build krb5 wrapper at" message
on success.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=11702

Signed-off-by: Stefan Metzmacher <metze at samba.org>
---
 source3/libsmb/clispnego.c | 15 ++++++++++-----
 1 file changed, 10 insertions(+), 5 deletions(-)

diff --git a/source3/libsmb/clispnego.c b/source3/libsmb/clispnego.c
index 3300c85..82f13b7 100644
--- a/source3/libsmb/clispnego.c
+++ b/source3/libsmb/clispnego.c
@@ -262,14 +262,19 @@ DATA_BLOB spnego_gen_krb5_wrap(TALLOC_CTX *ctx, const DATA_BLOB ticket, const ui
 		goto err;
 	}
 
+	asn1_free(data);
+	data = NULL;
+
   err:
 
-	if (asn1_has_error(data)) {
-		DEBUG(1, ("Failed to build krb5 wrapper at offset %d\n",
-			  (int)asn1_current_ofs(data)));
-	}
+	if (data != NULL) {
+		if (asn1_has_error(data)) {
+			DEBUG(1, ("Failed to build krb5 wrapper at offset %d\n",
+				  (int)asn1_current_ofs(data)));
+		}
 
-	asn1_free(data);
+		asn1_free(data);
+	}
 
 	return ret;
 }
-- 
1.9.1

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: OpenPGP digital signature
URL: <http://lists.samba.org/pipermail/samba-technical/attachments/20160131/a96fa7d5/signature.sig>


More information about the samba-technical mailing list