[SCM] Samba Shared Repository - branch master updated

Jeremy Allison jra at samba.org
Wed Nov 5 04:19:50 MST 2014


The branch, master has been updated
       via  e07ecd4 smbstatus: check for lock_path talloc failures
       via  c5e2418 smbXsrv: don't leak lock_path onto talloc tos
       via  ca18783 notify_internal: don't leak lock_path onto talloc tos
       via  d3cd60d printer_list: don't leak lock_path onto talloc tos
       via  49fe698 nmbd_namelistdb: don't leak lock_path onto talloc tos
       via  8f9137c share_mode_lock: don't leak lock_path onto talloc tos
       via  39f8ff2 brlock: don't leak lock_path onto talloc tos
       via  d6792ec serverid: don't leak lock_path onto talloc tos
       via  76fe51c server_mutex: don't leak lock_path onto talloc tos
       via  d9d16cb g_lock: don't leak lock_path onto talloc tos
       via  176259f dbwrap_watch: don't leak lock_path onto talloc tos
       via  760af79 lang_tdb: don't leak lock_path or data_path onto talloc tos
       via  3553982 winbindd_cache: don't leak state_path onto talloc tos
       via  d428aa6 winbindd: don't leak state_path onto talloc tos
       via  364d55c idmap_autorid: don't leak state_path onto talloc tos
       via  0210e3c smbcontrol: don't leak state_path onto talloc tos
       via  c3f3b13 net_registry: don't leak state_path onto talloc tos
       via  7089683 net_idmap: don't leak state_path onto talloc tos
       via  587b216 reg_perfcount: don't leak state_path onto talloc tos
       via  4b6af0d reg_backend_db: don't leak state_path onto talloc tos
       via  2307c37 nt_printing: don't leak state_path onto talloc tos
       via  6d5b8dd pdb_tdb: don't leak state_path onto talloc tos
       via  f88535e account_pol: don't leak state_path onto talloc tos
       via  30ab958 nmbd_winsserver: don't leak state_path onto talloc tos
       via  f62d908 sharesec: don't leak state_path onto talloc tos
       via  a852116 eventlog: don't leak state_path onto talloc tos
       via  b75d7ac groupdb: don't leak state_path onto talloc tos
       via  745a1c5 Change expired password flag indicator
      from  a3b333a s3:locking: remove dead code from brl_get_locks_readonly()

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


- Log -----------------------------------------------------------------
commit e07ecd4fe698f685299258a666127430a3952058
Author: David Disseldorp <ddiss at samba.org>
Date:   Sun Nov 2 20:21:49 2014 +0100

    smbstatus: check for lock_path talloc failures
    
    Signed-off-by: David Disseldorp <ddiss at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>
    
    Autobuild-User(master): Jeremy Allison <jra at samba.org>
    Autobuild-Date(master): Tue Nov  4 02:07:35 CET 2014 on sn-devel-104

commit c5e241831c4d62ca9571fe3bec1434ecbf3e706c
Author: David Disseldorp <ddiss at samba.org>
Date:   Sun Nov 2 20:21:48 2014 +0100

    smbXsrv: don't leak lock_path onto talloc tos
    
    Also check for allocation failures.
    
    Signed-off-by: David Disseldorp <ddiss at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit ca18783463d2f49a4249b0774196caafd4a08a22
Author: David Disseldorp <ddiss at samba.org>
Date:   Sun Nov 2 20:21:47 2014 +0100

    notify_internal: don't leak lock_path onto talloc tos
    
    Also check for allocation failures.
    
    Signed-off-by: David Disseldorp <ddiss at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit d3cd60d660a4a8ef03689c0b66ed730e444f84cc
Author: David Disseldorp <ddiss at samba.org>
Date:   Sun Nov 2 20:21:46 2014 +0100

    printer_list: don't leak lock_path onto talloc tos
    
    Also check for allocation failures.
    
    Signed-off-by: David Disseldorp <ddiss at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit 49fe698fe9a794938725efd32b14c6bce95e1ef7
Author: David Disseldorp <ddiss at samba.org>
Date:   Sun Nov 2 20:21:45 2014 +0100

    nmbd_namelistdb: don't leak lock_path onto talloc tos
    
    Also check for allocation failures.
    
    Signed-off-by: David Disseldorp <ddiss at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit 8f9137cb5298a87bd989d29005a059f20dc2273f
