diff options
author | Jeremy Allison <jra@samba.org> | 2001-07-06 00:49:45 +0000 |
---|---|---|
committer | Jeremy Allison <jra@samba.org> | 2001-07-06 00:49:45 +0000 |
commit | fb1e289408cb8de4b8f9b988c56aa6d64df9b622 (patch) | |
tree | 9a8a56b622404f352d416cd7ddd0354f030b332e /source/nmbd | |
parent | 6ad113dce11db901ff666dac9a34e74f7b763f14 (diff) | |
download | samba-fb1e289408cb8de4b8f9b988c56aa6d64df9b622.tar.gz samba-fb1e289408cb8de4b8f9b988c56aa6d64df9b622.tar.xz samba-fb1e289408cb8de4b8f9b988c56aa6d64df9b622.zip |
Syncup getting ready for release.
Jeremy.
Diffstat (limited to 'source/nmbd')
-rw-r--r-- | source/nmbd/nmbd.c | 10 | ||||
-rw-r--r-- | source/nmbd/nmbd_namequery.c | 80 | ||||
-rw-r--r-- | source/nmbd/nmbd_packets.c | 21 | ||||
-rw-r--r-- | source/nmbd/nmbd_synclists.c | 9 |
4 files changed, 83 insertions, 37 deletions
diff --git a/source/nmbd/nmbd.c b/source/nmbd/nmbd.c index 46f6056e7c0..2fab8f6bc7b 100644 --- a/source/nmbd/nmbd.c +++ b/source/nmbd/nmbd.c @@ -83,7 +83,7 @@ static void sig_term(int sig) /**************************************************************************** ** catch a sighup **************************************************************************** */ -static VOLATILE SIG_ATOMIC_T reload_after_sighup = False; +static VOLATILE sig_atomic_t reload_after_sighup = False; static void sig_hup(int sig) { @@ -460,7 +460,9 @@ static void process(void) * This will only work to a Samba WINS server. * (nmbd_browsesync.c) */ - collect_all_workgroup_names_from_wins_server(t); + if (lp_enhanced_browsing()) { + collect_all_workgroup_names_from_wins_server(t); + } /* * Go through the response record queue and time out or re-transmit @@ -477,7 +479,9 @@ static void process(void) /* * regularly sync with any other DMBs we know about */ - sync_all_dmbs(t); + if (lp_enhanced_browsing()) { + sync_all_dmbs(t); + } /* * clear the unexpected packet queue diff --git a/source/nmbd/nmbd_namequery.c b/source/nmbd/nmbd_namequery.c index 57baa4cb2f0..61435c14f55 100644 --- a/source/nmbd/nmbd_namequery.c +++ b/source/nmbd/nmbd_namequery.c @@ -30,8 +30,9 @@ extern int DEBUGLEVEL; Deal with a response packet when querying a name. ****************************************************************************/ -static void query_name_response(struct subnet_record *subrec, - struct response_record *rrec, struct packet_struct *p) +static void query_name_response( struct subnet_record *subrec, + struct response_record *rrec, + struct packet_struct *p) { struct nmb_packet *nmb = &p->packet.nmb; BOOL success = False; @@ -52,9 +53,14 @@ static void query_name_response(struct subnet_record *subrec, { /* WINS server is telling us to wait. Pretend we didn't get the response but don't send out any more query requests. */ - - DEBUG(5,("query_name_response: WACK from WINS server %s in querying \ -name %s on subnet %s.\n", inet_ntoa(p->ip), nmb_namestr(question_name), subrec->subnet_name)); + + if( DEBUGLVL( 5 ) ) + { + dbgtext( "query_name_response: " ); + dbgtext( "WACK from WINS server %s ", inet_ntoa(p->ip) ); + dbgtext( "in querying name %s ", nmb_namestr(question_name) ); + dbgtext( "on subnet %s.\n", subrec->subnet_name ); + } rrec->repeat_count = 0; /* How long we should wait for. */ @@ -66,18 +72,26 @@ name %s on subnet %s.\n", inet_ntoa(p->ip), nmb_namestr(question_name), subrec-> { success = False; - DEBUG(5,("query_name_response: On subnet %s - negative response \ -from IP %s for name %s. Error code was %d.\n", subrec->subnet_name, inet_ntoa(p->ip), - nmb_namestr(question_name), nmb->header.rcode)); + if( DEBUGLVL( 5 ) ) + { + dbgtext( "query_name_response: On subnet %s ", subrec->subnet_name ); + dbgtext( "- negative response from IP %s ", inet_ntoa(p->ip) ); + dbgtext( "for name %s. ", nmb_namestr(question_name) ); + dbgtext( "Error code was %d.\n", nmb->header.rcode ); + } } else { success = True; putip((char *)&answer_ip,&nmb->answers->rdata[2]); - DEBUG(5,("query_name_response: On subnet %s - positive response from IP %s \ -for name %s. IP of that name is %s\n", subrec->subnet_name, inet_ntoa(p->ip), - nmb_namestr(question_name), inet_ntoa(answer_ip))); + if( DEBUGLVL( 5 ) ) + { + dbgtext( "query_name_response: On subnet %s ", subrec->subnet_name ); + dbgtext( "- positive response from IP %s ", inet_ntoa(p->ip) ); + dbgtext( "for name %s. ", nmb_namestr(question_name) ); + dbgtext( "IP of that name is %s\n", inet_ntoa(answer_ip) ); + } /* Interestingly, we could add these names to our namelists, and change nmbd to a model that checked its own name cache first, @@ -87,10 +101,15 @@ for name %s. IP of that name is %s\n", subrec->subnet_name, inet_ntoa(p->ip), } else if( rrec->num_msgs > 1) { - DEBUG(0,("query_name_response: Multiple (%d) responses received for a query on \ -subnet %s for name %s. This response was from IP %s\n", - rrec->num_msgs, subrec->subnet_name, nmb_namestr(question_name), - inet_ntoa(p->ip) )); + if( DEBUGLVL( 0 ) ) + { + dbgtext( "query_name_response: " ); + dbgtext( "Multiple (%d) responses ", rrec->num_msgs ); + dbgtext( "received for a query on subnet %s ", subrec->subnet_name ); + dbgtext( "for name %s.\nThis response ", nmb_namestr(question_name) ); + dbgtext( "was from IP %s, reporting", inet_ntoa(p->ip) ); + dbgtext( "an IP address of %s.\n", inet_ntoa(answer_ip) ); + } /* We have already called the success or fail function, so we don't call again here. Leave the response record around in @@ -128,9 +147,12 @@ static void query_name_timeout_response(struct subnet_record *subrec, if(failed) { - DEBUG(5,("query_name_timeout_response: No response to querying name %s on subnet %s.\n", - nmb_namestr(question_name), subrec->subnet_name)); - + if( DEBUGLVL( 5 ) ) + { + dbgtext( "query_name_timeout_response: No response to " ); + dbgtext( "query for name %s ", nmb_namestr(question_name) ); + dbgtext( "on subnet %s.\n", subrec->subnet_name ); + } if(rrec->fail_fn) (*rrec->fail_fn)(subrec, rrec, question_name, 0); } @@ -201,8 +223,12 @@ BOOL query_name(struct subnet_record *subrec, char *name, int type, rrec.rdlength = namerec->data.num_ips * 6; if(rrec.rdlength > MAX_DGRAM_SIZE) { - DEBUG(0,("query_name: nmbd internal error - there are %d ip addresses for name %s.\n", - namerec->data.num_ips, nmb_namestr(&nmbname) )); + if( DEBUGLVL( 0 ) ) + { + dbgtext( "query_name: nmbd internal error - " ); + dbgtext( "there are %d ip addresses ", namerec->data.num_ips ); + dbgtext( "for name %s.\n", nmb_namestr(&nmbname) ); + } return False; } @@ -226,8 +252,11 @@ BOOL query_name(struct subnet_record *subrec, char *name, int type, userdata, &nmbname) == NULL) { - DEBUG(0,("query_name: Failed to send packet trying to query name %s\n", - nmb_namestr(&nmbname))); + if( DEBUGLVL( 0 ) ) + { + dbgtext( "query_name: Failed to send packet " ); + dbgtext( "trying to query name %s\n", nmb_namestr(&nmbname) ); + } return True; } return False; @@ -255,8 +284,11 @@ BOOL query_name_from_wins_server(struct in_addr ip_to, userdata, &nmbname) == NULL) { - DEBUG(0,("query_name_from_wins_server: Failed to send packet trying to query name %s\n", - nmb_namestr(&nmbname))); + if( DEBUGLVL( 0 ) ) + { + dbgtext( "query_name_from_wins_server: Failed to send packet " ); + dbgtext( "trying to query name %s\n", nmb_namestr(&nmbname) ); + } return True; } return False; diff --git a/source/nmbd/nmbd_packets.c b/source/nmbd/nmbd_packets.c index 8b102985611..00059c1775e 100644 --- a/source/nmbd/nmbd_packets.c +++ b/source/nmbd/nmbd_packets.c @@ -107,12 +107,14 @@ static void debug_browse_data(char *outbuf, int len) for (j = 0; j < 16; j++) { - unsigned char x = outbuf[i+j]; + unsigned char x; + if (i+j >= len) + break; + + x = outbuf[i+j]; if (x < 32 || x > 127) x = '.'; - if (i+j >= len) - break; DEBUGADD( 4, ( "%c", x ) ); } @@ -1263,14 +1265,21 @@ an error packet of type %x\n", len = SVAL(buf,smb_vwv11); buf2 = smb_base(buf) + SVAL(buf,smb_vwv12); + if (len <= 0) + return; + + if (buf2 + len > buf + sizeof(dgram->data)) { + DEBUG(2,("process_dgram: datagram from %s to %s IP %s for %s len=%d too long.\n", + nmb_namestr(&dgram->source_name),nmb_namestr(&dgram->dest_name), + inet_ntoa(p->ip), smb_buf(buf),len)); + len = (buf + sizeof(dgram->data)) - buf; + } + DEBUG(4,("process_dgram: datagram from %s to %s IP %s for %s of type %d len=%d\n", nmb_namestr(&dgram->source_name),nmb_namestr(&dgram->dest_name), inet_ntoa(p->ip), smb_buf(buf),CVAL(buf2,0),len)); - if (len <= 0) - return; - /* Datagram packet received for the browser mailslot */ if (strequal(smb_buf(buf),BROWSE_MAILSLOT)) { diff --git a/source/nmbd/nmbd_synclists.c b/source/nmbd/nmbd_synclists.c index 6105fb41650..23cbc01b889 100644 --- a/source/nmbd/nmbd_synclists.c +++ b/source/nmbd/nmbd_synclists.c @@ -51,7 +51,8 @@ static FILE *fp; This is the NetServerEnum callback. Note sname and comment are in UNIX codepage format. ******************************************************************/ -static void callback(const char *sname, uint32 stype, const char *comment) +static void callback(const char *sname, uint32 stype, + const char *comment, void *state) { fprintf(fp,"\"%s\" %08X \"%s\"\n", sname, stype, comment); } @@ -106,8 +107,8 @@ static void sync_child(char *name, int nm_type, /* Fetch a workgroup list. */ cli_NetServerEnum(&cli, unix_workgroup, - local_type|SV_TYPE_DOMAIN_ENUM, - callback); + local_type|SV_TYPE_DOMAIN_ENUM, + callback, NULL); /* Now fetch a server list. */ if (servers) { @@ -115,7 +116,7 @@ static void sync_child(char *name, int nm_type, dos_to_unix(unix_workgroup, True); cli_NetServerEnum(&cli, unix_workgroup, local?SV_TYPE_LOCAL_LIST_ONLY:SV_TYPE_ALL, - callback); + callback, NULL); } cli_shutdown(&cli); |