[SCM] Samba Shared Repository - branch master updated

Alexander Bokovoy ab at samba.org
Fri Feb 22 10:19:01 MST 2013


The branch, master has been updated
       via  36da56e Make systemctl reference indirect in packaging/NetworkManager/30-winbind-systemd
       via  92b0871 s3-rpc_server: Make sure that fd is really closed on error. Reviewed-by: Alexander Bokovoy <ab at samba.org>
       via  3ca727b lib-util: Don't leak file descriptor on error. Reviewed-by: Alexander Bokovoy <ab at samba.org>
       via  c647169 s3-vfs: Don't leak file descriptor on error. Reviewed-by: Alexander Bokovoy <ab at samba.org>
       via  6213606 s4-lib: Don't leak plugin handle on error. Reviewed-by: Alexander Bokovoy <ab at samba.org>
       via  6e8a975 s3-libsmb: Don't leak memory on error. Reviewed-by: Alexander Bokovoy <ab at samba.org>
       via  32a107c ndrdump: Don't leak plugin handle on error. Reviewed-by: Alexander Bokovoy <ab at samba.org>
       via  312355a smbpasswd: Don't leak memory. Reviewed-by: Alexander Bokovoy <ab at samba.org>
       via  3a3baa4 smbget: Fix file descriptor leak. Reviewed-by: Alexander Bokovoy <ab at samba.org>
       via  aa6cc31 s4-policy: Fix memory leaks in push_recursive(). Reviewed-by: Alexander Bokovoy <ab at samba.org>
       via  82e9ff8 s4-cifsdd: Don't leak memory. Reviewed-by: Alexander Bokovoy <ab at samba.org>
       via  f4d1e8c s4-registry: Don't leak file descriptor. Reviewed-by: Alexander Bokovoy <ab at samba.org>
       via  66ee744 s4-registry: Don't leak memory on error. Reviewed-by: Alexander Bokovoy <ab at samba.org>
       via  b055798 winbind: Don't leak centry memory. Reviewed-by: Alexander Bokovoy <ab at samba.org>
       via  cf8be08 s4-client: Don't leak memory. Reviewed-by: Alexander Bokovoy <ab at samba.org>
       via  d5a210a s3-torture: Don't leak memory. Reviewed-by: Alexander Bokovoy <ab at samba.org>
       via  301a3cb wbinfo: Fix several memory leaks. Reviewed-by: Alexander Bokovoy <ab at samba.org>
       via  d555f6d winbind: Don't leak memory on return. Reviewed-by: Alexander Bokovoy <ab at samba.org>
       via  b229d1d s3-smbd: Don't leak subcntarr array. Reviewed-by: Alexander Bokovoy <ab at samba.org>
       via  6ac1435 torture: Don't leak file resource handle in spoolss test. Reviewed-by: Alexander Bokovoy <ab at samba.org>
       via  aab2e17 s3-vfs: Don't leak file descriptor. Reviewed-by: Alexander Bokovoy <ab at samba.org>
       via  6b2b125 s3-param: Don't leak file descriptor. Reviewed-by: Alexander Bokovoy <ab at samba.org>
       via  f573826 s3-lsasd: Don't leak file descriptors. Reviewed-by: Alexander Bokovoy <ab at samba.org>
       via  c013df3 s3-spoolss: Don't leak memory. Reviewed-by: Alexander Bokovoy <ab at samba.org>
       via  b70d116 s3-net: Don't leak username. Reviewed-by: Alexander Bokovoy <ab at samba.org>
       via  b91a20f s4-client: Don't leak file descriptor. Reviewed-by: Alexander Bokovoy <ab at samba.org>
       via  34ad975 s4-client: Don't leak resource handle. Reviewed-by: Alexander Bokovoy <ab at samba.org>
       via  e762858 torture: Make sure we don't overrun the buffer. Reviewed-by: Alexander Bokovoy <ab at samba.org>
       via  1d24fa6 torture: Fix memcmp of short buffer. Reviewed-by: Alexander Bokovoy <ab at samba.org>
       via  aff301d torture: Fix array access in spoolss test. Reviewed-by: Alexander Bokovoy <ab at samba.org>
       via  b510e5e pdb: Fix array overrun by one. Reviewed-by: Alexander Bokovoy <ab at samba.org>
       via  5207d45 s4-libcli: Check return value of smbcli_request_setup(). Reviewed-by: Alexander Bokovoy <ab at samba.org>
       via  9e6e9c7 pyauth: Check return value of lpcfg_from_py_object(). Reviewed-by: Alexander Bokovoy <ab at samba.org>
       via  a9e6240 ndrdump: Check return value of ndr_pull_init_blob(). Reviewed-by: Alexander Bokovoy <ab at samba.org>
       via  318ecbc s4-libcli: Check return code of smbcli_request_setup(). Reviewed-by: Alexander Bokovoy <ab at samba.org>
       via  e508746 librpc: Add NULL check for ndr functions for epm bindings. Reviewed-by: Alexander Bokovoy <ab at samba.org>
       via  f4761c9 s3-tldap: Make sure we don't deref a null pointer. Reviewed-by: Alexander Bokovoy <ab at samba.org>
       via  a3ac48d s4-libcli: Add null check for ndr functions in rap. Reviewed-by: Alexander Bokovoy <ab at samba.org>
       via  52530f5 nmbd: Fix request data data processing.
       via  742296d torture: Fix samsync domain_name checks. Reviewed-by: Alexander Bokovoy <ab at samba.org>
       via  48a4539 libsmb: Fix possible null pointer dereference. Reviewed-by: Alexander Bokovoy <ab at samba.org>
       via  8bfbb81 ndr: Comparing an array to null is always true. Reviewed-by: Alexander Bokovoy <ab at samba.org>
       via  03cf4be winbind: Correctly cast name to messaging_send_buf(). Reviewed-by: Alexander Bokovoy <ab at samba.org>
       via  de14fd9 winbind: Use uint8_t type and use const where needed. Reviewed-by: Alexander Bokovoy <ab at samba.org>
       via  2b89067 messages: Use uint8_t type. Reviewed-by: Alexander Bokovoy <ab at samba.org>
       via  4567174 winbind: Make domain_name const in wcache_ndr_key(). Reviewed-by: Alexander Bokovoy <ab at samba.org>
      from  240a552 build: use -fstack-protector if available

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