Author: David Disseldorp <ddiss at samba.org>
Date:   Sun Nov 2 20:21:44 2014 +0100

    share_mode_lock: don't leak lock_path onto talloc tos
    
    Also check for allocation failures.
    
    Signed-off-by: David Disseldorp <ddiss at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit 39f8ff2355f7b92ed364e80b842373978254b96d
Author: David Disseldorp <ddiss at samba.org>
Date:   Sun Nov 2 20:21:43 2014 +0100

    brlock: don't leak lock_path onto talloc tos
    
    Also check for allocation failures.
    
    Signed-off-by: David Disseldorp <ddiss at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit d6792eca3c8cc4356d1e3a64161c8a0e5f8ff9d4
Author: David Disseldorp <ddiss at samba.org>
Date:   Sun Nov 2 20:21:42 2014 +0100

    serverid: don't leak lock_path onto talloc tos
    
    Also check for allocation failures.
    
    Signed-off-by: David Disseldorp <ddiss at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit 76fe51cea27ac29c5de237850795be7122ffdc12
Author: David Disseldorp <ddiss at samba.org>
Date:   Sun Nov 2 20:21:41 2014 +0100

    server_mutex: don't leak lock_path onto talloc tos
    
    Also check for allocation failures.
    
    Signed-off-by: David Disseldorp <ddiss at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit d9d16cb582caa34154fef1ad1ff84265fc4eaea4
Author: David Disseldorp <ddiss at samba.org>
Date:   Sun Nov 2 20:21:40 2014 +0100

    g_lock: don't leak lock_path onto talloc tos
    
    Also check for allocation failures.
    
    Signed-off-by: David Disseldorp <ddiss at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit 176259f2c47d3a32dc105e211cc8097c60031dbf
Author: David Disseldorp <ddiss at samba.org>
Date:   Sun Nov 2 20:21:39 2014 +0100

    dbwrap_watch: don't leak lock_path onto talloc tos
    
    Also check for allocation failures.
    
    Signed-off-by: David Disseldorp <ddiss at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit 760af796213cc8adcf6967510e65358f165847dc
Author: David Disseldorp <ddiss at samba.org>
Date:   Sun Nov 2 20:21:38 2014 +0100

    lang_tdb: don't leak lock_path or data_path onto talloc tos
    
    Also check for allocation failures.
    
    Signed-off-by: David Disseldorp <ddiss at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit 35539826d4c063b904651cfdc47a0649aa979eb6
Author: David Disseldorp <ddiss at samba.org>
Date:   Sun Nov 2 20:21:37 2014 +0100

    winbindd_cache: don't leak state_path onto talloc tos
    
    Also check for allocation failures.
    
    Signed-off-by: David Disseldorp <ddiss at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit d428aa65d3e7b78750764e645bc7c1b2eda799ed
Author: David Disseldorp <ddiss at samba.org>
Date:   Sun Nov 2 20:21:36 2014 +0100

    winbindd: don't leak state_path onto talloc tos
    
    Also check for allocation failures.
    
    Signed-off-by: David Disseldorp <ddiss at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit 364d55ccabbe319b68b154bd2d15c19b67327ede
Author: David Disseldorp <ddiss at samba.org>
Date:   Sun Nov 2 20:21:35 2014 +0100

    idmap_autorid: don't leak state_path onto talloc tos
    
    Also check for allocation failures.
    
    Signed-off-by: David Disseldorp <ddiss at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit 0210e3c9cec96e31173fdf13f225bb56008c3cef
Author: David Disseldorp <ddiss at samba.org>
Date:   Sun Nov 2 20:21:34 2014 +0100

    smbcontrol: don't leak state_path onto talloc tos
    
    Also check for allocation failures.
    
    Signed-off-by: David Disseldorp <ddiss at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit c3f3b13bebcbe10baf805a1b1ad3386e59a532ba
Author: David Disseldorp <ddiss at samba.org>
Date:   Sun Nov 2 20:21:33 2014 +0100

    net_registry: don't leak state_path onto talloc tos
    
    Signed-off-by: David Disseldorp <ddiss at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit 70896833c9dc47a7310620d492026a26e421713f
Author: David Disseldorp <ddiss at samba.org>
Date:   Sun Nov 2 20:21:32 2014 +0100

    net_idmap: don't leak state_path onto talloc tos
    
    net_idmap currently uses a net_idmap_dbfile() helper to return the idmap
    backed specific db path. Fix leaks in all callers.
    
    Signed-off-by: David Disseldorp <ddiss at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit 587b21646cd33727fa39c2db872b6d041c0c7057
