summaryrefslogtreecommitdiff
path: root/source3/rpcclient/rpcclient.c
diff options
context:
space:
mode:
authorSimo Sorce <idra@samba.org>2001-08-10 09:52:10 +0000
committerSimo Sorce <idra@samba.org>2001-08-10 09:52:10 +0000
commitacc149c427e780b35ebe3028722ed0c42c4c3854 (patch)
tree064b2307dac4fbaa23c1fdab0d900b63faf04737 /source3/rpcclient/rpcclient.c
parent5c47841335059ace57dfbf03e35872504d86b447 (diff)
downloadsamba-acc149c427e780b35ebe3028722ed0c42c4c3854.tar.gz
samba-acc149c427e780b35ebe3028722ed0c42c4c3854.tar.bz2
samba-acc149c427e780b35ebe3028722ed0c42c4c3854.zip
- avoid possible mem leaks in rpcclient/cmd_*.c (talloc_destroy not performed)
- ported two rpc back from TNG (WINREG: shutdown and abort shutdown) - some optimizations and changed some DEBUG statement in loadparm.c - changed rpcclient a bit moved from non reentrant next_token_nr to next_token - in cmd_reg.c not sure if getopt will work ok on all platforms only setting optind=0 (This used to be commit fd54412ce9c3504a547e232602d6129e08dd9d4d)
Diffstat (limited to 'source3/rpcclient/rpcclient.c')
-rw-r--r--source3/rpcclient/rpcclient.c16
1 files changed, 7 insertions, 9 deletions
diff --git a/source3/rpcclient/rpcclient.c b/source3/rpcclient/rpcclient.c
index ee860798f6..d833043401 100644
--- a/source3/rpcclient/rpcclient.c
+++ b/source3/rpcclient/rpcclient.c
@@ -374,6 +374,7 @@ extern struct cmd_set spoolss_commands[];
extern struct cmd_set netlogon_commands[];
extern struct cmd_set srvsvc_commands[];
extern struct cmd_set dfs_commands[];
+extern struct cmd_set reg_commands[];
static struct cmd_set *rpcclient_command_list[] = {
rpcclient_commands,
@@ -383,6 +384,7 @@ static struct cmd_set *rpcclient_command_list[] = {
netlogon_commands,
srvsvc_commands,
dfs_commands,
+ reg_commands,
NULL
};
@@ -406,15 +408,13 @@ static uint32 do_cmd(struct cli_state *cli, struct cmd_set *cmd_entry, char *cmd
char *p = cmd, **argv = NULL;
uint32 result;
pstring buf;
- int argc = 1, i;
-
- next_token_nr(&p, buf, " ", sizeof(buf));
+ int argc = 0, i;
/* Count number of arguments first time through the loop then
allocate memory and strdup them. */
again:
- while(next_token_nr(NULL, buf, " ", sizeof(buf))) {
+ while(next_token(&p, buf, " ", sizeof(buf))) {
if (argv) {
argv[argc] = strdup(buf);
}
@@ -429,14 +429,12 @@ static uint32 do_cmd(struct cli_state *cli, struct cmd_set *cmd_entry, char *cmd
argv = (char **)malloc(sizeof(char *) * argc);
if (!argv) {
- fprintf(stderr, "out of memoryx\n");
+ fprintf(stderr, "out of memory\n");
return 0;
}
p = cmd;
- next_token_nr(&p, buf, " ", sizeof(buf));
- argv[0] = strdup(buf);
- argc = 1;
+ argc = 0;
goto again;
}
@@ -475,7 +473,7 @@ static uint32 process_cmd(struct cli_state *cli, char *cmd)
if (cmd[strlen(cmd) - 1] == '\n')
cmd[strlen(cmd) - 1] = '\0';
- if (!next_token_nr(&p, buf, " ", sizeof(buf))) {
+ if (!next_token(&p, buf, " ", sizeof(buf))) {
return 0;
}