- Log -----------------------------------------------------------------
commit 36da56ec51ecf03458fd85741ae248b49cf0d592
Author: Alexander Bokovoy <ab at samba.org>
Date:   Fri Feb 22 12:07:19 2013 +0200

    Make systemctl reference indirect in packaging/NetworkManager/30-winbind-systemd
    
    Some distributions have clever dependency generators when building packages
    and generate dependencies for each executable called out in shell scripts.
    The end result is that a package built out of samba would contain explicit dependency
    to systemd even though it is usable without systemd.
    
    Making systemctl reference indirect avoids explicit dependency.
    
    Reviewed-by: Andreas Schneider <asn at samba.org>
    
    Autobuild-User(master): Alexander Bokovoy <ab at samba.org>
    Autobuild-Date(master): Fri Feb 22 18:18:20 CET 2013 on sn-devel-104

commit 92b087182c047cd457bbe04d6306c50451698d61
Author: Andreas Schneider <asn at samba.org>
Date:   Wed Feb 20 10:52:37 2013 +0100

    s3-rpc_server: Make sure that fd is really closed on error.
    Reviewed-by: Alexander Bokovoy <ab at samba.org>

commit 3ca727b2f98ca942040d5a6c54fe61bb268d75d9
Author: Andreas Schneider <asn at samba.org>
Date:   Wed Feb 20 10:48:05 2013 +0100

    lib-util: Don't leak file descriptor on error.
    Reviewed-by: Alexander Bokovoy <ab at samba.org>

commit c647169e2850cf6f8ea8705d7008e3ce4d24f454
Author: Andreas Schneider <asn at samba.org>
Date:   Wed Feb 20 10:45:06 2013 +0100

    s3-vfs: Don't leak file descriptor on error.
    Reviewed-by: Alexander Bokovoy <ab at samba.org>

commit 62136067712aad9cff8c757b2bfb228ebbecfd76
Author: Andreas Schneider <asn at samba.org>
Date:   Wed Feb 20 10:42:54 2013 +0100

    s4-lib: Don't leak plugin handle on error.
    Reviewed-by: Alexander Bokovoy <ab at samba.org>

commit 6e8a975e8e33670803e9166a942bd986e695f4fc
Author: Andreas Schneider <asn at samba.org>
Date:   Wed Feb 20 10:38:13 2013 +0100

    s3-libsmb: Don't leak memory on error.
    Reviewed-by: Alexander Bokovoy <ab at samba.org>

commit 32a107cfcc04aa05b4db525fcc0dd7550264dff3
Author: Andreas Schneider <asn at samba.org>
Date:   Wed Feb 20 10:36:52 2013 +0100

    ndrdump: Don't leak plugin handle on error.
    Reviewed-by: Alexander Bokovoy <ab at samba.org>

commit 312355ad59001fcc1eaa30344d69fc8c91acebc8
Author: Andreas Schneider <asn at samba.org>
Date:   Wed Feb 20 10:25:55 2013 +0100

    smbpasswd: Don't leak memory.
    Reviewed-by: Alexander Bokovoy <ab at samba.org>

commit 3a3baa442ed77dbc0688d25571bc0edb5c367bcb
Author: Andreas Schneider <asn at samba.org>
Date:   Wed Feb 20 10:23:45 2013 +0100

    smbget: Fix file descriptor leak.
    Reviewed-by: Alexander Bokovoy <ab at samba.org>

commit aa6cc31ef9b1789b3e81222204f30ba01d69803a
Author: Andreas Schneider <asn at samba.org>
Date:   Wed Feb 20 10:22:00 2013 +0100

    s4-policy: Fix memory leaks in push_recursive().
    Reviewed-by: Alexander Bokovoy <ab at samba.org>

commit 82e9ff81cf6a9945cad799ae35279e16837b8033
Author: Andreas Schneider <asn at samba.org>
Date:   Wed Feb 20 10:09:20 2013 +0100

    s4-cifsdd: Don't leak memory.
    Reviewed-by: Alexander Bokovoy <ab at samba.org>

commit f4d1e8c1e2920560c9db49cd3511f0edbd577c8b
Author: Andreas Schneider <asn at samba.org>
Date:   Wed Feb 20 10:10:15 2013 +0100

    s4-registry: Don't leak file descriptor.
    Reviewed-by: Alexander Bokovoy <ab at samba.org>

commit 66ee744ccbb0a57e651d76881328554dffab8bcd
Author: Andreas Schneider <asn at samba.org>
Date:   Wed Feb 20 10:03:13 2013 +0100

    s4-registry: Don't leak memory on error.
    Reviewed-by: Alexander Bokovoy <ab at samba.org>

commit b055798c5660e48f88b74478b89ce88aae9ed019
Author: Andreas Schneider <asn at samba.org>
Date:   Wed Feb 20 09:51:43 2013 +0100

    winbind: Don't leak centry memory.
    Reviewed-by: Alexander Bokovoy <ab at samba.org>

commit cf8be08968f2aae3769140aee00ecac542ff1884
Author: Andreas Schneider <asn at samba.org>
Date:   Wed Feb 20 09:48:59 2013 +0100

    s4-client: Don't leak memory.
    Reviewed-by: Alexander Bokovoy <ab at samba.org>

