[SCM] Samba Shared Repository - branch v3-2-test updated - initial-v3-2-unstable-669-geb523ba

Volker Lendecke vl at samba.org
Sat Dec 15 22:11:20 GMT 2007


The branch, v3-2-test has been updated
       via  eb523ba77697346a365589101aac379febecd546 (commit)
       via  3a0b1b2060facd5f1ac1461b23dd86c75cdd9458 (commit)
       via  7b8276aaa48852270c6b70b081c3f28e316a7a2c (commit)
       via  c7c885078be8fd3024c186044ac28275d7609679 (commit)
       via  c221c246b10e2dbbd54a9af2dc45de2eae237380 (commit)
       via  60e830b0f4571bd5d9039f2edd199534f2a4c341 (commit)
       via  0a911d38b8f4be382a9df60f9c6de0c500464b3a (commit)
       via  bb35e794ec129805e874ceba882bcc1e84791a09 (commit)
       via  3e4148c280efe154c3f8d552731c8b29d6977507 (commit)
       via  6312016e2727c2b5b1a4964a98cfb9585d77cc8c (commit)
       via  f00ab810d2540679bec109498ac89e1eafe18f03 (commit)
       via  9e3ef0923d71cc06b8445be2625ebd8dfed1b42d (commit)
      from  1f352cdd1976ad36484e146165df585b88ec5527 (commit)

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


- Log -----------------------------------------------------------------
commit eb523ba77697346a365589101aac379febecd546
Author: Volker Lendecke <vl at samba.org>
Date:   Sat Dec 15 22:47:30 2007 +0100

    s/sid_to_string/sid_to_fstring/
    
    least surprise for callers

commit 3a0b1b2060facd5f1ac1461b23dd86c75cdd9458
Author: Volker Lendecke <vl at samba.org>
Date:   Sat Dec 15 22:33:52 2007 +0100

    Use dom_sid_string for sid_string_talloc
    
    Remove some code duplication, but introduce one more dependency on librpc/ndr.
    Easily turned around so that librpc/ndr depends on lib/util_sid if necessary

commit 7b8276aaa48852270c6b70b081c3f28e316a7a2c
Author: Volker Lendecke <vl at samba.org>
Date:   Sat Dec 15 22:08:09 2007 +0100

    sid_string_static is no more :-)
    
    We now have four ways to do sid_to_string:
    
    sid_to_string: Convert it into an existing fstring, when you have one
    
    sid_string_talloc: The obvious thing
    
    sid_string_tos: For the lazy, use only with care
    
    sid_string_dbg: The one to use in DEBUG statements

commit c7c885078be8fd3024c186044ac28275d7609679
Author: Volker Lendecke <vl at samba.org>
Date:   Sat Dec 15 22:00:39 2007 +0100

    Replace sid_string_static with sid_to_string
    
    This adds 28 fstrings on the stack, but I think an fstring on the stack is
    still far better than a static one.

commit c221c246b10e2dbbd54a9af2dc45de2eae237380
Author: Volker Lendecke <vl at samba.org>
Date:   Sat Dec 15 21:58:28 2007 +0100

    Use sid_to_string directly
    
    It seems a bit pointless to do a fstrcpy(dst, sid_string_static(src))

commit 60e830b0f4571bd5d9039f2edd199534f2a4c341
Author: Volker Lendecke <vl at samba.org>
Date:   Sat Dec 15 21:53:26 2007 +0100

    Replace sid_string_static with sid_string_tos
    
    In utils/ I was a bit lazy...

commit 0a911d38b8f4be382a9df60f9c6de0c500464b3a
Author: Volker Lendecke <vl at samba.org>
Date:   Sat Dec 15 21:49:15 2007 +0100

    Use sid_string_talloc where we have a tmp talloc ctx

commit bb35e794ec129805e874ceba882bcc1e84791a09
Author: Volker Lendecke <vl at samba.org>
Date:   Sat Dec 15 21:11:36 2007 +0100

    Replace sid_string_static by sid_string_dbg in DEBUGs

commit 3e4148c280efe154c3f8d552731c8b29d6977507
Author: Volker Lendecke <vl at samba.org>
Date:   Sat Dec 15 21:06:20 2007 +0100

    Add sid_string_dbg
    
    This makes use of the just added debug_ctx and will kill many
    sid_string_static() calls

