summaryrefslogtreecommitdiff
path: root/source3/rpcclient
diff options
context:
space:
mode:
authorJim McDonough <jmcd@samba.org>2005-02-28 10:55:13 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 10:55:49 -0500
commitac1cc8712295fafc007d1341e68b84cfb7b7b7a1 (patch)
tree4051ba2c2960aab1cd0f57ad9f287b895275b7ff /source3/rpcclient
parent2f158e1565e634958abf2efe31736c55d20f55cd (diff)
downloadsamba-ac1cc8712295fafc007d1341e68b84cfb7b7b7a1.tar.gz
samba-ac1cc8712295fafc007d1341e68b84cfb7b7b7a1.tar.bz2
samba-ac1cc8712295fafc007d1341e68b84cfb7b7b7a1.zip
r5591: Implement "net rpc trustdom del", including client side of
samr_remove_sid_from_foreign_domain. (This used to be commit 8360695fc02dfb09aff92a434bf9d411e65c478c)
Diffstat (limited to 'source3/rpcclient')
-rw-r--r--source3/rpcclient/cmd_lsarpc.c11
-rw-r--r--source3/rpcclient/rpcclient.c4
2 files changed, 8 insertions, 7 deletions
diff --git a/source3/rpcclient/cmd_lsarpc.c b/source3/rpcclient/cmd_lsarpc.c
index 597c950a24..3fca535ff0 100644
--- a/source3/rpcclient/cmd_lsarpc.c
+++ b/source3/rpcclient/cmd_lsarpc.c
@@ -192,6 +192,7 @@ static NTSTATUS cmd_lsa_lookup_sids(struct cli_state *cli, TALLOC_CTX *mem_ctx,
char **names;
uint32 *types;
int i;
+ int nsids = atoi(argv[2]);
if (argc == 1) {
printf("Usage: %s [sid1 [sid2 [...]]]\n", argv[0]);
@@ -207,22 +208,22 @@ static NTSTATUS cmd_lsa_lookup_sids(struct cli_state *cli, TALLOC_CTX *mem_ctx,
/* Convert arguments to sids */
- sids = TALLOC_ARRAY(mem_ctx, DOM_SID, argc - 1);
+ sids = TALLOC_ARRAY(mem_ctx, DOM_SID, nsids);
if (!sids) {
printf("could not allocate memory for %d sids\n", argc - 1);
goto done;
}
- for (i = 0; i < argc - 1; i++)
- if (!string_to_sid(&sids[i], argv[i + 1])) {
+ for (i = 0; i < nsids; i++)
+ if (!string_to_sid(&sids[i], argv[1])) {
result = NT_STATUS_INVALID_SID;
goto done;
}
/* Lookup the SIDs */
- result = cli_lsa_lookup_sids(cli, mem_ctx, &pol, argc - 1, sids,
+ result = cli_lsa_lookup_sids(cli, mem_ctx, &pol, nsids, sids,
&domains, &names, &types);
if (!NT_STATUS_IS_OK(result) && NT_STATUS_V(result) !=
@@ -233,7 +234,7 @@ static NTSTATUS cmd_lsa_lookup_sids(struct cli_state *cli, TALLOC_CTX *mem_ctx,
/* Print results */
- for (i = 0; i < (argc - 1); i++) {
+ for (i = 0; i < nsids; i++) {
fstring sid_str;
sid_to_string(sid_str, &sids[i]);
diff --git a/source3/rpcclient/rpcclient.c b/source3/rpcclient/rpcclient.c
index acb65b7f7c..85d1d848bf 100644
--- a/source3/rpcclient/rpcclient.c
+++ b/source3/rpcclient/rpcclient.c
@@ -100,7 +100,7 @@ static char **completion_fn(const char *text, int start, int end)
static char* next_command (char** cmdstr)
{
- static pstring command;
+ static char command[10000];
char *p;
if (!cmdstr || !(*cmdstr))
@@ -109,7 +109,7 @@ static char* next_command (char** cmdstr)
p = strchr_m(*cmdstr, ';');
if (p)
*p = '\0';
- pstrcpy(command, *cmdstr);
+ strncpy(command, *cmdstr, sizeof(command));
if (p)
*cmdstr = p + 1;
else