commit d5a210a26f289bba92192187fa543ed70bdf8387
Author: Andreas Schneider <asn at samba.org>
Date:   Wed Feb 20 09:47:19 2013 +0100

    s3-torture: Don't leak memory.
    Reviewed-by: Alexander Bokovoy <ab at samba.org>

commit 301a3cb4afadab6232a34086339696abd0dcbe0c
Author: Andreas Schneider <asn at samba.org>
Date:   Wed Feb 20 09:43:44 2013 +0100

    wbinfo: Fix several memory leaks.
    Reviewed-by: Alexander Bokovoy <ab at samba.org>

commit d555f6d789ede9879f2b5d07d5c00199622ffe5a
Author: Andreas Schneider <asn at samba.org>
Date:   Wed Feb 20 09:41:55 2013 +0100

    winbind: Don't leak memory on return.
    Reviewed-by: Alexander Bokovoy <ab at samba.org>

commit b229d1dcb324c3da9d0865bd72a07e9e1b8b0c53
Author: Andreas Schneider <asn at samba.org>
Date:   Wed Feb 20 09:31:17 2013 +0100

    s3-smbd: Don't leak subcntarr array.
    Reviewed-by: Alexander Bokovoy <ab at samba.org>

commit 6ac1435ab3389d36497ece61a2461d9ccc7b4560
Author: Andreas Schneider <asn at samba.org>
Date:   Wed Feb 20 09:26:02 2013 +0100

    torture: Don't leak file resource handle in spoolss test.
    Reviewed-by: Alexander Bokovoy <ab at samba.org>

commit aab2e176dc8f67424cf8b4475a8bd38c79ad999a
Author: Andreas Schneider <asn at samba.org>
Date:   Wed Feb 20 09:16:25 2013 +0100

    s3-vfs: Don't leak file descriptor.
    Reviewed-by: Alexander Bokovoy <ab at samba.org>

commit 6b2b125ab910530610b5e3e4b72f6733bd1f174f
Author: Andreas Schneider <asn at samba.org>
Date:   Wed Feb 20 09:15:26 2013 +0100

    s3-param: Don't leak file descriptor.
    Reviewed-by: Alexander Bokovoy <ab at samba.org>

commit f573826f18e590dd53a0795b670e6f30a3f5cd68
Author: Andreas Schneider <asn at samba.org>
Date:   Wed Feb 20 09:11:48 2013 +0100

    s3-lsasd: Don't leak file descriptors.
    Reviewed-by: Alexander Bokovoy <ab at samba.org>

commit c013df3ae52d57b1206f156a2fc529f52cf39531
Author: Andreas Schneider <asn at samba.org>
Date:   Wed Feb 20 09:06:51 2013 +0100

    s3-spoolss: Don't leak memory.
    Reviewed-by: Alexander Bokovoy <ab at samba.org>

commit b70d1168cf511c83eaa6a2761d3924935513d233
Author: Andreas Schneider <asn at samba.org>
Date:   Wed Feb 20 09:03:17 2013 +0100

    s3-net: Don't leak username.
    Reviewed-by: Alexander Bokovoy <ab at samba.org>

commit b91a20f704363374bc37aaa75e5d2c80f7997017
Author: Andreas Schneider <asn at samba.org>
Date:   Wed Feb 20 09:23:37 2013 +0100

    s4-client: Don't leak file descriptor.
    Reviewed-by: Alexander Bokovoy <ab at samba.org>

commit 34ad9756d73bc4203281ab39ff68489aab1b44e9
Author: Andreas Schneider <asn at samba.org>
Date:   Wed Feb 20 08:58:02 2013 +0100

    s4-client: Don't leak resource handle.
    Reviewed-by: Alexander Bokovoy <ab at samba.org>

commit e762858a054f865780e9f05f7896452a525890f4
Author: Andreas Schneider <asn at samba.org>
Date:   Tue Feb 19 18:19:12 2013 +0100

    torture: Make sure we don't overrun the buffer.
    Reviewed-by: Alexander Bokovoy <ab at samba.org>

commit 1d24fa6919a4ff7588c20f1a0365fbfcfd404203
Author: Andreas Schneider <asn at samba.org>
Date:   Tue Feb 19 16:02:01 2013 +0100

    torture: Fix memcmp of short buffer.
    Reviewed-by: Alexander Bokovoy <ab at samba.org>

commit aff301d9ebc4f5c1be059838a8a6ef6b38129f88
Author: Andreas Schneider <asn at samba.org>
Date:   Tue Feb 19 09:32:30 2013 +0100

    torture: Fix array access in spoolss test.
    Reviewed-by: Alexander Bokovoy <ab at samba.org>

commit b510e5e6c4332356067331c7afff47f7dbf587fc
Author: Andreas Schneider <asn at samba.org>
Date:   Tue Feb 19 09:23:53 2013 +0100

    pdb: Fix array overrun by one.
    Reviewed-by: Alexander Bokovoy <ab at samba.org>

commit 5207d456f1132041a07c9b3c48bfa7a9112a698f
Author: Andreas Schneider <asn at samba.org>
Date:   Tue Feb 19 09:00:51 2013 +0100

    s4-libcli: Check return value of smbcli_request_setup().
    Reviewed-by: Alexander Bokovoy <ab at samba.org>

commit 9e6e9c7707506709de2b0e765647783f471b412a
Author: Andreas Schneider <asn at samba.org>
Date:   Tue Feb 19 08:58:00 2013 +0100

    pyauth: Check return value of lpcfg_from_py_object().
    Reviewed-by: Alexander Bokovoy <ab at samba.org>

commit a9e6240441583688388885cf48c5d3df09263784
Author: Andreas Schneider <asn at samba.org>
Date:   Tue Feb 19 08:56:22 2013 +0100

    ndrdump: Check return value of ndr_pull_init_blob().
    Reviewed-by: Alexander Bokovoy <ab at samba.org>

