svn commit: samba r4334 - in branches/SAMBA_3_0/source: lib libads

jra at samba.org jra at samba.org
Wed Dec 22 22:07:07 GMT 2004


Author: jra
Date: 2004-12-22 22:07:04 +0000 (Wed, 22 Dec 2004)
New Revision: 4334

WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=4334

Log:
Fix for bugid #2186 - from Buck Huppmann <buckh at pobox.com>
to prevent uninitialized creds being freed.
Jeremy.

Modified:
   branches/SAMBA_3_0/source/lib/util_str.c
   branches/SAMBA_3_0/source/libads/kerberos.c


Changeset:
Modified: branches/SAMBA_3_0/source/lib/util_str.c
===================================================================
--- branches/SAMBA_3_0/source/lib/util_str.c	2004-12-22 22:06:55 UTC (rev 4333)
+++ branches/SAMBA_3_0/source/lib/util_str.c	2004-12-22 22:07:04 UTC (rev 4334)
@@ -1527,6 +1527,9 @@
 /**
  Some platforms don't have strndup.
 **/
+#if defined(PARANOID_MALLOC_CHECKER)
+#undef strndup
+#endif
 
  char *strndup(const char *s, size_t n)
 {
@@ -1541,8 +1544,13 @@
 
 	return ret;
 }
+
+#if defined(PARANOID_MALLOC_CHECKER)
+#define strndup(s,n) __ERROR_DONT_USE_STRNDUP_DIRECTLY
 #endif
 
+#endif
+
 #if !defined(HAVE_STRNLEN) || defined(BROKEN_STRNLEN)
 /**
  Some platforms don't have strnlen

Modified: branches/SAMBA_3_0/source/libads/kerberos.c
===================================================================
--- branches/SAMBA_3_0/source/libads/kerberos.c	2004-12-22 22:06:55 UTC (rev 4333)
+++ branches/SAMBA_3_0/source/libads/kerberos.c	2004-12-22 22:07:04 UTC (rev 4334)
@@ -320,6 +320,8 @@
 	krb5_auth_context auth_context = NULL;
 	krb5_error_code err = 0;
 
+	ZERO_STRUCT(creds);
+
 	asprintf(&machine_account, "%s$@%s", global_myname(), lp_realm());
 	if (machine_account == NULL) {
 		goto out;
@@ -340,7 +342,6 @@
 	   ticket to ourselves. */
 
 	/* Set up the enctype and client and server principal fields for krb5_get_credentials. */
-	memset(&creds, '\0', sizeof(creds));
 	kerberos_set_creds_enctype(&creds, enctype);
 
 	if ((err = krb5_cc_get_principal(ctx, ccache, &creds.client))) {



More information about the samba-cvs mailing list