The branch, master has been updated
       via  90de1431b91 rpcclient: Use dom_sid_str_buf
       via  e5a3364834d libnet: Use dom_sid_str_buf
       via  1b3ee68b790 net: Use dom_sid_str_buf
       via  f7f350ec3a2 pdb_ldap: Use dom_sid_str_buf
       via  166b40b2ef3 winbindd: Use dom_sid_str_buf
       via  70b9477922e idmap_tdb: Use dom_sid_str_buf
       via  263edf7fe96 winbindd_cache: Use dom_sid_str_buf
       via  a32564eaf92 net_usershare: Use dom_sid_str_buf
       via  b080389f3ed net_rpc: Use dom_sid_str_buf
       via  99a7756598f net_rpc: Use dom_sid_equal where appropriate
      from  353a947b4a9 ctdb: Adding memory pool for queue callback

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


- Log -----------------------------------------------------------------
commit 90de1431b91231c2ef0013fb3cfac537ca9830f1
Author: Volker Lendecke <[email protected]>
Date:   Fri Dec 7 10:32:08 2018 +0100

    rpcclient: Use dom_sid_str_buf
    
    Signed-off-by: Volker Lendecke <[email protected]>
    Reviewed-by: Jeremy Allison <[email protected]>
    
    Autobuild-User(master): Jeremy Allison <[email protected]>
    Autobuild-Date(master): Sat Dec  8 02:43:48 CET 2018 on sn-devel-144

commit e5a3364834d425b25c6e77ac28e33dfe996234be
Author: Volker Lendecke <[email protected]>
Date:   Fri Dec 7 10:25:09 2018 +0100

    libnet: Use dom_sid_str_buf
    
    Signed-off-by: Volker Lendecke <[email protected]>
    Reviewed-by: Jeremy Allison <[email protected]>

commit 1b3ee68b790b4a07ef4b681693fab726f98b990c
Author: Volker Lendecke <[email protected]>
Date:   Fri Dec 7 10:20:38 2018 +0100

    net: Use dom_sid_str_buf
    
    Signed-off-by: Volker Lendecke <[email protected]>
    Reviewed-by: Jeremy Allison <[email protected]>

commit f7f350ec3a25ed6af1aeac34f8eab83787fff35e
Author: Volker Lendecke <[email protected]>
Date:   Thu Dec 6 20:36:09 2018 +0100

    pdb_ldap: Use dom_sid_str_buf
    
    Signed-off-by: Volker Lendecke <[email protected]>
    Reviewed-by: Jeremy Allison <[email protected]>

commit 166b40b2ef30aee075f609f7862f9e32f7243c80
Author: Volker Lendecke <[email protected]>
Date:   Thu Dec 6 19:14:20 2018 +0100

    winbindd: Use dom_sid_str_buf
    
    Signed-off-by: Volker Lendecke <[email protected]>
    Reviewed-by: Jeremy Allison <[email protected]>

commit 70b9477922ec2de81876f40bf1c8b75b085a0c3a
Author: Volker Lendecke <[email protected]>
Date:   Thu Dec 6 19:12:07 2018 +0100

    idmap_tdb: Use dom_sid_str_buf
    
    Signed-off-by: Volker Lendecke <[email protected]>
    Reviewed-by: Jeremy Allison <[email protected]>

commit 263edf7fe96ab7b072bd3733074e44e6ab60a80b
Author: Volker Lendecke <[email protected]>
Date:   Thu Dec 6 18:25:02 2018 +0100

    winbindd_cache: Use dom_sid_str_buf
    
    Signed-off-by: Volker Lendecke <[email protected]>
    Reviewed-by: Jeremy Allison <[email protected]>

commit a32564eaf9241d2572ce1a7023b8ceec5846f97d
Author: Volker Lendecke <[email protected]>
Date:   Thu Dec 6 18:20:06 2018 +0100

    net_usershare: Use dom_sid_str_buf
    
    Signed-off-by: Volker Lendecke <[email protected]>
    Reviewed-by: Jeremy Allison <[email protected]>

commit b080389f3ed29cde717ada6ae025672cf29fefce
Author: Volker Lendecke <[email protected]>
Date:   Thu Dec 6 17:53:24 2018 +0100

    net_rpc: Use dom_sid_str_buf
    
    Signed-off-by: Volker Lendecke <[email protected]>
    Reviewed-by: Jeremy Allison <[email protected]>