commit 318ecbc2085d2eaee9d24a77c1c3496185af2bdd
Author: Andreas Schneider <asn at samba.org>
Date:   Mon Feb 18 18:00:38 2013 +0100

    s4-libcli: Check return code of smbcli_request_setup().
    Reviewed-by: Alexander Bokovoy <ab at samba.org>

commit e50874606f235cf9d8cf159997b97fcb6ad74ce2
Author: Andreas Schneider <asn at samba.org>
Date:   Mon Feb 18 17:32:28 2013 +0100

    librpc: Add NULL check for ndr functions for epm bindings.
    Reviewed-by: Alexander Bokovoy <ab at samba.org>

commit f4761c90fa0f2161e3d799b69d569cd2e38fe10c
Author: Andreas Schneider <asn at samba.org>
Date:   Mon Feb 18 17:30:19 2013 +0100

    s3-tldap: Make sure we don't deref a null pointer.
    Reviewed-by: Alexander Bokovoy <ab at samba.org>

commit a3ac48d07fa101743a023c31046495125498e5a1
Author: Andreas Schneider <asn at samba.org>
Date:   Mon Feb 18 17:26:14 2013 +0100

    s4-libcli: Add null check for ndr functions in rap.
    Reviewed-by: Alexander Bokovoy <ab at samba.org>

commit 52530f5c61994766fd4c85017fcf5287b2d16837
Author: Andreas Schneider <asn at samba.org>
Date:   Mon Feb 18 17:21:31 2013 +0100

    nmbd: Fix request data data processing.
    
    answers->rdata is an array and will never be NULL.
    Reviewed-by: Alexander Bokovoy <ab at samba.org>

commit 742296d3c375630f76ced9970cff95d7bc1b2547
Author: Andreas Schneider <asn at samba.org>
Date:   Mon Feb 18 17:17:19 2013 +0100

    torture: Fix samsync domain_name checks.
    Reviewed-by: Alexander Bokovoy <ab at samba.org>

commit 48a453996ac161d7c7a7cb15a047e57cbdbb1e87
Author: Andreas Schneider <asn at samba.org>
Date:   Mon Feb 18 17:11:15 2013 +0100

    libsmb: Fix possible null pointer dereference.
    Reviewed-by: Alexander Bokovoy <ab at samba.org>

commit 8bfbb81bcd5a70280f49fbe3ab67ccf035fdeade
Author: Andreas Schneider <asn at samba.org>
Date:   Mon Feb 18 17:08:21 2013 +0100

    ndr: Comparing an array to null is always true.
    Reviewed-by: Alexander Bokovoy <ab at samba.org>

commit 03cf4bedf0bb9729fcf70f321647cf780e002a48
Author: Andreas Schneider <asn at samba.org>
Date:   Mon Feb 18 16:24:38 2013 +0100

    winbind: Correctly cast name to messaging_send_buf().
    Reviewed-by: Alexander Bokovoy <ab at samba.org>

commit de14fd942aaaa4e18bae7fc7cb109d9a60b12648
Author: Andreas Schneider <asn at samba.org>
Date:   Mon Feb 18 15:48:24 2013 +0100

    winbind: Use uint8_t type and use const where needed.
    Reviewed-by: Alexander Bokovoy <ab at samba.org>

commit 2b890679a61efa676473c11ebbf7d31f4aeeb3b2
Author: Andreas Schneider <asn at samba.org>
Date:   Mon Feb 18 15:46:52 2013 +0100

    messages: Use uint8_t type.
    Reviewed-by: Alexander Bokovoy <ab at samba.org>

commit 45671747f0b4a569581773ce497ab4dd31e7710d
Author: Andreas Schneider <asn at samba.org>
Date:   Mon Feb 18 15:44:20 2013 +0100

    winbind: Make domain_name const in wcache_ndr_key().
    Reviewed-by: Alexander Bokovoy <ab at samba.org>

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

Summary of changes:
 lib/util/become_daemon.c                    |    1 +
 librpc/ndr/ndr_sec_helper.c                 |    2 +-
 librpc/rpc/binding.c                        |    7 +++-
 librpc/tools/ndrdump.c                      |   13 +++++++
 nsswitch/wbinfo.c                           |    8 ++++
 packaging/NetworkManager/30-winbind-systemd |    8 ++--
 source3/lib/messages.c                      |    4 +-
 source3/lib/tldap.c                         |    3 ++
 source3/libsmb/libsmb_server.c              |    1 +
 source3/libsmb/libsmb_xattr.c               |    4 +-
 source3/modules/vfs_aio_fork.c              |    3 +-
 source3/modules/vfs_crossrename.c           |    4 ++-
 source3/nmbd/nmbd_browsesync.c              |    4 +-
 source3/param/loadparm.c                    |    1 +
 source3/passdb/pdb_smbpasswd.c              |    7 ++--
 source3/rpc_server/lsasd.c                  |   29 ++++++++++------
 source3/rpc_server/rpc_sock_helper.c        |    6 +++
 source3/rpc_server/spoolss/srv_spoolss_nt.c |    4 ++-
 source3/smbd/lanman.c                       |    2 +-
 source3/torture/torture.c                   |    3 ++
 source3/utils/net_rpc.c                     |    3 +-
 source3/utils/smbget.c                      |    3 ++
 source3/utils/smbpasswd.c                   |    1 +
 source3/winbindd/winbindd_cache.c           |    3 +-
 source3/winbindd/winbindd_cm.c              |   17 +++++----
 source3/winbindd/winbindd_dual.c            |    6 ++--
 source4/auth/pyauth.c                       |    4 ++
 source4/client/cifsdd.c                     |    6 +++
 source4/client/client.c                     |   11 ++++++
 source4/lib/com/tables.c                    |    1 +
 source4/lib/policy/gp_filesys.c             |   40 ++++++++++++++--------
 source4/lib/registry/hive.c                 |    3 +-
 source4/lib/registry/tools/regshell.c       |    7 ++++
 source4/libcli/climessage.c                 |    9 +++++
 source4/libcli/rap/rap.c                    |    8 ++++
 source4/libcli/raw/clioplock.c              |    3 ++
 source4/libcli/raw/clitree.c                |    3 ++
 source4/libcli/raw/rawfsinfo.c              |    3 ++
 source4/torture/raw/open.c                  |    4 +-
 source4/torture/rpc/samsync.c               |   49 ++++++++++++++++++++++++--
 source4/torture/rpc/spoolss.c               |    5 ++-
 source4/torture/smb2/dir.c                  |    2 +-
 42 files changed, 237 insertions(+), 68 deletions(-)