commit 6312016e2727c2b5b1a4964a98cfb9585d77cc8c
Author: Volker Lendecke <vl at samba.org>
Date:   Sat Dec 15 21:05:11 2007 +0100

    Add debug_ctx according to an idea by Tridge
    
    Sorry, Jeremy, I think for debug messages this is just the right way to do it.

commit f00ab810d2540679bec109498ac89e1eafe18f03
Author: Volker Lendecke <vl at samba.org>
Date:   Sat Dec 15 21:10:58 2007 +0100

    Use sid_string_talloc where we have a tmp talloc ctx

commit 9e3ef0923d71cc06b8445be2625ebd8dfed1b42d
Author: Volker Lendecke <vl at samba.org>
Date:   Sat Dec 15 19:00:42 2007 +0100

    add sid_string_talloc

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

Summary of changes:
 source/auth/auth_util.c            |   12 ++--
 source/auth/token_util.c           |    7 +-
 source/groupdb/mapping.c           |    2 +-
 source/groupdb/mapping_ldb.c       |   12 ++--
 source/groupdb/mapping_tdb.c       |   22 ++++---
 source/lib/afs.c                   |    2 +-
 source/lib/debug.c                 |   14 +++++
 source/lib/display_sec.c           |    6 +-
 source/lib/privileges.c            |   20 +++---
 source/lib/secdesc.c               |   25 +++-----
 source/lib/smbldap_util.c          |    2 +-
 source/lib/substitute.c            |    3 +-
 source/lib/util_seaccess.c         |   25 +++++----
 source/lib/util_sid.c              |   59 ++++++++----------
 source/libads/authdata.c           |   13 +++--
 source/libads/disp_sec.c           |    6 +-
 source/libads/ldap.c               |    7 +-
 source/libgpo/gpo_sec.c            |    4 +-
 source/librpc/ndr/sid.c            |    5 ++
 source/libsmb/cliquota.c           |    2 +-
 source/libsmb/libsmbclient.c       |    2 +-
 source/libsmb/samlogon_cache.c     |   12 ++--
 source/libsmb/trustdom_cache.c     |    4 +-
 source/modules/nfs4_acls.c         |   11 ++--
 source/modules/vfs_afsacl.c        |    7 +-
 source/nsswitch/wb_client.c        |   12 ++--
 source/passdb/lookup_sid.c         |   67 +++++++++++----------
 source/passdb/passdb.c             |    5 +-
 source/passdb/pdb_compat.c         |    4 +-
 source/passdb/pdb_get_set.c        |    4 +-
 source/passdb/pdb_interface.c      |   11 ++--
 source/passdb/pdb_ldap.c           |  114 ++++++++++++++++++-----------------
 source/passdb/pdb_smbpasswd.c      |   11 ++--
 source/passdb/secrets.c            |    2 +-
 source/passdb/util_wellknown.c     |    6 +-
 source/printing/nt_printing.c      |    7 +--
 source/rpc_client/cli_samr.c       |    3 +-
 source/rpc_parse/parse_samr.c      |   14 +---
 source/rpc_server/srv_lsa_nt.c     |   17 +++--
 source/rpc_server/srv_netlog_nt.c  |    6 +-
 source/rpc_server/srv_samr_nt.c    |  103 +++++++++++++++++---------------
 source/rpc_server/srv_spoolss_nt.c |   14 +---
 source/rpcclient/cmd_lsarpc.c      |   21 ++++---
 source/rpcclient/cmd_netlogon.c    |    2 +-
 source/rpcclient/cmd_samr.c        |    4 +-
 source/smbd/lanman.c               |    2 +-
 source/smbd/ntquotas.c             |    9 ++-
 source/smbd/nttrans.c              |    7 +-
 source/smbd/posix_acls.c           |   18 +++---
 source/smbd/service.c              |    4 +-
 source/utils/net.c                 |    6 +-
 source/utils/net_groupmap.c        |   16 +++---
 source/utils/net_idmap.c           |    3 +-
 source/utils/net_lookup.c          |    4 +-
 source/utils/net_rpc.c             |   19 +++---
 source/utils/net_rpc_rights.c      |    6 +-
 source/utils/net_rpc_samsync.c     |   29 +++++----
 source/utils/net_rpc_shell.c       |    2 +-
 source/utils/net_sam.c             |   24 +++++---
 source/utils/net_usershare.c       |    6 +-
 source/utils/pdbedit.c             |    4 +-
 source/utils/profiles.c            |   16 +++---
 source/utils/sharesec.c            |   11 ++--
 source/utils/smbcacls.c            |    2 +-
 source/utils/smbcquotas.c          |    2 +-
 source/winbindd/idmap.c            |   12 ++--
 source/winbindd/idmap_ad.c         |    6 +-
 source/winbindd/idmap_cache.c      |    5 +-
 source/winbindd/idmap_ldap.c       |   13 ++--
 source/winbindd/idmap_rid.c        |    2 +-
 source/winbindd/idmap_tdb.c        |   14 +++-
 source/winbindd/idmap_util.c       |   12 ++--
 source/winbindd/winbindd_ads.c     |   33 +++++-----
 source/winbindd/winbindd_async.c   |   17 +++---
 source/winbindd/winbindd_cache.c   |   77 +++++++++++++++---------
 source/winbindd/winbindd_group.c   |   37 ++++++-----
 source/winbindd/winbindd_idmap.c   |   14 +++--
 source/winbindd/winbindd_misc.c    |   53 ++++++++---------
 source/winbindd/winbindd_pam.c     |    6 +-
 source/winbindd/winbindd_passdb.c  |    4 +-
 source/winbindd/winbindd_rpc.c     |   17 ++----
 source/winbindd/winbindd_sid.c     |    2 +-
 source/winbindd/winbindd_user.c    |   21 ++++---
 source/winbindd/winbindd_util.c    |    8 +--
 84 files changed, 650 insertions(+), 604 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source/auth/auth_util.c b/source/auth/auth_util.c