commit 99a7756598fd84bc2b62f646745b991585209815
Author: Volker Lendecke <[email protected]>
Date:   Thu Dec 6 17:43:05 2018 +0100

    net_rpc: Use dom_sid_equal where appropriate
    
    Signed-off-by: Volker Lendecke <[email protected]>
    Reviewed-by: Jeremy Allison <[email protected]>

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

Summary of changes:
 source3/libnet/libnet_dssync_passdb.c        | 14 ++++---
 source3/passdb/pdb_ldap.c                    | 34 +++++++++-------
 source3/rpcclient/cmd_lsarpc.c               | 61 +++++++++++++++-------------
 source3/rpcclient/cmd_samr.c                 | 12 +++---
 source3/utils/net.c                          | 18 ++++----
 source3/utils/net_rpc.c                      | 54 ++++++++++++------------
 source3/utils/net_usershare.c                | 14 ++++---
 source3/winbindd/idmap_tdb.c                 |  5 +--
 source3/winbindd/winbindd_ads.c              |  6 +--
 source3/winbindd/winbindd_cache.c            | 38 +++++++++--------
 source3/winbindd/winbindd_getsidaliases.c    |  9 ++--
 source3/winbindd/winbindd_getuserdomgroups.c |  4 +-
 source3/winbindd/winbindd_lookupsids.c       |  6 +--
 13 files changed, 146 insertions(+), 129 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source3/libnet/libnet_dssync_passdb.c 
