rpcclient: Use dom_sid_str_buf
authorVolker Lendecke <vl@samba.org>
Fri, 7 Dec 2018 09:32:08 +0000 (10:32 +0100)
committerJeremy Allison <jra@samba.org>
Sat, 8 Dec 2018 01:43:48 +0000 (02:43 +0100)
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Sat Dec  8 02:43:48 CET 2018 on sn-devel-144

source3/rpcclient/cmd_lsarpc.c
source3/rpcclient/cmd_samr.c

index 462ed06e0078eb83d777ceb5f331e9e49621c468..d2479821bee4f2ac53442fc08aeec71ed6cd5445 100644 (file)
@@ -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);
index 19ae0aa30ea9fb13be52936cec1fb62ecf36ad4b..d55d1648c91af105bb1e18fa7dd412ffbcda1dbe 100644 (file)
@@ -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);