Author: David Disseldorp <ddiss at samba.org>
Date:   Sun Nov 2 20:21:31 2014 +0100

    reg_perfcount: don't leak state_path onto talloc tos
    
    reg_perfcount currently uses a counters_directory() helper to return the
    counter specific tdb path. Fix leaks and error checking in the helper
    function and all callers.
    
    Signed-off-by: David Disseldorp <ddiss at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit 4b6af0dfa719e1ef05ebcf8cbdd18c0715bbc0bc
Author: David Disseldorp <ddiss at samba.org>
Date:   Sun Nov 2 20:21:30 2014 +0100

    reg_backend_db: don't leak state_path onto talloc tos
    
    Also check for allocation failures, and ensure that the regdb refcount
    is not set by regdb_open() on failure.
    
    Signed-off-by: David Disseldorp <ddiss at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit 2307c3700cc8eea44e33c8ad0a993115a841ae7c
Author: David Disseldorp <ddiss at samba.org>
Date:   Sun Nov 2 20:21:29 2014 +0100

    nt_printing: don't leak state_path onto talloc tos
    
    Also check for allocation failures, and close tdbs in
    nt_printing_tdb_upgrade error paths.
    
    Signed-off-by: David Disseldorp <ddiss at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit 6d5b8dd70e542840a96c45b916b1bd2b9685697f
Author: David Disseldorp <ddiss at samba.org>
Date:   Sun Nov 2 20:21:28 2014 +0100

    pdb_tdb: don't leak state_path onto talloc tos
    
    Also check for allocation failures.
    
    Signed-off-by: David Disseldorp <ddiss at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit f88535e56e23e27492851c0fc6e9a86cfdaab041
Author: David Disseldorp <ddiss at samba.org>
Date:   Sun Nov 2 20:21:27 2014 +0100

    account_pol: don't leak state_path onto talloc tos
    
    Also check for allocation failures.
    
    Signed-off-by: David Disseldorp <ddiss at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit 30ab958f500050f49dfb9c47a3d20f901ceed52e
Author: David Disseldorp <ddiss at samba.org>
Date:   Sun Nov 2 20:21:26 2014 +0100

    nmbd_winsserver: don't leak state_path onto talloc tos
    
    Also check for allocation failures.
    
    Signed-off-by: David Disseldorp <ddiss at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit f62d9080ad143a35c7825f187c8f7eea9def9810
Author: David Disseldorp <ddiss at samba.org>
Date:   Sun Nov 2 20:21:25 2014 +0100

    sharesec: don't leak state_path onto talloc tos
    
    Also check for allocation failures.
    
    Signed-off-by: David Disseldorp <ddiss at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit a852116ab3d5e5ffd8f11d2b01c3fc17f8b6a086
Author: David Disseldorp <ddiss at samba.org>
Date:   Sun Nov 2 20:21:24 2014 +0100

    eventlog: don't leak state_path onto talloc tos
    
    Also check for allocation failures.
    
    Signed-off-by: David Disseldorp <ddiss at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit b75d7ac9cbb0fef4daaac417dd63f2ef9e4701a8
Author: David Disseldorp <ddiss at samba.org>
Date:   Sun Nov 2 20:21:23 2014 +0100

    groupdb: don't leak state_path onto talloc tos
    
    Also check for allocation failures.
    
    Signed-off-by: David Disseldorp <ddiss at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit 745a1c54b619caaaa80b4e8d4b4345f4d79a8c58
Author: Gabriel Buades <gbuades at soffid.com>
Date:   Mon Sep 8 12:21:26 2014 +0200

    Change expired password flag indicator
    
    Signed-off-by: Gabriel Buades <gbuades at soffid.com>
    Reviewed-by: Jeremy Allison <jra at samba.org>
    Reviewed-by: Jim McDonough <jmcd at samba.org>

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

