[SCM] Samba Shared Repository - branch master updated

Andreas Schneider asn at samba.org
Tue Jun 29 03:13:00 MDT 2010


The branch, master has been updated
       via  ee01fe8... s3-client: Make sure we only write to an opened file.
       via  f324036... s3-winbind: Make sure we crash if domain is really not found.
       via  eb7bf9d... s3-net: Make sure we don't call free on garbage.
       via  1db7356... s3-net: Use talloc_asprintf and return if file is in wrong format.
       via  e52f3d8... s3-librpc: Fixed GUID_from_data_blob() with length of 32.
      from  845e7a6... Fixed incorrect use of cn instead of lDAPDisplayName

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


- Log -----------------------------------------------------------------
commit ee01fe8c5bd450c82db3f7a7e8c783ac32b0812d
Author: Andreas Schneider <asn at samba.org>
Date:   Tue Jun 29 10:42:36 2010 +0200

    s3-client: Make sure we only write to an opened file.
    
    Found by clang-analyzer.

commit f324036e76abb0b572fb65c4c403e7ede259682a
Author: Andreas Schneider <asn at samba.org>
Date:   Tue Jun 29 10:34:17 2010 +0200

    s3-winbind: Make sure we crash if domain is really not found.
    
    Found by clang-analyzer.

commit eb7bf9d7309914fb2207f822e8017e1c1001de46
Author: Andreas Schneider <asn at samba.org>
Date:   Tue Jun 29 10:07:22 2010 +0200

    s3-net: Make sure we don't call free on garbage.
    
    Found by clang-analyzer.

commit 1db7356fa17cb3aeffcf4aff2149eaceaa5a62ea
Author: Andreas Schneider <asn at samba.org>
Date:   Mon Jun 28 13:20:18 2010 +0200

    s3-net: Use talloc_asprintf and return if file is in wrong format.
    
    Found by clang-analyzer.

commit e52f3d8637c7af2f0ea57954c7f13389f5a1e125
Author: Andreas Schneider <asn at samba.org>
Date:   Mon Jun 28 21:00:30 2010 +0200

    s3-librpc: Fixed GUID_from_data_blob() with length of 32.
    
    If we hit the case that the blob length is 32. The code goes to the end
    of the function and generates a GUID with garbage.
    So try to convert the blob to the GUID and return.

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

Summary of changes:
 librpc/ndr/uuid.c               |   10 +++++-----
 nsswitch/pam_winbind.c          |    2 +-
 source3/client/clitar.c         |   14 ++++++++++----
 source3/utils/net_ads_gpo.c     |    2 +-
 source3/utils/net_rpc_printer.c |   35 ++++++++++++++++-------------------
 5 files changed, 33 insertions(+), 30 deletions(-)


Changeset truncated at 500 lines:

