summaryrefslogtreecommitdiff
path: root/source3/nmbd
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>1998-04-25 01:12:08 +0000
committerJeremy Allison <jra@samba.org>1998-04-25 01:12:08 +0000
commite7ac86607c80912e55ac7179b100cea22749c16f (patch)
tree257b85ec9e88be65c95cf82afb1f6e7c4c20e4c7 /source3/nmbd
parent9189005f7f884123d29c8f27db73687b68c80bb9 (diff)
downloadsamba-e7ac86607c80912e55ac7179b100cea22749c16f.tar.gz
samba-e7ac86607c80912e55ac7179b100cea22749c16f.tar.bz2
samba-e7ac86607c80912e55ac7179b100cea22749c16f.zip
This looks like a big change but really isn't.
It is changing the global variables "myname" and "myworkgroup" to "global_myname" and "global_myworkgroup" respectively. This is to make it very explicit when we are messing with a global (don't ask - it makes the domain client code much clearer :-). Jeremy. (This used to be commit 866406bfe399cf757c8275093dacd5ce4843afa0)
Diffstat (limited to 'source3/nmbd')
-rw-r--r--source3/nmbd/nmbd.c32
-rw-r--r--source3/nmbd/nmbd_become_dmb.c26
-rw-r--r--source3/nmbd/nmbd_become_lmb.c30
-rw-r--r--source3/nmbd/nmbd_browsesync.c12
-rw-r--r--source3/nmbd/nmbd_elections.c18
-rw-r--r--source3/nmbd/nmbd_incomingdgrams.c28
-rw-r--r--source3/nmbd/nmbd_incomingrequests.c16
-rw-r--r--source3/nmbd/nmbd_logonnames.c18
-rw-r--r--source3/nmbd/nmbd_mynames.c11
-rw-r--r--source3/nmbd/nmbd_nameregister.c4
-rw-r--r--source3/nmbd/nmbd_processlogon.c10
-rw-r--r--source3/nmbd/nmbd_responserecordsdb.c1
-rw-r--r--source3/nmbd/nmbd_sendannounce.c40
-rw-r--r--source3/nmbd/nmbd_serverlistdb.c15
-rw-r--r--source3/nmbd/nmbd_subnetdb.c1
-rw-r--r--source3/nmbd/nmbd_workgroupdb.c12
16 files changed, 135 insertions, 139 deletions
diff --git a/source3/nmbd/nmbd.c b/source3/nmbd/nmbd.c
index 5de1d3291d..512504b02d 100644
--- a/source3/nmbd/nmbd.c
+++ b/source3/nmbd/nmbd.c
@@ -40,8 +40,8 @@ int global_nmb_port = -1;
extern pstring myhostname;
static pstring host_file;
-extern pstring myname;
-extern fstring myworkgroup;
+extern pstring global_myname;
+extern fstring global_myworkgroup;
extern char **my_netbios_names;
extern BOOL global_in_nmbd;
@@ -450,23 +450,23 @@ static BOOL init_structs(void)
int nodup;
pstring nbname;
- if (! *myname)
+ if (! *global_myname)
{
- fstrcpy( myname, myhostname );
- p = strchr( myname, '.' );
+ fstrcpy( global_myname, myhostname );
+ p = strchr( global_myname, '.' );
if (p)
*p = 0;
}
- strupper( myname );
+ strupper( global_myname );
/* Add any NETBIOS name aliases. Ensure that the first entry
- is equal to myname.
+ is equal to global_myname.
*/
/* Work out the max number of netbios aliases that we have */
ptr = lp_netbios_aliases();
for( namecount=0; next_token(&ptr,nbname,NULL); namecount++ )
;
- if ( *myname )
+ if ( *global_myname )
namecount++;
/* Allocate space for the netbios aliases */
@@ -477,10 +477,10 @@ static BOOL init_structs(void)
return( False );
}
- /* Use the myname string first */
+ /* Use the global_myname string first */
namecount=0;
- if ( *myname )
- my_netbios_names[namecount++] = myname;
+ if ( *global_myname )
+ my_netbios_names[namecount++] = global_myname;
ptr = lp_netbios_aliases();
while ( next_token( &ptr, nbname, NULL ) )
@@ -508,7 +508,7 @@ static BOOL init_structs(void)
/* Terminate name list */
my_netbios_names[namecount++] = NULL;
- fstrcpy( local_machine, myname );
+ fstrcpy( local_machine, global_myname );
trim_string( local_machine, " ", " " );
p = strchr( local_machine, ' ' );
if (p)
@@ -615,8 +615,8 @@ int main(int argc,char *argv[])
pstrcpy(host_file,optarg);
break;
case 'n':
- pstrcpy(myname,optarg);
- strupper(myname);
+ pstrcpy(global_myname,optarg);
+ strupper(global_myname);
break;
case 'l':
sprintf(debugf,"%s.nmb",optarg);
@@ -674,9 +674,9 @@ int main(int argc,char *argv[])
reload_services( True );
- fstrcpy( myworkgroup, lp_workgroup() );
+ fstrcpy( global_myworkgroup, lp_workgroup() );
- if (strequal(myworkgroup,"*"))
+ if (strequal(global_myworkgroup,"*"))
{
DEBUG(0,("ERROR: a workgroup name of * is no longer supported\n"));
exit(1);
diff --git a/source3/nmbd/nmbd_become_dmb.c b/source3/nmbd/nmbd_become_dmb.c
index 52065758bc..d01bf18310 100644
--- a/source3/nmbd/nmbd_become_dmb.c
+++ b/source3/nmbd/nmbd_become_dmb.c
@@ -27,8 +27,8 @@
extern int DEBUGLEVEL;
extern pstring scope;
-extern pstring myname;
-extern fstring myworkgroup;
+extern pstring global_myname;
+extern fstring global_myworkgroup;
extern char **my_netbios_names;
extern struct in_addr ipzero;
extern struct in_addr allones_ip;
@@ -56,11 +56,11 @@ static void unbecome_dmb_success(struct subnet_record *subrec,
return;
}
- if((servrec = find_server_in_workgroup( work, myname)) == NULL)
+ if((servrec = find_server_in_workgroup( work, global_myname)) == NULL)
{
DEBUG(0,("unbecome_dmb_success: Error - cannot find server %s \
in workgroup %s on subnet %s\n",
- myname, released_name->name, subrec->subnet_name));
+ global_myname, released_name->name, subrec->subnet_name));
return;
}
@@ -82,7 +82,7 @@ in workgroup %s on subnet %s\n",
putip((char *)&work->dmb_addr, &ipzero);
DEBUG(0,("\n%s ***** Samba server %s has stopped being a domain master browser \
-for workgroup %s on subnet %s *****\n\n", timestring(), myname, work->work_group, subrec->subnet_name));
+for workgroup %s on subnet %s *****\n\n", timestring(), global_myname, work->work_group, subrec->subnet_name));
}
@@ -157,11 +157,11 @@ workgroup %s on subnet %s\n", fail_name->name, subrec->subnet_name));
/* Set the state back to DOMAIN_NONE. */
work->dom_state = DOMAIN_NONE;
- if((servrec = find_server_in_workgroup( work, myname)) == NULL)
+ if((servrec = find_server_in_workgroup( work, global_myname)) == NULL)
{
DEBUG(0,("become_domain_master_fail: Error - cannot find server %s \
in workgroup %s on subnet %s\n",
- myname, work->work_group, subrec->subnet_name));
+ global_myname, work->work_group, subrec->subnet_name));
return;
}
@@ -196,11 +196,11 @@ workgroup %s on subnet %s\n", registered_name->name, subrec->subnet_name));
return;
}
- if((servrec = find_server_in_workgroup( work, myname)) == NULL)
+ if((servrec = find_server_in_workgroup( work, global_myname)) == NULL)
{
DEBUG(0,("become_domain_master_stage2: Error - cannot find server %s \
in workgroup %s on subnet %s\n",
- myname, registered_name->name, subrec->subnet_name));
+ global_myname, registered_name->name, subrec->subnet_name));
work->dom_state = DOMAIN_NONE;
return;
}
@@ -215,7 +215,7 @@ in workgroup %s on subnet %s\n",
subrec->work_changed = True;
DEBUG(0,("\n%s ***** Samba server %s is now a domain master browser for \
-workgroup %s on subnet %s *****\n\n", timestring(),myname, work->work_group,
+workgroup %s on subnet %s *****\n\n", timestring(),global_myname, work->work_group,
subrec->subnet_name));
if(subrec == unicast_subnet)
@@ -228,7 +228,7 @@ subrec->subnet_name));
will stop us syncing with ourself if we are also
a local master browser. */
- make_nmb_name(&nmbname, myname, 0x20, scope);
+ make_nmb_name(&nmbname, global_myname, 0x20, scope);
work->dmb_name = nmbname;
/* Pick the first interface ip address as the domain master browser ip. */
@@ -464,9 +464,9 @@ void add_domain_names(time_t t)
1.9.16p2 to 1.9.16p11 - due to a bug in namelogon.c,
cannot provide domain master / domain logon services.
*/
- become_domain_master_browser_wins(myworkgroup);
+ become_domain_master_browser_wins(global_myworkgroup);
}
else
- become_domain_master_browser_bcast(myworkgroup);
+ become_domain_master_browser_bcast(global_myworkgroup);
}
}
diff --git a/source3/nmbd/nmbd_become_lmb.c b/source3/nmbd/nmbd_become_lmb.c
index b58244104d..c602789fb8 100644
--- a/source3/nmbd/nmbd_become_lmb.c
+++ b/source3/nmbd/nmbd_become_lmb.c
@@ -26,7 +26,7 @@
extern int DEBUGLEVEL;
extern pstring scope;
-extern pstring myname;
+extern pstring global_myname;
extern uint16 samba_nb_type; /* Samba's NetBIOS name type. */
@@ -90,11 +90,11 @@ subnet %s.\n", workgroup_name, subrec->subnet_name ));
return;
}
- if((servrec = find_server_in_workgroup( work, myname)) == NULL)
+ if((servrec = find_server_in_workgroup( work, global_myname)) == NULL)
{
DEBUG(0,("reset_workgroup_state: Error - cannot find server %s \
in workgroup %s on subnet %s\n",
- myname, work->work_group, subrec->subnet_name));
+ global_myname, work->work_group, subrec->subnet_name));
work->mst_state = lp_local_master() ? MST_POTENTIAL : MST_NONE;
return;
}
@@ -146,7 +146,7 @@ void unbecome_local_master_success(struct subnet_record *subrec,
reset_workgroup_state( subrec, released_name->name );
DEBUG(0,("\n%s ***** Samba name server %s has stopped being a local master browser for workgroup %s \
-on subnet %s *****\n\n", timestring(), myname, released_name->name, subrec->subnet_name));
+on subnet %s *****\n\n", timestring(), global_myname, released_name->name, subrec->subnet_name));
}
@@ -171,7 +171,7 @@ Removing from namelist anyway.\n", namestr(fail_name)));
reset_workgroup_state( subrec, fail_name->name );
DEBUG(0,("\n%s ***** Samba name server %s has stopped being a local master browser for workgroup %s \
-on subnet %s *****\n\n", timestring(), myname, fail_name->name, subrec->subnet_name));
+on subnet %s *****\n\n", timestring(), global_myname, fail_name->name, subrec->subnet_name));
}
@@ -254,11 +254,11 @@ void unbecome_local_master_browser(struct subnet_record *subrec, struct work_rec
DEBUG(2,("unbecome_local_master_browser: unbecoming local master for workgroup %s \
on subnet %s\n",work->work_group, subrec->subnet_name));
- if((servrec = find_server_in_workgroup( work, myname)) == NULL)
+ if((servrec = find_server_in_workgroup( work, global_myname)) == NULL)
{
DEBUG(0,("unbecome_local_master_browser: Error - cannot find server %s \
in workgroup %s on subnet %s\n",
- myname, work->work_group, subrec->subnet_name));
+ global_myname, work->work_group, subrec->subnet_name));
work->mst_state = lp_local_master() ? MST_POTENTIAL : MST_NONE;
return;
}
@@ -314,11 +314,11 @@ workgroup %s on subnet %s\n", registered_name->name, subrec->subnet_name));
return;
}
- if((servrec = find_server_in_workgroup( work, myname)) == NULL)
+ if((servrec = find_server_in_workgroup( work, global_myname)) == NULL)
{
DEBUG(0,("become_local_master_stage2: Error - cannot find server %s \
in workgroup %s on subnet %s\n",
- myname, registered_name->name, subrec->subnet_name));
+ global_myname, registered_name->name, subrec->subnet_name));
work->mst_state = lp_local_master() ? MST_POTENTIAL : MST_NONE;
return;
}
@@ -336,7 +336,7 @@ on subnet %s\n", work->work_group, subrec->subnet_name));
subrec->work_changed = True;
/* Add this name to the workgroup as local master browser. */
- set_workgroup_local_master_browser_name( work, myname);
+ set_workgroup_local_master_browser_name( work, global_myname);
/* Count the number of servers we have on our list. If it's
less than 10 (just a heuristic) request the servers
@@ -369,7 +369,7 @@ on subnet %s\n", work->work_group, subrec->subnet_name));
reset_announce_timer();
DEBUG(0,("\n%s ***** Samba name server %s is now a local master browser for workgroup %s \
-on subnet %s *****\n\n", timestring(), myname, work->work_group, subrec->subnet_name));
+on subnet %s *****\n\n", timestring(), global_myname, work->work_group, subrec->subnet_name));
}
@@ -456,11 +456,11 @@ workgroup %s on subnet %s\n", work_name, subrec->subnet_name));
return;
}
- if((servrec = find_server_in_workgroup(work, myname)) == NULL)
+ if((servrec = find_server_in_workgroup(work, global_myname)) == NULL)
{
DEBUG(0,("become_local_master_fail1: Error - cannot find server %s \
in workgroup %s on subnet %s\n",
- myname, work->work_group, subrec->subnet_name));
+ global_myname, work->work_group, subrec->subnet_name));
return;
}
@@ -499,11 +499,11 @@ void become_local_master_browser(struct subnet_record *subrec, struct work_recor
return;
}
- if((servrec = find_server_in_workgroup( work, myname)) == NULL)
+ if((servrec = find_server_in_workgroup( work, global_myname)) == NULL)
{
DEBUG(0,("become_local_master_browser: Error - cannot find server %s \
in workgroup %s on subnet %s\n",
- myname, work->work_group, subrec->subnet_name));
+ global_myname, work->work_group, subrec->subnet_name));
return;
}
diff --git a/source3/nmbd/nmbd_browsesync.c b/source3/nmbd/nmbd_browsesync.c
index 94bdecb8fc..c78fdfc514 100644
--- a/source3/nmbd/nmbd_browsesync.c
+++ b/source3/nmbd/nmbd_browsesync.c
@@ -28,8 +28,8 @@
extern int DEBUGLEVEL;
extern pstring scope;
extern struct in_addr ipzero;
-extern pstring myname;
-extern fstring myworkgroup;
+extern pstring global_myname;
+extern fstring global_myworkgroup;
/* This is our local master browser list database. */
extern struct browse_cache_record *lmb_browserlist;
@@ -244,7 +244,7 @@ Do not announce to ourselves.\n", work->work_group ));
CVAL(p,0) = ANN_MasterAnnouncement;
p++;
- StrnCpy(p,myname,15);
+ StrnCpy(p,global_myname,15);
strupper(p);
p = skip_string(p,1);
@@ -252,7 +252,7 @@ Do not announce to ourselves.\n", work->work_group ));
to %s for workgroup %s.\n", namestr(&work->dmb_name), work->work_group ));
send_mailslot(True, BROWSE_MAILSLOT, outbuf,PTR_DIFF(p,outbuf),
- myname, 0x0, work->dmb_name.name, 0x0, work->dmb_addr, FIRST_SUBNET->myip);
+ global_myname, 0x0, work->dmb_name.name, 0x0, work->dmb_addr, FIRST_SUBNET->myip);
}
@@ -640,10 +640,10 @@ void collect_all_workgroup_names_from_wins_server(time_t t)
return;
/* Check to see if we are a domain master browser on the unicast subnet. */
- if((work = find_workgroup_on_subnet( unicast_subnet, myworkgroup)) == NULL)
+ if((work = find_workgroup_on_subnet( unicast_subnet, global_myworkgroup)) == NULL)
{
DEBUG(0,("collect_all_workgroup_names_from_wins_server: Cannot find my workgroup %s on subnet %s.\n",
- myworkgroup, unicast_subnet->subnet_name ));
+ global_myworkgroup, unicast_subnet->subnet_name ));
return;
}
diff --git a/source3/nmbd/nmbd_elections.c b/source3/nmbd/nmbd_elections.c
index fa1e5986a8..569b653129 100644
--- a/source3/nmbd/nmbd_elections.c
+++ b/source3/nmbd/nmbd_elections.c
@@ -26,8 +26,8 @@
extern int DEBUGLEVEL;
-extern pstring myname;
-extern fstring myworkgroup;
+extern pstring global_myname;
+extern fstring global_myworkgroup;
/* Election parameters. */
extern time_t StartupTime;
@@ -95,7 +95,7 @@ static void check_for_master_browser_fail( struct subnet_record *subrec,
return;
}
- if (strequal(work->work_group, myworkgroup))
+ if (strequal(work->work_group, global_myworkgroup))
{
if (lp_local_master())
@@ -117,7 +117,7 @@ static void check_for_master_browser_fail( struct subnet_record *subrec,
not to become the local master, but we still need one,
having detected that one doesn't exist.
*/
- send_election_dgram(subrec, work->work_group, 0, 0, myname);
+ send_election_dgram(subrec, work->work_group, 0, 0, global_myname);
}
}
}
@@ -131,7 +131,7 @@ void check_master_browser_exists(time_t t)
{
static time_t lastrun=0;
struct subnet_record *subrec;
- char *workgroup_name = myworkgroup;
+ char *workgroup_name = global_myworkgroup;
if (!lastrun)
lastrun = t;
@@ -186,7 +186,7 @@ void run_elections(time_t t)
if (work->RunningElection)
{
send_election_dgram(subrec, work->work_group, work->ElectionCriterion,
- t - StartupTime, myname);
+ t - StartupTime, global_myname);
if (work->ElectionCount++ >= 4)
{
@@ -225,7 +225,7 @@ static BOOL win_election(struct work_record *work, int version,
version, ELECTION_VERSION,
criterion, mycriterion,
timeup, mytimeup,
- server_name, myname));
+ server_name, global_myname));
if (version > ELECTION_VERSION)
return(False);
@@ -242,7 +242,7 @@ static BOOL win_election(struct work_record *work, int version,
if (timeup < mytimeup)
return(True);
- if (strcasecmp(myname, server_name) > 0)
+ if (strcasecmp(global_myname, server_name) > 0)
return(False);
return(True);
@@ -276,7 +276,7 @@ void process_election(struct subnet_record *subrec, struct packet_struct *p, cha
return;
}
- if (!strequal(work->work_group, myworkgroup))
+ if (!strequal(work->work_group, global_myworkgroup))
{
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 ));
diff --git a/source3/nmbd/nmbd_incomingdgrams.c b/source3/nmbd/nmbd_incomingdgrams.c
index 80057ef12c..62dc444e0c 100644
--- a/source3/nmbd/nmbd_incomingdgrams.c
+++ b/source3/nmbd/nmbd_incomingdgrams.c
@@ -26,8 +26,8 @@
extern int DEBUGLEVEL;
-extern pstring myname;
-extern fstring myworkgroup;
+extern pstring global_myname;
+extern fstring global_myworkgroup;
extern BOOL found_lm_clients;
#if 0
@@ -143,8 +143,8 @@ void process_host_announce(struct subnet_record *subrec, struct packet_struct *p
* to be our primary workgroup name.
*/
- if(strequal(work_name, myname))
- work_name = myworkgroup;
+ if(strequal(work_name, global_myname))
+ work_name = global_myworkgroup;
/*
* We are being very agressive here in adding a workgroup
@@ -391,10 +391,10 @@ master - ignoring master announce.\n"));
return;
}
- if((work = find_workgroup_on_subnet(subrec, myworkgroup)) == NULL)
+ if((work = find_workgroup_on_subnet(subrec, global_myworkgroup)) == NULL)
{
DEBUG(0,("process_master_browser_announce: Cannot find workgroup %s on subnet %s\n",
- myworkgroup, subrec->subnet_name));
+ global_myworkgroup, subrec->subnet_name));
return;
}
@@ -481,8 +481,8 @@ originate from OS/2 Warp client. Ignoring packet.\n"));
* not needed in the LanMan announce code, but it won't hurt.
*/
- if(strequal(work_name, myname))
- work_name = myworkgroup;
+ if(strequal(work_name, global_myname))
+ work_name = global_myworkgroup;
/*
* We are being very agressive here in adding a workgroup
@@ -571,7 +571,7 @@ static void send_backup_list_response(struct subnet_record *subrec,
/* We always return at least one name - our own. */
count = 1;
- StrnCpy(p,myname,15);
+ StrnCpy(p,global_myname,15);
strupper(p);
p = skip_string(p,1);
@@ -585,7 +585,7 @@ static void send_backup_list_response(struct subnet_record *subrec,
if(count >= (unsigned int)max_number_requested)
break;
- if(strnequal(servrec->serv.name, myname,15))
+ if(strnequal(servrec->serv.name, global_myname,15))
continue;
if(!(servrec->serv.type & SV_TYPE_BACKUP_BROWSER))
@@ -610,7 +610,7 @@ static void send_backup_list_response(struct subnet_record *subrec,
send_mailslot(True, BROWSE_MAILSLOT,
outbuf,PTR_DIFF(p,outbuf),
- myname, 0,
+ global_myname, 0,
send_to_name->name,0,
sendto_ip, subrec->myip);
}
@@ -643,7 +643,7 @@ void process_get_backup_list_request(struct subnet_record *subrec,
for the requested workgroup. That means it must be our
workgroup. */
- if(strequal(workgroup_name, myworkgroup) == False)
+ if(strequal(workgroup_name, global_myworkgroup) == False)
{
DEBUG(7,("process_get_backup_list_request: Ignoring announce request for workgroup %s.\n",
workgroup_name));
@@ -769,7 +769,7 @@ void process_announce_request(struct subnet_record *subrec, struct packet_struct
namestr(&dgram->dest_name)));
/* We only send announcement requests on our workgroup. */
- if(strequal(workgroup_name, myworkgroup) == False)
+ if(strequal(workgroup_name, global_myworkgroup) == False)
{
DEBUG(7,("process_announce_request: Ignoring announce request for workgroup %s.\n",
workgroup_name));
@@ -806,7 +806,7 @@ void process_lm_announce_request(struct subnet_record *subrec, struct packet_str
namestr(&dgram->dest_name)));
/* We only send announcement requests on our workgroup. */
- if(strequal(workgroup_name, myworkgroup) == False)
+ if(strequal(workgroup_name, global_myworkgroup) == False)
{
DEBUG(7,("process_lm_announce_request: Ignoring announce request for workgroup %s.\n",
workgroup_name));
diff --git a/source3/nmbd/nmbd_incomingrequests.c b/source3/nmbd/nmbd_incomingrequests.c
index ae163c6014..e1c56f591f 100644
--- a/source3/nmbd/nmbd_incomingrequests.c
+++ b/source3/nmbd/nmbd_incomingrequests.c
@@ -29,7 +29,7 @@
#include "includes.h"
extern int DEBUGLEVEL;
-extern fstring myworkgroup;
+extern fstring global_myworkgroup;
/****************************************************************************
Send a name release response.
@@ -102,7 +102,7 @@ subnet %s from owner IP %s\n",
* names and *don't set the group bit* !!!!!
*/
- if( !group && !ismyip(owner_ip) && strequal(question->name, myworkgroup) &&
+ if( !group && !ismyip(owner_ip) && strequal(question->name, global_myworkgroup) &&
((question->name_type == 0x0) || (question->name_type == 0x1e)))
{
DEBUG(6,("process_name_release_request: FTP OnNet bug workaround. Ignoring \
@@ -290,20 +290,20 @@ We put our own names first, then in alphabetical order.
static int status_compare(char *n1,char *n2)
{
- extern pstring myname;
+ extern pstring global_myname;
int l1,l2,l3;
/* It's a bit tricky because the names are space padded */
for (l1=0;l1<15 && n1[l1] && n1[l1] != ' ';l1++) ;
for (l2=0;l2<15 && n2[l2] && n2[l2] != ' ';l2++) ;
- l3 = strlen(myname);
+ l3 = strlen(global_myname);
- if ((l1==l3) && strncmp(n1,myname,l3) == 0 &&
- (l2!=l3 || strncmp(n2,myname,l3) != 0))
+ if ((l1==l3) && strncmp(n1,global_myname,l3) == 0 &&
+ (l2!=l3 || strncmp(n2,global_myname,l3) != 0))
return -1;
- if ((l2==l3) && strncmp(n2,myname,l3) == 0 &&
- (l1!=l3 || strncmp(n1,myname,l3) != 0))
+ if ((l2==l3) && strncmp(n2,global_myname,l3) == 0 &&
+ (l1!=l3 || strncmp(n1,global_myname,l3) != 0))
return 1;
return memcmp(n1,n2,18);
diff --git a/source3/nmbd/nmbd_logonnames.c b/source3/nmbd/nmbd_logonnames.c
index 4128213f97..c5e2e6ca4f 100644
--- a/source3/nmbd/nmbd_logonnames.c
+++ b/source3/nmbd/nmbd_logonnames.c
@@ -27,8 +27,8 @@
extern int DEBUGLEVEL;
extern pstring scope;
-extern pstring myname;
-extern fstring myworkgroup;
+extern pstring global_myname;
+extern fstring global_myworkgroup;
extern char **my_netbios_names;
extern struct in_addr ipzero;
extern struct in_addr allones_ip;
@@ -52,11 +52,11 @@ workgroup %s on subnet %s\n", fail_name->name, subrec->subnet_name));
return;
}
- if((servrec = find_server_in_workgroup( work, myname)) == NULL)
+ if((servrec = find_server_in_workgroup( work, global_myname)) == NULL)
{
DEBUG(0,("become_logon_server_fail: Error - cannot find server %s \
in workgroup %s on subnet %s\n",
- myname, fail_name->name, subrec->subnet_name));
+ global_myname, fail_name->name, subrec->subnet_name));
work->log_state = LOGON_NONE;
return;
}
@@ -92,11 +92,11 @@ workgroup %s on subnet %s\n", registered_name->name, subrec->subnet_name));
return;
}
- if((servrec = find_server_in_workgroup( work, myname)) == NULL)
+ if((servrec = find_server_in_workgroup( work, global_myname)) == NULL)
{
DEBUG(0,("become_logon_server_success: Error - cannot find server %s \
in workgroup %s on subnet %s\n",
- myname, registered_name->name, subrec->subnet_name));
+ global_myname, registered_name->name, subrec->subnet_name));
work->log_state = LOGON_NONE;
return;
}
@@ -147,17 +147,17 @@ void add_logon_names(void)
for (subrec = FIRST_SUBNET; subrec; subrec = NEXT_SUBNET_INCLUDING_UNICAST(subrec))
{
- struct work_record *work = find_workgroup_on_subnet(subrec, myworkgroup);
+ struct work_record *work = find_workgroup_on_subnet(subrec, global_myworkgroup);
if (work && (work->log_state == LOGON_NONE))
{
struct nmb_name nmbname;
- make_nmb_name(&nmbname,myworkgroup,0x1c,scope);
+ make_nmb_name(&nmbname,global_myworkgroup,0x1c,scope);
if (find_name_on_subnet(subrec, &nmbname, FIND_SELF_NAME) == NULL)
{
DEBUG(0,("add_domain_logon_names: At time %s attempting to become \
-logon server for workgroup %s on subnet %s\n", timestring(), myworkgroup,
+logon server for workgroup %s on subnet %s\n", timestring(), global_myworkgroup,
subrec->subnet_name));
become_logon_server(subrec, work);
}
diff --git a/source3/nmbd/nmbd_mynames.c b/source3/nmbd/nmbd_mynames.c
index cf21fafd87..92ea3ea154 100644
--- a/source3/nmbd/nmbd_mynames.c
+++ b/source3/nmbd/nmbd_mynames.c
@@ -27,8 +27,7 @@
extern int DEBUGLEVEL;
extern char **my_netbios_names;
-extern pstring myname;
-extern fstring myworkgroup;
+extern fstring global_myworkgroup;
extern pstring scope;
extern uint16 samba_nb_type; /* Samba's NetBIOS type. */
@@ -58,10 +57,10 @@ BOOL register_my_workgroup_and_names(void)
for(subrec = FIRST_SUBNET; subrec; subrec = NEXT_SUBNET_INCLUDING_UNICAST(subrec))
{
/* Create the workgroup on the subnet. */
- if((work = create_workgroup_on_subnet(subrec, myworkgroup, PERMANENT_TTL)) == NULL)
+ if((work = create_workgroup_on_subnet(subrec, global_myworkgroup, PERMANENT_TTL)) == NULL)
{
DEBUG(0,("register_my_workgroup_and_names: Failed to create my workgroup %s on subnet %s. \
-Exiting.\n", myworkgroup, subrec->subnet_name));
+Exiting.\n", global_myworkgroup, subrec->subnet_name));
return False;
}
@@ -128,10 +127,10 @@ Exiting.\n", myworkgroup, subrec->subnet_name));
*/
struct nmb_name nmbname;
- make_nmb_name(&nmbname, myworkgroup, 0x0, scope);
+ make_nmb_name(&nmbname, global_myworkgroup, 0x0, scope);
insert_permanent_name_into_unicast(subrec, &nmbname, samba_nb_type|NB_GROUP);
- make_nmb_name(&nmbname, myworkgroup, 0x1e, scope);
+ make_nmb_name(&nmbname, global_myworkgroup, 0x1e, scope);
insert_permanent_name_into_unicast(subrec, &nmbname, samba_nb_type|NB_GROUP);
}
}
diff --git a/source3/nmbd/nmbd_nameregister.c b/source3/nmbd/nmbd_nameregister.c
index a3e4208cdc..8eae5e0f1c 100644
--- a/source3/nmbd/nmbd_nameregister.c
+++ b/source3/nmbd/nmbd_nameregister.c
@@ -27,7 +27,7 @@
extern int DEBUGLEVEL;
extern pstring scope;
-extern fstring myworkgroup;
+extern fstring global_myworkgroup;
/****************************************************************************
Deal with a response packet when registering one of our names.
@@ -73,7 +73,7 @@ name %s.\n", namestr(answer_name), namestr(question_name)));
*/
#if 1 /* OLD_SAMBA_SERVER_HACK */
- if((nmb->header.rcode == ACT_ERR) && strequal(myworkgroup, answer_name->name) &&
+ if((nmb->header.rcode == ACT_ERR) && strequal(global_myworkgroup, answer_name->name) &&
(answer_name->name_type == 0x1b))
{
/* Pretend we did not get this. */
diff --git a/source3/nmbd/nmbd_processlogon.c b/source3/nmbd/nmbd_processlogon.c
index bc9fcb5921..f647687db8 100644
--- a/source3/nmbd/nmbd_processlogon.c
+++ b/source3/nmbd/nmbd_processlogon.c
@@ -28,8 +28,8 @@
extern int DEBUGLEVEL;
-extern pstring myname;
-extern fstring myworkgroup;
+extern pstring global_myname;
+extern fstring global_myworkgroup;
/****************************************************************************
Process a domain logon packet
@@ -68,7 +68,7 @@ logons are not enabled.\n", inet_ntoa(p->ip) ));
return;
}
- strcpy(my_name, myname);
+ strcpy(my_name, global_myname);
strupper(my_name);
code = SVAL(buf,0);
@@ -145,7 +145,7 @@ logons are not enabled.\n", inet_ntoa(p->ip) ));
PutUniCode(q, my_name); /* PDC name */
q = skip_unicode_string(q, 1);
- PutUniCode(q, myworkgroup); /* Domain name*/
+ PutUniCode(q, global_myworkgroup); /* Domain name*/
q = skip_unicode_string(q, 1);
SIVAL(q, 0, ntversion); q += 4;
@@ -218,7 +218,7 @@ reporting %s domain %s 0x%x ntversion=%x lm_nt token=%x lm_20 token=%x\n",
else
{
DEBUG(3,("process_logon_packet: SAMLOGON request from %s(%s) for %s, returning logon svr %s domain %s code %x token=%x\n",
- unistr(unicomp),inet_ntoa(p->ip), ascuser, reply_name, myworkgroup,
+ unistr(unicomp),inet_ntoa(p->ip), ascuser, reply_name, global_myworkgroup,
SAMLOGON_R ,lmnttoken));
}
diff --git a/source3/nmbd/nmbd_responserecordsdb.c b/source3/nmbd/nmbd_responserecordsdb.c
index ceace36a61..6dae0d43e9 100644
--- a/source3/nmbd/nmbd_responserecordsdb.c
+++ b/source3/nmbd/nmbd_responserecordsdb.c
@@ -29,7 +29,6 @@ extern int ClientNMB;
extern int DEBUGLEVEL;
extern pstring scope;
-extern pstring myname;
extern struct in_addr ipzero;
int num_response_packets = 0;
diff --git a/source3/nmbd/nmbd_sendannounce.c b/source3/nmbd/nmbd_sendannounce.c
index 48072650c2..3936b7e92e 100644
--- a/source3/nmbd/nmbd_sendannounce.c
+++ b/source3/nmbd/nmbd_sendannounce.c
@@ -28,8 +28,8 @@
#include "includes.h"
extern int DEBUGLEVEL;
-extern pstring myname;
-extern fstring myworkgroup;
+extern pstring global_myname;
+extern fstring global_myworkgroup;
extern char **my_netbios_names;
extern int updatecount;
extern BOOL found_lm_clients;
@@ -54,7 +54,7 @@ void send_browser_reset(int reset_type, char *to_name, int to_type, struct in_ad
p++;
send_mailslot(True, BROWSE_MAILSLOT, outbuf,PTR_DIFF(p,outbuf),
- myname, 0x0, to_name, to_type, to_ip, FIRST_SUBNET->myip);
+ global_myname, 0x0, to_name, to_type, to_ip, FIRST_SUBNET->myip);
}
/****************************************************************************
@@ -79,12 +79,12 @@ to subnet %s\n", work->work_group, subrec->subnet_name));
CVAL(p,0) = work->token; /* (local) Unique workgroup token id. */
p++;
- StrnCpy(p,myname,15);
+ StrnCpy(p,global_myname,15);
strupper(p);
p = skip_string(p,1);
send_mailslot(False, BROWSE_MAILSLOT, outbuf,PTR_DIFF(p,outbuf),
- myname, 0x0, work->work_group,0x1e, subrec->bcast_ip, subrec->myip);
+ global_myname, 0x0, work->work_group,0x1e, subrec->bcast_ip, subrec->myip);
}
/****************************************************************************
@@ -169,14 +169,14 @@ static void send_local_master_announcement(struct subnet_record *subrec, struct
uint32 type = servrec->serv.type & ~SV_TYPE_LOCAL_LIST_ONLY;
DEBUG(3,("send_local_master_announcement: type %x for name %s on subnet %s for workgroup %s\n",
- type, myname, subrec->subnet_name, work->work_group));
+ type, global_myname, subrec->subnet_name, work->work_group));
send_announcement(subrec, ANN_LocalMasterAnnouncement,
- myname, /* From nbt name. */
+ global_myname, /* From nbt name. */
work->work_group, 0x1e, /* To nbt name. */
subrec->bcast_ip, /* To ip. */
work->announce_interval, /* Time until next announce. */
- myname, /* Name to announce. */
+ global_myname, /* Name to announce. */
type, /* Type field. */
servrec->serv.comment);
}
@@ -191,13 +191,13 @@ static void send_workgroup_announcement(struct subnet_record *subrec, struct wor
subrec->subnet_name, work->work_group));
send_announcement(subrec, ANN_DomainAnnouncement,
- myname, /* From nbt name. */
+ global_myname, /* From nbt name. */
MSBROWSE, 0x1, /* To nbt name. */
subrec->bcast_ip, /* To ip. */
work->announce_interval, /* Time until next announce. */
work->work_group, /* Name to announce. */
SV_TYPE_DOMAIN_ENUM|SV_TYPE_NT, /* workgroup announce flags. */
- myname); /* From name as comment. */
+ global_myname); /* From name as comment. */
}
/****************************************************************************
@@ -256,7 +256,7 @@ static void announce_server(struct subnet_record *subrec, struct work_record *wo
/* Only do domain announcements if we are a master and it's
our primary name we're being asked to announce. */
- if (AM_LOCAL_MASTER_BROWSER(work) && strequal(myname,servrec->serv.name))
+ if (AM_LOCAL_MASTER_BROWSER(work) && strequal(global_myname,servrec->serv.name))
{
send_local_master_announcement(subrec, work, servrec);
send_workgroup_announcement(subrec, work);
@@ -278,7 +278,7 @@ void announce_my_server_names(time_t t)
for (subrec = FIRST_SUBNET; subrec; subrec = NEXT_SUBNET_EXCLUDING_UNICAST(subrec))
{
- struct work_record *work = find_workgroup_on_subnet(subrec, myworkgroup);
+ struct work_record *work = find_workgroup_on_subnet(subrec, global_myworkgroup);
if(work)
{
@@ -342,7 +342,7 @@ void announce_my_lm_server_names(time_t t)
for (subrec = FIRST_SUBNET; subrec; subrec = NEXT_SUBNET_EXCLUDING_UNICAST(subrec))
{
- struct work_record *work = find_workgroup_on_subnet(subrec, myworkgroup);
+ struct work_record *work = find_workgroup_on_subnet(subrec, global_myworkgroup);
if(work)
{
@@ -512,7 +512,7 @@ void announce_remote(time_t t)
if (wgroup)
*wgroup++ = 0;
if (!wgroup || !*wgroup)
- wgroup = myworkgroup;
+ wgroup = global_myworkgroup;
addr = *interpret_addr2(s2);
@@ -568,17 +568,17 @@ void browse_sync_remote(time_t t)
* for our workgroup on the firsst subnet.
*/
- if((work = find_workgroup_on_subnet(FIRST_SUBNET, myworkgroup)) == NULL)
+ if((work = find_workgroup_on_subnet(FIRST_SUBNET, global_myworkgroup)) == NULL)
{
DEBUG(0,("browse_sync_remote: Cannot find workgroup %s on subnet %s\n",
- myworkgroup, FIRST_SUBNET->subnet_name ));
+ global_myworkgroup, FIRST_SUBNET->subnet_name ));
return;
}
if(!AM_LOCAL_MASTER_BROWSER(work))
{
DEBUG(5,("browse_sync_remote: We can only do this if we are a local master browser \
-for workgroup %s on subnet %s.\n", myworkgroup, FIRST_SUBNET->subnet_name ));
+for workgroup %s on subnet %s.\n", global_myworkgroup, FIRST_SUBNET->subnet_name ));
return;
}
@@ -587,7 +587,7 @@ for workgroup %s on subnet %s.\n", myworkgroup, FIRST_SUBNET->subnet_name ));
CVAL(p,0) = ANN_MasterAnnouncement;
p++;
- StrnCpy(p,myname,15);
+ StrnCpy(p,global_myname,15);
strupper(p);
p = skip_string(p,1);
@@ -597,9 +597,9 @@ for workgroup %s on subnet %s.\n", myworkgroup, FIRST_SUBNET->subnet_name ));
addr = *interpret_addr2(s2);
DEBUG(5,("announce_remote: Doing remote browse sync announce for server %s to IP %s.\n",
- myname, inet_ntoa(addr) ));
+ global_myname, inet_ntoa(addr) ));
send_mailslot(True, BROWSE_MAILSLOT, outbuf,PTR_DIFF(p,outbuf),
- myname, 0x0, "*", 0x0, addr, FIRST_SUBNET->myip);
+ global_myname, 0x0, "*", 0x0, addr, FIRST_SUBNET->myip);
}
}
diff --git a/source3/nmbd/nmbd_serverlistdb.c b/source3/nmbd/nmbd_serverlistdb.c
index e94cb1da6e..ea1948cece 100644
--- a/source3/nmbd/nmbd_serverlistdb.c
+++ b/source3/nmbd/nmbd_serverlistdb.c
@@ -29,8 +29,7 @@ extern int ClientNMB;
extern int DEBUGLEVEL;
-extern pstring myname;
-extern fstring myworkgroup;
+extern fstring global_myworkgroup;
extern char **my_netbios_names;
int updatecount = 0;
@@ -259,7 +258,7 @@ static uint32 write_this_server_name( struct subnet_record *subrec,
/*******************************************************************
Decide if we should write out a workgroup record for this workgroup.
- We return zero if we should not. Don't write out myworkgroup (we've
+ We return zero if we should not. Don't write out global_myworkgroup (we've
already done it) and also don't write out a second workgroup record
on the unicast subnet that we've already written out on one of the
broadcast subnets.
@@ -270,7 +269,7 @@ static uint32 write_this_workgroup_name( struct subnet_record *subrec,
{
struct subnet_record *ssub;
- if(strequal(myworkgroup, work->work_group))
+ if(strequal(global_myworkgroup, work->work_group))
return 0;
/* This is a workgroup we have seen on a broadcast subnet. All
@@ -358,10 +357,10 @@ void write_browse_list(time_t t, BOOL force_write)
* subnet.
*/
- if((work = find_workgroup_on_subnet(FIRST_SUBNET, myworkgroup)) == NULL)
+ if((work = find_workgroup_on_subnet(FIRST_SUBNET, global_myworkgroup)) == NULL)
{
DEBUG(0,("write_browse_list: Fatal error - cannot find my workgroup %s\n",
- myworkgroup));
+ global_myworkgroup));
fclose(fp);
return;
}
@@ -386,7 +385,7 @@ void write_browse_list(time_t t, BOOL force_write)
stype = 0;
for (subrec = FIRST_SUBNET; subrec ; subrec = NEXT_SUBNET_INCLUDING_UNICAST(subrec))
{
- if((work = find_workgroup_on_subnet( subrec, myworkgroup )) == NULL)
+ if((work = find_workgroup_on_subnet( subrec, global_myworkgroup )) == NULL)
continue;
if((servrec = find_server_in_workgroup( work, my_netbios_names[i])) == NULL)
continue;
@@ -400,7 +399,7 @@ void write_browse_list(time_t t, BOOL force_write)
fprintf(fp, "%08x ", stype);
sprintf(tmp, "\"%s\" ", lp_serverstring());
fprintf(fp, "%-30s", tmp);
- fprintf(fp, "\"%s\"\n", myworkgroup);
+ fprintf(fp, "\"%s\"\n", global_myworkgroup);
}
for (subrec = FIRST_SUBNET; subrec ; subrec = NEXT_SUBNET_INCLUDING_UNICAST(subrec))
diff --git a/source3/nmbd/nmbd_subnetdb.c b/source3/nmbd/nmbd_subnetdb.c
index d8e8dd4ab9..34287bbe69 100644
--- a/source3/nmbd/nmbd_subnetdb.c
+++ b/source3/nmbd/nmbd_subnetdb.c
@@ -33,7 +33,6 @@ extern int global_nmb_port;
extern int DEBUGLEVEL;
-extern pstring myname;
extern fstring myworkgroup;
extern char **my_netbios_names;
extern struct in_addr ipzero;
diff --git a/source3/nmbd/nmbd_workgroupdb.c b/source3/nmbd/nmbd_workgroupdb.c
index b834525747..0b392680df 100644
--- a/source3/nmbd/nmbd_workgroupdb.c
+++ b/source3/nmbd/nmbd_workgroupdb.c
@@ -29,8 +29,8 @@ extern int ClientNMB;
extern int DEBUGLEVEL;
-extern pstring myname;
-extern fstring myworkgroup;
+extern pstring global_myname;
+extern fstring global_myworkgroup;
extern char **my_netbios_names;
extern uint16 samba_nb_type;
extern struct in_addr ipzero;
@@ -246,7 +246,7 @@ void initiate_myworkgroup_startup(struct subnet_record *subrec, struct work_reco
{
int i;
- if(!strequal(myworkgroup, work->work_group))
+ if(!strequal(global_myworkgroup, work->work_group))
return;
/* If this is a broadcast subnet then start elections on it
@@ -264,11 +264,11 @@ workgroup %s on subnet %s\n", work->work_group, subrec->subnet_name));
/* Register the WORKGROUP<0> and WORKGROUP<1e> names on the network. */
- register_name(subrec,myworkgroup,0x0,samba_nb_type|NB_GROUP,
+ register_name(subrec,global_myworkgroup,0x0,samba_nb_type|NB_GROUP,
NULL,
fail_register,NULL);
- register_name(subrec,myworkgroup,0x1e,samba_nb_type|NB_GROUP,
+ register_name(subrec,global_myworkgroup,0x1e,samba_nb_type|NB_GROUP,
NULL,
fail_register,NULL);
@@ -278,7 +278,7 @@ workgroup %s on subnet %s\n", work->work_group, subrec->subnet_name));
int stype = lp_default_server_announce() | (lp_local_master() ?
SV_TYPE_POTENTIAL_BROWSER : 0 );
- if(!strequal(myname, name))
+ if(!strequal(global_myname, name))
stype &= ~(SV_TYPE_MASTER_BROWSER|SV_TYPE_POTENTIAL_BROWSER|
SV_TYPE_DOMAIN_MASTER|SV_TYPE_DOMAIN_MEMBER);