summaryrefslogtreecommitdiff
path: root/source3/nmbd/nmbd_elections.c
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2002-11-12 23:20:50 +0000
committerJeremy Allison <jra@samba.org>2002-11-12 23:20:50 +0000
commit2f194322d419350f35a48dff750066894d68eccf (patch)
treeb0501eaf874ca8e740a51a8e0f29d261e32e0093 /source3/nmbd/nmbd_elections.c
parentf2b669b37fecda2687860eba4a15801dc89855dc (diff)
downloadsamba-2f194322d419350f35a48dff750066894d68eccf.tar.gz
Removed global_myworkgroup, global_myname, global_myscope. Added liberal
dashes of const. This is a rather large check-in, some things may break. It does compile though :-). Jeremy. (This used to be commit f755711df8f74f9b8e8c1a2b0d07d02a931eeb89)
Diffstat (limited to 'source3/nmbd/nmbd_elections.c')
-rw-r--r--source3/nmbd/nmbd_elections.c23
1 files changed, 10 insertions, 13 deletions
diff --git a/source3/nmbd/nmbd_elections.c b/source3/nmbd/nmbd_elections.c
index acff7a72e80..976abbed257 100644
--- a/source3/nmbd/nmbd_elections.c
+++ b/source3/nmbd/nmbd_elections.c
@@ -23,17 +23,14 @@
#include "includes.h"
-extern pstring global_myname;
-extern fstring global_myworkgroup;
-
/* Election parameters. */
extern time_t StartupTime;
/****************************************************************************
Send an election datagram packet.
**************************************************************************/
-static void send_election_dgram(struct subnet_record *subrec, char *workgroup_name,
- uint32 criterion, int timeup,char *server_name)
+static void send_election_dgram(struct subnet_record *subrec, const char *workgroup_name,
+ uint32 criterion, int timeup,const char *server_name)
{
pstring outbuf;
char *p;
@@ -55,7 +52,7 @@ static void send_election_dgram(struct subnet_record *subrec, char *workgroup_na
p = skip_string(p,1);
send_mailslot(False, BROWSE_MAILSLOT, outbuf, PTR_DIFF(p,outbuf),
- global_myname, 0,
+ global_myname(), 0,
workgroup_name, 0x1e,
subrec->bcast_ip, subrec->myip, DGRAM_PORT);
}
@@ -92,7 +89,7 @@ static void check_for_master_browser_fail( struct subnet_record *subrec,
return;
}
- if (strequal(work->work_group, global_myworkgroup))
+ if (strequal(work->work_group, lp_workgroup()))
{
if (lp_local_master())
@@ -128,7 +125,7 @@ void check_master_browser_exists(time_t t)
{
static time_t lastrun=0;
struct subnet_record *subrec;
- char *workgroup_name = global_myworkgroup;
+ const char *workgroup_name = lp_workgroup();
if (!lastrun)
lastrun = t;
@@ -198,7 +195,7 @@ yet registered on subnet %s\n", nmb_namestr(&nmbname), subrec->subnet_name ));
}
send_election_dgram(subrec, work->work_group, work->ElectionCriterion,
- t - StartupTime, global_myname);
+ t - StartupTime, global_myname());
if (work->ElectionCount++ >= 4)
{
@@ -238,7 +235,7 @@ static BOOL win_election(struct work_record *work, int version,
version, ELECTION_VERSION,
criterion, mycriterion,
timeup, mytimeup,
- server_name, global_myname));
+ server_name, global_myname()));
if (version > ELECTION_VERSION)
return(False);
@@ -255,7 +252,7 @@ static BOOL win_election(struct work_record *work, int version,
if (timeup < mytimeup)
return(True);
- if (strcasecmp(global_myname, server_name) > 0)
+ if (strcasecmp(global_myname(), server_name) > 0)
return(False);
return(True);
@@ -290,7 +287,7 @@ void process_election(struct subnet_record *subrec, struct packet_struct *p, cha
goto done;
}
- if (!strequal(work->work_group, global_myworkgroup))
+ if (!strequal(work->work_group, lp_workgroup()))
{
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 ));
@@ -396,7 +393,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, global_myworkgroup)) {
+ if (strequal(work->work_group, lp_workgroup())) {
work->needelection = True;
work->ElectionCount=0;
work->mst_state = lp_local_master() ? MST_POTENTIAL : MST_NONE;