Summary of changes:
 source3/groupdb/mapping_tdb.c                   |  19 +++-
 source3/intl/lang_tdb.c                         |  23 ++++-
 source3/lib/dbwrap/dbwrap_watch.c               |   8 +-
 source3/lib/eventlog/eventlog.c                 |  10 +-
 source3/lib/g_lock.c                            |  10 +-
 source3/lib/netapi/user.c                       |   2 +-
 source3/lib/server_mutex.c                      |   7 +-
 source3/lib/serverid.c                          |  10 +-
 source3/lib/sharesec.c                          |  12 ++-
 source3/locking/brlock.c                        |  13 ++-
 source3/locking/share_mode_lock.c               |  11 ++-
 source3/nmbd/nmbd_namelistdb.c                  |  17 +++-
 source3/nmbd/nmbd_winsserver.c                  |  20 +++-
 source3/passdb/account_pol.c                    |  12 ++-
 source3/passdb/pdb_tdb.c                        |  10 +-
 source3/printing/nt_printing_migrate_internal.c |  25 +++--
 source3/printing/nt_printing_tdb.c              |  85 +++++++++++-----
 source3/printing/printer_list.c                 |  11 ++-
 source3/registry/reg_backend_db.c               |  37 +++++--
 source3/registry/reg_perfcount.c                | 123 ++++++++++++++++--------
 source3/smbd/notify_internal.c                  |  21 +++-
 source3/smbd/smbXsrv_open.c                     |   6 +-
 source3/smbd/smbXsrv_session.c                  |   6 +-
 source3/smbd/smbXsrv_tcon.c                     |   6 +-
 source3/smbd/smbXsrv_version.c                  |   4 +
 source3/utils/net_idmap.c                       |  24 +++--
 source3/utils/net_registry.c                    |  17 +++-
 source3/utils/smbcontrol.c                      |  24 ++++-
 source3/utils/status.c                          |  25 ++++-
 source3/winbindd/idmap_autorid.c                |  10 +-
 source3/winbindd/winbindd.c                     |   9 +-
 source3/winbindd/winbindd_cache.c               |  61 +++++++++---
 32 files changed, 524 insertions(+), 154 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source3/groupdb/mapping_tdb.c b/source3/groupdb/mapping_tdb.c
index cc397d9..ab79b68 100644
--- a/source3/groupdb/mapping_tdb.c
+++ b/source3/groupdb/mapping_tdb.c
@@ -46,24 +46,35 @@ static bool mapping_switch(const char *ldb_path);
 ****************************************************************************/
 static bool init_group_mapping(void)
 {
-	const char *ldb_path;
+	char *tdb_path;
+	char *ldb_path;
 
 	if (db != NULL) {
 		return true;
 	}
 
-	db = db_open(NULL, state_path("group_mapping.tdb"), 0,
+	tdb_path = state_path("group_mapping.tdb");
+	if (tdb_path == NULL) {
+		return false;
+	}
+	db = db_open(NULL, tdb_path, 0,
 		     TDB_DEFAULT, O_RDWR|O_CREAT, 0600,
 		     DBWRAP_LOCK_ORDER_1, DBWRAP_FLAG_NONE);
 	if (db == NULL) {
 		DEBUG(0, ("Failed to open group mapping database: %s\n",
 			  strerror(errno)));
+		talloc_free(tdb_path);
 		return false;
 	}
 
 	ldb_path = state_path("group_mapping.ldb");
+	if (ldb_path == NULL) {
+		return false;
+	}
 	if (file_exist(ldb_path) && !mapping_switch(ldb_path)) {
-		unlink(state_path("group_mapping.tdb"));
+		unlink(tdb_path);
+		talloc_free(tdb_path);
+		talloc_free(ldb_path);
 		return false;
 
 	} else {
@@ -114,6 +125,8 @@ static bool init_group_mapping(void)
 		}
 #endif
 	}
+	talloc_free(tdb_path);
+	talloc_free(ldb_path);
 	return true;
 }
 
diff --git a/source3/intl/lang_tdb.c b/source3/intl/lang_tdb.c
index 6070e29..68da8ce 100644
--- a/source3/intl/lang_tdb.c
+++ b/source3/intl/lang_tdb.c
@@ -103,7 +103,9 @@ bool lang_tdb_init(const char *lang)
 	struct stat st;
 	static int initialised;
 	time_t loadtime;
-	bool result = False;
+	bool result = false;
+	char *dpath = NULL;
+	char *lpath = NULL;
 
 	/* we only want to init once per process, unless given
 	   an override */
@@ -130,8 +132,12 @@ bool lang_tdb_init(const char *lang)
 	if (!lang) 
 		return True;
 
-	if (asprintf(&msg_path, "%s.msg",
-		     data_path(talloc_tos(), (const char *)lang)) == -1) {
+	dpath = data_path(talloc_tos(), (const char *)lang);
+	if (dpath == NULL) {
+		goto done;
+	}
+
+	if (asprintf(&msg_path, "%s.msg", dpath) == -1) {
 		DEBUG(0, ("asprintf failed\n"));
 		goto done;
 	}
@@ -141,8 +147,13 @@ bool lang_tdb_init(const char *lang)
 			   strerror(errno)));
 		goto done;
 	}
