[SCM] Samba Shared Repository - branch v3-2-test updated - initial-v3-2-test-1602-g196e4ce

Michael Adam obnox at samba.org
Mon Jan 21 21:50:38 GMT 2008


The branch, v3-2-test has been updated
       via  196e4ce8c5dd5aab518aaa7d170eb1fb5d66bcd1 (commit)
       via  654e96208ec847e32797cbd2442ef9e73c014567 (commit)
       via  4d734106b70b9b6029b537fe11f8b3c1aebd42cf (commit)
       via  bdc49b07cc6de36c9319254a131858c9a7f9dd53 (commit)
       via  35e23368dd4240a3c907b4cee882f51119032527 (commit)
      from  5b05e09daf18eaea5e86dfd607c8070228f7571b (commit)

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=v3-2-test


- Log -----------------------------------------------------------------
commit 196e4ce8c5dd5aab518aaa7d170eb1fb5d66bcd1
Author: Michael Adam <obnox at samba.org>
Date:   Mon Jan 21 15:35:09 2008 +0100

    Add another check for talloc failure to libnet_conf
    
    Michael

commit 654e96208ec847e32797cbd2442ef9e73c014567
Author: Michael Adam <obnox at samba.org>
Date:   Mon Jan 21 15:31:57 2008 +0100

    Fix formatting of multi_sz registry values.
    
    Don't print only the last component.
    
    Michael

commit 4d734106b70b9b6029b537fe11f8b3c1aebd42cf
Author: Michael Adam <obnox at samba.org>
Date:   Mon Jan 21 15:28:04 2008 +0100

    Use talloc_stackframe() for temporary contexts throughout libnet_conf.c
    
    Michael

commit bdc49b07cc6de36c9319254a131858c9a7f9dd53
Author: Michael Adam <obnox at samba.org>
Date:   Mon Jan 21 15:24:23 2008 +0100

    Add a check for talloc failure. - Pointed out by Volker.
    
    Michael

commit 35e23368dd4240a3c907b4cee882f51119032527
Author: Michael Adam <obnox at samba.org>
Date:   Mon Jan 21 15:14:16 2008 +0100

    Fix two debug messages.
    
    Michael

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

Summary of changes:
 source/libnet/libnet_conf.c   |   22 +++++++++++++++++-----
 source/services/services_db.c |    4 ++--
 2 files changed, 19 insertions(+), 7 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source/libnet/libnet_conf.c b/source/libnet/libnet_conf.c
index d20e10b..4d998ac 100644
--- a/source/libnet/libnet_conf.c
+++ b/source/libnet/libnet_conf.c
@@ -48,6 +48,10 @@ static WERROR libnet_conf_add_string_to_array(TALLOC_CTX *mem_ctx,
 	}
 
 	new_array[count] = talloc_strdup(new_array, string);
+	if (new_array[count] == NULL) {
+		TALLOC_FREE(new_array);
+		return WERR_NOMEM;
+	}
 
 	*array = new_array;
 
@@ -134,6 +138,10 @@ static WERROR libnet_conf_reg_open_service_key(TALLOC_CTX *mem_ctx,
 	}
 
 	path = talloc_asprintf(mem_ctx, "%s\\%s", KEY_SMBCONF, servicename);
+	if (path == NULL) {
+		werr = WERR_NOMEM;
+		goto done;
+	}
 
 	werr = libnet_conf_reg_open_path(mem_ctx, ctx, path, desired_access,
 					 key);
@@ -191,7 +199,7 @@ static WERROR libnet_conf_reg_create_service_key(TALLOC_CTX *mem_ctx,
 	/* create a new talloc ctx for creation. it will hold
 	 * the intermediate parent key (SMBCONF) for creation
 	 * and will be destroyed when leaving this function... */
-	if (!(create_ctx = talloc_new(mem_ctx))) {
+	if (!(create_ctx = talloc_stackframe())) {
 		werr = WERR_NOMEM;
 		goto done;
 	}
@@ -316,8 +324,12 @@ static char *libnet_conf_format_registry_value(TALLOC_CTX *mem_ctx,
 	case REG_MULTI_SZ: {
                 uint32 j;
                 for (j = 0; j < value->v.multi_sz.num_strings; j++) {
-                        result = talloc_asprintf(mem_ctx, "\"%s\" ",
+                        result = talloc_asprintf(mem_ctx, "%s \"%s\" ",
+						 result,
 						 value->v.multi_sz.strings[j]);
+			if (result == NULL) {
+				break;
+			}
                 }
                 break;
         }
@@ -357,7 +369,7 @@ static WERROR libnet_conf_reg_get_values(TALLOC_CTX *mem_ctx,
 		goto done;
 	}
 
-	tmp_ctx = talloc_new(mem_ctx);
+	tmp_ctx = talloc_stackframe();
 	if (tmp_ctx == NULL) {
 		werr = WERR_NOMEM;
 		goto done;
@@ -540,7 +552,7 @@ WERROR libnet_conf_get_config(TALLOC_CTX *mem_ctx,
 		goto done;
 	}
 
-	tmp_ctx = talloc_new(mem_ctx);
+	tmp_ctx = talloc_stackframe();
 	if (tmp_ctx == NULL) {
 		werr = WERR_NOMEM;
 		goto done;
@@ -615,7 +627,7 @@ WERROR libnet_conf_get_share_names(TALLOC_CTX *mem_ctx,
 		goto done;
 	}
 
-	tmp_ctx = talloc_new(mem_ctx);
+	tmp_ctx = talloc_stackframe();
 	if (tmp_ctx == NULL) {
 		werr = WERR_NOMEM;
 		goto done;
diff --git a/source/services/services_db.c b/source/services/services_db.c
index b1daae4..d4e144d 100644
--- a/source/services/services_db.c
+++ b/source/services/services_db.c
@@ -526,7 +526,7 @@ SEC_DESC *svcctl_get_secdesc( TALLOC_CTX *ctx, const char *name, NT_USER_TOKEN *
 	SAFE_FREE(path);
 
 	if ( !(values = TALLOC_ZERO_P( key, REGVAL_CTR )) ) {
-		DEBUG(0,("add_new_svc_name: talloc() failed!\n"));
+		DEBUG(0,("svcctl_get_secdesc: talloc() failed!\n"));
 		TALLOC_FREE( key );
 		return NULL;
 	}
@@ -582,7 +582,7 @@ bool svcctl_set_secdesc( TALLOC_CTX *ctx, const char *name, SEC_DESC *sec_desc,
 	SAFE_FREE(path);
 
 	if ( !(values = TALLOC_ZERO_P( key, REGVAL_CTR )) ) {
-		DEBUG(0,("add_new_svc_name: talloc() failed!\n"));
+		DEBUG(0,("svcctl_set_secdesc: talloc() failed!\n"));
 		TALLOC_FREE( key );
 		return False;
 	}


-- 
Samba Shared Repository


More information about the samba-cvs mailing list