From 171da4d78736730557a94b44af9f2d62081b80ba Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Fri, 7 Jan 2000 06:55:36 +0000 Subject: 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) --- source3/libsmb/clientgen.c | 9 ++++----- source3/libsmb/namequery.c | 9 ++++----- source3/libsmb/nmblib.c | 5 +++-- source3/libsmb/passchange.c | 5 ++--- 4 files changed, 13 insertions(+), 15 deletions(-) (limited to 'source3/libsmb') 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", -- cgit