diff options
-rw-r--r-- | source3/libsmb/nmblib.c | 77 | ||||
-rw-r--r-- | source3/nmbd/nmbd_become_lmb.c | 30 | ||||
-rw-r--r-- | source3/nmbd/nmbd_browsesync.c | 9 | ||||
-rw-r--r-- | source3/nmbd/nmbd_logonnames.c | 10 | ||||
-rw-r--r-- | source3/nmbd/nmbd_packets.c | 12 | ||||
-rw-r--r-- | source3/nmbd/nmbd_workgroupdb.c | 4 | ||||
-rw-r--r-- | source3/param/loadparm.c | 13 |
7 files changed, 96 insertions, 59 deletions
diff --git a/source3/libsmb/nmblib.c b/source3/libsmb/nmblib.c index 62c3f22b1a..9c7a606a26 100644 --- a/source3/libsmb/nmblib.c +++ b/source3/libsmb/nmblib.c @@ -67,18 +67,19 @@ static void debug_nmb_res_rec(struct res_rec *res, char *hdr) { int i, j; - DEBUG(4,(" %s: nmb_name=%s rr_type=%d rr_class=%d ttl=%d\n", - hdr, - namestr(&res->rr_name), - res->rr_type, - res->rr_class, - res->ttl)); - - if (res->rdlength == 0 || res->rdata == NULL) return; + DEBUGADD( 4, ( " %s: nmb_name=%s rr_type=%d rr_class=%d ttl=%d\n", + hdr, + namestr(&res->rr_name), + res->rr_type, + res->rr_class, + res->ttl ) ); + + if( res->rdlength == 0 || res->rdata == NULL ) + return; for (i = 0; i < res->rdlength; i+= 16) { - DEBUG(4, (" %s %3x char ", hdr, i)); + DEBUGADD(4, (" %s %3x char ", hdr, i)); for (j = 0; j < 16; j++) { @@ -86,18 +87,18 @@ static void debug_nmb_res_rec(struct res_rec *res, char *hdr) if (x < 32 || x > 127) x = '.'; if (i+j >= res->rdlength) break; - DEBUG(4, ("%c", x)); + DEBUGADD(4, ("%c", x)); } - DEBUG(4, (" hex ", i)); + DEBUGADD(4, (" hex ", i)); for (j = 0; j < 16; j++) { if (i+j >= res->rdlength) break; - DEBUG(4, ("%02X", (unsigned char)res->rdata[i+j])); + DEBUGADD(4, ("%02X", (unsigned char)res->rdata[i+j])); } - DEBUG(4, ("\n")); + DEBUGADD(4, ("\n")); } } @@ -107,34 +108,38 @@ static void debug_nmb_res_rec(struct res_rec *res, char *hdr) void debug_nmb_packet(struct packet_struct *p) { struct nmb_packet *nmb = &p->packet.nmb; - - DEBUG(4,("nmb packet from %s(%d) header: id=%d opcode=%s(%d) response=%s\n", - inet_ntoa(p->ip), p->port, - nmb->header.name_trn_id, - lookup_opcode_name(nmb->header.opcode), - nmb->header.opcode,BOOLSTR(nmb->header.response))); - DEBUG(4,(" header: flags: bcast=%s rec_avail=%s rec_des=%s trunc=%s auth=%s\n", - BOOLSTR(nmb->header.nm_flags.bcast), - BOOLSTR(nmb->header.nm_flags.recursion_available), - BOOLSTR(nmb->header.nm_flags.recursion_desired), - BOOLSTR(nmb->header.nm_flags.trunc), - BOOLSTR(nmb->header.nm_flags.authoritative))); - DEBUG(4,(" header: rcode=%d qdcount=%d ancount=%d nscount=%d arcount=%d\n", - nmb->header.rcode, - nmb->header.qdcount, - nmb->header.ancount, - nmb->header.nscount, - nmb->header.arcount)); + + if( DEBUGLVL( 4 ) ) + { + dbgtext( "nmb packet from %s(%d) header: id=%d opcode=%s(%d) response=%s\n", + inet_ntoa(p->ip), p->port, + nmb->header.name_trn_id, + lookup_opcode_name(nmb->header.opcode), + nmb->header.opcode, + BOOLSTR(nmb->header.response) ); + dbgtext( " header: flags: bcast=%s rec_avail=%s rec_des=%s trunc=%s auth=%s\n", + BOOLSTR(nmb->header.nm_flags.bcast), + BOOLSTR(nmb->header.nm_flags.recursion_available), + BOOLSTR(nmb->header.nm_flags.recursion_desired), + BOOLSTR(nmb->header.nm_flags.trunc), + BOOLSTR(nmb->header.nm_flags.authoritative) ); + dbgtext( " header: rcode=%d qdcount=%d ancount=%d nscount=%d arcount=%d\n", + nmb->header.rcode, + nmb->header.qdcount, + nmb->header.ancount, + nmb->header.nscount, + nmb->header.arcount ); + } if (nmb->header.qdcount) { - DEBUG(4,(" question: q_name=%s q_type=%d q_class=%d\n", - namestr(&nmb->question.question_name), - nmb->question.question_type, - nmb->question.question_class)); + DEBUGADD( 4, ( " question: q_name=%s q_type=%d q_class=%d\n", + namestr(&nmb->question.question_name), + nmb->question.question_type, + nmb->question.question_class) ); } - if (nmb->answers && nmb->header.ancount) + if (nmb->answers && nmb->header.ancount) { debug_nmb_res_rec(nmb->answers,"answers"); } diff --git a/source3/nmbd/nmbd_become_lmb.c b/source3/nmbd/nmbd_become_lmb.c index f66723eb17..2d007ecd75 100644 --- a/source3/nmbd/nmbd_become_lmb.c +++ b/source3/nmbd/nmbd_become_lmb.c @@ -153,8 +153,14 @@ void unbecome_local_master_success(struct subnet_record *subrec, /* Now reset the workgroup and server state. */ reset_workgroup_state( subrec, released_name->name, force_new_election ); - DEBUG(0,("\n%s ***** Samba name server %s has stopped being a local master browser for workgroup %s \ -on subnet %s *****\n\n", timestring(), global_myname, released_name->name, subrec->subnet_name)); + if( DEBUGLVL( 0 ) ) + { + dbgtext( "*****\n\n" ); + dbgtext( "Samba name server %s ", global_myname ); + dbgtext( "has stopped being a local master browser " ); + dbgtext( "for workgroup %s ", released_name->name ); + dbgtext( "on subnet %s\n\n*****\n", subrec->subnet_name ); + } } @@ -182,8 +188,14 @@ Removing from namelist anyway.\n", namestr(fail_name))); /* Now reset the workgroup and server state. */ reset_workgroup_state( subrec, fail_name->name, force_new_election ); - DEBUG(0,("\n%s ***** Samba name server %s has stopped being a local master browser for workgroup %s \ -on subnet %s *****\n\n", timestring(), global_myname, fail_name->name, subrec->subnet_name)); + if( DEBUGLVL( 0 ) ) + { + dbgtext( "*****\n\n" ); + dbgtext( "Samba name server %s ", global_myname ); + dbgtext( "has stopped being a local master browser " ); + dbgtext( "for workgroup %s ", fail_name->name ); + dbgtext( "on subnet %s\n\n*****\n", subrec->subnet_name ); + } } /******************************************************************* @@ -392,8 +404,14 @@ on subnet %s\n", work->work_group, subrec->subnet_name)); master browser as soon as possible that we are a local master browser. */ 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(), global_myname, work->work_group, subrec->subnet_name)); + if( DEBUGLVL( 0 ) ) + { + dbgtext( "*****\n\n" ); + dbgtext( "Samba name server %s ", global_myname ); + dbgtext( "is now a local master browser " ); + dbgtext( "for workgroup %s ", work->work_group ); + dbgtext( "on subnet %s\n\n*****\n", subrec->subnet_name ); + } } diff --git a/source3/nmbd/nmbd_browsesync.c b/source3/nmbd/nmbd_browsesync.c index fd55fe161d..dcf2ea3c48 100644 --- a/source3/nmbd/nmbd_browsesync.c +++ b/source3/nmbd/nmbd_browsesync.c @@ -101,8 +101,13 @@ static void sync_browse_lists(struct subnet_record *subrec, struct work_record * static struct cli_state cli; uint32 local_type = local ? SV_TYPE_LOCAL_LIST_ONLY : 0; - DEBUG(2,("%s: sync_browse_lists: Sync browse lists with server %s<%02x> at IP %s for workgroup %s\n", - timestring(), name, nm_type, inet_ntoa(ip), work->work_group )); + if( DEBUGLVL( 2 ) ) + { + dbgtext( "sync_browse_lists():\n" ); + dbgtext( "Sync browse lists with server %s<%02x> ", name, nm_type ); + dbgtext( "at IP %s ", inet_ntoa( ip ) ); + dbgtext( "for workgroup %s\n", work->work_group ); + } /* Check we're not trying to sync with ourselves. This can happen if we are a domain *and* a local master browser. */ diff --git a/source3/nmbd/nmbd_logonnames.c b/source3/nmbd/nmbd_logonnames.c index dbbb8defaf..4486fb2840 100644 --- a/source3/nmbd/nmbd_logonnames.c +++ b/source3/nmbd/nmbd_logonnames.c @@ -156,9 +156,13 @@ void add_logon_names(void) 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(), global_myworkgroup, - subrec->subnet_name)); + if( DEBUGLVL( 0 ) ) + { + dbgtext( "add_domain_logon_names:\n" ); + dbgtext( "Attempting to become logon server " ); + dbgtext( "for workgroup %s ", global_myworkgroup ); + dbgtext( "on subnet %s\n", subrec->subnet_name ); + } become_logon_server(subrec, work); } } diff --git a/source3/nmbd/nmbd_packets.c b/source3/nmbd/nmbd_packets.c index 23db845348..1f216e3111 100644 --- a/source3/nmbd/nmbd_packets.c +++ b/source3/nmbd/nmbd_packets.c @@ -95,9 +95,11 @@ Dumps out the browse packet data. static void debug_browse_data(char *outbuf, int len) { int i,j; + + DEBUG( 4, ( "debug_browse_data():\n" ) ); for (i = 0; i < len; i+= 16) { - DEBUG(4, ("%3x char ", i)); + DEBUGADD( 4, ( "%3x char ", i ) ); for (j = 0; j < 16; j++) { @@ -107,19 +109,19 @@ static void debug_browse_data(char *outbuf, int len) if (i+j >= len) break; - DEBUG(4, ("%c", x)); + DEBUGADD( 4, ( "%c", x ) ); } - DEBUG(4, (" hex ", i)); + DEBUGADD( 4, ( " hex ", i ) ); for (j = 0; j < 16; j++) { if (i+j >= len) break; - DEBUG(4, (" %02x", (unsigned char)outbuf[i+j])); + DEBUGADD( 4, ( " %02x", (unsigned char)outbuf[i+j] ) ); } - DEBUG(4, ("\n")); + DEBUGADD( 4, ("\n") ); } } diff --git a/source3/nmbd/nmbd_workgroupdb.c b/source3/nmbd/nmbd_workgroupdb.c index 818875c820..51b2519d83 100644 --- a/source3/nmbd/nmbd_workgroupdb.c +++ b/source3/nmbd/nmbd_workgroupdb.c @@ -183,11 +183,11 @@ struct work_record *find_workgroup_on_subnet(struct subnet_record *subrec, { if (!strcmp(ret->work_group,name)) { - DEBUG(4, ("found\n")); + DEBUGADD(4, ("found.\n")); return(ret); } } - DEBUG(4, ("not found\n")); + DEBUGADD(4, ("not found.\n")); return NULL; } diff --git a/source3/param/loadparm.c b/source3/param/loadparm.c index 4d5ef3d657..2a42546662 100644 --- a/source3/param/loadparm.c +++ b/source3/param/loadparm.c @@ -1956,13 +1956,16 @@ BOOL lp_do_parameter(int snum, char *pszParmName, char *pszParmValue) /*************************************************************************** Process a parameter. ***************************************************************************/ -static BOOL do_parameter(char *pszParmName, char *pszParmValue) +static BOOL do_parameter( char *pszParmName, char *pszParmValue ) { - if (!bInGlobalSection && bGlobalOnly) return(True); + if( !bInGlobalSection && bGlobalOnly ) + return(True); - DEBUG(3,("doing parameter %s = %s\n",pszParmName,pszParmValue)); + DEBUGADD( 3, ( "doing parameter %s = %s\n", pszParmName, pszParmValue ) ); - return lp_do_parameter(bInGlobalSection?-2:iServiceIndex, pszParmName, pszParmValue); + return( lp_do_parameter( bInGlobalSection ? -2 : iServiceIndex, + pszParmName, + pszParmValue ) ); } @@ -2082,7 +2085,7 @@ static BOOL do_section(char *pszSectionName) /* check for multiple global sections */ if (bInGlobalSection) { - DEBUG(3,( "Processing section \"[%s]\"\n", pszSectionName)); + DEBUG( 3, ( "Processing section \"[%s]\"\n", pszSectionName ) ); return(True); } |