summaryrefslogtreecommitdiff
path: root/source3/nmbd
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2003-08-27 18:00:09 +0000
committerJeremy Allison <jra@samba.org>2003-08-27 18:00:09 +0000
commit8dc1a4f30066f7cc25ab6b775b24f32ba275d78e (patch)
treeffddb657a9c0dd56e9153729f95d3d2941bcd2a4 /source3/nmbd
parent4561b811df8b858fd7fbedeb534aa715d66a9005 (diff)
downloadsamba-8dc1a4f30066f7cc25ab6b775b24f32ba275d78e.tar.gz
samba-8dc1a4f30066f7cc25ab6b775b24f32ba275d78e.tar.bz2
samba-8dc1a4f30066f7cc25ab6b775b24f32ba275d78e.zip
Ensure we use correct length nstrings for workgroup and browser names.
Jeremy. (This used to be commit be534c8adf6c3cb8921ce49dbb79991c632d501e)
Diffstat (limited to 'source3/nmbd')
-rw-r--r--source3/nmbd/nmbd_become_lmb.c2
-rw-r--r--source3/nmbd/nmbd_browserdb.c4
-rw-r--r--source3/nmbd/nmbd_browsesync.c6
-rw-r--r--source3/nmbd/nmbd_elections.c8
-rw-r--r--source3/nmbd/nmbd_serverlistdb.c2
-rw-r--r--source3/nmbd/nmbd_synclists.c11
-rw-r--r--source3/nmbd/nmbd_workgroupdb.c8
7 files changed, 20 insertions, 21 deletions
diff --git a/source3/nmbd/nmbd_become_lmb.c b/source3/nmbd/nmbd_become_lmb.c
index a6ae1ce42e..2370c7ba36 100644
--- a/source3/nmbd/nmbd_become_lmb.c
+++ b/source3/nmbd/nmbd_become_lmb.c
@@ -590,5 +590,5 @@ local_master_browser_name for workgroup %s to workgroup name.\n",
}
#endif
- fstrcpy(work->local_master_browser_name, newname);
+ nstrcpy(work->local_master_browser_name, newname);
}
diff --git a/source3/nmbd/nmbd_browserdb.c b/source3/nmbd/nmbd_browserdb.c
index 83dfba66e9..443edf599d 100644
--- a/source3/nmbd/nmbd_browserdb.c
+++ b/source3/nmbd/nmbd_browserdb.c
@@ -106,8 +106,8 @@ struct browse_cache_record *create_browser_in_lmb_cache( const char *work_name,
/* Allow the new lmb to miss an announce period before we remove it. */
browc->death_time = now + ( (CHECK_TIME_MST_ANNOUNCE + 2) * 60 );
- pstrcpy( browc->lmb_name, browser_name);
- pstrcpy( browc->work_group, work_name);
+ nstrcpy( browc->lmb_name, browser_name);
+ nstrcpy( browc->work_group, work_name);
strupper_m( browc->lmb_name );
strupper_m( browc->work_group );
diff --git a/source3/nmbd/nmbd_browsesync.c b/source3/nmbd/nmbd_browsesync.c
index 95e542354f..96e8fd1b81 100644
--- a/source3/nmbd/nmbd_browsesync.c
+++ b/source3/nmbd/nmbd_browsesync.c
@@ -460,7 +460,7 @@ static void get_domain_master_name_node_status_success(struct subnet_record *sub
return;
/* remember who the master is */
- fstrcpy(work->local_master_browser_name, server_name);
+ nstrcpy(work->local_master_browser_name, server_name);
make_nmb_name(&nmbname, server_name, 0x20);
work->dmb_name = nmbname;
work->dmb_addr = from_ip;
@@ -639,14 +639,14 @@ void sync_all_dmbs(time_t t)
/* count how many syncs we might need to do */
for (work=unicast_subnet->workgrouplist; work; work = work->next) {
- if (strcmp(lp_workgroup(), work->work_group)) {
+ if (strncmp(lp_workgroup(), work->work_group, sizeof(nstring))) {
count++;
}
}
/* sync with a probability of 1/count */
for (work=unicast_subnet->workgrouplist; work; work = work->next) {
- if (strcmp(lp_workgroup(), work->work_group)) {
+ if (strncmp(lp_workgroup(), work->work_group, sizeof(nstring))) {
nstring dmb_name;
if (((unsigned)sys_random()) % count != 0)
diff --git a/source3/nmbd/nmbd_elections.c b/source3/nmbd/nmbd_elections.c
index d4d6da081a..e341f6f7fb 100644
--- a/source3/nmbd/nmbd_elections.c
+++ b/source3/nmbd/nmbd_elections.c
@@ -97,7 +97,7 @@ static void check_for_master_browser_fail( struct subnet_record *subrec,
return;
}
- if (strequal(work->work_group, lp_workgroup())) {
+ if (strnequal(work->work_group, lp_workgroup(), sizeof(nstring))) {
if (lp_local_master()) {
/* We have discovered that there is no local master
@@ -145,7 +145,7 @@ void check_master_browser_exists(time_t t)
struct work_record *work;
for (work = subrec->workgrouplist; work; work = work->next) {
- if (strequal(work->work_group, workgroup_name) && !AM_LOCAL_MASTER_BROWSER(work)) {
+ if (strnequal(work->work_group, workgroup_name, sizeof(nstring)) && !AM_LOCAL_MASTER_BROWSER(work)) {
/* Do a name query for the local master browser on this net. */
query_name( subrec, work->work_group, 0x1d,
check_for_master_browser_success,
@@ -284,7 +284,7 @@ void process_election(struct subnet_record *subrec, struct packet_struct *p, cha
goto done;
}
- if (!strequal(work->work_group, lp_workgroup())) {
+ if (!strnequal(work->work_group, lp_workgroup(), sizeof(nstring))) {
DEBUG(3,("process_election: ignoring election request for workgroup %s on subnet %s as this \
is not my workgroup.\n", work->work_group, subrec->subnet_name ));
goto done;
@@ -381,7 +381,7 @@ void nmbd_message_election(int msg_type, pid_t src, void *buf, size_t len)
for (subrec = FIRST_SUBNET; subrec; subrec = NEXT_SUBNET_EXCLUDING_UNICAST(subrec)) {
struct work_record *work;
for (work = subrec->workgrouplist; work; work = work->next) {
- if (strequal(work->work_group, lp_workgroup())) {
+ if (strnequal(work->work_group, lp_workgroup(), sizeof(nstring))) {
work->needelection = True;
work->ElectionCount=0;
work->mst_state = lp_local_master() ? MST_POTENTIAL : MST_NONE;
diff --git a/source3/nmbd/nmbd_serverlistdb.c b/source3/nmbd/nmbd_serverlistdb.c
index b4c6e2902d..ecde45cfb9 100644
--- a/source3/nmbd/nmbd_serverlistdb.c
+++ b/source3/nmbd/nmbd_serverlistdb.c
@@ -251,7 +251,7 @@ static uint32 write_this_workgroup_name( struct subnet_record *subrec,
{
struct subnet_record *ssub;
- if(strequal(lp_workgroup(), work->work_group))
+ if(strnequal(lp_workgroup(), work->work_group, sizeof(nstring)))
return 0;
/* This is a workgroup we have seen on a broadcast subnet. All
diff --git a/source3/nmbd/nmbd_synclists.c b/source3/nmbd/nmbd_synclists.c
index 337c2f9468..6a0576a5a4 100644
--- a/source3/nmbd/nmbd_synclists.c
+++ b/source3/nmbd/nmbd_synclists.c
@@ -31,8 +31,8 @@
struct sync_record {
struct sync_record *next, *prev;
- fstring workgroup;
- fstring server;
+ nstring workgroup;
+ nstring server;
pstring fname;
struct in_addr ip;
pid_t pid;
@@ -148,8 +148,8 @@ done:
ZERO_STRUCTP(s);
- fstrcpy(s->workgroup, work->work_group);
- fstrcpy(s->server, name);
+ nstrcpy(s->workgroup, work->work_group);
+ nstrcpy(s->server, name);
s->ip = ip;
slprintf(s->fname, sizeof(pstring)-1,
@@ -206,8 +206,7 @@ static void complete_one(struct sync_record *s,
sname, lp_max_ttl());
if (work) {
/* remember who the master is */
- fstrcpy(work->local_master_browser_name,
- comment);
+ nstrcpy(work->local_master_browser_name, comment);
}
}
return;
diff --git a/source3/nmbd/nmbd_workgroupdb.c b/source3/nmbd/nmbd_workgroupdb.c
index 08d6fb2c62..c957b517cf 100644
--- a/source3/nmbd/nmbd_workgroupdb.c
+++ b/source3/nmbd/nmbd_workgroupdb.c
@@ -56,7 +56,7 @@ static struct work_record *create_workgroup(const char *name, int ttl)
}
memset((char *)work, '\0', sizeof(*work));
- fstrcpy(work->work_group,name);
+ nstrcpy(work->work_group,name);
work->serverlist = NULL;
work->RunningElection = False;
@@ -76,7 +76,7 @@ static struct work_record *create_workgroup(const char *name, int ttl)
for (subrec = FIRST_SUBNET; subrec && (t == -1); subrec = NEXT_SUBNET_INCLUDING_UNICAST(subrec)) {
struct work_record *w;
for (w = subrec->workgrouplist; w && t == -1; w = w->next) {
- if (strequal(w->work_group, work->work_group))
+ if (strnequal(w->work_group, work->work_group, sizeof(nstring)))
t = w->token;
}
}
@@ -150,7 +150,7 @@ struct work_record *find_workgroup_on_subnet(struct subnet_record *subrec,
name, subrec->subnet_name));
for (ret = subrec->workgrouplist; ret; ret = ret->next) {
- if (strequal(ret->work_group,name)) {
+ if (strnequal(ret->work_group,name,sizeof(nstring))) {
DEBUGADD(4, ("found.\n"));
return(ret);
}
@@ -211,7 +211,7 @@ void initiate_myworkgroup_startup(struct subnet_record *subrec, struct work_reco
{
int i;
- if(!strequal(lp_workgroup(), work->work_group))
+ if(!strnequal(lp_workgroup(), work->work_group,sizeof(nstring)))
return;
/* If this is a broadcast subnet then start elections on it if we are so configured. */