index c0a9e9b..1e33869 100644
--- a/source/auth/auth_util.c
+++ b/source/auth/auth_util.c
@@ -586,12 +586,12 @@ static NTSTATUS log_nt_token(TALLOC_CTX *tmp_ctx, NT_USER_TOKEN *token)
 	for (i=1; i<token->num_sids; i++) {
 		group_sidstr = talloc_asprintf(
 			tmp_ctx, "%s %s", group_sidstr,
-			sid_string_static(&token->user_sids[i]));
+			sid_string_talloc(tmp_ctx, &token->user_sids[i]));
 	}
 
 	command = talloc_string_sub(
 		tmp_ctx, lp_log_nt_token_command(),
-		"%s", sid_string_static(&token->user_sids[0]));
+		"%s", sid_string_talloc(tmp_ctx, &token->user_sids[0]));
 	command = talloc_string_sub(tmp_ctx, command, "%t", group_sidstr);
 
 	if (command == NULL) {
@@ -669,7 +669,7 @@ NTSTATUS create_local_token(auth_serversupplied_info *server_info)
 
 		if (!sid_to_gid(sid, &gid)) {
 			DEBUG(10, ("Could not convert SID %s to gid, "
-				   "ignoring it\n", sid_string_static(sid)));
+				   "ignoring it\n", sid_string_dbg(sid)));
 			continue;
 		}
 		add_gid_to_array_unique(server_info, gid, &server_info->groups,
@@ -740,7 +740,7 @@ NTSTATUS create_token_from_username(TALLOC_CTX *mem_ctx, const char *username,
 
 	if (!sid_to_uid(&user_sid, uid)) {
 		DEBUG(1, ("sid_to_uid for %s (%s) failed\n",
-			  username, sid_string_static(&user_sid)));
+			  username, sid_string_dbg(&user_sid)));
 		goto done;
 	}
 
@@ -762,7 +762,7 @@ NTSTATUS create_token_from_username(TALLOC_CTX *mem_ctx, const char *username,
 
 		if (!ret) {
 			DEBUG(1, ("pdb_getsampwsid(%s) for user %s failed\n",
-				  sid_string_static(&user_sid), username));
+				  sid_string_dbg(&user_sid), username));
 			DEBUGADD(1, ("Fall back to unix user %s\n", username));
 			goto unix_user;
 		}
@@ -864,7 +864,7 @@ NTSTATUS create_token_from_username(TALLOC_CTX *mem_ctx, const char *username,
 
 		if (!sid_to_gid(&group_sids[0], gid)) {
 			DEBUG(1, ("sid_to_gid(%s) failed\n",
-				  sid_string_static(&group_sids[0])));
+				  sid_string_dbg(&group_sids[0])));
 			goto done;
 		}
 
