[SCM] Samba Shared Repository - branch master updated

Stefan Metzmacher metze at samba.org
Fri Jan 11 10:56:02 MST 2013


The branch, master has been updated
       via  8ae1c46 winbind: Fix some missing NULL checks
       via  54e01f6 winbind: Fix error check in unpack_tdc_domains
       via  aea49ed dbwrap: Use INCOMPATIBLE_HASH for dbwrap_watchers.tdb
      from  edbc26b scripting/samba_upgradedns: Only look for IPv4/IPv6 addresses if we actually them

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


- Log -----------------------------------------------------------------
commit 8ae1c4636ebfbdb8d77a04dbad6edb52dfb671fc
Author: Volker Lendecke <vl at samba.org>
Date:   Fri Jan 11 14:51:42 2013 +0100

    winbind: Fix some missing NULL checks
    
    Reviewed-by: Stefan Metzmacher <metze at samba.org>
    
    Autobuild-User(master): Stefan Metzmacher <metze at samba.org>
    Autobuild-Date(master): Fri Jan 11 18:55:41 CET 2013 on sn-devel-104

commit 54e01f68e7a6869a203bfdbdcc6c0294835b841f
Author: Volker Lendecke <vl at samba.org>
Date:   Fri Jan 11 14:02:52 2013 +0100

    winbind: Fix error check in unpack_tdc_domains
    
    Reviewed-by: Stefan Metzmacher <metze at samba.org>

commit aea49ed37afe49d12fbb6303f6ea5e7f984b2fda
Author: Volker Lendecke <vl at samba.org>
Date:   Fri Jan 11 17:04:39 2013 +0100

    dbwrap: Use INCOMPATIBLE_HASH for dbwrap_watchers.tdb
    
    Reviewed-by: Stefan Metzmacher <metze at samba.org>

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

Summary of changes:
 source3/lib/dbwrap/dbwrap_watch.c |    7 ++--
 source3/winbindd/winbindd_cache.c |   60 +++++++++++++++++++++----------------
 2 files changed, 38 insertions(+), 29 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source3/lib/dbwrap/dbwrap_watch.c b/source3/lib/dbwrap/dbwrap_watch.c
index d7392a3..d8f1b74 100644
--- a/source3/lib/dbwrap/dbwrap_watch.c
+++ b/source3/lib/dbwrap/dbwrap_watch.c
@@ -31,9 +31,10 @@ static struct db_context *dbwrap_record_watchers_db(void)
 	static struct db_context *watchers_db;
 
 	if (watchers_db == NULL) {
-		watchers_db = db_open(NULL, lock_path("dbwrap_watchers.tdb"),
-				      0, TDB_CLEAR_IF_FIRST, O_RDWR|O_CREAT,
-				      0600, DBWRAP_LOCK_ORDER_3);
+		watchers_db = db_open(
+			NULL, lock_path("dbwrap_watchers.tdb"),	0,
+			TDB_CLEAR_IF_FIRST | TDB_INCOMPATIBLE_HASH,
+			O_RDWR|O_CREAT, 0600, DBWRAP_LOCK_ORDER_3);
 	}
 	return watchers_db;
 }
diff --git a/source3/winbindd/winbindd_cache.c b/source3/winbindd/winbindd_cache.c
index 76970d6..252cf4a 100644
--- a/source3/winbindd/winbindd_cache.c
+++ b/source3/winbindd/winbindd_cache.c
@@ -4455,7 +4455,9 @@ static size_t unpack_tdc_domains( unsigned char *buf, int buflen,
 	}
 
 	for ( i=0; i<num_domains; i++ ) {
-		len += tdb_unpack( buf+len, buflen-len, "fffddd",
+		int this_len;
+
+		this_len = tdb_unpack( buf+len, buflen-len, "fffddd",
 				   domain_name,
 				   dns_name,
 				   sid_string,
@@ -4463,11 +4465,12 @@ static size_t unpack_tdc_domains( unsigned char *buf, int buflen,
 				   &attribs,
 				   &type );
 
-		if ( len == -1 ) {
+		if ( this_len == -1 ) {
 			DEBUG(5,("unpack_tdc_domains: Failed to unpack domain array\n"));
 			TALLOC_FREE( list );			
 			return 0;
 		}
+		len += this_len;
 
 		DEBUG(11,("unpack_tdc_domains: Unpacking domain %s (%s) "
 			  "SID %s, flags = 0x%x, attribs = 0x%x, type = 0x%x\n",
@@ -4602,6 +4605,33 @@ bool wcache_tdc_add_domain( struct winbindd_domain *domain )
 	return ret;	
 }
 
+static struct winbindd_tdc_domain *wcache_tdc_dup_domain(
+	TALLOC_CTX *mem_ctx, const struct winbindd_tdc_domain *src)
+{
+	struct winbindd_tdc_domain *dst;
+
+	dst = talloc(mem_ctx, struct winbindd_tdc_domain);
+	if (dst == NULL) {
+		goto fail;
+	}
+	dst->domain_name = talloc_strdup(dst, src->domain_name);
+	if (dst->domain_name == NULL) {
+		goto fail;
+	}
+	dst->dns_name = talloc_strdup(dst, src->dns_name);
+	if (dst->dns_name == NULL) {
+		goto fail;
+	}
+	sid_copy(&dst->sid, &src->sid);
+	dst->trust_flags = src->trust_flags;
+	dst->trust_type = src->trust_type;
+	dst->trust_attribs = src->trust_attribs;
+	return dst;
+fail:
+	TALLOC_FREE(dst);
+	return NULL;
+}
+
 /*********************************************************************
  ********************************************************************/
 
@@ -4629,17 +4659,7 @@ struct winbindd_tdc_domain * wcache_tdc_fetch_domain( TALLOC_CTX *ctx, const cha
 			DEBUG(10,("wcache_tdc_fetch_domain: Found domain %s\n",
 				  name));
 
-			d = talloc( ctx, struct winbindd_tdc_domain );
-			if ( !d )
-				break;			
-
-			d->domain_name = talloc_strdup( d, dom_list[i].domain_name );
-			d->dns_name = talloc_strdup( d, dom_list[i].dns_name );
-			sid_copy( &d->sid, &dom_list[i].sid );
-			d->trust_flags   = dom_list[i].trust_flags;
-			d->trust_type    = dom_list[i].trust_type;
-			d->trust_attribs = dom_list[i].trust_attribs;
-
+			d = wcache_tdc_dup_domain(ctx, &dom_list[i]);
 			break;
 		}
 	}
@@ -4679,19 +4699,7 @@ struct winbindd_tdc_domain*
 				   dom_list[i].domain_name,
 				   sid_string_dbg(sid)));
 
-			d = talloc(ctx, struct winbindd_tdc_domain);
-			if (!d)
-				break;
-
-			d->domain_name = talloc_strdup(d,
-						       dom_list[i].domain_name);
-
-			d->dns_name = talloc_strdup(d, dom_list[i].dns_name);
-			sid_copy(&d->sid, &dom_list[i].sid);
-			d->trust_flags = dom_list[i].trust_flags;
-			d->trust_type = dom_list[i].trust_type;
-			d->trust_attribs = dom_list[i].trust_attribs;
-
+			d = wcache_tdc_dup_domain(ctx, &dom_list[i]);
 			break;
 		}
 	}


-- 
Samba Shared Repository


More information about the samba-cvs mailing list