b/source3/libnet/libnet_dssync_passdb.c
index 8e2a4593373..1b151943f5b 100644
--- a/source3/libnet/libnet_dssync_passdb.c
+++ b/source3/libnet/libnet_dssync_passdb.c
@@ -1482,7 +1482,7 @@ static NTSTATUS handle_alias_object(struct dssync_passdb 
*pctx,
        struct dom_sid group_sid;
        uint32_t rid = 0;
        struct dom_sid *dom_sid = NULL;
-       fstring sid_string;
+       struct dom_sid_buf sid_str;
        GROUP_MAP *map;
        bool insert = true;
 
@@ -1529,9 +1529,10 @@ static NTSTATUS handle_alias_object(struct dssync_passdb 
*pctx,
                goto done;
        }
 
-       sid_to_fstring(sid_string, &group_sid);
        DEBUG(0,("Creating alias[%s] - %s members[%u]\n",
-                 map->nt_name, sid_string, num_members));
+                map->nt_name,
+                dom_sid_str_buf(&group_sid, &sid_str),
+                num_members));
 
        status = dssync_insert_obj(pctx, pctx->aliases, obj);
        if (!NT_STATUS_IS_OK(status)) {
@@ -1617,7 +1618,7 @@ static NTSTATUS handle_group_object(struct dssync_passdb 
*pctx,
        NTSTATUS status;
        struct group *grp = NULL;
        struct dom_sid group_sid;
-       fstring sid_string;
+       struct dom_sid_buf sid_str;
        GROUP_MAP *map;
        bool insert = true;
 
@@ -1660,9 +1661,10 @@ static NTSTATUS handle_group_object(struct dssync_passdb 
*pctx,
                goto done;
        }
 
-       sid_to_fstring(sid_string, &group_sid);
        DEBUG(0,("Creating group[%s] - %s members [%u]\n",
-                 map->nt_name, sid_string, num_members));
+                map->nt_name,
+                dom_sid_str_buf(&group_sid, &sid_str),
+                num_members));
 
        status = dssync_insert_obj(pctx, pctx->groups, obj);
        if (!NT_STATUS_IS_OK(status)) {
diff --git a/source3/passdb/pdb_ldap.c b/source3/passdb/pdb_ldap.c
index 1ac6c500573..62f899314de 100644
--- a/source3/passdb/pdb_ldap.c
+++ b/source3/passdb/pdb_ldap.c
@@ -361,12 +361,12 @@ static int ldapsam_search_suffix_by_sid (struct 
ldapsam_privates *ldap_state,
 {
        char *filter = NULL;
        int rc;
-       fstring sid_string;
+       struct dom_sid_buf sid_string;
 
        filter = talloc_asprintf(talloc_tos(), "(&(%s=%s)%s)",
                get_userattr_key2string(ldap_state->schema_ver,
                        LDAP_ATTR_USER_SID),
-               sid_to_fstring(sid_string, sid),
+               dom_sid_str_buf(sid, &sid_string),
                get_objclass_filter(ldap_state->schema_ver));
        if (!filter) {
                return LDAP_NO_MEMORY;
@@ -1152,7 +1152,7 @@ static bool init_ldap_from_sam (struct ldapsam_privates 
*ldap_state,
 
        /* only update the RID if we actually need to */
        if (need_update(sampass, PDB_USERSID)) {
-               fstring sid_string;
+               struct dom_sid_buf sid_str;
                const struct dom_sid *user_sid = pdb_get_user_sid(sampass);
 
                switch ( ldap_state->schema_ver ) {
@@ -1162,7 +1162,7 @@ static bool init_ldap_from_sam (struct ldapsam_privates 
*ldap_state,
                                                ldap_state->smbldap_state),
                                        existing, mods,
                                        
get_userattr_key2string(ldap_state->schema_ver, LDAP_ATTR_USER_SID), 
-                                       sid_to_fstring(sid_string, user_sid));
+                                       dom_sid_str_buf(user_sid, &sid_str));
                                break;
 
                        default:
@@ -1175,7 +1175,7 @@ static bool init_ldap_from_sam (struct ldapsam_privates 
*ldap_state,
           'free' to hang off the unix primary group makes life easier */
 
        if (need_update(sampass, PDB_GROUPSID)) {
-               fstring sid_string;
+               struct dom_sid_buf sid_str;
                const struct dom_sid *group_sid = pdb_get_group_sid(sampass);
 
                switch ( ldap_state->schema_ver ) {
@@ -1185,7 +1185,8 @@ static bool init_ldap_from_sam (struct ldapsam_privates 
*ldap_state,
                                                ldap_state->smbldap_state),
                                        existing, mods,
                                        
get_userattr_key2string(ldap_state->schema_ver, 
-                                       LDAP_ATTR_PRIMARY_GROUP_SID), 
sid_to_fstring(sid_string, group_sid));
+                                       LDAP_ATTR_PRIMARY_GROUP_SID),
+                                       dom_sid_str_buf(group_sid, &sid_str));
                                break;
 
                        default:
@@ -2548,12 +2549,12 @@ static NTSTATUS ldapsam_getgrsid(struct pdb_methods 
*methods, GROUP_MAP *map,
 {
        char *filter = NULL;
        NTSTATUS status;
-       fstring tmp;
+       struct dom_sid_buf tmp;
 
        if (asprintf(&filter, "(&(objectClass=%s)(%s=%s))",
                LDAP_OBJ_GROUPMAP,
                get_attr_key2string(groupmap_attr_list, LDAP_ATTR_GROUP_SID),
-               sid_to_fstring(tmp, &sid)) < 0) {
+               dom_sid_str_buf(&sid, &tmp)) < 0) {
                return NT_STATUS_NO_MEMORY;
        }
 
@@ -3561,7 +3562,7 @@ static NTSTATUS ldapsam_modify_aliasmem(struct 
pdb_methods *methods,
        LDAPMod **mods = NULL;
        int rc;
        enum lsa_SidType type = SID_NAME_USE_NONE;
-       fstring tmp;
+       struct dom_sid_buf tmp;
 
        char *filter = NULL;
 
@@ -3581,7 +3582,8 @@ static NTSTATUS ldapsam_modify_aliasmem(struct 
pdb_methods *methods,
 
        if (asprintf(&filter,
                     "(&(objectClass=%s)(sambaSid=%s)(sambaGroupType=%d))",
-                    LDAP_OBJ_GROUPMAP, sid_to_fstring(tmp, alias),
+                    LDAP_OBJ_GROUPMAP,
+                    dom_sid_str_buf(alias, &tmp),
                     type) < 0) {
                return NT_STATUS_NO_MEMORY;
        }
@@ -3631,7 +3633,7 @@ static NTSTATUS ldapsam_modify_aliasmem(struct 
pdb_methods *methods,
        smbldap_set_mod(&mods, modop,
                        get_attr_key2string(groupmap_attr_list,
                                            LDAP_ATTR_SID_LIST),
-                       sid_to_fstring(tmp, member));
+                       dom_sid_str_buf(member, &tmp));
 
        rc = smbldap_modify(ldap_state->smbldap_state, dn, mods);
 
@@ -3685,7 +3687,7 @@ static NTSTATUS ldapsam_enum_aliasmem(struct pdb_methods 
*methods,
        char *filter = NULL;
        uint32_t num_members = 0;
        enum lsa_SidType type = SID_NAME_USE_NONE;
-       fstring tmp;
+       struct dom_sid_buf tmp;
 
        *pp_members = NULL;
        *p_num_members = 0;
@@ -3706,7 +3708,8 @@ static NTSTATUS ldapsam_enum_aliasmem(struct pdb_methods 
*methods,
 
        if (asprintf(&filter,
                     "(&(objectClass=%s)(sambaSid=%s)(sambaGroupType=%d))",
-                    LDAP_OBJ_GROUPMAP, sid_to_fstring(tmp, alias),
+                    LDAP_OBJ_GROUPMAP,
+                    dom_sid_str_buf(alias, &tmp),
                     type) < 0) {
                return NT_STATUS_NO_MEMORY;
        }
@@ -4825,7 +4828,7 @@ static bool ldapsam_search_grouptype(struct pdb_methods 
*methods,
        struct ldapsam_privates *ldap_state =
                (struct ldapsam_privates *)methods->private_data;
        struct ldap_search_state *state;
-       fstring tmp;
+       struct dom_sid_buf tmp;
 
        state = talloc(search, struct ldap_search_state);
        if (state == NULL) {
@@ -4841,7 +4844,8 @@ static bool ldapsam_search_grouptype(struct pdb_methods 
*methods,
        state->filter = talloc_asprintf(search, "(&(objectclass=%s)"
                                        "(sambaGroupType=%d)(sambaSID=%s*))",
                                         LDAP_OBJ_GROUPMAP,
-                                        type, sid_to_fstring(tmp, sid));
+                                        type,
+                                        dom_sid_str_buf(sid, &tmp));
        state->attrs = talloc_attrs(search, "cn", "sambaSid",
                                    "displayName", "description",
                                    "sambaGroupType", NULL);
diff --git a/source3/rpcclient/cmd_lsarpc.c b/source3/rpcclient/cmd_lsarpc.c
index 462ed06e007..d2479821bee 100644
--- a/source3/rpcclient/cmd_lsarpc.c
+++ b/source3/rpcclient/cmd_lsarpc.c
@@ -252,10 +252,12 @@ static NTSTATUS cmd_lsa_lookup_names(struct 
rpc_pipe_client *cli,
        /* Print results */
 
        for (i = 0; i < (argc - 1); i++) {
-               fstring sid_str;
-               sid_to_fstring(sid_str, &sids[i]);
-               printf("%s %s (%s: %d)\n", argv[i + 1], sid_str,
-                      sid_type_lookup(types[i]), types[i]);
+               struct dom_sid_buf sid_str;
+               printf("%s %s (%s: %d)\n",
+                      argv[i + 1],
+                      dom_sid_str_buf(&sids[i], &sid_str),
+                      sid_type_lookup(types[i]),
+                      types[i]);
        }
 
        dcerpc_lsa_Close(b, mem_ctx, &pol, &result);
@@ -305,10 +307,12 @@ static NTSTATUS cmd_lsa_lookup_names_level(struct 
rpc_pipe_client *cli,
        /* Print results */
 
        for (i = 0; i < (argc - 2); i++) {
-               fstring sid_str;
-               sid_to_fstring(sid_str, &sids[i]);
-               printf("%s %s (%s: %d)\n", argv[i + 2], sid_str,
-                      sid_type_lookup(types[i]), types[i]);
+               struct dom_sid_buf sid_str;
+               printf("%s %s (%s: %d)\n",
+                      argv[i + 2],
+                      dom_sid_str_buf(&sids[i], &sid_str),
+                      sid_type_lookup(types[i]),
+                      types[i]);
        }
 
        dcerpc_lsa_Close(b, mem_ctx, &pol, &result);
@@ -368,9 +372,10 @@ static NTSTATUS cmd_lsa_lookup_names4(struct 
rpc_pipe_client *cli,
        }
 
        for (i = 0; i < sids.count; i++) {
-               fstring sid_str;
-               sid_to_fstring(sid_str, sids.sids[i].sid);
-               printf("%s %s (%s: %d)\n", argv[i+1], sid_str,
+               struct dom_sid_buf sid_str;
+               printf("%s %s (%s: %d)\n",
+                      argv[i+1],
+                      dom_sid_str_buf(sids.sids[i].sid, &sid_str),
                       sid_type_lookup(sids.sids[i].sid_type),
                       sids.sids[i].sid_type);
        }
@@ -433,15 +438,15 @@ static NTSTATUS cmd_lsa_lookup_sids(struct 
rpc_pipe_client *cli, TALLOC_CTX *mem
        /* Print results */
 
        for (i = 0; i < (argc - 1); i++) {
-               fstring sid_str;
+               struct dom_sid_buf sid_str;
 
-               sid_to_fstring(sid_str, &sids[i]);
+               dom_sid_str_buf(&sids[i], &sid_str);
                if (types[i] == SID_NAME_DOMAIN) {
-                       printf("%s %s (%d)\n", sid_str,
+                       printf("%s %s (%d)\n", sid_str.buf,
                               domains[i] ? domains[i] : "*unknown*",
                               types[i]);
                } else {
-                       printf("%s %s\\%s (%d)\n", sid_str,
+                       printf("%s %s\\%s (%d)\n", sid_str.buf,
                               domains[i] ? domains[i] : "*unknown*",
                               names[i] ? names[i] : "*unknown*",
                               types[i]);
@@ -525,15 +530,15 @@ static NTSTATUS cmd_lsa_lookup_sids_level(struct 
rpc_pipe_client *cli,
        /* Print results */
 
        for (i = 0; i < (argc - 2); i++) {
-               fstring sid_str;
+               struct dom_sid_buf sid_str;
 
-               sid_to_fstring(sid_str, &sids[i]);
+               dom_sid_str_buf(&sids[i], &sid_str);
                if (types[i] == SID_NAME_DOMAIN) {
-                       printf("%s %s (%d)\n", sid_str,
+                       printf("%s %s (%d)\n", sid_str.buf,
                               domains[i] ? domains[i] : "*unknown*",
                               types[i]);
                } else {
-                       printf("%s %s\\%s (%d)\n", sid_str,
+                       printf("%s %s\\%s (%d)\n", sid_str.buf,
                               domains[i] ? domains[i] : "*unknown*",
                               names[i] ? names[i] : "*unknown*",
                               types[i]);
@@ -612,13 +617,13 @@ static NTSTATUS cmd_lsa_lookup_sids3(struct 
rpc_pipe_client *cli,
        /* Print results */
 
        for (i = 0; i < names.count; i++) {
-               fstring sid_str;
+               struct dom_sid_buf sid_str;
 
                if (i >= sids.num_sids) {
                        break;
                }
-               sid_to_fstring(sid_str, sids.sids[i].sid);
-               printf("%s %s (%d)\n", sid_str,
+               printf("%s %s (%d)\n",
+                      dom_sid_str_buf(sids.sids[i].sid, &sid_str),
                       names.names[i].name.string,
                       names.names[i].sid_type);
        }
@@ -685,13 +690,13 @@ static NTSTATUS cmd_lsa_enum_trust_dom(struct 
rpc_pipe_client *cli,
                /* Print results: list of names and sids returned in this
                 * response. */  
                for (i = 0; i < domain_list.count; i++) {
-                       fstring sid_str;
+                       struct dom_sid_buf sid_str;
 
-                       sid_to_fstring(sid_str, domain_list.domains[i].sid);
                        printf("%s %s\n",
                                domain_list.domains[i].name.string ?
                                domain_list.domains[i].name.string : 
"*unknown*",
-                               sid_str);
+                               dom_sid_str_buf(domain_list.domains[i].sid,
+                                               &sid_str));
                }
        }
 
@@ -866,10 +871,10 @@ static NTSTATUS cmd_lsa_enum_sids(struct rpc_pipe_client 
*cli,
        printf("found %d SIDs\n\n", sid_array.num_sids);
 
        for (i = 0; i < sid_array.num_sids; i++) {
-               fstring sid_str;
+               struct dom_sid_buf sid_str;
 
-               sid_to_fstring(sid_str, sid_array.sids[i].sid);
-               printf("%s\n", sid_str);
+               printf("%s\n",
+                      dom_sid_str_buf(sid_array.sids[i].sid, &sid_str));
        }
 
        dcerpc_lsa_Close(b, mem_ctx, &pol, &result);
diff --git a/source3/rpcclient/cmd_samr.c b/source3/rpcclient/cmd_samr.c
index 19ae0aa30ea..d55d1648c91 100644
--- a/source3/rpcclient/cmd_samr.c
+++ b/source3/rpcclient/cmd_samr.c
@@ -1279,10 +1279,10 @@ static NTSTATUS cmd_samr_query_aliasmem(struct 
rpc_pipe_client *cli,
        }
 
        for (i = 0; i < sid_array.num_sids; i++) {
-               fstring sid_str;
+               struct dom_sid_buf sid_str;
 
-               sid_to_fstring(sid_str, sid_array.sids[i].sid);
-               printf("\tsid:[%s]\n", sid_str);
+               printf("\tsid:[%s]\n",
+                      dom_sid_str_buf(sid_array.sids[i].sid, &sid_str));
        }
 
        dcerpc_samr_Close(b, mem_ctx, &alias_pol, &result);
@@ -2690,7 +2690,6 @@ static NTSTATUS cmd_samr_lookup_domain(struct 
rpc_pipe_client *cli,
        struct policy_handle connect_pol, domain_pol;
        NTSTATUS status, result;
        uint32_t access_mask = MAXIMUM_ALLOWED_ACCESS;
-       fstring sid_string;
        struct lsa_String domain_name;
        struct dom_sid *sid = NULL;
        struct dcerpc_binding_handle *b = cli->binding_handle;
@@ -2737,9 +2736,10 @@ static NTSTATUS cmd_samr_lookup_domain(struct 
rpc_pipe_client *cli,
        }
 
        if (NT_STATUS_IS_OK(result)) {
-               sid_to_fstring(sid_string, sid);
+               struct dom_sid_buf sid_str;
                printf("SAMR_LOOKUP_DOMAIN: Domain Name: %s Domain SID: %s\n",
-                      argv[1], sid_string);
+                      argv[1],
+                      dom_sid_str_buf(sid, &sid_str));
        }
 
        dcerpc_samr_Close(b, mem_ctx, &domain_pol, &result);
diff --git a/source3/utils/net.c b/source3/utils/net.c
index 769e6f86f8f..8350e8c0967 100644
--- a/source3/utils/net.c
+++ b/source3/utils/net.c
@@ -359,7 +359,7 @@ static int net_getlocalsid(struct net_context *c, int argc, 
const char **argv)
 {
         struct dom_sid sid;
        const char *name;
-       fstring sid_str;
+       struct dom_sid_buf sid_str;
 
        if (argc >= 1) {
                name = argv[0];
@@ -390,8 +390,9 @@ static int net_getlocalsid(struct net_context *c, int argc, 
const char **argv)
                DEBUG(0, ("Can't fetch domain SID for name: %s\n", name));
                return 1;
        }
-       sid_to_fstring(sid_str, &sid);
-       d_printf(_("SID for domain %s is: %s\n"), name, sid_str);
+       d_printf(_("SID for domain %s is: %s\n"),
+                name,
+                dom_sid_str_buf(&sid, &sid_str));
        return 0;
 }
 
@@ -440,7 +441,7 @@ static int net_setdomainsid(struct net_context *c, int 
argc, const char **argv)
 static int net_getdomainsid(struct net_context *c, int argc, const char **argv)
 {
        struct dom_sid domain_sid;
-       fstring sid_str;
+       struct dom_sid_buf sid_str;
 
        if (argc > 0) {
                d_printf(_("Usage:"));
@@ -471,17 +472,18 @@ static int net_getdomainsid(struct net_context *c, int 
argc, const char **argv)
                        d_fprintf(stderr, _("Could not fetch local SID\n"));
                        return 1;
                }
-               sid_to_fstring(sid_str, &domain_sid);
                d_printf(_("SID for local machine %s is: %s\n"),
-                        lp_netbios_name(), sid_str);
+                        lp_netbios_name(),
+                        dom_sid_str_buf(&domain_sid, &sid_str));
        }
        if (!secrets_fetch_domain_sid(c->opt_workgroup, &domain_sid)) {
                d_fprintf(stderr, _("Could not fetch domain SID\n"));
                return 1;
        }
 
-       sid_to_fstring(sid_str, &domain_sid);
-       d_printf(_("SID for domain %s is: %s\n"), c->opt_workgroup, sid_str);
+       d_printf(_("SID for domain %s is: %s\n"),
+                c->opt_workgroup,
+                dom_sid_str_buf(&domain_sid, &sid_str));
 
        return 0;
 }
diff --git a/source3/utils/net_rpc.c b/source3/utils/net_rpc.c
index 41e72975e76..d6ade7471b4 100644
--- a/source3/utils/net_rpc.c
+++ b/source3/utils/net_rpc.c
@@ -723,11 +723,8 @@ NTSTATUS rpc_info_internals(struct net_context *c,
        struct policy_handle connect_pol, domain_pol;
        NTSTATUS status, result;
        union samr_DomainInfo *info = NULL;
-       fstring sid_str;
        struct dcerpc_binding_handle *b = pipe_hnd->binding_handle;
 
-       sid_to_fstring(sid_str, domain_sid);
-
        /* Get sam policy handle */
        status = dcerpc_samr_Connect2(b, mem_ctx,
                                      pipe_hnd->desthost,
@@ -776,9 +773,12 @@ NTSTATUS rpc_info_internals(struct net_context *c,
        }
        status = result;
        if (NT_STATUS_IS_OK(result)) {
+               struct dom_sid_buf sid_str;
+
                d_printf(_("Domain Name: %s\n"),
                         info->general.domain_name.string);
-               d_printf(_("Domain SID: %s\n"), sid_str);
+               d_printf(_("Domain SID: %s\n"),
+                        dom_sid_str_buf(domain_sid, &sid_str));
                d_printf(_("Sequence number: %llu\n"),
                        (unsigned long long)info->general.sequence_num);
                d_printf(_("Num users: %u\n"), info->general.num_users);
@@ -838,11 +838,11 @@ static NTSTATUS rpc_getsid_internals(struct net_context 
*c,
                        int argc,
                        const char **argv)
 {
-       fstring sid_str;
+       struct dom_sid_buf sid_str;
 
-       sid_to_fstring(sid_str, domain_sid);
        d_printf(_("Storing SID %s for Domain %s in secrets.tdb\n"),
-                sid_str, domain_name);
+                dom_sid_str_buf(domain_sid, &sid_str),
+                domain_name);
 
        if (!secrets_store_domain_sid(domain_name, domain_sid)) {
                DEBUG(0,("Can't store domain SID\n"));
@@ -3050,9 +3050,6 @@ static NTSTATUS rpc_list_group_members(struct net_context 
*c,
        struct samr_Ids types;
        struct dcerpc_binding_handle *b = pipe_hnd->binding_handle;
 
-       fstring sid_str;
-       sid_to_fstring(sid_str, domain_sid);
-
        status = dcerpc_samr_OpenGroup(b, mem_ctx,
                                       domain_pol,
                                       MAXIMUM_ALLOWED_ACCESS,
@@ -3111,8 +3108,14 @@ static NTSTATUS rpc_list_group_members(struct 
net_context *c,
                for (i = 0; i < this_time; i++) {
 
                        if (c->opt_long_list_entries) {
-                               printf("%s-%d %s\\%s %d\n", sid_str,
-                                      group_rids[i], domain_name,
+                               struct dom_sid sid;
+                               struct dom_sid_buf sid_str;
+
+                               sid_compose(&sid, domain_sid, group_rids[i]);
+
+                               printf("%s %s\\%s %d\n",
+                                      dom_sid_str_buf(&sid, &sid_str),
+                                      domain_name,
                                       names.names[i].string,
                                       SID_NAME_USER);
                        } else {
@@ -3220,18 +3223,18 @@ static NTSTATUS rpc_list_alias_members(struct 
net_context *c,
        }
 
        for (i = 0; i < num_members; i++) {
-               fstring sid_str;
-               sid_to_fstring(sid_str, &alias_sids[i]);
+               struct dom_sid_buf sid_str;


-- 
Samba Shared Repository

Reply via email to