summaryrefslogtreecommitdiff
path: root/source3/auth/pampass.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/auth/pampass.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/auth/pampass.c')
-rw-r--r--source3/auth/pampass.c21
1 files changed, 14 insertions, 7 deletions
diff --git a/source3/auth/pampass.c b/source3/auth/pampass.c
index 739e0a78fd..554df3c157 100644
--- a/source3/auth/pampass.c
+++ b/source3/auth/pampass.c
@@ -207,15 +207,17 @@ struct chat_struct {
static struct chat_struct *make_pw_chat(const char *p)
{
- fstring prompt;
- fstring reply;
+ char *prompt;
+ char *reply;
struct chat_struct *list = NULL;
struct chat_struct *t;
+ TALLOC_CTX *frame = talloc_stackframe();
while (1) {
t = SMB_MALLOC_P(struct chat_struct);
if (!t) {
DEBUG(0,("make_pw_chat: malloc failed!\n"));
+ TALLOC_FREE(frame);
return NULL;
}
@@ -223,22 +225,26 @@ static struct chat_struct *make_pw_chat(const char *p)
DLIST_ADD_END(list, t, struct chat_struct*);
- if (!next_token(&p, prompt, NULL, sizeof(fstring)))
+ if (!next_token_talloc(frame, &p, &prompt, NULL)) {
break;
+ }
- if (strequal(prompt,"."))
+ if (strequal(prompt,".")) {
fstrcpy(prompt,"*");
+ }
special_char_sub(prompt);
fstrcpy(t->prompt, prompt);
strlower_m(t->prompt);
trim_char(t->prompt, ' ', ' ');
- if (!next_token(&p, reply, NULL, sizeof(fstring)))
+ if (!next_token_talloc(frame, &p, reply, NULL)) {
break;
+ }
- if (strequal(reply,"."))
- fstrcpy(reply,"");
+ if (strequal(reply,".")) {
+ fstrcpy(reply,"");
+ }
special_char_sub(reply);
fstrcpy(t->reply, reply);
@@ -246,6 +252,7 @@ static struct chat_struct *make_pw_chat(const char *p)
trim_char(t->reply, ' ', ' ');
}
+ TALLOC_FREE(frame);
return list;
}