[SCM] Samba Shared Repository - branch master updated

Jeremy Allison jra at samba.org
Tue Dec 11 03:23:03 UTC 2018


The branch, master has been updated
       via  6a7a9933171 lib: Remove sid_string_talloc
       via  9ffa6d49a56 libgpo: Use dom_sid_str_buf
       via  939d64b9f83 winbind: Use dom_sid_str_buf
       via  6e55ca9e6f4 net: Use dom_sid_str_buf
       via  12f3a37a1a6 libads: Use dom_sid_str_buf
       via  5ba64d4968d netapi: Use dom_sid_str_buf
       via  da1d1e80772 lib: Remove sid_string_tos
       via  f4ee95517e3 vfs: Use dom_sid_str_buf
       via  bea43789bcb torture3: Use dom_sid_str_buf
       via  918602e0f88 rpcclient: Use dom_sid_str_buf
       via  b0077bb0592 rpc_server3: Use dom_sid_str_buf
       via  38a39701325 libnet: Use dom_sid_str_buf
       via  56afb781cde pdb_ldap: Use dom_sid_str_buf
       via  2c179bcdecb pdbedit: Use dom_sid_str_buf
       via  d20c57c2d63 sharesec: Use dom_sid_str_buf
       via  49f7dc01f23 lib: Use dom_sid_str_buf
       via  30284017371 net: Use dom_sid_str_buf
       via  c48d6345e32 profiles: Use dom_sid_str_buf
       via  eaa035b8c4b net: Use dom_sid_str_buf
       via  de331ce92b4 lib: Use dom_sid_str_buf
       via  d833403139e auth: Use dom_sid_str_buf
       via  2b1125fa816 passdb: dom_sid_str_buf
       via  a6805552864 pdb_ldap: Fix typos
      from  f7516971b56 CI: Adjust CI tasks for new python3 autobuild.py default

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


- Log -----------------------------------------------------------------
commit 6a7a993317119f54e1b1d6e4aa6b295a9827c15f
Author: Volker Lendecke <vl at samba.org>
Date:   Mon Dec 10 12:39:29 2018 +0100

    lib: Remove sid_string_talloc
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>
    
    Autobuild-User(master): Jeremy Allison <jra at samba.org>
    Autobuild-Date(master): Tue Dec 11 04:22:33 CET 2018 on sn-devel-144

