summaryrefslogtreecommitdiff
path: root/source3/nmbd
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2000-01-07 06:55:36 +0000
committerAndrew Tridgell <tridge@samba.org>2000-01-07 06:55:36 +0000
commit171da4d78736730557a94b44af9f2d62081b80ba (patch)
treead74341f9d50a521baec09c65637b81b150a0891 /source3/nmbd
parent102e44e446035bdcc7611b8b556d0e20978fbb80 (diff)
downloadsamba-171da4d78736730557a94b44af9f2d62081b80ba.tar.gz
samba-171da4d78736730557a94b44af9f2d62081b80ba.tar.bz2
samba-171da4d78736730557a94b44af9f2d62081b80ba.zip
this looks like a big commit, but it isn't really :)
This fixes our netbios scope handling. We now have a 'netbios scope' option in smb.conf and the scope option is removed from make_nmb_name() this was prompted by a bug in our PDC finding code where it didn't append the scope to the query of the '*' name. (This used to be commit b563be824b8c3141c49558eced7829b48d4ab26f)
Diffstat (limited to 'source3/nmbd')
-rw-r--r--source3/nmbd/nmbd.c11
-rw-r--r--source3/nmbd/nmbd_become_dmb.c7
-rw-r--r--source3/nmbd/nmbd_become_lmb.c7
-rw-r--r--source3/nmbd/nmbd_browsesync.c17
-rw-r--r--source3/nmbd/nmbd_elections.c6
-rw-r--r--source3/nmbd/nmbd_logonnames.c3
-rw-r--r--source3/nmbd/nmbd_mynames.c11
-rw-r--r--source3/nmbd/nmbd_namelistdb.c5
-rw-r--r--source3/nmbd/nmbd_namequery.c6
-rw-r--r--source3/nmbd/nmbd_nameregister.c3
-rw-r--r--source3/nmbd/nmbd_namerelease.c2
-rw-r--r--source3/nmbd/nmbd_nodestatus.c2
-rw-r--r--source3/nmbd/nmbd_packets.c15
-rw-r--r--source3/nmbd/nmbd_responserecordsdb.c1
-rw-r--r--source3/nmbd/nmbd_synclists.c5
15 files changed, 38 insertions, 63 deletions
diff --git a/source3/nmbd/nmbd.c b/source3/nmbd/nmbd.c
index 5bb3d7fc00..cf472d579d 100644
--- a/source3/nmbd/nmbd.c
+++ b/source3/nmbd/nmbd.c
@@ -32,8 +32,6 @@ extern int DEBUGLEVEL;
extern pstring debugf;
pstring servicesf = CONFIGFILE;
-extern pstring scope;
-
int ClientNMB = -1;
int ClientDGRAM = -1;
int global_nmb_port = -1;
@@ -606,7 +604,7 @@ static void usage(char *pname)
{
printf( "Usage: %s [-DaohV] [-H lmhosts file] [-d debuglevel] [-l log basename]\n", pname );
- printf( " [-n name] [-p port] [-s configuration file] [-i scope]\n" );
+ printf( " [-n name] [-p port] [-s configuration file]\n" );
printf( "\t-D Become a daemon\n" );
printf( "\t-a Append to log file (default)\n" );
printf( "\t-o Overwrite log file, don't append\n" );
@@ -618,7 +616,6 @@ static void usage(char *pname)
printf( "\t-n netbiosname. Primary netbios name\n" );
printf( "\t-p port Listen on the specified port\n" );
printf( "\t-s configuration file Configuration file name\n" );
- printf( "\t-i scope NetBIOS scope\n" );
printf( "\n");
} /* usage */
@@ -686,7 +683,7 @@ static void usage(char *pname)
#endif /* SIGUSR2 */
while( EOF !=
- (opt = getopt( argc, argv, "Vaos:T:I:C:bAi:B:N:Rn:l:d:Dp:hSH:G:f:" )) )
+ (opt = getopt( argc, argv, "Vaos:T:I:C:bAB:N:Rn:l:d:Dp:hSH:G:f:" )) )
{
switch (opt)
{
@@ -710,10 +707,6 @@ static void usage(char *pname)
case 'l':
slprintf(debugf,sizeof(debugf)-1, "%s.nmb",optarg);
break;
- case 'i':
- pstrcpy(scope,optarg);
- strupper(scope);
- break;
case 'a':
append_log = True;
break;
diff --git a/source3/nmbd/nmbd_become_dmb.c b/source3/nmbd/nmbd_become_dmb.c
index ae809607dc..76d92c2f3e 100644
--- a/source3/nmbd/nmbd_become_dmb.c
+++ b/source3/nmbd/nmbd_become_dmb.c
@@ -26,7 +26,6 @@
extern int DEBUGLEVEL;
-extern pstring scope;
extern pstring global_myname;
extern fstring global_myworkgroup;
extern char **my_netbios_names;
@@ -133,7 +132,7 @@ in workgroup %s on subnet %s\n",
will stop us syncing with ourself if we are also
a local master browser. */
- make_nmb_name(&nmbname, global_myname, 0x20, scope);
+ make_nmb_name(&nmbname, global_myname, 0x20);
work->dmb_name = nmbname;
/* Pick the first interface ip address as the domain master browser ip. */
@@ -282,7 +281,7 @@ static void become_domain_master_browser_bcast(char *workgroup_name)
if (work && (work->dom_state == DOMAIN_NONE))
{
struct nmb_name nmbname;
- make_nmb_name(&nmbname,workgroup_name,0x1b,scope);
+ make_nmb_name(&nmbname,workgroup_name,0x1b);
/*
* Check for our name on the given broadcast subnet first, only initiate
@@ -330,7 +329,7 @@ static void become_domain_master_browser_wins(char *workgroup_name)
{
struct nmb_name nmbname;
- make_nmb_name(&nmbname,workgroup_name,0x1b,scope);
+ make_nmb_name(&nmbname,workgroup_name,0x1b);
/*
* Check for our name on the unicast subnet first, only initiate
diff --git a/source3/nmbd/nmbd_become_lmb.c b/source3/nmbd/nmbd_become_lmb.c
index f3fa69132e..31c67ae7f3 100644
--- a/source3/nmbd/nmbd_become_lmb.c
+++ b/source3/nmbd/nmbd_become_lmb.c
@@ -25,7 +25,6 @@
#include "includes.h"
extern int DEBUGLEVEL;
-extern pstring scope;
extern pstring global_myname;
extern uint16 samba_nb_type; /* Samba's NetBIOS name type. */
@@ -126,7 +125,7 @@ in workgroup %s on subnet %s\n",
* master browser.
*/
- make_nmb_name(&nmbname, work->work_group, 0x1d, scope);
+ make_nmb_name(&nmbname, work->work_group, 0x1d);
remove_permanent_name_from_unicast( subrec, &nmbname);
@@ -208,7 +207,7 @@ static void release_1d_name( struct subnet_record *subrec, char *workgroup_name,
struct nmb_name nmbname;
struct name_record *namerec;
- make_nmb_name(&nmbname, workgroup_name, 0x1d, scope);
+ make_nmb_name(&nmbname, workgroup_name, 0x1d);
if((namerec = find_name_on_subnet( subrec, &nmbname, FIND_SELF_NAME))!=NULL)
{
struct userdata_struct *userdata;
@@ -308,7 +307,7 @@ in workgroup %s on subnet %s\n",
release_1d_name( subrec, work->work_group, force_new_election);
/* Deregister any browser names we may have. */
- make_nmb_name(&nmbname, MSBROWSE, 0x1, scope);
+ make_nmb_name(&nmbname, MSBROWSE, 0x1);
if((namerec = find_name_on_subnet( subrec, &nmbname, FIND_SELF_NAME))!=NULL)
{
release_name(subrec, namerec,
diff --git a/source3/nmbd/nmbd_browsesync.c b/source3/nmbd/nmbd_browsesync.c
index b177fb524e..23ca0a398f 100644
--- a/source3/nmbd/nmbd_browsesync.c
+++ b/source3/nmbd/nmbd_browsesync.c
@@ -26,7 +26,6 @@
#include "smb.h"
extern int DEBUGLEVEL;
-extern pstring scope;
extern struct in_addr ipzero;
extern pstring global_myname;
extern fstring global_myworkgroup;
@@ -226,7 +225,7 @@ static void domain_master_node_status_success(struct subnet_record *subrec,
{
struct nmb_name nmbname;
- make_nmb_name(&nmbname, qname, name_type, scope);
+ make_nmb_name(&nmbname, qname, name_type);
/* Copy the dmb name and IP address
into the workgroup struct. */
@@ -324,8 +323,7 @@ static void find_domain_master_name_query_success(struct subnet_record *subrec,
putip((char *)&work->dmb_addr, &ipzero);
/* Now initiate the node status request. */
- memset((char *)&nmbname, '\0',sizeof(nmbname));
- nmbname.name[0] = '*';
+ make_nmb_name(&nmbname,"*",0x0);
/* Put the workgroup name into the userdata so we know
what workgroup we're talking to when the reply comes
@@ -391,7 +389,7 @@ void announce_and_sync_with_domain_master_browser( struct subnet_record *subrec,
return;
}
- make_nmb_name(&nmbname,work->work_group,0x1b,scope);
+ make_nmb_name(&nmbname,work->work_group,0x1b);
/* First, query for the WORKGROUP<1b> name from the WINS server. */
query_name(unicast_subnet, nmbname.name, nmbname.name_type,
@@ -486,7 +484,7 @@ static void get_domain_master_name_node_status_success(struct subnet_record *sub
/* remember who the master is */
fstrcpy(work->local_master_browser_name, server_name);
- make_nmb_name(&nmbname, server_name, 0x20, scope);
+ make_nmb_name(&nmbname, server_name, 0x20);
work->dmb_name = nmbname;
work->dmb_addr = from_ip;
}
@@ -549,8 +547,7 @@ static void find_all_domain_master_names_query_success(struct subnet_record *sub
for(i = 0; i < rrec->rdlength / 6; i++)
{
/* Initiate the node status requests. */
- memset((char *)&nmbname, '\0', sizeof(nmbname));
- nmbname.name[0] = '*';
+ make_nmb_name(&nmbname, "*", 0);
putip((char *)&send_ip, (char *)&rrec->rdata[(i*6) + 2]);
@@ -636,7 +633,7 @@ void collect_all_workgroup_names_from_wins_server(time_t t)
lastrun = t;
- make_nmb_name(&nmbname,"*",0x1b,scope);
+ make_nmb_name(&nmbname,"*",0x1b);
/* First, query for the *<1b> name from the WINS server. */
query_name(unicast_subnet, nmbname.name, nmbname.name_type,
@@ -694,7 +691,7 @@ void sync_all_dmbs(time_t t)
the same as the unicast local master */
make_nmb_name(&work->dmb_name,
work->local_master_browser_name,
- 0x20, scope);
+ 0x20);
}
DEBUG(3,("Initiating DMB<->DMB sync with %s(%s)\n",
diff --git a/source3/nmbd/nmbd_elections.c b/source3/nmbd/nmbd_elections.c
index 8e1605dbba..be38b572f6 100644
--- a/source3/nmbd/nmbd_elections.c
+++ b/source3/nmbd/nmbd_elections.c
@@ -26,8 +26,6 @@
extern int DEBUGLEVEL;
-extern pstring scope;
-
extern pstring global_myname;
extern fstring global_myworkgroup;
@@ -194,7 +192,7 @@ void run_elections(time_t t)
*/
struct nmb_name nmbname;
- make_nmb_name(&nmbname, work->work_group, 0x1e, scope);
+ make_nmb_name(&nmbname, work->work_group, 0x1e);
if(find_name_on_subnet( subrec, &nmbname, FIND_SELF_NAME)==NULL) {
DEBUG(8,("run_elections: Cannot send election packet yet as name %s not \
yet registered on subnet %s\n", nmb_namestr(&nmbname), subrec->subnet_name ));
@@ -365,7 +363,7 @@ BOOL check_elections(void)
*/
struct nmb_name nmbname;
- make_nmb_name(&nmbname, work->work_group, 0x1e, scope);
+ make_nmb_name(&nmbname, work->work_group, 0x1e);
if(find_name_on_subnet( subrec, &nmbname, FIND_SELF_NAME)==NULL) {
DEBUG(8,("check_elections: Cannot send election packet yet as name %s not \
yet registered on subnet %s\n", nmb_namestr(&nmbname), subrec->subnet_name ));
diff --git a/source3/nmbd/nmbd_logonnames.c b/source3/nmbd/nmbd_logonnames.c
index 471a64377d..c63de56a34 100644
--- a/source3/nmbd/nmbd_logonnames.c
+++ b/source3/nmbd/nmbd_logonnames.c
@@ -26,7 +26,6 @@
extern int DEBUGLEVEL;
-extern pstring scope;
extern pstring global_myname;
extern fstring global_myworkgroup;
extern char **my_netbios_names;
@@ -152,7 +151,7 @@ void add_logon_names(void)
if (work && (work->log_state == LOGON_NONE))
{
struct nmb_name nmbname;
- make_nmb_name(&nmbname,global_myworkgroup,0x1c,scope);
+ make_nmb_name(&nmbname,global_myworkgroup,0x1c);
if (find_name_on_subnet(subrec, &nmbname, FIND_SELF_NAME) == NULL)
{
diff --git a/source3/nmbd/nmbd_mynames.c b/source3/nmbd/nmbd_mynames.c
index c36df21e7b..7ea8ffc946 100644
--- a/source3/nmbd/nmbd_mynames.c
+++ b/source3/nmbd/nmbd_mynames.c
@@ -28,7 +28,6 @@ extern int DEBUGLEVEL;
extern char **my_netbios_names;
extern fstring global_myworkgroup;
-extern pstring scope;
extern uint16 samba_nb_type; /* Samba's NetBIOS type. */
@@ -119,13 +118,13 @@ BOOL register_my_workgroup_and_names(void)
*/
struct nmb_name nmbname;
- make_nmb_name(&nmbname, my_netbios_names[i],0x20, scope);
+ make_nmb_name(&nmbname, my_netbios_names[i],0x20);
insert_permanent_name_into_unicast(subrec, &nmbname, samba_nb_type);
- make_nmb_name(&nmbname, my_netbios_names[i],0x3, scope);
+ make_nmb_name(&nmbname, my_netbios_names[i],0x3);
insert_permanent_name_into_unicast(subrec, &nmbname, samba_nb_type);
- make_nmb_name(&nmbname, my_netbios_names[i],0x0, scope);
+ make_nmb_name(&nmbname, my_netbios_names[i],0x0);
insert_permanent_name_into_unicast(subrec, &nmbname, samba_nb_type);
}
}
@@ -142,10 +141,10 @@ BOOL register_my_workgroup_and_names(void)
*/
struct nmb_name nmbname;
- make_nmb_name(&nmbname, global_myworkgroup, 0x0, scope);
+ make_nmb_name(&nmbname, global_myworkgroup, 0x0);
insert_permanent_name_into_unicast(subrec, &nmbname, samba_nb_type|NB_GROUP);
- make_nmb_name(&nmbname, global_myworkgroup, 0x1e, scope);
+ make_nmb_name(&nmbname, global_myworkgroup, 0x1e);
insert_permanent_name_into_unicast(subrec, &nmbname, samba_nb_type|NB_GROUP);
}
}
diff --git a/source3/nmbd/nmbd_namelistdb.c b/source3/nmbd/nmbd_namelistdb.c
index e2433f42d3..15328af33e 100644
--- a/source3/nmbd/nmbd_namelistdb.c
+++ b/source3/nmbd/nmbd_namelistdb.c
@@ -26,7 +26,6 @@
extern int DEBUGLEVEL;
-extern pstring scope;
extern char **my_netbios_names;
uint16 samba_nb_type = 0; /* samba's NetBIOS name type */
@@ -213,8 +212,8 @@ struct name_record *add_name_to_subnet( struct subnet_record *subrec,
namerec->subnet = subrec;
- make_nmb_name( &namerec->name, name, type, scope );
- upcase_name( &namerec->name, NULL );
+ make_nmb_name(&namerec->name, name, type);
+ upcase_name(&namerec->name, NULL );
/* Enter the name as active. */
namerec->data.nb_flags = nb_flags | NB_ACTIVE;
diff --git a/source3/nmbd/nmbd_namequery.c b/source3/nmbd/nmbd_namequery.c
index 8c41554842..57baa4cb2f 100644
--- a/source3/nmbd/nmbd_namequery.c
+++ b/source3/nmbd/nmbd_namequery.c
@@ -26,8 +26,6 @@
extern int DEBUGLEVEL;
-extern pstring scope;
-
/****************************************************************************
Deal with a response packet when querying a name.
****************************************************************************/
@@ -180,7 +178,7 @@ BOOL query_name(struct subnet_record *subrec, char *name, int type,
struct nmb_name nmbname;
struct name_record *namerec;
- make_nmb_name(&nmbname, name, type, scope);
+ make_nmb_name(&nmbname, name, type);
/*
* We need to check our local namelists first.
@@ -247,7 +245,7 @@ BOOL query_name_from_wins_server(struct in_addr ip_to,
{
struct nmb_name nmbname;
- make_nmb_name(&nmbname, name, type, scope);
+ make_nmb_name(&nmbname, name, type);
if(queue_query_name_from_wins_server( ip_to,
query_name_response,
diff --git a/source3/nmbd/nmbd_nameregister.c b/source3/nmbd/nmbd_nameregister.c
index 1e819cc88f..8805728737 100644
--- a/source3/nmbd/nmbd_nameregister.c
+++ b/source3/nmbd/nmbd_nameregister.c
@@ -26,7 +26,6 @@
extern int DEBUGLEVEL;
-extern pstring scope;
extern fstring global_myworkgroup;
/****************************************************************************
@@ -333,7 +332,7 @@ BOOL register_name(struct subnet_record *subrec,
{
struct nmb_name nmbname;
- make_nmb_name(&nmbname, name, type, scope);
+ make_nmb_name(&nmbname, name, type);
/* Always set the NB_ACTIVE flag on the name we are
registering. Doesn't make sense without it.
diff --git a/source3/nmbd/nmbd_namerelease.c b/source3/nmbd/nmbd_namerelease.c
index 1cdc78e6a0..2e3b4e8c6a 100644
--- a/source3/nmbd/nmbd_namerelease.c
+++ b/source3/nmbd/nmbd_namerelease.c
@@ -26,8 +26,6 @@
extern int DEBUGLEVEL;
-extern pstring scope;
-
/****************************************************************************
Deal with a response packet when releasing one of our names.
****************************************************************************/
diff --git a/source3/nmbd/nmbd_nodestatus.c b/source3/nmbd/nmbd_nodestatus.c
index d8af09b398..d78f8a5547 100644
--- a/source3/nmbd/nmbd_nodestatus.c
+++ b/source3/nmbd/nmbd_nodestatus.c
@@ -26,8 +26,6 @@
extern int DEBUGLEVEL;
-extern pstring scope;
-
/****************************************************************************
Deal with a successful node status response.
****************************************************************************/
diff --git a/source3/nmbd/nmbd_packets.c b/source3/nmbd/nmbd_packets.c
index 3bf009f2c2..428758ada3 100644
--- a/source3/nmbd/nmbd_packets.c
+++ b/source3/nmbd/nmbd_packets.c
@@ -32,7 +32,6 @@ extern int DEBUGLEVEL;
extern int num_response_packets;
-extern pstring scope;
extern struct in_addr loopback_ip;
static void queue_packet(struct packet_struct *packet);
@@ -1026,14 +1025,15 @@ static void process_browse_packet(struct packet_struct *p, char *buf,int len)
struct dgram_packet *dgram = &p->packet.dgram;
int command = CVAL(buf,0);
struct subnet_record *subrec = find_subnet_for_dgram_browse_packet(p);
+ extern pstring global_scope;
/* Drop the packet if it's a different NetBIOS scope, or
the source is from one of our names. */
- if (!strequal(dgram->dest_name.scope,scope ))
+ if (!strequal(dgram->dest_name.scope, global_scope))
{
DEBUG(7,("process_browse_packet: Discarding datagram from IP %s. Scope (%s) \
-mismatch with our scope (%s).\n", inet_ntoa(p->ip), dgram->dest_name.scope, scope));
+mismatch with our scope (%s).\n", inet_ntoa(p->ip), dgram->dest_name.scope, global_scope));
return;
}
@@ -1138,14 +1138,15 @@ static void process_lanman_packet(struct packet_struct *p, char *buf,int len)
struct dgram_packet *dgram = &p->packet.dgram;
int command = SVAL(buf,0);
struct subnet_record *subrec = find_subnet_for_dgram_browse_packet(p);
+ extern pstring global_scope;
/* Drop the packet if it's a different NetBIOS scope, or
the source is from one of our names. */
- if (!strequal(dgram->dest_name.scope,scope ))
+ if (!strequal(dgram->dest_name.scope, global_scope))
{
DEBUG(7,("process_lanman_packet: Discarding datagram from IP %s. Scope (%s) \
-mismatch with our scope (%s).\n", inet_ntoa(p->ip), dgram->dest_name.scope, scope));
+mismatch with our scope (%s).\n", inet_ntoa(p->ip), dgram->dest_name.scope, global_scope));
return;
}
@@ -1927,8 +1928,8 @@ BOOL send_mailslot(BOOL unique, char *mailslot,char *buf,int len,
dgram->header.dgm_length = 0; /* Let build_dgram() handle this. */
dgram->header.packet_offset = 0;
- make_nmb_name(&dgram->source_name,srcname,src_type,scope);
- make_nmb_name(&dgram->dest_name,dstname,dest_type,scope);
+ make_nmb_name(&dgram->source_name,srcname,src_type);
+ make_nmb_name(&dgram->dest_name,dstname,dest_type);
ptr = &dgram->data[0];
diff --git a/source3/nmbd/nmbd_responserecordsdb.c b/source3/nmbd/nmbd_responserecordsdb.c
index fe29464773..1b6e1ca16d 100644
--- a/source3/nmbd/nmbd_responserecordsdb.c
+++ b/source3/nmbd/nmbd_responserecordsdb.c
@@ -28,7 +28,6 @@ extern int ClientNMB;
extern int DEBUGLEVEL;
-extern pstring scope;
extern struct in_addr ipzero;
int num_response_packets = 0;
diff --git a/source3/nmbd/nmbd_synclists.c b/source3/nmbd/nmbd_synclists.c
index fb51be4d8f..7bf1790377 100644
--- a/source3/nmbd/nmbd_synclists.c
+++ b/source3/nmbd/nmbd_synclists.c
@@ -32,7 +32,6 @@
#include "smb.h"
extern int DEBUGLEVEL;
-extern pstring scope;
struct sync_record {
struct sync_record *next, *prev;
@@ -77,8 +76,8 @@ static void sync_child(char *name, int nm_type,
return;
}
- make_nmb_name(&calling, local_machine, 0x0 , scope);
- make_nmb_name(&called , name , nm_type, scope);
+ make_nmb_name(&calling, local_machine, 0x0);
+ make_nmb_name(&called , name , nm_type);
if (!cli_session_request(&cli, &calling, &called))
{