diff --git a/source/auth/token_util.c b/source/auth/token_util.c
index 330acde..2415a90 100644
--- a/source/auth/token_util.c
+++ b/source/auth/token_util.c
@@ -280,7 +280,8 @@ struct nt_user_token *create_local_nt_token(TALLOC_CTX *mem_ctx,
 	NTSTATUS status;
 	gid_t gid;
 
-	DEBUG(10, ("Create local NT token for %s\n", sid_string_static(user_sid)));
+	DEBUG(10, ("Create local NT token for %s\n",
+		   sid_string_dbg(user_sid)));
 
 	if (!(result = TALLOC_ZERO_P(mem_ctx, NT_USER_TOKEN))) {
 		DEBUG(0, ("talloc failed\n"));
@@ -434,13 +435,13 @@ void debug_nt_user_token(int dbg_class, int dbg_lev, NT_USER_TOKEN *token)
 	
 	DEBUGC(dbg_class, dbg_lev,
 	       ("NT user token of user %s\n",
-		sid_string_static(&token->user_sids[0]) ));
+		sid_string_dbg(&token->user_sids[0]) ));
 	DEBUGADDC(dbg_class, dbg_lev,
 		  ("contains %lu SIDs\n", (unsigned long)token->num_sids));
 	for (i = 0; i < token->num_sids; i++)
 		DEBUGADDC(dbg_class, dbg_lev,
 			  ("SID[%3lu]: %s\n", (unsigned long)i, 
-			   sid_string_static(&token->user_sids[i])));
+			   sid_string_dbg(&token->user_sids[i])));
 
 	dump_se_priv( dbg_class, dbg_lev, &token->privileges );
 }