Changeset truncated at 500 lines:

diff --git a/lib/util/become_daemon.c b/lib/util/become_daemon.c
index 373927c..2ca0478 100644
--- a/lib/util/become_daemon.c
+++ b/lib/util/become_daemon.c
@@ -62,6 +62,7 @@ _PUBLIC_ void close_low_fds(bool stdin_too, bool stdout_too, bool stderr_too)
 		}
 		if (fd != i) {
 			DEBUG(0,("Didn't get file descriptor %d\n",i));
+			close(fd);
 			return;
 		}
 	}
diff --git a/librpc/ndr/ndr_sec_helper.c b/librpc/ndr/ndr_sec_helper.c
index 66b0013..ea082d1 100644
--- a/librpc/ndr/ndr_sec_helper.c
+++ b/librpc/ndr/ndr_sec_helper.c
@@ -228,7 +228,7 @@ enum ndr_err_code ndr_pull_dom_sid28(struct ndr_pull *ndr, int ndr_flags, struct
 	if (!NDR_ERR_CODE_IS_SUCCESS(status)) {
 		/* handle a w2k bug which send random data in the buffer */
 		ZERO_STRUCTP(sid);
-	} else if (sid->num_auths == 0 && sid->sub_auths) {
+	} else if (sid->num_auths == 0) {
 		ZERO_STRUCT(sid->sub_auths);
 	}
 
diff --git a/librpc/rpc/binding.c b/librpc/rpc/binding.c
index ce59349..49651e8 100644
--- a/librpc/rpc/binding.c
+++ b/librpc/rpc/binding.c
@@ -425,7 +425,12 @@ static DATA_BLOB dcerpc_floor_pack_lhs_data(TALLOC_CTX *mem_ctx, const struct nd
 {
 	DATA_BLOB blob;
 	enum ndr_err_code ndr_err;
-	struct ndr_push *ndr = ndr_push_init_ctx(mem_ctx);
+	struct ndr_push *ndr;
+
+	ndr = ndr_push_init_ctx(mem_ctx);
+	if (ndr == NULL) {
+		return data_blob_null;
+	}
 
 	ndr->flags |= LIBNDR_FLAG_NOALIGN;
 
diff --git a/librpc/tools/ndrdump.c b/librpc/tools/ndrdump.c
index 4a102f5..692e655 100644
--- a/librpc/tools/ndrdump.c
+++ b/librpc/tools/ndrdump.c
@@ -117,6 +117,7 @@ static const struct ndr_interface_table *load_iface_from_plugin(const char *plug
 	if (!p) {
 		printf("%s: Unable to find DCE/RPC interface table for '%s': %s\n", plugin, pipe_name, dlerror());
 		talloc_free(symbol);
+		dlclose(handle);
 		return NULL;
 	}
 
@@ -335,6 +336,10 @@ static NTSTATUS ndrdump_pull_and_print_pipes(const char *function,
 		blob.length = size;
 
 		ndr_pull = ndr_pull_init_blob(&blob, mem_ctx);
+		if (ndr_pull == NULL) {
+			perror("ndr_pull_init_blob");
+			exit(1);
+		}
 		ndr_pull->flags |= LIBNDR_FLAG_REF_ALLOC;
 		if (assume_ndr64) {
 			ndr_pull->flags |= LIBNDR_FLAG_NDR64;
@@ -377,6 +382,10 @@ static NTSTATUS ndrdump_pull_and_print_pipes(const char *function,
 	blob.length = size;
 
 	ndr_pull = ndr_pull_init_blob(&blob, mem_ctx);
+	if (ndr_pull == NULL) {
+		perror("ndr_pull_init_blob");
+		exit(1);
+	}
 	ndr_pull->flags |= LIBNDR_FLAG_REF_ALLOC;
 	if (assume_ndr64) {
 		ndr_pull->flags |= LIBNDR_FLAG_NDR64;
@@ -459,6 +468,10 @@ static NTSTATUS ndrdump_pull_and_print_pipes(const char *function,
 		}
 
 		ndr_v_pull = ndr_pull_init_blob(&v_blob, mem_ctx);
+		if (ndr_v_pull == NULL) {
+			perror("ndr_pull_init_blob");
+			exit(1);
+		}
 		ndr_v_pull->flags |= LIBNDR_FLAG_REF_ALLOC;
 
 		ndr_err = f->ndr_pull(ndr_v_pull, flags, v_st);
diff --git a/nsswitch/wbinfo.c b/nsswitch/wbinfo.c
index b96b73c..cd6de34 100644
--- a/nsswitch/wbinfo.c
+++ b/nsswitch/wbinfo.c
@@ -243,6 +243,8 @@ static bool wbinfo_get_user_sidinfo(const char *sid_str)
 		 pwd->pw_dir,
 		 pwd->pw_shell);
 
+	wbcFreeMemory(pwd);
+
 	return true;
 }
 
@@ -1227,6 +1229,9 @@ static bool wbinfo_lookupsid(const char *sid_str)
 	d_printf("%s%c%s %d\n",
 		 domain, winbind_separator(), name, type);
 
+	wbcFreeMemory(domain);
+	wbcFreeMemory(name);
+
 	return true;
 }
 
@@ -1261,6 +1266,9 @@ static bool wbinfo_lookupsid_fullname(const char *sid_str)
 	d_printf("%s%c%s %d\n",
 		 domain, winbind_separator(), name, type);
 
+	wbcFreeMemory(domain);
+	wbcFreeMemory(name);
+
 	return true;
 }
 
diff --git a/packaging/NetworkManager/30-winbind-systemd b/packaging/NetworkManager/30-winbind-systemd
index af0edf9..9db422a 100755
--- a/packaging/NetworkManager/30-winbind-systemd
+++ b/packaging/NetworkManager/30-winbind-systemd
@@ -1,6 +1,6 @@
 #!/bin/sh
-
-winbind_is_active=$(/bin/systemctl is-active winbind.service)
+SYSTEMCTL=/bin/systemctl
+winbind_is_active=$($SYSTEMCTL is-active winbind.service)
 test "${winbind_is_active}" = "active" || exit 0
 
 winbind_offline_logon=$(testparm -s --parameter-name "winbind offline logon" 2>/dev/null)
@@ -8,9 +8,9 @@ test "${winbind_offline_logon}" = "Yes" || exit 0
 
 case "$2" in
 	up|vpn-up)
-		nmb_is_active=$(/bin/systemctl is-active nmb.service)
+		nmb_is_active=$($SYSTEMCTL is-active nmb.service)
 		if test "${nmb_is_active}" = "active"; then
-			/bin/systemctl try-restart nmb.service || :
+			$SYSTEMCTL try-restart nmb.service || :
 		fi
 		/usr/bin/smbcontrol winbind online || :
 	;;
diff --git a/source3/lib/messages.c b/source3/lib/messages.c
index b60ab79..f4d6227 100644
--- a/source3/lib/messages.c
+++ b/source3/lib/messages.c
@@ -119,7 +119,7 @@ static int traverse_fn(struct db_record *rec, const struct server_id *id,
 	 * the msg has already been deleted from the messages.tdb.*/
 
 	status = messaging_send_buf(msg_all->msg_ctx, *id, msg_all->msg_type,
-				    (const uint8 *)msg_all->buf, msg_all->len);
+				    (const uint8_t *)msg_all->buf, msg_all->len);
 
 	if (NT_STATUS_EQUAL(status, NT_STATUS_INVALID_HANDLE)) {
 
@@ -368,7 +368,7 @@ NTSTATUS messaging_send(struct messaging_context *msg_ctx,
 
 NTSTATUS messaging_send_buf(struct messaging_context *msg_ctx,
 			    struct server_id server, uint32_t msg_type,
-			    const uint8 *buf, size_t len)
+			    const uint8_t *buf, size_t len)
 {
 	DATA_BLOB blob = data_blob_const(buf, len);
 	return messaging_send(msg_ctx, server, msg_type, &blob);
diff --git a/source3/lib/tldap.c b/source3/lib/tldap.c
index 8e91234..b094c2d 100644
--- a/source3/lib/tldap.c
+++ b/source3/lib/tldap.c
@@ -1370,6 +1370,9 @@ static bool tldap_push_filter_basic(struct tldap_context *ld,
 			dn++;
 
 			rule = strchr(dn, ':');
+			if (rule == NULL) {
+				return false;
+			}
 			if ((rule == dn + 1) || rule + 1 == e) {
 				/* malformed filter, contains "::" */
 				return false;
diff --git a/source3/libsmb/libsmb_server.c b/source3/libsmb/libsmb_server.c
index 858622f..0d39245 100644
--- a/source3/libsmb/libsmb_server.c
+++ b/source3/libsmb/libsmb_server.c
@@ -812,6 +812,7 @@ SMBC_attr_server(TALLOC_CTX *ctx,
                 if (!NT_STATUS_IS_OK(nt_status)) {
                         errno = SMBC_errno(context, ipc_srv->cli);
                         cli_shutdown(ipc_srv->cli);
+                        free(ipc_srv);
                         return NULL;
                 }
 
diff --git a/source3/libsmb/libsmb_xattr.c b/source3/libsmb/libsmb_xattr.c
index 03cdc34..c2ba61f 100644
--- a/source3/libsmb/libsmb_xattr.c
+++ b/source3/libsmb/libsmb_xattr.c
@@ -351,7 +351,7 @@ parse_ace(struct cli_state *ipc_cli,
 		goto done;
 	}
 
-	for (v = standard_values; v->perm; v++) {
+	for (v = standard_values; v != NULL; v++) {
 		if (strcmp(tok, v->perm) == 0) {
 			amask = v->mask;
 			goto done;
@@ -363,7 +363,7 @@ parse_ace(struct cli_state *ipc_cli,
 	while(*p) {
 		bool found = False;
 
-		for (v = special_values; v->perm; v++) {
+		for (v = special_values; v != NULL; v++) {
 			if (v->perm[0] == *p) {
 				amask |= v->mask;
 				found = True;
diff --git a/source3/modules/vfs_aio_fork.c b/source3/modules/vfs_aio_fork.c
index 1d840fa..dc33031 100644
--- a/source3/modules/vfs_aio_fork.c
+++ b/source3/modules/vfs_aio_fork.c
@@ -68,13 +68,12 @@ static struct mmap_area *mmap_area_init(TALLOC_CTX *mem_ctx, size_t size)
 
 	result->ptr = mmap(NULL, size, PROT_READ|PROT_WRITE,
 			   MAP_SHARED|MAP_FILE, fd, 0);
+	close(fd);
 	if (result->ptr == MAP_FAILED) {
 		DEBUG(1, ("mmap failed: %s\n", strerror(errno)));
 		goto fail;
 	}
 
-	close(fd);
-
 	result->size = size;
 	talloc_set_destructor(result, mmap_area_destructor);
 
diff --git a/source3/modules/vfs_crossrename.c b/source3/modules/vfs_crossrename.c
index 19a182c..9bb42b9 100644
--- a/source3/modules/vfs_crossrename.c
+++ b/source3/modules/vfs_crossrename.c
@@ -73,8 +73,10 @@ static int copy_reg(const char *source, const char *dest)
 	if((ifd = open (source, O_RDONLY, 0)) < 0)
 		return -1;
 
-	if (unlink (dest) && errno != ENOENT)
+	if (unlink (dest) && errno != ENOENT) {
+		close(ifd);
 		return -1;
+	}
 
 #ifdef O_NOFOLLOW
 	if((ofd = open (dest, O_WRONLY | O_CREAT | O_TRUNC | O_NOFOLLOW, 0600)) < 0 )
diff --git a/source3/nmbd/nmbd_browsesync.c b/source3/nmbd/nmbd_browsesync.c
index 8bc28ad..30d2891 100644
--- a/source3/nmbd/nmbd_browsesync.c
+++ b/source3/nmbd/nmbd_browsesync.c
@@ -194,7 +194,7 @@ static void domain_master_node_status_success(struct subnet_record *subrec,
   /* Go through the list of names found at answers->rdata and look for
      the first SERVER<0x20> name. */
 
-	if(answers->rdata != NULL) {
+	if (answers->rdlength > 0) {
 		char *p = answers->rdata;
 		int numnames = CVAL(p, 0);
 
@@ -416,7 +416,7 @@ static void get_domain_master_name_node_status_success(struct subnet_record *sub
 	 * the first WORKGROUP<0x1b> name.
 	 */
 
-	if(answers->rdata != NULL) {
+	if (answers->rdlength > 0) {
 		char *p = answers->rdata;
 		int numnames = CVAL(p, 0);
 
diff --git a/source3/param/loadparm.c b/source3/param/loadparm.c
index 5bf430d..ce1c1d8 100644
--- a/source3/param/loadparm.c
+++ b/source3/param/loadparm.c
@@ -4432,6 +4432,7 @@ static int process_usershare_file(const char *dir_name, const char *file_name, i
 	/* This must be a regular file, not a symlink, directory or
 	   other strange filetype. */
 	if (!check_usershare_stat(fname, &sbuf)) {
+		close(fd);
 		goto out;
 	}
 
diff --git a/source3/passdb/pdb_smbpasswd.c b/source3/passdb/pdb_smbpasswd.c
index 0703ea4..83785c6 100644
--- a/source3/passdb/pdb_smbpasswd.c
+++ b/source3/passdb/pdb_smbpasswd.c
@@ -737,7 +737,8 @@ static bool mod_smbfilepwd_entry(struct smbpasswd_privates *smbpasswd_state, con
 	fstring user_name;
 
 	char *status;
-	char linebuf[256];
+#define LINEBUF_SIZE 255
+	char linebuf[LINEBUF_SIZE + 1];
 	char readbuf[1024];
 	int c;
 	fstring ascii_p16;
@@ -792,7 +793,7 @@ static bool mod_smbfilepwd_entry(struct smbpasswd_privates *smbpasswd_state, con
 
 		linebuf[0] = '\0';
 
-		status = fgets(linebuf, sizeof(linebuf), fp);
+		status = fgets(linebuf, LINEBUF_SIZE, fp);
 		if (status == NULL && ferror(fp)) {
 			pw_file_unlock(lockfd, &smbpasswd_state->pw_file_lock_depth);
 			fclose(fp);
@@ -1021,7 +1022,7 @@ This is no longer supported.!\n", pwd->smb_name));
 	dump_data(100, (uint8 *)ascii_p16, wr_len);
 #endif
 
-	if(wr_len > sizeof(linebuf)) {
+	if(wr_len > LINEBUF_SIZE) {
 		DEBUG(0, ("mod_smbfilepwd_entry: line to write (%d) is too long.\n", wr_len+1));
 		pw_file_unlock(lockfd,&smbpasswd_state->pw_file_lock_depth);
 		fclose(fp);
diff --git a/source3/rpc_server/lsasd.c b/source3/rpc_server/lsasd.c
index a1ac49a..72ad785 100644
--- a/source3/rpc_server/lsasd.c
+++ b/source3/rpc_server/lsasd.c
@@ -598,7 +598,7 @@ static bool lsasd_create_sockets(struct tevent_context *ev_ctx,
 	TALLOC_CTX *tmp_ctx;
 	NTSTATUS status;
 	uint32_t i;
-	int fd;
+	int fd = -1;
 	int rc;
 	bool ok = true;
 
@@ -641,8 +641,6 @@ static bool lsasd_create_sockets(struct tevent_context *ev_ctx,
 		ok = false;
 		goto done;
 	}
-	listen_fd[*listen_fd_size] = fd;
-	(*listen_fd_size)++;
 
 	rc = listen(fd, pf_lsasd_cfg.max_allowed_clients);
 	if (rc == -1) {
@@ -651,14 +649,14 @@ static bool lsasd_create_sockets(struct tevent_context *ev_ctx,
 		ok = false;
 		goto done;
 	}
+	listen_fd[*listen_fd_size] = fd;
+	(*listen_fd_size)++;
 
 	fd = create_named_pipe_socket("lsass");
 	if (fd < 0) {
 		ok = false;
 		goto done;
 	}
-	listen_fd[*listen_fd_size] = fd;
-	(*listen_fd_size)++;
 
 	rc = listen(fd, pf_lsasd_cfg.max_allowed_clients);
 	if (rc == -1) {
@@ -667,14 +665,14 @@ static bool lsasd_create_sockets(struct tevent_context *ev_ctx,
 		ok = false;
 		goto done;
 	}
+	listen_fd[*listen_fd_size] = fd;
+	(*listen_fd_size)++;
 
 	fd = create_dcerpc_ncalrpc_socket("lsarpc");
 	if (fd < 0) {
 		ok = false;
 		goto done;
 	}
-	listen_fd[*listen_fd_size] = fd;
-	(*listen_fd_size)++;
 
 	rc = listen(fd, pf_lsasd_cfg.max_allowed_clients);
 	if (rc == -1) {
@@ -683,6 +681,9 @@ static bool lsasd_create_sockets(struct tevent_context *ev_ctx,
 		ok = false;
 		goto done;
 	}
+	listen_fd[*listen_fd_size] = fd;
+	(*listen_fd_size)++;
+	fd = -1;
 
 	v = dcerpc_binding_vector_dup(tmp_ctx, v_orig);
 	if (v == NULL) {
@@ -735,8 +736,6 @@ static bool lsasd_create_sockets(struct tevent_context *ev_ctx,
 		ok = false;
 		goto done;
 	}
-	listen_fd[*listen_fd_size] = fd;
-	(*listen_fd_size)++;
 
 	rc = listen(fd, pf_lsasd_cfg.max_allowed_clients);
 	if (rc == -1) {
@@ -745,6 +744,9 @@ static bool lsasd_create_sockets(struct tevent_context *ev_ctx,
 		ok = false;
 		goto done;
 	}
+	listen_fd[*listen_fd_size] = fd;
+	(*listen_fd_size)++;
+	fd = -1;
 
 	v = dcerpc_binding_vector_dup(tmp_ctx, v_orig);
 	if (v == NULL) {
@@ -797,16 +799,18 @@ static bool lsasd_create_sockets(struct tevent_context *ev_ctx,
 		ok = false;
 		goto done;
 	}
-	listen_fd[*listen_fd_size] = fd;
-	(*listen_fd_size)++;
 
 	rc = listen(fd, pf_lsasd_cfg.max_allowed_clients);
 	if (rc == -1) {
 		DEBUG(0, ("Failed to listen on netlogon ncalrpc - %s\n",
 			  strerror(errno)));
+		close(fd);
 		ok = false;
 		goto done;
 	}
+	listen_fd[*listen_fd_size] = fd;
+	(*listen_fd_size)++;
+	fd = -1;
 
 	v = dcerpc_binding_vector_dup(tmp_ctx, v_orig);
 	if (v == NULL) {
@@ -838,6 +842,9 @@ static bool lsasd_create_sockets(struct tevent_context *ev_ctx,
 	}
 
 done:
+	if (fd != -1) {
+		close(fd);
+	}
 	talloc_free(tmp_ctx);
 	return ok;
 }
diff --git a/source3/rpc_server/rpc_sock_helper.c b/source3/rpc_server/rpc_sock_helper.c
index 198df90..dc88f25 100644
--- a/source3/rpc_server/rpc_sock_helper.c
+++ b/source3/rpc_server/rpc_sock_helper.c
@@ -63,6 +63,9 @@ NTSTATUS rpc_create_tcpip_sockets(const struct ndr_interface_table *iface,
 			fd = create_tcpip_socket(ifss, &p);
 			if (fd < 0 || p == 0) {
 				status = NT_STATUS_UNSUCCESSFUL;
+				if (fd != -1) {
+					close(fd);
+				}
 				goto done;
 			}
 			listen_fd[*listen_fd_size] = fd;
@@ -124,6 +127,9 @@ NTSTATUS rpc_create_tcpip_sockets(const struct ndr_interface_table *iface,
 			fd = create_tcpip_socket(&ss, &p);
 			if (fd < 0 || p == 0) {
 				status = NT_STATUS_UNSUCCESSFUL;
+				if (fd != -1) {
+					close(fd);
+				}
 				goto done;
 			}
 			listen_fd[*listen_fd_size] = fd;
diff --git a/source3/rpc_server/spoolss/srv_spoolss_nt.c b/source3/rpc_server/spoolss/srv_spoolss_nt.c
index ef203d8..891f429 100644
--- a/source3/rpc_server/spoolss/srv_spoolss_nt.c
+++ b/source3/rpc_server/spoolss/srv_spoolss_nt.c
@@ -4867,8 +4867,10 @@ static WERROR string_array_from_driver_info(TALLOC_CTX *mem_ctx,
 			     &array, &num_strings);
 	}
 
-	if (presult) {
+	if (presult != NULL) {
 		*presult = array;
+	} else {
+		talloc_free(array);
 	}
 
 	return WERR_OK;
diff --git a/source3/smbd/lanman.c b/source3/smbd/lanman.c
index d54e1d5..b5598a4 100644
--- a/source3/smbd/lanman.c
+++ b/source3/smbd/lanman.c
@@ -1159,8 +1159,8 @@ static bool api_DosPrintQEnum(struct smbd_server_connection *sconn,
 		}
 	}
 
-	SAFE_FREE(subcntarr);
  out:
+	SAFE_FREE(subcntarr);
 	*rdata_len = desc.usedlen;
 	*rparam_len = 8;
 	*rparam = smb_realloc_limit(*rparam,*rparam_len);
diff --git a/source3/torture/torture.c b/source3/torture/torture.c
index db18825..93b9cfd 100644
--- a/source3/torture/torture.c
+++ b/source3/torture/torture.c
@@ -3101,6 +3101,9 @@ static bool run_randomipc(int dummy)
 		correct = False;
 	}
 
+	SAFE_FREE(rparam);
+	SAFE_FREE(rdata);
+
 	printf("finished random ipc test\n");
 


-- 
Samba Shared Repository


More information about the samba-cvs mailing list