[SCM] Samba Shared Repository - branch v3-6-test updated

Jeremy Allison jra at samba.org
Wed Jan 26 15:27:43 MST 2011


The branch, v3-6-test has been updated
       via  e396ae0 s3-utils: Fixed a resource leak in net_afs.
       via  948ceb0 s3-utils: Fixed a resource leak in smbta-util.
       via  702549a s3-utils: Fixed possible resource leak in net_usershare.
       via  096679c s3-utils: Fixed possible resource leak in smbget.
       via  6b3d0d8 s3-utils: Fixed possible resource leak in smbfilter.
       via  22b0b80 s3-modules: Fixed the for-loop code block.
       via  7e7d283 s3-lib: Fixed a missing return value in tldap.
       via  795516f errormap: Add unix_to_werror() function
      from  7bc0737 Allow "security = share" with SMB2. We already handle this in smb2/smb2_server.c (cherry picked from commit de53c1e30ddbc640fd0755cf38a40e9e0acac309)

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


- Log -----------------------------------------------------------------
commit e396ae005e36e2af8b1d8c22a8295b6be1e49521
Author: Andreas Schneider <asn at samba.org>
Date:   Wed Jan 19 23:15:21 2011 +0100

    s3-utils: Fixed a resource leak in net_afs.
    
    s3-utils: Fixed a resource leak in net_afs.
    (cherry picked from commit 92f8a5747bf74adedc97ea3a63819d6e58f010c3)

commit 948ceb0dcf10578a8276ad75778384ae755c2f4c
Author: Andreas Schneider <asn at samba.org>
Date:   Wed Jan 19 23:13:47 2011 +0100

    s3-utils: Fixed a resource leak in smbta-util.
    
    s3-utils: Fixed a resource leak in smbta-util.
    (cherry picked from commit 4fc75c755d0b20ba4f4e1c42471a0355fd85990d)

commit 702549a4ec668a51ec4cea5096ef6af493e50aed
Author: Andreas Schneider <asn at samba.org>
Date:   Wed Jan 19 23:07:33 2011 +0100

    s3-utils: Fixed possible resource leak in net_usershare.
    
    s3-utils: Fixed possible resource leak in net_usershare.
    (cherry picked from commit f419c2b0911788cdd0474bd543ebdbfa52954889)

commit 096679cff55808a1484d627ee3e0c8a25a169a24
Author: Andreas Schneider <asn at samba.org>
Date:   Wed Jan 19 15:18:10 2011 +0100

    s3-utils: Fixed possible resource leak in smbget.
    
    s3-utils: Fixed possible resource leak in smbget.
    (cherry picked from commit de4ef101c165cf735938f914f7da620daea91762)

commit 6b3d0d8f3524f35240624e17eff68cbf6d248f34
Author: Andreas Schneider <asn at samba.org>
Date:   Wed Jan 19 15:20:34 2011 +0100

    s3-utils: Fixed possible resource leak in smbfilter.
    
    s3-utils: Fixed possible resource leak in smbfilter.
    (cherry picked from commit 08dc51d3caabcebf9cc2dc02aac74632831c09b7)

commit 22b0b8069d7b1e1900ef3be60a8e4734a88eeefb
Author: Andreas Schneider <asn at samba.org>
Date:   Wed Jan 19 23:11:32 2011 +0100

    s3-modules: Fixed the for-loop code block.
    
    s3-modules: Fixed the for-loop code block.
    (cherry picked from commit f6f0dac4271b2bd1304c2b592c4d2dcbc795afaf)

commit 7e7d28369eabfca59ab21f1541c78f9fd76a66be
Author: Andreas Schneider <asn at samba.org>
Date:   Wed Jan 19 23:04:13 2011 +0100

    s3-lib: Fixed a missing return value in tldap.
    
    s3-lib: Fixed a missing return value in tldap.
    (cherry picked from commit 2c47368d682ee908e79bc43d5c865049397440e1)

