summaryrefslogtreecommitdiff
path: root/source3/nmbd/nmbd_synclists.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/nmbd/nmbd_synclists.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/nmbd/nmbd_synclists.c')
-rw-r--r--source3/nmbd/nmbd_synclists.c18
1 files changed, 11 insertions, 7 deletions
diff --git a/source3/nmbd/nmbd_synclists.c b/source3/nmbd/nmbd_synclists.c
index 8abf60c8ce..147df68a69 100644
--- a/source3/nmbd/nmbd_synclists.c
+++ b/source3/nmbd/nmbd_synclists.c
@@ -201,7 +201,7 @@ done:
Handle one line from a completed sync file.
**********************************************************************/
-static void complete_one(struct sync_record *s,
+static void complete_one(struct sync_record *s,
char *sname, uint32 stype, char *comment)
{
struct work_record *work;
@@ -258,9 +258,10 @@ static void complete_one(struct sync_record *s,
static void complete_sync(struct sync_record *s)
{
XFILE *f;
- unstring server, type_str;
+ char *server;
+ char *type_str;
unsigned type;
- fstring comment;
+ char *comment;
char line[1024];
const char *ptr;
int count=0;
@@ -271,15 +272,18 @@ static void complete_sync(struct sync_record *s)
return;
while (!x_feof(f)) {
+ TALLOC_CTX *frame = NULL;
if (!fgets_slash(line,sizeof(line),f))
continue;
ptr = line;
- if (!next_token(&ptr,server,NULL,sizeof(server)) ||
- !next_token(&ptr,type_str,NULL, sizeof(type_str)) ||
- !next_token(&ptr,comment,NULL, sizeof(comment))) {
+ frame = talloc_stackframe();
+ if (!next_token_talloc(frame,&ptr,&server,NULL) ||
+ !next_token_talloc(frame,&ptr,&type_str,NULL) ||
+ !next_token_talloc(frame,&ptr,&comment,NULL)) {
+ TALLOC_FREE(frame);
continue;
}
@@ -288,8 +292,8 @@ static void complete_sync(struct sync_record *s)
complete_one(s, server, type, comment);
count++;
+ TALLOC_FREE(frame);
}
-
x_fclose(f);
unlink(s->fname);