diff options
author | Andrew Tridgell <tridge@samba.org> | 2001-06-21 09:10:42 +0000 |
---|---|---|
committer | Andrew Tridgell <tridge@samba.org> | 2001-06-21 09:10:42 +0000 |
commit | 91b8a8d1d21b810b6aca44ce647837669efd6dcf (patch) | |
tree | 2490cec37a9ae7f9f9ad9adabac033b41e26c07b /source3/rpcclient/rpcclient.c | |
parent | 4ff011d88ef5b79b92d2cea1abe32c93bc03f724 (diff) | |
download | samba-91b8a8d1d21b810b6aca44ce647837669efd6dcf.tar.gz samba-91b8a8d1d21b810b6aca44ce647837669efd6dcf.tar.bz2 samba-91b8a8d1d21b810b6aca44ce647837669efd6dcf.zip |
next_token() was supposed to be a reentrant replacement for strtok(),
but the code suffered from bitrot and is not now reentrant. That means
we can get bizarre behaviour
i've fixed this by making next_token() reentrant and creating a
next_token_nr() that is a small non-reentrant wrapper for those lumps
of code (mostly smbclient) that have come to rely on the non-reentrant
behaviour
(This used to be commit 674ee2f1d12b0afc164a9e9072758fd1c5e54df7)
Diffstat (limited to 'source3/rpcclient/rpcclient.c')
-rw-r--r-- | source3/rpcclient/rpcclient.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/source3/rpcclient/rpcclient.c b/source3/rpcclient/rpcclient.c index 82e1ba03ba..e8029dec49 100644 --- a/source3/rpcclient/rpcclient.c +++ b/source3/rpcclient/rpcclient.c @@ -358,13 +358,13 @@ static uint32 do_cmd(struct cli_state *cli, struct cmd_set *cmd_entry, char *cmd pstring buf; int argc = 1, i; - next_token(&p, buf, " ", sizeof(buf)); + next_token_nr(&p, buf, " ", sizeof(buf)); /* Count number of arguments first time through the loop then allocate memory and strdup them. */ again: - while(next_token(NULL, buf, " ", sizeof(buf))) { + while(next_token_nr(NULL, buf, " ", sizeof(buf))) { if (argv) { argv[argc] = strdup(buf); } @@ -384,7 +384,7 @@ static uint32 do_cmd(struct cli_state *cli, struct cmd_set *cmd_entry, char *cmd } p = cmd; - next_token(&p, buf, " ", sizeof(buf)); + next_token_nr(&p, buf, " ", sizeof(buf)); argv[0] = strdup(buf); argc = 1; @@ -425,7 +425,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(&p, buf, " ", sizeof(buf))) { + if (!next_token_nr(&p, buf, " ", sizeof(buf))) { return 0; } |