commit 795516f550e84f60e956b2673093017849eb985d
Author: Kai Blin <kai at samba.org>
Date:   Wed Jan 26 22:17:43 2011 +0100

    errormap: Add unix_to_werror() function
    
    While this function technically is closest to the
    map_nt_status_from_unix() function, I think it is better to keep the new
    function in line with our usual fooerror_to_barerror() naming scheme.
    
    Signed-off-by: Kai Blin <kai at samba.org>
    
    Autobuild-User: Kai Blin <kai at samba.org>
    Autobuild-Date: Wed Jan 26 23:07:24 CET 2011 on sn-devel-104
    (cherry picked from commit 278c6f8fc538ad8ee069f0682229fad34abb3513)

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

Summary of changes:
 libcli/util/error.h            |    5 +++++
 source3/lib/errmap_unix.c      |    6 ++++++
 source3/lib/tldap.c            |    1 +
 source3/modules/onefs_cbrl.c   |    1 +
 source3/utils/net_afs.c        |    2 ++
 source3/utils/net_usershare.c  |    5 +++++
 source3/utils/smbfilter.c      |    1 +
 source3/utils/smbget.c         |    1 +
 source3/utils/smbta-util.c     |    1 +
 source4/libcli/util/errormap.c |    6 ++++++
 10 files changed, 29 insertions(+), 0 deletions(-)


Changeset truncated at 500 lines:

diff --git a/libcli/util/error.h b/libcli/util/error.h
index 5a7cc1b..77a2f5a 100644
--- a/libcli/util/error.h
+++ b/libcli/util/error.h
@@ -46,4 +46,9 @@ WERROR ntstatus_to_werror(NTSTATUS error);
 *********************************************************************/
 NTSTATUS map_nt_error_from_unix(int unix_error);
 
+/*********************************************************************
+convert a Unix error code to a WERROR
+*********************************************************************/
+WERROR unix_to_werror(int unix_error);
+
 #endif /* _SAMBA_ERROR_H */
diff --git a/source3/lib/errmap_unix.c b/source3/lib/errmap_unix.c
index 91a620e..b4a98f9 100644
--- a/source3/lib/errmap_unix.c
+++ b/source3/lib/errmap_unix.c
@@ -141,6 +141,12 @@ NTSTATUS map_nt_error_from_unix(int unix_error)
 	return NT_STATUS_ACCESS_DENIED;
 }
 
+/* Convert a Unix error code to a WERROR. */
+WERROR unix_to_werror(int unix_error)
+{
+	return ntstatus_to_werror(map_nt_error_from_unix(unix_error));
+}
+
 /* Return a UNIX errno from a NT status code */
 static const struct {
 	NTSTATUS status;
diff --git a/source3/lib/tldap.c b/source3/lib/tldap.c
index 56cd870..f97dc7c 100644
--- a/source3/lib/tldap.c
+++ b/source3/lib/tldap.c
@@ -2371,6 +2371,7 @@ void tldap_msg_sctrls(struct tldap_message *msg, int *num_sctrls,
 	if (msg == NULL) {
 		*sctrls = NULL;
 		*num_sctrls = 0;
+		return;
 	}
 	*sctrls = msg->res_sctrls;
 	*num_sctrls = talloc_array_length(msg->res_sctrls);
diff --git a/source3/modules/onefs_cbrl.c b/source3/modules/onefs_cbrl.c
index 33f35a7..203710e 100644
--- a/source3/modules/onefs_cbrl.c
+++ b/source3/modules/onefs_cbrl.c
@@ -128,6 +128,7 @@ static struct blocking_lock_record *onefs_cbrl_find_blr(uint64_t id)
 				    onefs_cbrl_blr_state_str(blr)));
 				break;
 			}