commit 9ffa6d49a56f9a55ad34f4c687429c8fd14e9d8c
Author: Volker Lendecke <vl at samba.org>
Date:   Mon Dec 10 12:34:13 2018 +0100

    libgpo: Use dom_sid_str_buf
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit 939d64b9f830e9da88caf24d97299e379f3cdcd2
Author: Volker Lendecke <vl at samba.org>
Date:   Mon Dec 10 12:32:12 2018 +0100

    winbind: Use dom_sid_str_buf
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit 6e55ca9e6f488d6996511e34e0fc7ffa1cb8fcac
Author: Volker Lendecke <vl at samba.org>
Date:   Mon Dec 10 12:03:37 2018 +0100

    net: Use dom_sid_str_buf
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit 12f3a37a1a623a56fc6d397f1fac08effe9b7c79
Author: Volker Lendecke <vl at samba.org>
Date:   Mon Dec 10 11:52:50 2018 +0100

    libads: Use dom_sid_str_buf
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit 5ba64d4968da8001c54d697f142231872a88481f
Author: Volker Lendecke <vl at samba.org>
Date:   Mon Dec 10 11:50:52 2018 +0100

    netapi: Use dom_sid_str_buf
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit da1d1e80772559f490887f131c2d02d94d681dd9
Author: Volker Lendecke <vl at samba.org>
Date:   Sat Dec 8 15:39:31 2018 +0100

    lib: Remove sid_string_tos
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit f4ee95517e37cd7c6bf2a3de87bfefb432204828
Author: Volker Lendecke <vl at samba.org>
Date:   Sat Dec 8 15:37:21 2018 +0100

    vfs: Use dom_sid_str_buf
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit bea43789bcb826006f38f2f96989953107dbbc74
Author: Volker Lendecke <vl at samba.org>
Date:   Sat Dec 8 15:33:13 2018 +0100

    torture3: Use dom_sid_str_buf
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit 918602e0f88db3ec5ac226ca5e3206ab3a75f4db
Author: Volker Lendecke <vl at samba.org>
Date:   Sat Dec 8 15:31:40 2018 +0100

    rpcclient: Use dom_sid_str_buf
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit b0077bb05928a3ff0526043537abca5f9f36ef73
Author: Volker Lendecke <vl at samba.org>
Date:   Sat Dec 8 15:27:24 2018 +0100

    rpc_server3: Use dom_sid_str_buf
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit 38a3970132587827da71ab367d6ed9463dad8b7a
Author: Volker Lendecke <vl at samba.org>
Date:   Sat Dec 8 15:25:14 2018 +0100

    libnet: Use dom_sid_str_buf
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit 56afb781cdee1b882419f5e7088aec1b77021305
Author: Volker Lendecke <vl at samba.org>
Date:   Sat Dec 8 15:23:15 2018 +0100

    pdb_ldap: Use dom_sid_str_buf
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit 2c179bcdecb56881b5e533d6e5b0b1999586ca91
Author: Volker Lendecke <vl at samba.org>
Date:   Sat Dec 8 15:21:46 2018 +0100

    pdbedit: Use dom_sid_str_buf
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit d20c57c2d63cd2d042452ab8e81eac1693388b73
Author: Volker Lendecke <vl at samba.org>
Date:   Sat Dec 8 15:20:36 2018 +0100

    sharesec: Use dom_sid_str_buf
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit 49f7dc01f239cd5900e1e2dcee9e9a7f5373990a
Author: Volker Lendecke <vl at samba.org>
Date:   Sat Dec 8 15:18:38 2018 +0100

    lib: Use dom_sid_str_buf
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit 302840173714420efeef219ebdf8bd13b850aaa4
Author: Volker Lendecke <vl at samba.org>
Date:   Sat Dec 8 15:05:53 2018 +0100

    net: Use dom_sid_str_buf
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit c48d6345e32fb8f5727f8545c60d58bd7570b056
Author: Volker Lendecke <vl at samba.org>
Date:   Sat Dec 8 15:00:16 2018 +0100

    profiles: Use dom_sid_str_buf
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit eaa035b8c4b936d751d916dadb7f541286382c9b
Author: Volker Lendecke <vl at samba.org>
Date:   Sun Dec 9 12:22:50 2018 +0100

    net: Use dom_sid_str_buf
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit de331ce92b4129615bd6f84a18ec605980d10f90
Author: Volker Lendecke <vl at samba.org>
Date:   Sun Dec 9 12:15:05 2018 +0100

    lib: Use dom_sid_str_buf
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit d833403139e145701942fb47db29bb61246739bc
Author: Volker Lendecke <vl at samba.org>
Date:   Sun Dec 9 11:56:59 2018 +0100

    auth: Use dom_sid_str_buf
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit 2b1125fa81676b05b6fd76fd537f1229a714d1cf
Author: Volker Lendecke <vl at samba.org>
Date:   Sat Dec 8 15:52:31 2018 +0100

    passdb: dom_sid_str_buf
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit a68055528644fbbbe94487385e23aaa70b0f3afa
Author: Volker Lendecke <vl at samba.org>
Date:   Sun Dec 9 11:52:16 2018 +0100

    pdb_ldap: Fix typos
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

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

Summary of changes:
 lib/afs/afs_funcs.c                       |  3 +-
 libgpo/gpo_reg.c                          | 10 +++--
 source3/auth/auth_util.c                  |  5 ++-
 source3/include/proto.h                   |  2 -
 source3/lib/eventlog/eventlog.c           |  8 ++--
 source3/lib/netapi/sid.c                  | 12 ++----
 source3/lib/util_sid.c                    | 25 ++----------
 source3/libads/disp_sec.c                 |  5 ++-
 source3/libnet/libnet_dssync_passdb.c     |  3 +-
 source3/modules/vfs_acl_common.c          |  4 +-
 source3/modules/vfs_afsacl.c              |  3 +-
 source3/modules/vfs_nfs4acl_xattr.c       |  5 ++-
 source3/passdb/pdb_ldap.c                 | 65 +++++++++++++++++++------------
 source3/passdb/pdb_samba_dsdb.c           |  3 +-
 source3/rpc_server/lsa/srv_lsa_nt.c       |  3 +-
 source3/rpc_server/mdssvc/srv_mdssvc_nt.c |  6 ++-
 source3/rpcclient/cmd_lsarpc.c            | 12 ++++--
 source3/torture/torture.c                 |  3 +-
 source3/utils/net_groupmap.c              | 22 +++++++----
 source3/utils/net_lookup.c                |  6 ++-
 source3/utils/net_rpc.c                   |  4 +-
 source3/utils/net_rpc_shell.c             |  4 +-
 source3/utils/net_rpc_trust.c             |  3 +-
 source3/utils/net_sam.c                   | 34 +++++++++++-----
 source3/utils/net_usershare.c             |  6 ++-
 source3/utils/pdbedit.c                   |  5 ++-
 source3/utils/profiles.c                  | 29 +++++++++-----
 source3/utils/sharesec.c                  |  6 ++-
 source3/winbindd/idmap_ldap.c             | 22 +++++------
 source3/winbindd/idmap_tdb2.c             | 56 +++++++++++---------------
 source3/winbindd/idmap_tdb_common.c       | 33 +++++-----------
 source3/winbindd/winbindd_misc.c          |  9 +++--
 32 files changed, 224 insertions(+), 192 deletions(-)


