summaryrefslogtreecommitdiff
path: root/source3/smbd/chgpasswd.c
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2007-12-07 17:32:32 -0800
committerJeremy Allison <jra@samba.org>2007-12-07 17:32:32 -0800
commit42cfffae80480eae4381902fff3f7c61f858a933 (patch)
tree2fc1bc486fa988a4f2854310bcf91943db1aa566 /source3/smbd/chgpasswd.c
parent25288b0e4472c728fc5a3a70c6c3e1f621ffae5f (diff)
downloadsamba-42cfffae80480eae4381902fff3f7c61f858a933.tar.gz
samba-42cfffae80480eae4381902fff3f7c61f858a933.tar.bz2
samba-42cfffae80480eae4381902fff3f7c61f858a933.zip
Remove next_token - all uses must now be next_token_talloc.
No more temptations to use static length strings. Jeremy. (This used to be commit ec003f39369910dee852b7cafb883ddaa321c2de)
Diffstat (limited to 'source3/smbd/chgpasswd.c')
-rw-r--r--source3/smbd/chgpasswd.c42
1 files changed, 29 insertions, 13 deletions
diff --git a/source3/smbd/chgpasswd.c b/source3/smbd/chgpasswd.c
index aef5adb72f..5a1d71d2af 100644
--- a/source3/smbd/chgpasswd.c
+++ b/source3/smbd/chgpasswd.c
@@ -304,34 +304,50 @@ static void pwd_sub(char *buf)
static int talktochild(int master, const char *seq)
{
+ TALLOC_CTX *frame = talloc_stackframe();
int count = 0;
- fstring issue, expected;
+ char *issue;
+ char *expected;
- fstrcpy(issue, ".");
+ issue = talloc_strdup(frame, ".");
+ if (!issue) {
+ TALLOC_FREE(frame);
+ return false;
+ }
- while (next_token(&seq, expected, NULL, sizeof(expected)))
- {
+ while (next_token_talloc(frame, &seq, &expected, NULL)) {
pwd_sub(expected);
count++;
- if (!expect(master, issue, expected))
- {
+ if (!expect(master, issue, expected)) {
DEBUG(3, ("Response %d incorrect\n", count));
- return False;
+ TALLOC_FREE(frame);
+ return false;
}
- if (!next_token(&seq, issue, NULL, sizeof(issue)))
- fstrcpy(issue, ".");
-
+ if (!next_token_talloc(frame, &seq, &issue, NULL)) {
+ issue = talloc_strdup(frame, ".");
+ if (!issue) {
+ TALLOC_FREE(frame);
+ return false;
+ }
+ }
pwd_sub(issue);
}
+
if (!strequal(issue, ".")) {
/* we have one final issue to send */
- fstrcpy(expected, ".");
- if (!expect(master, issue, expected))
+ expected = talloc_strdup(frame, ".");
+ if (!expected) {
+ TALLOC_FREE(frame);
+ return false;
+ }
+ if (!expect(master, issue, expected)) {
+ TALLOC_FREE(frame);
return False;
+ }
}
-
+ TALLOC_FREE(frame);
return (count > 0);
}