I finished removing timestring() calls from DEBUG() messages. Also went
authorChristopher R. Hertel <crh@samba.org>
Mon, 3 Aug 1998 18:13:13 +0000 (18:13 +0000)
committerChristopher R. Hertel <crh@samba.org>
Mon, 3 Aug 1998 18:13:13 +0000 (18:13 +0000)
through and changed some DEBUG() calls to DEBUGADD() to combine output
under a single timestamp.  There were too many timestamps.

Note that Jeremy has told me that he's working on adding a config parameter
to turn timestamps off.  Cool.

Chris -)-----
(This used to be commit 247dbc9a24987035a47f1ba4fa143b1e2c050e92)

source3/libsmb/nmblib.c
source3/nmbd/nmbd_become_lmb.c
source3/nmbd/nmbd_browsesync.c
source3/nmbd/nmbd_logonnames.c
source3/nmbd/nmbd_packets.c
source3/nmbd/nmbd_workgroupdb.c
source3/param/loadparm.c

index 62c3f22b1ae77b8a27b6174bdb4f71377439f52d..9c7a606a26270d07be0dd4dde849e3313fd47e42 100644 (file)
@@ -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");
     }
index f66723eb17a9323973c4b201847aac7c0fc3a64b..2d007ecd7538c674b188530bef5c008e60f7e3d7 100644 (file)
@@ -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 );
+  }
 
 }
 
index fd55fe161d87e237f815309c0fa1bd6d11ba7afb..dcf2ea3c4876658639169e171745dc9c036c23a7 100644 (file)
@@ -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. */
index dbbb8defafbd48e43c3882eb6c19e9fb30764f5f..4486fb2840d96847d0b016aac79fddebf4bdcfae 100644 (file)
@@ -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);
       }
     }
index 23db8453483daf6e2f7b62c7e22052278796cdd8..1f216e3111f610122fdf7bbdd1993a58b912ce68 100644 (file)
@@ -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") );
   }
 }
 
index 818875c8209d658fd0ce543fd2a344aba08e26bc..51b2519d837afca4b54c1ba9d9efcddef7d77496 100644 (file)
@@ -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;
 }
 
index 4d5ef3d657b3e6edcd722d9bc27f5f173467bc8a..2a425466623bda8eaee2b23292c2b9c62fb24be6 100644 (file)
@@ -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);
    }