+		}
 	} else {
 		for (blr = sconn->smb1.locks.blocking_lock_queue; blr; blr = blr->next) {
 			bs = (struct onefs_cbrl_blr_state *)blr->blr_private;
diff --git a/source3/utils/net_afs.c b/source3/utils/net_afs.c
index 26259c1..f6b2b2d 100644
--- a/source3/utils/net_afs.c
+++ b/source3/utils/net_afs.c
@@ -51,8 +51,10 @@ int net_afs_key(struct net_context *c, int argc, const char **argv)
 
 	if (read(fd, &keyfile, sizeof(keyfile)) != sizeof(keyfile)) {
 		d_fprintf(stderr, _("Could not read keyfile\n"));
+		close(fd);
 		return -1;
 	}
+	close(fd);
 
 	if (!secrets_store_afs_keyfile(argv[1], &keyfile)) {
 		d_fprintf(stderr, _("Could not write keyfile to secrets.tdb\n"));
diff --git a/source3/utils/net_usershare.c b/source3/utils/net_usershare.c
index 61b2caa..f0ee682 100644
--- a/source3/utils/net_usershare.c
+++ b/source3/utils/net_usershare.c
@@ -907,6 +907,7 @@ static int net_usershare_add(struct net_context *c, int argc, const char **argv)
 			  _("net usershare add: cannot lstat tmp file %s\n"),
 			  full_path_tmp );
 		TALLOC_FREE(ctx);
+		close(tmpfd);
 		return -1;
 	}
 
@@ -916,6 +917,7 @@ static int net_usershare_add(struct net_context *c, int argc, const char **argv)
 			  _("net usershare add: cannot fstat tmp file %s\n"),
 			  full_path_tmp );
 		TALLOC_FREE(ctx);
+		close(tmpfd);
 		return -1;
 	}
 
@@ -925,6 +927,7 @@ static int net_usershare_add(struct net_context *c, int argc, const char **argv)
 			    "file ?\n"),
 			  full_path_tmp );
 		TALLOC_FREE(ctx);
+		close(tmpfd);
 		return -1;
 	}
 
@@ -934,6 +937,7 @@ static int net_usershare_add(struct net_context *c, int argc, const char **argv)
 			    "to 0644n"),
 			  full_path_tmp );
 		TALLOC_FREE(ctx);
+		close(tmpfd);
 		return -1;
 	}
 
@@ -957,6 +961,7 @@ static int net_usershare_add(struct net_context *c, int argc, const char **argv)
 			(unsigned int)to_write, full_path_tmp, strerror(errno));
 		unlink(full_path_tmp);
 		TALLOC_FREE(ctx);
+		close(tmpfd);
 		return -1;
 	}
 
diff --git a/source3/utils/smbfilter.c b/source3/utils/smbfilter.c
index 2f78140..136047a 100644
--- a/source3/utils/smbfilter.c
+++ b/source3/utils/smbfilter.c
@@ -44,6 +44,7 @@ static void save_file(const char *fname, void *ppacket, size_t length)
 	}
 	if (write(fd, ppacket, length) != length) {
 		fprintf(stderr,"Failed to write %s\n", fname);
+		close(fd);
 		return;
 	}
 	close(fd);
diff --git a/source3/utils/smbget.c b/source3/utils/smbget.c
index f09c2f6..672e438 100644
--- a/source3/utils/smbget.c
+++ b/source3/utils/smbget.c
@@ -411,6 +411,7 @@ static int smb_download_file(const char *base, const char *name, int recursive,
 				fprintf(stderr, "Offset in local and remote files is different (local: "OFF_T_FORMAT", remote: "OFF_T_FORMAT")\n",
 					(OFF_T_FORMAT_CAST)off1,
 					(OFF_T_FORMAT_CAST)off2);
+				smbc_close(remotehandle); close(localhandle);
 				return 1;
 			}
 
diff --git a/source3/utils/smbta-util.c b/source3/utils/smbta-util.c
index e4f8144..cf90974 100644
--- a/source3/utils/smbta-util.c
+++ b/source3/utils/smbta-util.c
@@ -83,6 +83,7 @@ static void load_key_from_file(char *filename, char *key)
 		fclose(keyfile);
 		exit(1);
 	}
+	fclose(keyfile);
 }
 
 static void create_file_from_key(char *filename)
diff --git a/source4/libcli/util/errormap.c b/source4/libcli/util/errormap.c
index 8fcf60b..29f2331 100644
--- a/source4/libcli/util/errormap.c
+++ b/source4/libcli/util/errormap.c
@@ -1383,6 +1383,12 @@ NTSTATUS map_nt_error_from_unix(int unix_error)
 	return NT_STATUS_UNSUCCESSFUL;
 }
 
+/* Convert a Unix error code to WERROR */
+WERROR unix_to_werror(int unix_error)
+{
+	return ntstatus_to_werror(map_nt_error_from_unix(unix_error));
+}
+
 NTSTATUS ndr_map_error2ntstatus(enum ndr_err_code ndr_err)
 {
 	switch (ndr_err) {


-- 
Samba Shared Repository


More information about the samba-cvs mailing list