-	
-	if (asprintf(&path, "%s%s.tdb", lock_path("lang_"), lang) == -1) {
+
+	lpath = lock_path("lang_");
+	if (lpath == NULL) {
+		goto done;
+	}
+
+	if (asprintf(&path, "%s%s.tdb", lpath, lang) == -1) {
 		DEBUG(0, ("asprintf failed\n"));
 		goto done;
 	}
@@ -175,6 +186,8 @@ bool lang_tdb_init(const char *lang)
  done:
 	SAFE_FREE(msg_path);
 	SAFE_FREE(path);
+	TALLOC_FREE(lpath);
+	TALLOC_FREE(dpath);
 
 	return result;
 }
diff --git a/source3/lib/dbwrap/dbwrap_watch.c b/source3/lib/dbwrap/dbwrap_watch.c
index 9ff8fc2..c0571d9 100644
--- a/source3/lib/dbwrap/dbwrap_watch.c
+++ b/source3/lib/dbwrap/dbwrap_watch.c
@@ -30,11 +30,17 @@ static struct db_context *dbwrap_record_watchers_db(void)
 	static struct db_context *watchers_db;
 
 	if (watchers_db == NULL) {
+		char *db_path = lock_path("dbwrap_watchers.tdb");
+		if (db_path == NULL) {
+			return NULL;
+		}
+
 		watchers_db = db_open(
-			NULL, lock_path("dbwrap_watchers.tdb"),	0,
+			NULL, db_path,	0,
 			TDB_CLEAR_IF_FIRST | TDB_INCOMPATIBLE_HASH,
 			O_RDWR|O_CREAT, 0600, DBWRAP_LOCK_ORDER_3,
 			DBWRAP_FLAG_NONE);
+		TALLOC_FREE(db_path);
 	}
 	return watchers_db;
 }
diff --git a/source3/lib/eventlog/eventlog.c b/source3/lib/eventlog/eventlog.c
index 4c6767d..b63111e 100644
--- a/source3/lib/eventlog/eventlog.c
+++ b/source3/lib/eventlog/eventlog.c
@@ -73,7 +73,7 @@ char *elog_tdbname(TALLOC_CTX *ctx, const char *name )
 	char *file;
 	char *tdbname;
 
-	path = talloc_strdup(ctx, state_path("eventlog"));
+	path = state_path("eventlog");
 	if (!path) {
 		return NULL;
 	}
@@ -84,7 +84,7 @@ char *elog_tdbname(TALLOC_CTX *ctx, const char *name )
 		return NULL;
 	}
 