Changeset truncated at 500 lines:

diff --git a/lib/afs/afs_funcs.c b/lib/afs/afs_funcs.c
index 8a3c90a47e5..66451665462 100644
--- a/lib/afs/afs_funcs.c
+++ b/lib/afs/afs_funcs.c
@@ -228,6 +228,7 @@ bool afs_login(connection_struct *conn)
 	char *ticket_str = NULL;
 	const struct dom_sid *user_sid;
 	TALLOC_CTX *ctx = talloc_tos();
+	struct dom_sid_buf buf;
 
 	struct ClearToken ct;
 
@@ -253,7 +254,7 @@ bool afs_login(connection_struct *conn)
 	afs_username = talloc_string_sub(talloc_tos(),
 					afs_username,
 					"%s",
-					sid_string_tos(user_sid));
+					dom_sid_str_buf(user_sid, &buf));
 	if (!afs_username) {
 		return false;
 	}
diff --git a/libgpo/gpo_reg.c b/libgpo/gpo_reg.c
index 644b4d36d62..a160c3dd03d 100644
--- a/libgpo/gpo_reg.c
+++ b/libgpo/gpo_reg.c
@@ -351,7 +351,6 @@ static WERROR gp_reg_store_groupmembership(TALLOC_CTX *mem_ctx,
 	uint32_t i = 0;
 	const char *valname = NULL;
 	const char *path = NULL;
-	const char *val = NULL;
 	int count = 0;
 
 	path = gp_reg_groupmembership_path(mem_ctx, &token->sids[0],
@@ -365,13 +364,16 @@ static WERROR gp_reg_store_groupmembership(TALLOC_CTX *mem_ctx,
 	W_ERROR_NOT_OK_RETURN(werr);
 
 	for (i=0; i<token->num_sids; i++) {
+		struct dom_sid_buf buf;
 
 		valname = talloc_asprintf(mem_ctx, "Group%d", count++);
 		W_ERROR_HAVE_NO_MEMORY(valname);
 
-		val = sid_string_talloc(mem_ctx, &token->sids[i]);
-		W_ERROR_HAVE_NO_MEMORY(val);
-		werr = gp_store_reg_val_sz(mem_ctx, key, valname, val);
+		werr = gp_store_reg_val_sz(
+			mem_ctx,
+			key,
+			valname,
+			dom_sid_str_buf(&token->sids[i], &buf));
 		W_ERROR_NOT_OK_RETURN(werr);
 	}
 
diff --git a/source3/auth/auth_util.c b/source3/auth/auth_util.c
index 7b0d69f1f21..e31f8183439 100644
--- a/source3/auth/auth_util.c
+++ b/source3/auth/auth_util.c
@@ -412,6 +412,7 @@ static NTSTATUS log_nt_token(struct security_token *token)
 	TALLOC_CTX *frame = talloc_stackframe();
 	char *command;
 	char *group_sidstr;
+	struct dom_sid_buf buf;
 	size_t i;
 
 	if ((lp_log_nt_token_command(frame) == NULL) ||
@@ -424,12 +425,12 @@ static NTSTATUS log_nt_token(struct security_token *token)
 	for (i=1; i<token->num_sids; i++) {
 		group_sidstr = talloc_asprintf(
 			frame, "%s %s", group_sidstr,
-			sid_string_talloc(frame, &token->sids[i]));
+			dom_sid_str_buf(&token->sids[i], &buf));
 	}
 
 	command = talloc_string_sub(
 		frame, lp_log_nt_token_command(frame),
-		"%s", sid_string_talloc(frame, &token->sids[0]));
+		"%s", dom_sid_str_buf(&token->sids[0], &buf));
 	command = talloc_string_sub(frame, command, "%t", group_sidstr);
 
 	if (command == NULL) {
diff --git a/source3/include/proto.h b/source3/include/proto.h
index 75ce12de320..02463413517 100644
--- a/source3/include/proto.h
+++ b/source3/include/proto.h
@@ -467,9 +467,7 @@ bool is_setuid_root(void) ;
 /* The following definitions come from lib/util_sid.c  */
 
 char *sid_to_fstring(fstring sidstr_out, const struct dom_sid *sid);
-char *sid_string_talloc(TALLOC_CTX *mem_ctx, const struct dom_sid *sid);
 char *sid_string_dbg(const struct dom_sid *sid);
-char *sid_string_tos(const struct dom_sid *sid);
 bool sid_linearize(uint8_t *outbuf, size_t len, const struct dom_sid *sid);
 bool non_mappable_sid(struct dom_sid *sid);
 char *sid_binstring_hex_talloc(TALLOC_CTX *mem_ctx, const struct dom_sid *sid);
diff --git a/source3/lib/eventlog/eventlog.c b/source3/lib/eventlog/eventlog.c
index 4b631180816..473b6fa6337 100644
--- a/source3/lib/eventlog/eventlog.c
+++ b/source3/lib/eventlog/eventlog.c
@@ -898,10 +898,12 @@ NTSTATUS evlog_evt_entry_to_tdb_entry(TALLOC_CTX *mem_ctx,
 
 	/* t->sid_padding; */
 	if (e->UserSidLength > 0) {
-		const char *sid_str = NULL;
+		struct dom_sid_buf sid_str;
 		smb_ucs2_t *dummy = NULL;
-		sid_str = sid_string_talloc(mem_ctx, &e->UserSid);
-		t->sid_length = rpcstr_push_talloc(mem_ctx, &dummy, sid_str);
+		t->sid_length = rpcstr_push_talloc(
+			mem_ctx,
+			&dummy,
+			dom_sid_str_buf(&e->UserSid, &sid_str));
 		if (t->sid_length == -1) {
 			return NT_STATUS_NO_MEMORY;
 		}
diff --git a/source3/lib/netapi/sid.c b/source3/lib/netapi/sid.c
index 704964a79f4..ba223749eff 100644
--- a/source3/lib/netapi/sid.c
+++ b/source3/lib/netapi/sid.c
@@ -28,20 +28,14 @@
 int ConvertSidToStringSid(const struct domsid *sid,
 			  char **sid_string)
 {
-	char *ret;
+	struct dom_sid_buf buf;
 
 	if (!sid || !sid_string) {
 		return false;
 	}
 
-	ret = sid_string_talloc(NULL, (const struct dom_sid *)sid);
-	if (!ret) {
-		return false;
-	}
-
-	*sid_string = SMB_STRDUP(ret);
-
-	TALLOC_FREE(ret);
+	*sid_string = SMB_STRDUP(
+		dom_sid_str_buf((const struct dom_sid *)sid, &buf));
 
 	if (!*sid_string) {
 		return false;
diff --git a/source3/lib/util_sid.c b/source3/lib/util_sid.c
index 2ed968d7285..0e79a6ef2f0 100644
--- a/source3/lib/util_sid.c
+++ b/source3/lib/util_sid.c
@@ -39,34 +39,15 @@ char *sid_to_fstring(fstring sidstr_out, const struct dom_sid *sid)
 	return sidstr_out;
 }
 
-/*****************************************************************
- Essentially a renamed dom_sid_string from
- ../libcli/security/dom_sid.c with a panic if it didn't work.
-*****************************************************************/
-
-char *sid_string_talloc(TALLOC_CTX *mem_ctx, const struct dom_sid *sid)
-{
-	char *result = dom_sid_string(mem_ctx, sid);
-	SMB_ASSERT(result != NULL);
-	return result;
-}
-
 /*****************************************************************
  Useful function for debug lines.
 *****************************************************************/
 
 char *sid_string_dbg(const struct dom_sid *sid)
 {
-	return sid_string_talloc(talloc_tos(), sid);
-}
-
-/*****************************************************************
- Use with care!
-*****************************************************************/
-
-char *sid_string_tos(const struct dom_sid *sid)
-{
-	return sid_string_talloc(talloc_tos(), sid);
+	char *result = dom_sid_string(talloc_tos(), sid);
+	SMB_ASSERT(result != NULL);
+	return result;
 }
 
 /*****************************************************************
diff --git a/source3/libads/disp_sec.c b/source3/libads/disp_sec.c
index 8ec4a32bd7e..15c99b67176 100644
--- a/source3/libads/disp_sec.c
+++ b/source3/libads/disp_sec.c
@@ -201,6 +201,7 @@ void ads_disp_sd(ADS_STRUCT *ads, TALLOC_CTX *mem_ctx, struct security_descripto
 {
 	uint32_t i;
 	char *tmp_path = NULL;
+	struct dom_sid_buf buf;
 
 	if (!sd) {
 		return;
@@ -223,9 +224,9 @@ void ads_disp_sd(ADS_STRUCT *ads, TALLOC_CTX *mem_ctx, struct security_descripto
                sd->type);
 
 	printf("owner SID: %s\n", sd->owner_sid ? 
-		sid_string_talloc(mem_ctx, sd->owner_sid) : "(null)");
+	       dom_sid_str_buf(sd->owner_sid, &buf) : "(null)");
 	printf("group SID: %s\n", sd->group_sid ?
-		sid_string_talloc(mem_ctx, sd->group_sid) : "(null)");
+	       dom_sid_str_buf(sd->group_sid, &buf) : "(null)");
 
 	ads_disp_acl(sd->sacl, "system");
 	if (sd->sacl) {
diff --git a/source3/libnet/libnet_dssync_passdb.c b/source3/libnet/libnet_dssync_passdb.c
index 1b151943f5b..26be6dc840c 100644
--- a/source3/libnet/libnet_dssync_passdb.c
+++ b/source3/libnet/libnet_dssync_passdb.c
@@ -540,8 +540,9 @@ static int dssync_passdb_traverse_gmembers(struct db_record *rec,
 	}
 
 	if (!pdb_getsampwsid(member, &member_sid)) {
+		struct dom_sid_buf buf;
 		DEBUG(1, ("Found bogus group member: (member_sid=%s group=%s)\n",
-			  sid_string_tos(&member_sid), grp->gr_name));
+			  dom_sid_str_buf(&member_sid, &buf), grp->gr_name));
 		TALLOC_FREE(member);
 		return -1;
 	}
diff --git a/source3/modules/vfs_acl_common.c b/source3/modules/vfs_acl_common.c
index 6c0d931bf43..5cc75ca99c0 100644
--- a/source3/modules/vfs_acl_common.c
+++ b/source3/modules/vfs_acl_common.c
@@ -813,6 +813,7 @@ static NTSTATUS set_underlying_acl(vfs_handle_struct *handle, files_struct *fsp,
 {
 	NTSTATUS status;
 	const struct security_token *token = NULL;
+	struct dom_sid_buf buf;
 
 	status = SMB_VFS_NEXT_FSET_NT_ACL(handle, fsp, security_info_sent, psd);
 	if (!NT_STATUS_EQUAL(status, NT_STATUS_ACCESS_DENIED)) {
@@ -840,7 +841,8 @@ static NTSTATUS set_underlying_acl(vfs_handle_struct *handle, files_struct *fsp,
 	}
 
 	DBG_DEBUG("overriding chown on file %s for sid %s\n",
-		   fsp_str_dbg(fsp), sid_string_tos(psd->owner_sid));
+		  fsp_str_dbg(fsp),
+		  dom_sid_str_buf(psd->owner_sid, &buf));
 
 	/* Ok, we failed to chown and we have
 	   SEC_STD_WRITE_OWNER access - override. */
diff --git a/source3/modules/vfs_afsacl.c b/source3/modules/vfs_afsacl.c
index 54c9344a637..d9be513d041 100644
--- a/source3/modules/vfs_afsacl.c
+++ b/source3/modules/vfs_afsacl.c
@@ -814,10 +814,11 @@ static bool nt_to_afs_acl(const char *filename,
 			}
 
 			if (sidpts) {
+				struct dom_sid_buf buf;
 				/* Expect all users/groups in pts as SIDs */
 				name = talloc_strdup(
 					talloc_tos(),
-					sid_string_tos(&ace->trustee));
+					dom_sid_str_buf(&ace->trustee, &buf));
 				if (name == NULL) {
 					return false;
 				}
diff --git a/source3/modules/vfs_nfs4acl_xattr.c b/source3/modules/vfs_nfs4acl_xattr.c
index 0e52782075b..65387af2c0e 100644
--- a/source3/modules/vfs_nfs4acl_xattr.c
+++ b/source3/modules/vfs_nfs4acl_xattr.c
@@ -30,6 +30,7 @@
 #include "system/filesys.h"
 #include "smbd/smbd.h"
 #include "libcli/security/security_token.h"
+#include "libcli/security/dom_sid.h"
 #include "nfs4_acls.h"
 #include "librpc/gen_ndr/ndr_nfs4acl.h"
 #include "nfs4acl_xattr.h"
@@ -372,6 +373,7 @@ static NTSTATUS nfs4acl_xattr_fset_nt_acl(vfs_handle_struct *handle,
 	mode_t expected_mode;
 	mode_t restored_mode;
 	bool chown_needed = false;
+	struct dom_sid_buf buf;
 	NTSTATUS status;
 	int ret;
 
@@ -467,7 +469,8 @@ static NTSTATUS nfs4acl_xattr_fset_nt_acl(vfs_handle_struct *handle,
 	}
 
 	DBG_DEBUG("overriding chown on file %s for sid %s\n",
-		  fsp_str_dbg(fsp), sid_string_tos(psd->owner_sid));
+		  fsp_str_dbg(fsp),
+		  dom_sid_str_buf(psd->owner_sid, &buf));
 
 	become_root();
 	status = smb_set_nt_acl_nfs4(handle,
diff --git a/source3/passdb/pdb_ldap.c b/source3/passdb/pdb_ldap.c
index 62f899314de..5850236374f 100644
--- a/source3/passdb/pdb_ldap.c
+++ b/source3/passdb/pdb_ldap.c
@@ -2208,13 +2208,15 @@ static NTSTATUS ldapsam_add_sam_account(struct pdb_methods *my_methods, struct s
 
 	} else if (ldap_state->schema_ver == SCHEMAVER_SAMBASAMACCOUNT) {
 
+		struct dom_sid_buf buf;
+
 		/* There might be a SID for this account already - say an idmap entry */
 
 		filter = talloc_asprintf(ctx,
 				"(&(%s=%s)(|(objectClass=%s)(objectClass=%s)))",
 				 get_userattr_key2string(ldap_state->schema_ver,
 					 LDAP_ATTR_USER_SID),
-				 sid_string_talloc(ctx, sid),
+				 dom_sid_str_buf(sid, &buf),
 				 LDAP_OBJ_IDMAP_ENTRY,
 				 LDAP_OBJ_SID_ENTRY);
 		if (!filter) {
@@ -2665,6 +2667,7 @@ static NTSTATUS ldapsam_enum_group_members(struct pdb_methods *methods,
 	char **memberuid;
 	char *gidstr;
 	int rc, count;
+	struct dom_sid_buf buf;
 
 	*pp_member_rids = NULL;
 	*p_num_members = 0;
@@ -2675,7 +2678,7 @@ static NTSTATUS ldapsam_enum_group_members(struct pdb_methods *methods,
 				 "(sambaSID=%s))",
 				 LDAP_OBJ_POSIXGROUP,
 				 LDAP_OBJ_GROUPMAP,
-				 sid_string_talloc(mem_ctx, group));
+				 dom_sid_str_buf(group, &buf));
 	if (filter == NULL) {
 		ret = NT_STATUS_NO_MEMORY;
 		goto done;
@@ -3033,6 +3036,7 @@ static NTSTATUS ldapsam_map_posixgroup(TALLOC_CTX *mem_ctx,
 	const char *filter, *dn;
 	LDAPMessage *msg, *entry;
 	LDAPMod **mods;
+	struct dom_sid_buf buf;
 	int rc;
 
 	filter = talloc_asprintf(mem_ctx,
@@ -3068,7 +3072,7 @@ static NTSTATUS ldapsam_map_posixgroup(TALLOC_CTX *mem_ctx,
 			LDAP_OBJ_GROUPMAP);
 	smbldap_make_mod(smbldap_get_ldap(ldap_state->smbldap_state), entry,
 			 &mods, "sambaSid",
-			 sid_string_talloc(mem_ctx, &map->sid));
+			 dom_sid_str_buf(&map->sid, &buf));
 	smbldap_make_mod(smbldap_get_ldap(ldap_state->smbldap_state), entry,
 			 &mods, "sambaGroupType",
 			 talloc_asprintf(mem_ctx, "%d", map->sid_name_use));
@@ -3103,6 +3107,7 @@ static NTSTATUS ldapsam_add_group_mapping_entry(struct pdb_methods *methods,
 	NTSTATUS result;
 
 	struct dom_sid sid;
+	struct dom_sid_buf buf;
 	struct unixid id;
 
 	int rc;
@@ -3114,7 +3119,7 @@ static NTSTATUS ldapsam_add_group_mapping_entry(struct pdb_methods *methods,
 	}
 
 	filter = talloc_asprintf(mem_ctx, "(sambaSid=%s)",
-				 sid_string_talloc(mem_ctx, &map->sid));
+				 dom_sid_str_buf(&map->sid, &buf));
 	if (filter == NULL) {
 		result = NT_STATUS_NO_MEMORY;
 		goto done;
@@ -3184,7 +3189,7 @@ static NTSTATUS ldapsam_add_group_mapping_entry(struct pdb_methods *methods,
 	 * the best we can get out of LDAP. */
 
 	dn = talloc_asprintf(mem_ctx, "sambaSid=%s,%s",
-			     sid_string_talloc(mem_ctx, &map->sid),
+			     dom_sid_str_buf(&map->sid, &buf),
 			     lp_ldap_group_suffix(talloc_tos()));
 	if (dn == NULL) {
 		result = NT_STATUS_NO_MEMORY;
@@ -3199,7 +3204,7 @@ static NTSTATUS ldapsam_add_group_mapping_entry(struct pdb_methods *methods,
 			 &mods, "objectClass", LDAP_OBJ_GROUPMAP);
 	smbldap_make_mod(smbldap_get_ldap(ldap_state->smbldap_state), NULL,
 			 &mods, "sambaSid",
-			 sid_string_talloc(mem_ctx, &map->sid));
+			 dom_sid_str_buf(&map->sid, &buf));
 	smbldap_make_mod(smbldap_get_ldap(ldap_state->smbldap_state), NULL,
 			 &mods, "sambaGroupType",
 			 talloc_asprintf(mem_ctx, "%d", map->sid_name_use));
@@ -3243,6 +3248,7 @@ static NTSTATUS ldapsam_update_group_mapping_entry(struct pdb_methods *methods,
 	LDAPMod **mods = NULL;
 	TALLOC_CTX *mem_ctx;
 	NTSTATUS result;
+	struct dom_sid_buf buf;
 
 	mem_ctx = talloc_new(NULL);
 	if (mem_ctx == NULL) {
@@ -3257,7 +3263,7 @@ static NTSTATUS ldapsam_update_group_mapping_entry(struct pdb_methods *methods,
 				 "(sambaSid=%s)(gidNumber=%u)"
 				 "(sambaGroupType=%d))",
 				 LDAP_OBJ_GROUPMAP,
-				 sid_string_talloc(mem_ctx, &map->sid),
+				 dom_sid_str_buf(&map->sid, &buf),
 				 (unsigned int)map->gid, map->sid_name_use);
 	if (filter == NULL) {
 		result = NT_STATUS_NO_MEMORY;
@@ -3331,6 +3337,7 @@ static NTSTATUS ldapsam_delete_group_mapping_entry(struct pdb_methods *methods,
 	NTSTATUS result;
 	TALLOC_CTX *mem_ctx;
 	char *filter;
+	struct dom_sid_buf buf;
 
 	mem_ctx = talloc_new(NULL);
 	if (mem_ctx == NULL) {
@@ -3340,7 +3347,7 @@ static NTSTATUS ldapsam_delete_group_mapping_entry(struct pdb_methods *methods,
 
 	filter = talloc_asprintf(mem_ctx, "(&(objectClass=%s)(%s=%s))",
 				 LDAP_OBJ_GROUPMAP, LDAP_ATTRIBUTE_SID,
-				 sid_string_talloc(mem_ctx, &sid));
+				 dom_sid_str_buf(&sid, &buf));
 	if (filter == NULL) {
 		result = NT_STATUS_NO_MEMORY;
 		goto done;
@@ -3832,11 +3839,12 @@ static NTSTATUS ldapsam_alias_memberships(struct pdb_methods *methods,
 				 "(&(objectclass=%s)(sambaGroupType=%d)(|",
 				 LDAP_OBJ_GROUPMAP, type);
 
-	for (i=0; i<num_members; i++)
+	for (i=0; i<num_members; i++) {
+		struct dom_sid_buf buf;
 		filter = talloc_asprintf(mem_ctx, "%s(sambaSIDList=%s)",
 					 filter,
-					 sid_string_talloc(mem_ctx,
-							   &members[i]));
+					 dom_sid_str_buf(&members[i], &buf));
+	}
 
 	filter = talloc_asprintf(mem_ctx, "%s))", filter);
 
@@ -4140,10 +4148,12 @@ static NTSTATUS ldapsam_lookup_rids(struct pdb_methods *methods,
 
 	for (i=0; i<num_rids; i++) {
 		struct dom_sid sid;
+		struct dom_sid_buf buf;
 		sid_compose(&sid, domain_sid, rids[i]);
 		allsids = talloc_asprintf_append_buffer(
-			allsids, "(sambaSid=%s)",
-			sid_string_talloc(mem_ctx, &sid));
+			allsids,
+			"(sambaSid=%s)",
+			dom_sid_str_buf(&sid, &buf));
 		if (allsids == NULL) {
 			goto done;
 		}
@@ -5017,6 +5027,7 @@ static bool ldapsam_sid_to_id(struct pdb_methods *methods,
 	struct ldapsam_privates *priv =
 		(struct ldapsam_privates *)methods->private_data;
 	char *filter;
+	struct dom_sid_buf buf;
 	const char *attrs[] = { "sambaGroupType", "gidNumber", "uidNumber",
 				NULL };
 	LDAPMessage *result = NULL;
@@ -5041,7 +5052,7 @@ static bool ldapsam_sid_to_id(struct pdb_methods *methods,
 	filter = talloc_asprintf(mem_ctx,
 				 "(&(sambaSid=%s)"
 				 "(|(objectClass=%s)(objectClass=%s)))",
-				 sid_string_talloc(mem_ctx, sid),
+				 dom_sid_str_buf(sid, &buf),
 				 LDAP_OBJ_GROUPMAP, LDAP_OBJ_SAMBASAMACCOUNT);
 	if (filter == NULL) {
 		DEBUG(5, ("talloc_asprintf failed\n"));
@@ -5159,7 +5170,7 @@ static bool ldapsam_uid_to_sid(struct pdb_methods *methods, uid_t uid,
 	}
 
 	if (!string_to_sid(&user_sid, user_sid_string)) {
-		DEBUG(3, ("Error calling sid_string_talloc for sid '%s'\n",
+		DEBUG(3, ("Error calling string_to_sid for sid '%s'\n",
 			  user_sid_string));
 		goto done;
 	}
@@ -5226,7 +5237,7 @@ static bool ldapsam_gid_to_sid(struct pdb_methods *methods, gid_t gid,
 	}
 
 	if (!string_to_sid(&group_sid, group_sid_string)) {
-		DEBUG(3, ("Error calling sid_string_talloc for sid '%s'\n",
+		DEBUG(3, ("Error calling string_to_sid for sid '%s'\n",
 			  group_sid_string));
 		goto done;
 	}
@@ -5630,12 +5641,12 @@ static NTSTATUS ldapsam_create_dom_group(struct pdb_methods *my_methods,
 	bool is_new_entry = False;
 	LDAPMod **mods = NULL;
 	char *filter;
-	char *groupsidstr;
 	char *groupname;
 	char *grouptype;
 	char *gidstr;
 	const char *dn = NULL;
 	struct dom_sid group_sid;
+	struct dom_sid_buf buf;
 	gid_t gid = -1;
 	int rc;
 
@@ -5702,17 +5713,18 @@ static NTSTATUS ldapsam_create_dom_group(struct pdb_methods *my_methods,
 
 	sid_compose(&group_sid, get_global_sam_sid(), *rid);
 


-- 
Samba Shared Repository



More information about the samba-cvs mailing list