diff --git a/source/groupdb/mapping.c b/source/groupdb/mapping.c
index 78643da..3a3da0a 100644
--- a/source/groupdb/mapping.c
+++ b/source/groupdb/mapping.c
@@ -538,7 +538,7 @@ NTSTATUS pdb_default_get_aliasinfo(struct pdb_methods *methods,
 	if ((map.sid_name_use != SID_NAME_ALIAS) &&
 	    (map.sid_name_use != SID_NAME_WKN_GRP)) {
 		DEBUG(2, ("%s is a %s, expected an alias\n",
-			  sid_string_static(sid),
+			  sid_string_dbg(sid),
 			  sid_type_lookup(map.sid_name_use)));
 		return NT_STATUS_NO_SUCH_ALIAS;
 	}
diff --git a/source/groupdb/mapping_ldb.c b/source/groupdb/mapping_ldb.c
index 205111e..ea46777 100644
--- a/source/groupdb/mapping_ldb.c
+++ b/source/groupdb/mapping_ldb.c
@@ -119,7 +119,7 @@ static struct ldb_dn *mapping_dn(TALLOC_CTX *mem_ctx, const DOM_SID *sid)
 	if (!sid_split_rid(&domsid, &rid)) {
 		return NULL;
 	}
-      	if (!sid_to_string(string_sid, &domsid)) {
+      	if (!sid_to_fstring(string_sid, &domsid)) {
 		return NULL;
 	}
 	/* we split by domain and rid so we can do a subtree search
@@ -149,7 +149,7 @@ static bool add_mapping_entry(GROUP_MAP *map, int flag)
 
 	if (ldb_msg_add_string(msg, "objectClass", "groupMap") != LDB_SUCCESS ||
 	    ldb_msg_add_string(msg, "sid", 
-			       sid_to_string(string_sid, &map->sid)) != LDB_SUCCESS ||
+			       sid_to_fstring(string_sid, &map->sid)) != LDB_SUCCESS ||
 	    ldb_msg_add_fmt(msg, "gidNumber", "%u", (unsigned)map->gid) != LDB_SUCCESS ||
 	    ldb_msg_add_fmt(msg, "sidNameUse", "%u", (unsigned)map->sid_name_use) != LDB_SUCCESS ||
 	    ldb_msg_add_string(msg, "comment", map->comment) != LDB_SUCCESS ||
@@ -327,7 +327,7 @@ static bool enum_group_mapping(const DOM_SID *domsid, enum lsa_SidType sid_name_
 
 	/* we do a subtree search on the domain */
 	if (domsid != NULL) {
-		sid_to_string(name, domsid);
+		sid_to_fstring(name, domsid);
 		basedn = ldb_dn_string_compose(tmp_ctx, NULL, "domain=%s", name);
 		if (basedn == NULL) goto failed;
 	}
@@ -376,7 +376,7 @@ static NTSTATUS one_alias_membership(const DOM_SID *member,
 	fstring string_sid;
 	NTSTATUS status = NT_STATUS_INTERNAL_DB_CORRUPTION;
 
-      	if (!sid_to_string(string_sid, member)) {
+      	if (!sid_to_fstring(string_sid, member)) {
 		return NT_STATUS_INVALID_PARAMETER;
 	}
 
@@ -427,7 +427,7 @@ static NTSTATUS modify_aliasmem(const DOM_SID *alias, const DOM_SID *member,
 	GROUP_MAP map;
 
 	if (!get_group_map_from_sid(*alias, &map)) {
-		sid_to_string(string_sid, alias);
+		sid_to_fstring(string_sid, alias);
 		return NT_STATUS_NO_SUCH_ALIAS;
 	}
 
@@ -452,7 +452,7 @@ static NTSTATUS modify_aliasmem(const DOM_SID *alias, const DOM_SID *member,
 	el.name = talloc_strdup(tmp_ctx, "member");
 	el.num_values = 1;
 	el.values = &val;
-	sid_to_string(string_sid, member);
+	sid_to_fstring(string_sid, member);
 	val.data = (uint8_t *)string_sid;
 	val.length = strlen(string_sid);
 
diff --git a/source/groupdb/mapping_tdb.c b/source/groupdb/mapping_tdb.c
index fa6e93c..cf9f905 100644
--- a/source/groupdb/mapping_tdb.c
+++ b/source/groupdb/mapping_tdb.c
@@ -97,7 +97,7 @@ static bool add_mapping_entry(GROUP_MAP *map, int flag)
 	int len;
 	bool ret;
 
-	sid_to_string(string_sid, &map->sid);
+	sid_to_fstring(string_sid, &map->sid);
 
 	len = tdb_pack(NULL, sizeof(buf), "ddff",
 		map->gid, map->sid_name_use, map->nt_name, map->comment);
@@ -139,7 +139,7 @@ static bool get_group_map_from_sid(DOM_SID sid, GROUP_MAP *map)
 
 	/* the key is the SID, retrieving is direct */
 
-	sid_to_string(string_sid, &sid);
+	sid_to_fstring(string_sid, &sid);
 	if (asprintf(&key, "%s%s", GROUP_PREFIX, string_sid) < 0) {
 		return false;
 	}
@@ -271,7 +271,7 @@ static bool group_map_remove(const DOM_SID *sid)
 
 	/* the key is the SID, retrieving is direct */
 
-	sid_to_string(string_sid, sid);
+	sid_to_fstring(string_sid, sid);
 	if (asprintf(&key, "%s%s", GROUP_PREFIX, string_sid) < 0) {
 		return false;
 	}
@@ -350,8 +350,9 @@ static bool enum_group_mapping(const DOM_SID *domsid, enum lsa_SidType sid_name_
 		/* Only check the domain if we were given one */
 
 		if ( domsid && !sid_equal( domsid, &grpsid ) ) {
-			DEBUG(11,("enum_group_mapping: group %s is not in domain %s\n", 
-				string_sid, sid_string_static(domsid)));
+			DEBUG(11,("enum_group_mapping: group %s is not in "
+				  "domain %s\n", string_sid,
+				  sid_string_dbg(domsid)));
 			continue;
 		}
 
@@ -388,6 +389,7 @@ static bool enum_group_mapping(const DOM_SID *domsid, enum lsa_SidType sid_name_
 static NTSTATUS one_alias_membership(const DOM_SID *member,
 			       DOM_SID **sids, size_t *num)
 {
+	fstring tmp;
 	fstring key;
 	char *string_sid;
 	TDB_DATA dbuf;
@@ -395,7 +397,7 @@ static NTSTATUS one_alias_membership(const DOM_SID *member,
 	TALLOC_CTX *frame;
 
 	slprintf(key, sizeof(key), "%s%s", MEMBEROF_PREFIX,
-		 sid_string_static(member));
+		 sid_to_fstring(tmp, member));
 
 	dbuf = tdb_fetch_bystring(tdb, key);
 
@@ -478,14 +480,14 @@ static NTSTATUS add_aliasmem(const DOM_SID *alias, const DOM_SID *member)
 	if (is_aliasmem(alias, member))
 		return NT_STATUS_MEMBER_IN_ALIAS;
 
-	sid_to_string(string_sid, member);
+	sid_to_fstring(string_sid, member);
 	if (asprintf(&key, "%s%s", MEMBEROF_PREFIX, string_sid) < 0) {
 		return NT_STATUS_NO_MEMORY;
 	}
 
 	dbuf = tdb_fetch_bystring(tdb, key);
 
-	sid_to_string(string_sid, alias);
+	sid_to_fstring(string_sid, alias);
 
 	if (dbuf.dptr != NULL) {
 		asprintf(&new_memberstring, "%s %s", (char *)(dbuf.dptr),
@@ -622,7 +624,7 @@ static NTSTATUS del_aliasmem(const DOM_SID *alias, const DOM_SID *member)
 
 	num -= 1;
 
-	sid_to_string(sid_string, member);
+	sid_to_fstring(sid_string, member);
 	if (asprintf(&key, "%s%s", MEMBEROF_PREFIX, sid_string) < 0) {
 		TALLOC_FREE(sids);
 		return NT_STATUS_NO_MEMORY;
@@ -647,7 +649,7 @@ static NTSTATUS del_aliasmem(const DOM_SID *alias, const DOM_SID *member)
 	for (i=0; i<num; i++) {
 		char *s = member_string;
 
-		sid_to_string(sid_string, &sids[i]);
+		sid_to_fstring(sid_string, &sids[i]);
 		asprintf(&member_string, "%s %s", s, sid_string);
 
 		SAFE_FREE(s);
diff --git a/source/lib/afs.c b/source/lib/afs.c
index a815c21..a7d6f6c 100644
--- a/source/lib/afs.c
+++ b/source/lib/afs.c
@@ -242,7 +242,7 @@ bool afs_login(connection_struct *conn)
 	afs_username = talloc_string_sub(talloc_tos(),
 					afs_username,
 					"%s",
-					sid_string_static(user_sid));
+					sid_string_tos(user_sid));
 	if (!afs_username) {
 		return false;
 	}
diff --git a/source/lib/debug.c b/source/lib/debug.c
index 185c237..87ec9ed 100644
--- a/source/lib/debug.c
+++ b/source/lib/debug.c
@@ -90,6 +90,7 @@ bool    AllowDebugChange = True;
 */
 bool    override_logfile;
 
+static TALLOC_CTX *tmp_debug_ctx;
 
 /*
  * This is to allow assignment to DEBUGLEVEL before the debug
@@ -856,6 +857,8 @@ void check_log_size( void )
 
 	errno = old_errno;
 
+	TALLOC_FREE(tmp_debug_ctx);
+
 	return( 0 );
 }
 
@@ -1065,3 +1068,14 @@ bool dbghdr(int level, int cls, const char *file, const char *func, int line)
 	SAFE_FREE(msgbuf);
 	return ret;
 }
+
+/*
+ * Get us a temporary talloc context usable just for DEBUG arguments
+ */
+TALLOC_CTX *debug_ctx(void)
+{
+        if (tmp_debug_ctx == NULL) {
+                tmp_debug_ctx = talloc_named_const(NULL, 0, "debug_ctx");
+        }
+        return tmp_debug_ctx;
+}
diff --git a/source/lib/display_sec.c b/source/lib/display_sec.c
index caa13a6..f6a6bb6 100644
--- a/source/lib/display_sec.c
+++ b/source/lib/display_sec.c
@@ -151,7 +151,7 @@ void display_sec_ace(SEC_ACE *ace)
 	printf(" (%d) flags: 0x%02x ", ace->type, ace->flags);
 	display_sec_ace_flags(ace->flags);
 	display_sec_access(&ace->access_mask);
-	sid_to_string(sid_str, &ace->trustee);
+	sid_to_fstring(sid_str, &ace->trustee);
 	printf("\t\tSID: %s\n\n", sid_str);
 
 	if (sec_ace_object(ace->type)) {
@@ -246,12 +246,12 @@ void display_sec_desc(SEC_DESC *sec)
 	}
 
 	if (sec->owner_sid) {
-		sid_to_string(sid_str, sec->owner_sid);
+		sid_to_fstring(sid_str, sec->owner_sid);
 		printf("\tOwner SID:\t%s\n", sid_str);
 	}
 
 	if (sec->group_sid) {
-		sid_to_string(sid_str, sec->group_sid);
+		sid_to_fstring(sid_str, sec->group_sid);
 		printf("\tGroup SID:\t%s\n", sid_str);
 	}
 }
diff --git a/source/lib/privileges.c b/source/lib/privileges.c
index 839ce91..63fb462 100644
--- a/source/lib/privileges.c
+++ b/source/lib/privileges.c
@@ -40,7 +40,7 @@ typedef struct {
 static bool get_privileges( const DOM_SID *sid, SE_PRIV *mask )
 {
 	TDB_CONTEXT *tdb = get_account_pol_tdb();
-	fstring keystr;
+	fstring tmp, keystr;
 	TDB_DATA data;
 
 	/* Fail if the admin has not enable privileges */
@@ -54,13 +54,13 @@ static bool get_privileges( const DOM_SID *sid, SE_PRIV *mask )
 
 	/* PRIV_<SID> (NULL terminated) as the key */
 	
-	fstr_sprintf( keystr, "%s%s", PRIVPREFIX, sid_string_static(sid) );
+	fstr_sprintf(keystr, "%s%s", PRIVPREFIX, sid_to_fstring(tmp, sid));
 
 	data = tdb_fetch_bystring( tdb, keystr );
 	
 	if ( !data.dptr ) {
-		DEBUG(3,("get_privileges: No privileges assigned to SID [%s]\n",
-			sid_string_static(sid)));
+		DEBUG(3, ("get_privileges: No privileges assigned to SID "
+			  "[%s]\n", sid_string_dbg(sid)));
 		return False;
 	}
 	
@@ -79,7 +79,7 @@ static bool get_privileges( const DOM_SID *sid, SE_PRIV *mask )
 static bool set_privileges( const DOM_SID *sid, SE_PRIV *mask )
 {
 	TDB_CONTEXT *tdb = get_account_pol_tdb();
-	fstring keystr;
+	fstring tmp, keystr;
 	TDB_DATA data;
 	
 	if ( !lp_enable_privileges() )
@@ -95,7 +95,7 @@ static bool set_privileges( const DOM_SID *sid, SE_PRIV *mask )
 
 	/* PRIV_<SID> (NULL terminated) as the key */
 	
-	fstr_sprintf( keystr, "%s%s", PRIVPREFIX, sid_string_static(sid) );
+	fstr_sprintf(keystr, "%s%s", PRIVPREFIX, sid_to_fstring(tmp, sid));
 	
 	/* no packing.  static size structure, just write it out */
 	
@@ -123,8 +123,8 @@ bool get_privileges_for_sids(SE_PRIV *privileges, DOM_SID *slist, int scount)
 		if ( !get_privileges( &slist[i], &mask ) )
 			continue;
 
-		DEBUG(5,("get_privileges_for_sids: sid = %s\nPrivilege set:\n", 
-			sid_string_static(&slist[i])));
+		DEBUG(5,("get_privileges_for_sids: sid = %s\nPrivilege "
+			 "set:\n", sid_string_dbg(&slist[i])));
 		dump_se_priv( DBGC_ALL, 5, &mask );
 			
 		se_priv_add( privileges, &mask );
@@ -266,7 +266,7 @@ bool grant_privilege(const DOM_SID *sid, const SE_PRIV *priv_mask)
 
 	se_priv_add( &new_mask, priv_mask );
 
-	DEBUG(10,("grant_privilege: %s\n", sid_string_static(sid)));
+	DEBUG(10,("grant_privilege: %s\n", sid_string_dbg(sid)));
 	
 	DEBUGADD( 10, ("original privilege mask:\n"));
 	dump_se_priv( DBGC_ALL, 10, &old_mask );
@@ -307,7 +307,7 @@ bool revoke_privilege(const DOM_SID *sid, const SE_PRIV *priv_mask)
 	if ( !get_privileges( sid, &mask ) )
 		return True;
 	
-	DEBUG(10,("revoke_privilege: %s\n", sid_string_static(sid)));
+	DEBUG(10,("revoke_privilege: %s\n", sid_string_dbg(sid)));
 	
 	DEBUGADD( 10, ("original privilege mask:\n"));
 	dump_se_priv( DBGC_ALL, 10, &mask );
diff --git a/source/lib/secdesc.c b/source/lib/secdesc.c
index db299c4..4a97850 100644
--- a/source/lib/secdesc.c
+++ b/source/lib/secdesc.c
@@ -93,24 +93,16 @@ bool sec_desc_equal(SEC_DESC *s1, SEC_DESC *s2)
 	/* Check owner and group */
 
 	if (!sid_equal(s1->owner_sid, s2->owner_sid)) {
-		fstring str1, str2;
-
-		sid_to_string(str1, s1->owner_sid);
-		sid_to_string(str2, s2->owner_sid);
-
 		DEBUG(10, ("sec_desc_equal(): owner differs (%s != %s)\n",
-			   str1, str2));
+			   sid_string_dbg(s1->owner_sid),
+			   sid_string_dbg(s2->owner_sid)));
 		return False;
 	}
 
 	if (!sid_equal(s1->group_sid, s2->group_sid)) {
-		fstring str1, str2;
-
-		sid_to_string(str1, s1->group_sid);
-		sid_to_string(str2, s2->group_sid);
-
 		DEBUG(10, ("sec_desc_equal(): group differs (%s != %s)\n",
-			   str1, str2));
+			   sid_string_dbg(s1->group_sid),
+			   sid_string_dbg(s2->group_sid)));
 		return False;
 	}
 
@@ -491,7 +483,6 @@ SEC_DESC_BUF *se_create_child_secdesc(TALLOC_CTX *ctx, SEC_DESC *parent_ctr,
 		SEC_ACE *new_ace = &new_ace_list[new_ace_list_ndx];
 		uint8 new_flags = 0;
 		bool inherit = False;
-		fstring sid_str;
 
 		/* The OBJECT_INHERIT_ACE flag causes the ACE to be
 		   inherited by non-container children objects.  Container
@@ -547,12 +538,12 @@ SEC_DESC_BUF *se_create_child_secdesc(TALLOC_CTX *ctx, SEC_DESC *parent_ctr,
 		init_sec_ace(new_ace, &ace->trustee, ace->type,
 			     new_ace->access_mask, new_flags);
 
-		sid_to_string(sid_str, &ace->trustee);
-
 		DEBUG(5, ("se_create_child_secdesc(): %s:%d/0x%02x/0x%08x "
-			  " inherited as %s:%d/0x%02x/0x%08x\n", sid_str,
+			  " inherited as %s:%d/0x%02x/0x%08x\n",
+			  sid_string_dbg(&ace->trustee),
 			  ace->type, ace->flags, ace->access_mask,
-			  sid_str, new_ace->type, new_ace->flags,
+			  sid_string_dbg(&ace->trustee),
+			  new_ace->type, new_ace->flags,
 			  new_ace->access_mask));
 
 		new_ace_list_ndx++;
diff --git a/source/lib/smbldap_util.c b/source/lib/smbldap_util.c
index 42861ae..66aef6b 100644
--- a/source/lib/smbldap_util.c
+++ b/source/lib/smbldap_util.c
@@ -192,7 +192,7 @@ static NTSTATUS add_new_domain_info(struct smbldap_state *ldap_state,
 	/* If we don't have an entry, then ask secrets.tdb for what it thinks.
 	   It may choose to make it up */
 
-	sid_to_string(sid_string, get_global_sam_sid());
+	sid_to_fstring(sid_string, get_global_sam_sid());
 	smbldap_set_mod(&mods, LDAP_MOD_ADD,
 			get_attr_key2string(dominfo_attr_list,
 					    LDAP_ATTR_DOM_SID),
diff --git a/source/lib/substitute.c b/source/lib/substitute.c
index b456b9b..e06917c 100644
--- a/source/lib/substitute.c
+++ b/source/lib/substitute.c
@@ -302,13 +302,14 @@ static char * realloc_expand_env_var(char *str, char *p)
 static char *longvar_domainsid( void )
 {
 	DOM_SID sid;
+	fstring tmp;
 	char *sid_string;
 	
 	if ( !secrets_fetch_domain_sid( lp_workgroup(), &sid ) ) {
 		return NULL;
 	}
 	
-	sid_string = SMB_STRDUP( sid_string_static( &sid ) );
+	sid_string = SMB_STRDUP( sid_to_fstring( tmp, &sid ) );
 	
 	if ( !sid_string ) {
 		DEBUG(0,("longvar_domainsid: failed to dup SID string!\n"));
diff --git a/source/lib/util_seaccess.c b/source/lib/util_seaccess.c
index ad05300..0481eea 100644
--- a/source/lib/util_seaccess.c
+++ b/source/lib/util_seaccess.c


-- 
Samba Shared Repository


More information about the samba-cvs mailing list