diff --git a/librpc/ndr/uuid.c b/librpc/ndr/uuid.c
index d46da09..33a7eee 100644
--- a/librpc/ndr/uuid.c
+++ b/librpc/ndr/uuid.c
@@ -117,12 +117,12 @@ _PUBLIC_ NTSTATUS GUID_from_data_blob(const DATA_BLOB *s, struct GUID *guid)
 	{
 		size_t rlen = strhex_to_str((char *)blob16.data, blob16.length,
 					    (const char *)s->data, s->length);
-		if (rlen == blob16.length) {
-			/* goto the ndr_pull_struct_blob() path */
-			status = NT_STATUS_OK;
-			s = &blob16;
+		if (rlen != blob16.length) {
+			return NT_STATUS_INVALID_PARAMETER;
 		}
-		break;
+
+		s = &blob16;
+		return GUID_from_ndr_blob(s, guid);
 	}
 	case 16:
 		return GUID_from_ndr_blob(s, guid);
diff --git a/nsswitch/pam_winbind.c b/nsswitch/pam_winbind.c
index f13e365..b2d74de 100644
--- a/nsswitch/pam_winbind.c
+++ b/nsswitch/pam_winbind.c
@@ -2422,7 +2422,7 @@ static char* winbind_upn_to_username(struct pwb_context *ctx,
 	wbcErr wbc_status = WBC_ERR_UNKNOWN_FAILURE;
 	struct wbcDomainSid sid;
 	enum wbcSidType type;
-	char *domain;
+	char *domain = NULL;
 	char *name;
 	char *p;
 
diff --git a/source3/client/clitar.c b/source3/client/clitar.c
index fc98fa8..0a1adb4 100644
--- a/source3/client/clitar.c
+++ b/source3/client/clitar.c
@@ -998,16 +998,22 @@ static int skip_file(int skipsize)
 
 static int get_file(file_info2 finfo)
 {
-	uint16_t fnum;
+	uint16_t fnum = (uint16_t) -1;
 	int pos = 0, dsize = 0, bpos = 0;
 	uint64_t rsize = 0;
+	NTSTATUS status;
 
 	DEBUG(5, ("get_file: file: %s, size %.0f\n", finfo.name, (double)finfo.size));
 
-	if (ensurepath(finfo.name) &&
-			(!NT_STATUS_IS_OK(cli_open(cli, finfo.name, O_RDWR|O_CREAT|O_TRUNC, DENY_NONE,&fnum)))) {
+	if (!ensurepath(finfo.name)) {
 		DEBUG(0, ("abandoning restore\n"));
-		return(False);
+		return False;
+	}
+
+	status = cli_open(cli, finfo.name, O_RDWR|O_CREAT|O_TRUNC, DENY_NONE, &fnum);
+	if (!NT_STATUS_IS_OK(status)) {
+		DEBUG(0, ("abandoning restore\n"));
+		return False;
 	}
 
 	/* read the blocks from the tar file and write to the remote file */
diff --git a/source3/utils/net_ads_gpo.c b/source3/utils/net_ads_gpo.c
index b120ca5..3d89045 100644
--- a/source3/utils/net_ads_gpo.c
+++ b/source3/utils/net_ads_gpo.c
@@ -291,7 +291,7 @@ out:
 
 static int net_ads_gpo_list(struct net_context *c, int argc, const char **argv)
 {
-	ADS_STRUCT *ads;
+	ADS_STRUCT *ads = NULL;
 	ADS_STATUS status;
 	LDAPMessage *res = NULL;
 	TALLOC_CTX *mem_ctx;
diff --git a/source3/utils/net_rpc_printer.c b/source3/utils/net_rpc_printer.c
index b75b195..c398253 100644
--- a/source3/utils/net_rpc_printer.c
+++ b/source3/utils/net_rpc_printer.c
@@ -490,12 +490,11 @@ static NTSTATUS net_copy_driverfile(struct net_context *c,
 				    struct cli_state *cli_share_dst,
 				    const char *file, const char *short_archi) {
 
-	NTSTATUS nt_status = NT_STATUS_UNSUCCESSFUL;
 	const char *p;
 	char *src_name;
 	char *dst_name;
-	char *version;
-	char *filename;
+	char *version = NULL;
+	char *filename = NULL;
 	char *tok;
 
 	if (!file) {
@@ -512,29 +511,27 @@ static NTSTATUS net_copy_driverfile(struct net_context *c,
 		}
 	}
 
+	if (version == NULL || filename == NULL) {
+		return NT_STATUS_UNSUCCESSFUL;
+	}
+
 	/* build source file name */
-	if (asprintf(&src_name, "\\%s\\%s\\%s", short_archi, version, filename) < 0 )
+	src_name = talloc_asprintf(mem_ctx, "\\%s\\%s\\%s",
+				   short_archi, version, filename);
+	if (src_name == NULL) {
 		return NT_STATUS_NO_MEMORY;
-
+	}
 
 	/* create destination file name */
-	if (asprintf(&dst_name, "\\%s\\%s", short_archi, filename) < 0 )
-                return NT_STATUS_NO_MEMORY;
+	dst_name = talloc_asprintf(mem_ctx, "\\%s\\%s", short_archi, filename);
+	if (dst_name == NULL) {
+		return NT_STATUS_NO_MEMORY;
+	}
 
 
 	/* finally copy the file */
-	nt_status = net_copy_file(c, mem_ctx, cli_share_src, cli_share_dst,
-				  src_name, dst_name, false, false, false, true);
-	if (!NT_STATUS_IS_OK(nt_status))
-		goto out;
-
-	nt_status = NT_STATUS_OK;
-
-out:
-	SAFE_FREE(src_name);
-	SAFE_FREE(dst_name);
-
-	return nt_status;
+	return net_copy_file(c, mem_ctx, cli_share_src, cli_share_dst,
+			     src_name, dst_name, false, false, false, true);
 }
 
 /**


-- 
Samba Shared Repository


More information about the samba-cvs mailing list