-	tdbname = talloc_asprintf(path, "%s/%s", state_path("eventlog"), file);
+	tdbname = talloc_asprintf(ctx, "%s/%s", path, file);
 	if (!tdbname) {
 		talloc_free(path);
 		return NULL;
@@ -372,8 +372,12 @@ ELOG_TDB *elog_open_tdb( const char *logname, bool force_clear, bool read_only )
 
 	/* make sure that the eventlog dir exists */
 
-	eventlogdir = state_path( "eventlog" );
+	eventlogdir = state_path("eventlog");
+	if (eventlogdir == NULL) {
+		return NULL;
+	}
 	ok = directory_create_or_exist(eventlogdir, 0755);
+	TALLOC_FREE(eventlogdir);
 	if (!ok) {
 		return NULL;
 	}
diff --git a/source3/lib/g_lock.c b/source3/lib/g_lock.c
index 6813f06..30c5f52 100644
--- a/source3/lib/g_lock.c
+++ b/source3/lib/g_lock.c
@@ -51,6 +51,7 @@ struct g_lock_ctx *g_lock_ctx_init(TALLOC_CTX *mem_ctx,
 				   struct messaging_context *msg)
 {
 	struct g_lock_ctx *result;
+	char *db_path;
 
 	result = talloc(mem_ctx, struct g_lock_ctx);
 	if (result == NULL) {
@@ -58,11 +59,18 @@ struct g_lock_ctx *g_lock_ctx_init(TALLOC_CTX *mem_ctx,
 	}
 	result->msg = msg;
 
-	result->db = db_open(result, lock_path("g_lock.tdb"), 0,
+	db_path = lock_path("g_lock.tdb");
+	if (db_path == NULL) {
+		TALLOC_FREE(result);
+		return NULL;
+	}
+
+	result->db = db_open(result, db_path, 0,
 			     TDB_CLEAR_IF_FIRST|TDB_INCOMPATIBLE_HASH,
 			     O_RDWR|O_CREAT, 0600,
 			     DBWRAP_LOCK_ORDER_2,
 			     DBWRAP_FLAG_NONE);
+	TALLOC_FREE(db_path);
 	if (result->db == NULL) {
 		DEBUG(1, ("g_lock_init: Could not open g_lock.tdb\n"));
 		TALLOC_FREE(result);
diff --git a/source3/lib/netapi/user.c b/source3/lib/netapi/user.c
index 4a39f69..6324084 100644
--- a/source3/lib/netapi/user.c
+++ b/source3/lib/netapi/user.c
@@ -68,7 +68,7 @@ static void convert_USER_INFO_X_to_samr_user_info21(struct USER_INFO_X *infoX,
 		fields_present |= SAMR_FIELD_DESCRIPTION;
 	}
 	if (infoX->usriX_password_age) {
-		fields_present |= SAMR_FIELD_FORCE_PWD_CHANGE;
+		fields_present |= SAMR_FIELD_EXPIRED_FLAG;
 	}
 	if (infoX->usriX_full_name) {
 		fields_present |= SAMR_FIELD_FULL_NAME;
diff --git a/source3/lib/server_mutex.c b/source3/lib/server_mutex.c
index 43cf77b..56673f6 100644
--- a/source3/lib/server_mutex.c
+++ b/source3/lib/server_mutex.c
@@ -48,7 +48,7 @@ struct named_mutex *grab_named_mutex(TALLOC_CTX *mem_ctx, const char *name,
 {
 	struct named_mutex *result;
 	struct loadparm_context *lp_ctx;
-	const char *fname;
+	char *fname;
 
 	result = talloc(mem_ctx, struct named_mutex);
 	if (result == NULL) {
@@ -71,6 +71,10 @@ struct named_mutex *grab_named_mutex(TALLOC_CTX *mem_ctx, const char *name,
 	}
 
 	fname = lock_path("mutex.tdb");
+	if (fname == NULL) {
+		TALLOC_FREE(result);
+		return NULL;
+	}
 
 	result->tdb = tdb_wrap_open(result, fname,
 				    lpcfg_tdb_hash_size(lp_ctx, fname),
@@ -79,6 +83,7 @@ struct named_mutex *grab_named_mutex(TALLOC_CTX *mem_ctx, const char *name,
 						    TDB_CLEAR_IF_FIRST |
 						    TDB_INCOMPATIBLE_HASH),
 				    O_RDWR|O_CREAT, 0600);
+	TALLOC_FREE(fname);
 	talloc_unlink(result, lp_ctx);
 	if (result->tdb == NULL) {
 		DEBUG(1, ("Could not open mutex.tdb: %s\n",
diff --git a/source3/lib/serverid.c b/source3/lib/serverid.c
index ee479b4..f5e0937 100644
--- a/source3/lib/serverid.c
+++ b/source3/lib/serverid.c
@@ -42,14 +42,22 @@ struct serverid_data {
 static struct db_context *serverid_db(void)
 {
 	static struct db_context *db;
+	char *db_path;
 
 	if (db != NULL) {
 		return db;
 	}
-	db = db_open(NULL, lock_path("serverid.tdb"), 0,
+
+	db_path = lock_path("serverid.tdb");
+	if (db_path == NULL) {
+		return NULL;
+	}
+
+	db = db_open(NULL, db_path, 0,
 		     TDB_DEFAULT|TDB_CLEAR_IF_FIRST|TDB_INCOMPATIBLE_HASH,
 		     O_RDWR|O_CREAT, 0644, DBWRAP_LOCK_ORDER_2,
 		     DBWRAP_FLAG_NONE);
+	TALLOC_FREE(db_path);
 	return db;
 }
 
diff --git a/source3/lib/sharesec.c b/source3/lib/sharesec.c
index 095c851..e9a3eae 100644
--- a/source3/lib/sharesec.c
+++ b/source3/lib/sharesec.c
@@ -142,19 +142,27 @@ bool share_info_db_init(void)
 	int32 vers_id = 0;
 	bool upgrade_ok = true;
 	NTSTATUS status;
+	char *db_path;
 
 	if (share_db != NULL) {
 		return True;
 	}
 
-	share_db = db_open(NULL, state_path("share_info.tdb"), 0,
+	db_path = state_path("share_info.tdb");
+	if (db_path == NULL) {
+		return false;
+	}
+
+	share_db = db_open(NULL, db_path, 0,
 			   TDB_DEFAULT, O_RDWR|O_CREAT, 0600,
 			   DBWRAP_LOCK_ORDER_1, DBWRAP_FLAG_NONE);
 	if (share_db == NULL) {
 		DEBUG(0,("Failed to open share info database %s (%s)\n",
-			state_path("share_info.tdb"), strerror(errno) ));
+			 db_path, strerror(errno)));
+		TALLOC_FREE(db_path);
 		return False;
 	}
+	TALLOC_FREE(db_path);
 
 	status = dbwrap_fetch_int32_bystring(share_db, vstring, &vers_id);
 	if (!NT_STATUS_IS_OK(status)) {
diff --git a/source3/locking/brlock.c b/source3/locking/brlock.c
index 1c4c4d0..0bed9f9 100644
--- a/source3/locking/brlock.c
+++ b/source3/locking/brlock.c
@@ -342,6 +342,7 @@ static NTSTATUS brl_lock_failed(files_struct *fsp,
 void brl_init(bool read_only)
 {
 	int tdb_flags;
+	char *db_path;
 
 	if (brlock_db) {
 		return;
@@ -358,15 +359,23 @@ void brl_init(bool read_only)
 		tdb_flags |= TDB_SEQNUM;
 	}
 
-	brlock_db = db_open(NULL, lock_path("brlock.tdb"),
+	db_path = lock_path("brlock.tdb");
+	if (db_path == NULL) {
+		DEBUG(0, ("out of memory!\n"));
+		return;
+	}
+
+	brlock_db = db_open(NULL, db_path,
 			    SMB_OPEN_DATABASE_TDB_HASH_SIZE, tdb_flags,
 			    read_only?O_RDONLY:(O_RDWR|O_CREAT), 0644,
 			    DBWRAP_LOCK_ORDER_2, DBWRAP_FLAG_NONE);
 	if (!brlock_db) {
 		DEBUG(0,("Failed to open byte range locking database %s\n",
-			lock_path("brlock.tdb")));
+			 db_path));
+		TALLOC_FREE(db_path);
 		return;
 	}
+	TALLOC_FREE(db_path);
 }
 
 /****************************************************************************
diff --git a/source3/locking/share_mode_lock.c b/source3/locking/share_mode_lock.c
index 65409ac..6447c61 100644
--- a/source3/locking/share_mode_lock.c
+++ b/source3/locking/share_mode_lock.c
@@ -58,17 +58,24 @@ static struct db_context *lock_db;
 
 static bool locking_init_internal(bool read_only)
 {
+	char *db_path;
+
 	brl_init(read_only);
 
 	if (lock_db)
 		return True;
 
-	lock_db = db_open(NULL, lock_path("locking.tdb"),
+	db_path = lock_path("locking.tdb");
+	if (db_path == NULL) {
+		return false;
+	}
+
+	lock_db = db_open(NULL, db_path,
 			  SMB_OPEN_DATABASE_TDB_HASH_SIZE,
 			  TDB_DEFAULT|TDB_VOLATILE|TDB_CLEAR_IF_FIRST|TDB_INCOMPATIBLE_HASH,
 			  read_only?O_RDONLY:O_RDWR|O_CREAT, 0644,
 			  DBWRAP_LOCK_ORDER_1, DBWRAP_FLAG_NONE);
-
+	TALLOC_FREE(db_path);
 	if (!lock_db) {
 		DEBUG(0,("ERROR: Failed to initialise locking database\n"));
 		return False;
diff --git a/source3/nmbd/nmbd_namelistdb.c b/source3/nmbd/nmbd_namelistdb.c
index c06bdda..313e4a6 100644
--- a/source3/nmbd/nmbd_namelistdb.c
+++ b/source3/nmbd/nmbd_namelistdb.c
@@ -642,17 +642,24 @@ static void dump_subnet_namelist( struct subnet_record *subrec, XFILE *fp)
 
 void dump_all_namelists(void)
 {
-	XFILE *fp; 
+	XFILE *fp;
 	struct subnet_record *subrec;
+	char *dump_path;
 
-	fp = x_fopen(lock_path("namelist.debug"),O_WRONLY|O_CREAT|O_TRUNC, 0644);
-     
-	if (!fp) { 
+	dump_path = lock_path("namelist.debug");
+	if (dump_path == NULL) {
+		DEBUG(0, ("out of memory!\n"));
+		return;
+	}
+
+	fp = x_fopen(dump_path, (O_WRONLY | O_CREAT | O_TRUNC), 0644);
+	TALLOC_FREE(dump_path);
+	if (!fp) {
 		DEBUG(0,("dump_all_namelists: Can't open file %s. Error was %s\n",
 			"namelist.debug",strerror(errno)));
 		return;
 	}
-      
+
 	for (subrec = FIRST_SUBNET; subrec; subrec = NEXT_SUBNET_INCLUDING_UNICAST(subrec)) {
 		dump_subnet_namelist( subrec, fp );
 	}
diff --git a/source3/nmbd/nmbd_winsserver.c b/source3/nmbd/nmbd_winsserver.c
index e09d1a0..a56ff45 100644
--- a/source3/nmbd/nmbd_winsserver.c
+++ b/source3/nmbd/nmbd_winsserver.c
@@ -594,14 +594,22 @@ bool initialise_wins(void)
 	time_t time_now = time(NULL);
 	XFILE *fp;
 	char line[1024];
+	char *db_path;
+	char *list_path;
 
 	if(!lp_we_are_a_wins_server()) {
 		return True;
 	}
 
+	db_path = state_path("wins.tdb");
+	if (db_path == NULL) {
+		return false;
+	}
+
 	/* Open the wins.tdb. */
-	wins_tdb = tdb_open_log(state_path("wins.tdb"), 0, TDB_DEFAULT|TDB_CLEAR_IF_FIRST|TDB_INCOMPATIBLE_HASH,
+	wins_tdb = tdb_open_log(db_path, 0, TDB_DEFAULT|TDB_CLEAR_IF_FIRST|TDB_INCOMPATIBLE_HASH,
 			O_CREAT|O_RDWR, 0600);
+	TALLOC_FREE(db_path);
 	if (!wins_tdb) {
 		DEBUG(0,("initialise_wins: failed to open wins.tdb. Error was %s\n",
 			strerror(errno) ));
@@ -612,7 +620,15 @@ bool initialise_wins(void)
 
 	add_samba_names_to_subnet(wins_server_subnet);
 
-	if((fp = x_fopen(state_path(WINS_LIST),O_RDONLY,0)) == NULL) {
+	list_path = state_path(WINS_LIST);
+	if (list_path == NULL) {
+		tdb_close(wins_tdb);
+		return false;
+	}
+
+	fp = x_fopen(list_path, O_RDONLY, 0);
+	TALLOC_FREE(list_path);
+	if (fp == NULL) {
 		DEBUG(2,("initialise_wins: Can't open wins database file %s. Error was %s\n",
 			WINS_LIST, strerror(errno) ));
 		return True;
diff --git a/source3/passdb/account_pol.c b/source3/passdb/account_pol.c
index 5f2c7ab..6b1066e 100644
--- a/source3/passdb/account_pol.c
+++ b/source3/passdb/account_pol.c
@@ -214,24 +214,32 @@ bool init_account_policy(void)
 	uint32_t version = 0;
 	int i;
 	NTSTATUS status;
+	char *db_path;
 
 	if (db != NULL) {
 		return True;
 	}
 
-	db = db_open(NULL, state_path("account_policy.tdb"), 0, TDB_DEFAULT,
+	db_path = state_path("account_policy.tdb");
+	if (db_path == NULL) {
+		return false;
+	}
+
+	db = db_open(NULL, db_path, 0, TDB_DEFAULT,
 		     O_RDWR, 0600, DBWRAP_LOCK_ORDER_1, DBWRAP_FLAG_NONE);
 
 	if (db == NULL) { /* the account policies files does not exist or open
 			   * failed, try to create a new one */
-		db = db_open(NULL, state_path("account_policy.tdb"), 0,
+		db = db_open(NULL, db_path, 0,
 			     TDB_DEFAULT, O_RDWR|O_CREAT, 0600,
 			     DBWRAP_LOCK_ORDER_1, DBWRAP_FLAG_NONE);
 		if (db == NULL) {
 			DEBUG(0,("Failed to open account policy database\n"));
+			TALLOC_FREE(db_path);
 			return False;
 		}
 	}
+	TALLOC_FREE(db_path);
 
 	status = dbwrap_fetch_uint32_bystring(db, vstring, &version);
 	if (!NT_STATUS_IS_OK(status)) {
diff --git a/source3/passdb/pdb_tdb.c b/source3/passdb/pdb_tdb.c
index 9dd4451..0d31c47 100644
--- a/source3/passdb/pdb_tdb.c
+++ b/source3/passdb/pdb_tdb.c
@@ -329,15 +329,21 @@ static bool tdbsam_upgrade_next_rid(struct db_context *db)
 	uint32 rid;
 	bool ok = false;
 	NTSTATUS status;


-- 
Samba Shared Repository


More information about the samba-cvs mailing list