summaryrefslogtreecommitdiff
path: root/source3/nmbd/nmbd_sendannounce.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_sendannounce.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_sendannounce.c')
-rw-r--r--source3/nmbd/nmbd_sendannounce.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/source3/nmbd/nmbd_sendannounce.c b/source3/nmbd/nmbd_sendannounce.c
index a4e646771f..3cc9bb52b0 100644
--- a/source3/nmbd/nmbd_sendannounce.c
+++ b/source3/nmbd/nmbd_sendannounce.c
@@ -457,10 +457,11 @@ void announce_remote(time_t t)
char *s;
const char *ptr;
static time_t last_time = 0;
- fstring s2;
+ char *s2;
struct in_addr addr;
char *comment;
int stype = lp_default_server_announce();
+ TALLOC_CTX *frame = NULL;
if (last_time && (t < (last_time + REMOTE_ANNOUNCE_INTERVAL)))
return;
@@ -473,7 +474,8 @@ void announce_remote(time_t t)
comment = string_truncate(lp_serverstring(), MAX_SERVER_STRING_LENGTH);
- for (ptr=s; next_token(&ptr,s2,NULL,sizeof(s2)); ) {
+ frame = talloc_stackframe();
+ for (ptr=s; next_token_talloc(frame,&ptr,&s2,NULL); ) {
/* The entries are of the form a.b.c.d/WORKGROUP with
WORKGROUP being optional */
const char *wgroup;
@@ -510,6 +512,7 @@ void announce_remote(time_t t)
comment);
}
}
+ TALLOC_FREE(frame);
}
/****************************************************************************
@@ -522,12 +525,13 @@ void browse_sync_remote(time_t t)
char *s;
const char *ptr;
static time_t last_time = 0;
- fstring s2;
+ char *s2;
struct in_addr addr;
struct work_record *work;
char outbuf[1024];
char *p;
unstring myname;
+ TALLOC_CTX *frame = NULL;
if (last_time && (t < (last_time + REMOTE_ANNOUNCE_INTERVAL)))
return;
@@ -567,7 +571,8 @@ for workgroup %s on subnet %s.\n", lp_workgroup(), FIRST_SUBNET->subnet_name ));
p = skip_string(outbuf,sizeof(outbuf),p);
- for (ptr=s; next_token(&ptr,s2,NULL,sizeof(s2)); ) {
+ frame = talloc_stackframe();
+ for (ptr=s; next_token_talloc(frame,&ptr,&s2,NULL); ) {
/* The entries are of the form a.b.c.d */
(void)interpret_addr2(&addr,s2);
@@ -577,4 +582,5 @@ for workgroup %s on subnet %s.\n", lp_workgroup(), FIRST_SUBNET->subnet_name ));
send_mailslot(True, BROWSE_MAILSLOT, outbuf,PTR_DIFF(p,outbuf),
global_myname(), 0x0, "*", 0x0, addr, FIRST_SUBNET->myip, DGRAM_PORT);
}
+ TALLOC_FREE(frame);
}