summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--source3/client/client.c17
-rw-r--r--source3/client/smbmount.c10
-rw-r--r--source3/client/smbspool.c4
-rw-r--r--source3/include/proto.h2
-rw-r--r--source3/lib/msrpc_use.c1
-rw-r--r--source3/lib/util.c9
-rw-r--r--source3/libsmb/clientgen.c9
-rw-r--r--source3/libsmb/namequery.c9
-rw-r--r--source3/libsmb/nmblib.c5
-rw-r--r--source3/libsmb/passchange.c5
-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
-rw-r--r--source3/param/loadparm.c2
-rw-r--r--source3/rpc_client/cli_netlogon.c1
-rw-r--r--source3/rpcclient/rpcclient.c9
-rw-r--r--source3/smbd/password.c1
-rw-r--r--source3/smbd/server.c10
-rw-r--r--source3/utils/nmblookup.c11
-rw-r--r--source3/utils/rpctorture.c5
32 files changed, 90 insertions, 121 deletions
diff --git a/source3/client/client.c b/source3/client/client.c
index 8915d197ab..3dc8371bb0 100644
--- a/source3/client/client.c
+++ b/source3/client/client.c
@@ -42,7 +42,6 @@ static char *cmdstr;
static BOOL got_pass;
static int io_bufsize = 65520;
extern struct in_addr ipzero;
-extern pstring scope;
static int name_type = 0x20;
@@ -1890,8 +1889,8 @@ struct cli_state *do_connect(char *server, char *share)
ip = ipzero;
- make_nmb_name(&calling, global_myname, 0x0, "");
- make_nmb_name(&called , server, name_type, "");
+ make_nmb_name(&calling, global_myname, 0x0);
+ make_nmb_name(&called , server, name_type);
again:
ip = ipzero;
@@ -1914,7 +1913,7 @@ struct cli_state *do_connect(char *server, char *share)
goto again;
}
if (strcmp(called.name, "*SMBSERVER")) {
- make_nmb_name(&called , "*SMBSERVER", 0x20, "");
+ make_nmb_name(&called , "*SMBSERVER", 0x20);
goto again;
}
return NULL;
@@ -2141,8 +2140,8 @@ static int do_message_op(void)
ip = ipzero;
- make_nmb_name(&calling, global_myname, 0x0, "");
- make_nmb_name(&called , desthost, name_type, "");
+ make_nmb_name(&calling, global_myname, 0x0);
+ make_nmb_name(&called , desthost, name_type);
ip = ipzero;
if (have_ip) ip = dest_ip;
@@ -2329,7 +2328,11 @@ static int do_message_op(void)
message = True;
break;
case 'i':
- pstrcpy(scope,optarg);
+ {
+ extern pstring global_scope;
+ pstrcpy(global_scope,optarg);
+ strupper(global_scope);
+ }
break;
case 'N':
got_pass = True;
diff --git a/source3/client/smbmount.c b/source3/client/smbmount.c
index e25efcaf56..18af824c1f 100644
--- a/source3/client/smbmount.c
+++ b/source3/client/smbmount.c
@@ -37,7 +37,6 @@
extern struct in_addr ipzero;
extern int DEBUGLEVEL;
-extern pstring scope;
extern BOOL in_client;
extern pstring user_socket_options;
@@ -142,8 +141,8 @@ static struct cli_state *do_connection(char *service)
ip = ipzero;
- make_nmb_name(&calling, my_netbios_name, 0x0, "");
- make_nmb_name(&called , server, 0x20, "");
+ make_nmb_name(&calling, my_netbios_name, 0x0);
+ make_nmb_name(&called , server, 0x20);
again:
ip = ipzero;
@@ -160,7 +159,7 @@ static struct cli_state *do_connection(char *service)
fprintf(stderr, "session request to %s failed\n", called.name);
cli_shutdown(c);
if (strcmp(called.name, "*SMBSERVER")) {
- make_nmb_name(&called , "*SMBSERVER", 0x20, "");
+ make_nmb_name(&called , "*SMBSERVER", 0x20);
goto again;
}
return NULL;
@@ -517,6 +516,7 @@ static void parse_mount_smb(int argc, char **argv)
char *opteq;
extern char *optarg;
int val;
+ extern pstring global_scope;
if (argc < 2 || argv[1][0] == '-') {
usage();
@@ -591,7 +591,7 @@ static void parse_mount_smb(int argc, char **argv)
} else if(!strcmp(opts, "sockopt")) {
pstrcpy(user_socket_options,opteq+1);
} else if(!strcmp(opts, "scope")) {
- pstrcpy(scope,opteq+1);
+ pstrcpy(global_scope,opteq+1);
} else {
usage();
exit(1);
diff --git a/source3/client/smbspool.c b/source3/client/smbspool.c
index 3dfa90f7a4..dd1d17d71a 100644
--- a/source3/client/smbspool.c
+++ b/source3/client/smbspool.c
@@ -242,8 +242,8 @@ smb_connect(char *workgroup, /* I - Workgroup */
ip = ipzero;
- make_nmb_name(&calling, myname, 0x0, "");
- make_nmb_name(&called, server, 0x20, "");
+ make_nmb_name(&calling, myname, 0x0);
+ make_nmb_name(&called, server, 0x20);
/*
* Open a new connection to the SMB server...
diff --git a/source3/include/proto.h b/source3/include/proto.h
index 4354447acd..0388ef6911 100644
--- a/source3/include/proto.h
+++ b/source3/include/proto.h
@@ -682,7 +682,7 @@ void free_packet(struct packet_struct *packet);
struct packet_struct *parse_packet(char *buf,int length,
enum packet_type packet_type);
struct packet_struct *read_packet(int fd,enum packet_type packet_type);
-void make_nmb_name( struct nmb_name *n, const char *name, int type, const char *this_scope );
+void make_nmb_name( struct nmb_name *n, const char *name, int type);
BOOL nmb_name_equal(struct nmb_name *n1, struct nmb_name *n2);
int build_packet(char *buf, struct packet_struct *p);
BOOL send_packet(struct packet_struct *p);
diff --git a/source3/lib/msrpc_use.c b/source3/lib/msrpc_use.c
index c755a35fb4..13bf7eb5f7 100644
--- a/source3/lib/msrpc_use.c
+++ b/source3/lib/msrpc_use.c
@@ -26,7 +26,6 @@
#include "trans2.h"
extern int DEBUGLEVEL;
-extern pstring scope;
extern pstring global_myname;
struct msrpc_use
diff --git a/source3/lib/util.c b/source3/lib/util.c
index a7c322c0a0..5063dab9c4 100644
--- a/source3/lib/util.c
+++ b/source3/lib/util.c
@@ -58,8 +58,6 @@ extern SSL *ssl;
extern int sslFd;
#endif /* WITH_SSL */
-pstring scope = "";
-
extern int DEBUGLEVEL;
int Protocol = PROTOCOL_COREPLUS;
@@ -297,6 +295,7 @@ int name_mangle( char *In, char *Out, char name_type )
int len;
char buf[20];
char *p = Out;
+ extern pstring global_scope;
/* Safely copy the input string, In, into buf[]. */
(void)memset( buf, 0, 20 );
@@ -320,9 +319,9 @@ int name_mangle( char *In, char *Out, char name_type )
p[0] = '\0';
/* Add the scope string. */
- for( i = 0, len = 0; NULL != scope; i++, len++ )
+ for( i = 0, len = 0; NULL != global_scope; i++, len++ )
{
- switch( scope[i] )
+ switch( global_scope[i] )
{
case '\0':
p[0] = len;
@@ -335,7 +334,7 @@ int name_mangle( char *In, char *Out, char name_type )
len = -1;
break;
default:
- p[len+1] = scope[i];
+ p[len+1] = global_scope[i];
break;
}
}
diff --git a/source3/libsmb/clientgen.c b/source3/libsmb/clientgen.c
index 1e230e2ff5..0436fb9df5 100644
--- a/source3/libsmb/clientgen.c
+++ b/source3/libsmb/clientgen.c
@@ -27,7 +27,6 @@
extern int DEBUGLEVEL;
extern pstring user_socket_options;
-extern pstring scope;
static void cli_process_oplock(struct cli_state *cli);
@@ -3223,7 +3222,7 @@ BOOL attempt_netbios_session_request(struct cli_state *cli, char *srchost, char
{
struct nmb_name calling, called;
- make_nmb_name(&calling, srchost, 0x0, scope);
+ make_nmb_name(&calling, srchost, 0x0);
/*
* If the called name is an IP address
@@ -3231,9 +3230,9 @@ BOOL attempt_netbios_session_request(struct cli_state *cli, char *srchost, char
*/
if(is_ipaddress(desthost))
- make_nmb_name(&called, "*SMBSERVER", 0x20, scope);
+ make_nmb_name(&called, "*SMBSERVER", 0x20);
else
- make_nmb_name(&called, desthost, 0x20, scope);
+ make_nmb_name(&called, desthost, 0x20);
if (!cli_session_request(cli, &calling, &called)) {
struct nmb_name smbservername;
@@ -3245,7 +3244,7 @@ BOOL attempt_netbios_session_request(struct cli_state *cli, char *srchost, char
cli_shutdown(cli);
- make_nmb_name(&smbservername , "*SMBSERVER", 0x20, scope);
+ make_nmb_name(&smbservername , "*SMBSERVER", 0x20);
if (!nmb_name_equal(&called, &smbservername) ||
!cli_initialise(cli) ||
diff --git a/source3/libsmb/namequery.c b/source3/libsmb/namequery.c
index 3898a721c6..08f26f10d5 100644
--- a/source3/libsmb/namequery.c
+++ b/source3/libsmb/namequery.c
@@ -22,7 +22,6 @@
#include "includes.h"
-extern pstring scope;
extern int DEBUGLEVEL;
/* nmbd.c sets this to True. */
@@ -131,7 +130,7 @@ static BOOL internal_name_status(int fd,char *name,int name_type,BOOL recurse,
nmb->header.nscount = 0;
nmb->header.arcount = 0;
- make_nmb_name(&nmb->question.question_name,name,name_type,scope);
+ make_nmb_name(&nmb->question.question_name,name,name_type);
nmb->question.question_type = 0x21;
nmb->question.question_class = 0x1;
@@ -238,7 +237,7 @@ struct in_addr *name_query(int fd,const char *name,int name_type,
nmb->header.nscount = 0;
nmb->header.arcount = 0;
- make_nmb_name(&nmb->question.question_name,name,name_type,scope);
+ make_nmb_name(&nmb->question.question_name,name,name_type);
nmb->question.question_type = 0x20;
nmb->question.question_class = 0x1;
@@ -781,8 +780,8 @@ BOOL lookup_pdc_name(const char *srcname, const char *domain, struct in_addr *pd
dgram->header.dgm_length = 0; /* Let build_dgram() handle this. */
dgram->header.packet_offset = 0;
- make_nmb_name(&dgram->source_name,srcname,0,scope);
- make_nmb_name(&dgram->dest_name,domain,0x1B,scope);
+ make_nmb_name(&dgram->source_name,srcname,0);
+ make_nmb_name(&dgram->dest_name,domain,0x1B);
ptr = &dgram->data[0];
diff --git a/source3/libsmb/nmblib.c b/source3/libsmb/nmblib.c
index 9ddfd3a6c6..e2ba79b006 100644
--- a/source3/libsmb/nmblib.c
+++ b/source3/libsmb/nmblib.c
@@ -819,13 +819,14 @@ static int build_dgram(char *buf,struct packet_struct *p)
/*******************************************************************
build a nmb name
*******************************************************************/
-void make_nmb_name( struct nmb_name *n, const char *name, int type, const char *this_scope )
+void make_nmb_name( struct nmb_name *n, const char *name, int type)
{
+ extern pstring global_scope;
memset( (char *)n, '\0', sizeof(struct nmb_name) );
StrnCpy( n->name, name, 15 );
strupper( n->name );
n->name_type = (unsigned int)type & 0xFF;
- StrnCpy( n->scope, this_scope, 63 );
+ StrnCpy( n->scope, global_scope, 63 );
strupper( n->scope );
}
diff --git a/source3/libsmb/passchange.c b/source3/libsmb/passchange.c
index b0b1188f32..335d9a7d1a 100644
--- a/source3/libsmb/passchange.c
+++ b/source3/libsmb/passchange.c
@@ -23,7 +23,6 @@
extern pstring global_myname;
-extern pstring scope;
/*************************************************************
change a password on a remote machine using IPC calls
@@ -52,8 +51,8 @@ BOOL remote_password_change(const char *remote_machine, const char *user_name,
return False;
}
- make_nmb_name(&calling, global_myname , 0x0 , scope);
- make_nmb_name(&called , remote_machine, 0x20, scope);
+ make_nmb_name(&calling, global_myname , 0x0);
+ make_nmb_name(&called , remote_machine, 0x20);
if (!cli_session_request(&cli, &calling, &called)) {
slprintf(err_str, err_str_len-1, "machine %s rejected the session setup. Error was : %s.\n",
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))
{
diff --git a/source3/param/loadparm.c b/source3/param/loadparm.c
index 2d2cd9db35..fed05b53a1 100644
--- a/source3/param/loadparm.c
+++ b/source3/param/loadparm.c
@@ -71,6 +71,7 @@ BOOL bLoaded = False;
extern int DEBUGLEVEL;
extern pstring user_socket_options;
extern pstring global_myname;
+pstring global_scope = "";
#ifndef GLOBAL_NAME
#define GLOBAL_NAME "global"
@@ -542,6 +543,7 @@ static struct parm_struct parm_table[] =
{"workgroup", P_USTRING, P_GLOBAL, &Globals.szWorkGroup, NULL, NULL, FLAG_BASIC|FLAG_DOS_STRING},
{"netbios name", P_UGSTRING,P_GLOBAL, global_myname, NULL, NULL, FLAG_BASIC|FLAG_DOS_STRING},
{"netbios aliases", P_STRING, P_GLOBAL, &Globals.szNetbiosAliases, NULL, NULL, FLAG_DOS_STRING},
+ {"netbios scope", P_UGSTRING,P_GLOBAL, global_scope, NULL, NULL, 0},
{"server string", P_STRING, P_GLOBAL, &Globals.szServerString, NULL, NULL, FLAG_BASIC|FLAG_DOS_STRING},
{"interfaces", P_STRING, P_GLOBAL, &Globals.szInterfaces, NULL, NULL, FLAG_BASIC},
{"bind interfaces only", P_BOOL,P_GLOBAL, &Globals.bBindInterfacesOnly,NULL, NULL, 0},
diff --git a/source3/rpc_client/cli_netlogon.c b/source3/rpc_client/cli_netlogon.c
index 583b4bb4b8..dab4aa7ad5 100644
--- a/source3/rpc_client/cli_netlogon.c
+++ b/source3/rpc_client/cli_netlogon.c
@@ -30,7 +30,6 @@
#include "includes.h"
extern int DEBUGLEVEL;
-extern pstring scope;
extern pstring global_myname;
extern fstring global_myworkgroup;
diff --git a/source3/rpcclient/rpcclient.c b/source3/rpcclient/rpcclient.c
index 2931356334..6dc3cdb25b 100644
--- a/source3/rpcclient/rpcclient.c
+++ b/source3/rpcclient/rpcclient.c
@@ -30,7 +30,6 @@
#endif
extern pstring debugf;
-extern pstring scope;
extern pstring global_myname;
extern pstring user_socket_options;
@@ -71,8 +70,8 @@ static BOOL rpcclient_connect(struct client_info *info)
struct nmb_name calling;
struct nmb_name called;
- make_nmb_name(&called , dns_to_netbios_name(info->dest_host ), info->name_type, scope);
- make_nmb_name(&calling, dns_to_netbios_name(info->myhostname), 0x0 , scope);
+ make_nmb_name(&called , dns_to_netbios_name(info->dest_host ), info->name_type);
+ make_nmb_name(&calling, dns_to_netbios_name(info->myhostname), 0x0 );
if (!cli_establish_connection(smb_cli,
info->dest_host, &info->dest_ip,
@@ -573,7 +572,9 @@ enum client_action
case 'i':
{
- pstrcpy(scope, optarg);
+ extern pstring global_scope;
+ pstrcpy(global_scope, optarg);
+ strupper(global_scope);
break;
}
diff --git a/source3/smbd/password.c b/source3/smbd/password.c
index e7f7f2c039..44fbdfa8ec 100644
--- a/source3/smbd/password.c
+++ b/source3/smbd/password.c
@@ -28,7 +28,6 @@ extern struct in_addr ipzero;
/* users from session setup */
static pstring session_users="";
-extern pstring scope;
extern pstring global_myname;
extern fstring global_myworkgroup;
diff --git a/source3/smbd/server.c b/source3/smbd/server.c
index 716f555c65..79d37e5093 100644
--- a/source3/smbd/server.c
+++ b/source3/smbd/server.c
@@ -35,7 +35,6 @@ int last_message = -1;
/* a useful macro to debug the last message processed */
#define LAST_MESSAGE() smb_fn_name(last_message)
-extern pstring scope;
extern int DEBUGLEVEL;
extern pstring user_socket_options;
@@ -478,7 +477,7 @@ static void usage(char *pname)
{
printf("Usage: %s [-DaoPh?V] [-d debuglevel] [-l log basename] [-p port]\n", pname);
- printf(" [-O socket options] [-s services file] [-i scope]\n");
+ printf(" [-O socket options] [-s services 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");
@@ -491,7 +490,6 @@ static void usage(char *pname)
printf("\t-p port Listen on the specified port\n");
printf("\t-O socket options Socket options\n");
printf("\t-s services file. Filename of services file\n");
- printf("\t-i scope NetBIOS scope to use (default none)\n");
printf("\n");
}
@@ -520,16 +518,12 @@ static void usage(char *pname)
argc--;
}
- while ( EOF != (opt = getopt(argc, argv, "O:i:l:s:d:Dp:h?VPaof:")) )
+ while ( EOF != (opt = getopt(argc, argv, "O:l:s:d:Dp:h?VPaof:")) )
switch (opt) {
case 'O':
pstrcpy(user_socket_options,optarg);
break;
- case 'i':
- pstrcpy(scope,optarg);
- break;
-
case 'P':
{
extern BOOL passive;
diff --git a/source3/utils/nmblookup.c b/source3/utils/nmblookup.c
index 6214c0e45b..8e26a206ca 100644
--- a/source3/utils/nmblookup.c
+++ b/source3/utils/nmblookup.c
@@ -26,8 +26,6 @@
extern int DEBUGLEVEL;
-extern pstring scope;
-
extern struct in_addr ipzero;
static BOOL use_bcast = True;
@@ -178,9 +176,12 @@ int main(int argc,char *argv[])
translate_addresses = !translate_addresses;
break;
case 'i':
- fstrcpy(scope,optarg);
- strupper(scope);
- break;
+ {
+ extern pstring global_scope;
+ pstrcpy(global_scope,optarg);
+ strupper(global_scope);
+ }
+ break;
case 'M':
find_master = True;
break;
diff --git a/source3/utils/rpctorture.c b/source3/utils/rpctorture.c
index fb08d70011..c80cfe4ade 100644
--- a/source3/utils/rpctorture.c
+++ b/source3/utils/rpctorture.c
@@ -29,7 +29,6 @@
#define REGISTER 0
#endif
-extern pstring scope;
extern pstring global_myname;
extern pstring user_socket_options;
@@ -69,8 +68,8 @@ static BOOL rpcclient_connect(struct client_info *info)
struct nmb_name calling;
struct nmb_name called;
- make_nmb_name(&called , dns_to_netbios_name(info->dest_host ), info->name_type, scope);
- make_nmb_name(&calling, dns_to_netbios_name(info->myhostname), 0x0 , scope);
+ make_nmb_name(&called , dns_to_netbios_name(info->dest_host ), info->name_type);
+ make_nmb_name(&calling, dns_to_netbios_name(info->myhostname), 0x0);
if (!cli_establish_connection(smb_cli,
info->dest_host, &info->dest_ip,