From c1098f24c34ba30e663995f925f055a4f09ca2c3 Mon Sep 17 00:00:00 2001 From: Kurt Zeilenga Date: Sun, 28 Jul 2002 21:05:15 +0000 Subject: [PATCH] Mostly new logging changes --- servers/slurpd/args.c | 21 ++--- servers/slurpd/config.c | 21 ++--- servers/slurpd/fm.c | 26 +++---- servers/slurpd/ldap_op.c | 162 ++++++++++++++++++++------------------- servers/slurpd/lock.c | 16 ++-- servers/slurpd/main.c | 11 ++- servers/slurpd/re.c | 42 +++++----- servers/slurpd/reject.c | 17 ++-- servers/slurpd/replica.c | 13 ++-- servers/slurpd/replog.c | 28 +++---- servers/slurpd/ri.c | 20 ++--- servers/slurpd/rq.c | 29 ++++--- servers/slurpd/st.c | 20 ++--- 13 files changed, 216 insertions(+), 210 deletions(-) diff --git a/servers/slurpd/args.c b/servers/slurpd/args.c index 4262952524..76b3cb8b62 100644 --- a/servers/slurpd/args.c +++ b/servers/slurpd/args.c @@ -113,15 +113,16 @@ doargs( g->one_shot_mode = 1; break; case 'r': /* slapd replog file */ - strncpy( g->slapd_replogfile, optarg, - sizeof(g->slapd_replogfile)-1 ); - g->slapd_replogfile[sizeof(g->slapd_replogfile)-1] = '\0'; + snprintf( g->slapd_replogfile, sizeof g->slapd_replogfile, + "%s", optarg ); rflag++; break; - case 't': /* dir to use for our copies of replogs */ - g->slurpd_rdir = (char *)malloc (strlen(optarg) + sizeof("/replica")); - sprintf(g->slurpd_rdir, "%s" LDAP_DIRSEP "replica", optarg); - break; + case 't': { /* dir to use for our copies of replogs */ + size_t sz; + g->slurpd_rdir = (char *)malloc (sz = (strlen(optarg) + sizeof("/replica"))); + snprintf(g->slurpd_rdir, sz, + "%s" LDAP_DIRSEP "replica", optarg); + } break; default: usage( g->myname ); return( -1 ); @@ -135,11 +136,13 @@ doargs( } /* Set location/name of our private copy of the slapd replog file */ - sprintf( g->slurpd_replogfile, "%s" LDAP_DIRSEP "%s", g->slurpd_rdir, + snprintf( g->slurpd_replogfile, sizeof g->slurpd_replogfile, + "%s" LDAP_DIRSEP "%s", g->slurpd_rdir, DEFAULT_SLURPD_REPLOGFILE ); /* Set location/name of the slurpd status file */ - sprintf( g->slurpd_status_file, "%s" LDAP_DIRSEP "%s", g->slurpd_rdir, + snprintf( g->slurpd_status_file, sizeof g->slurpd_status_file, + "%s" LDAP_DIRSEP "%s", g->slurpd_rdir, DEFAULT_SLURPD_STATUS_FILE ); ber_set_option(NULL, LBER_OPT_DEBUG_LEVEL, &ldap_debug); diff --git a/servers/slurpd/config.c b/servers/slurpd/config.c index bd47c26a61..cff7704899 100644 --- a/servers/slurpd/config.c +++ b/servers/slurpd/config.c @@ -67,8 +67,9 @@ slurpd_read_config( cargv_size = ARGS_STEP + 1; #ifdef NEW_LOGGING - LDAP_LOG (( "config", LDAP_LEVEL_ARGS, - "slurpd_read_config: Config: opening config file \"%s\"\n", fname )); + LDAP_LOG ( CONFIG, ARGS, + "slurpd_read_config: Config: opening config file \"%s\"\n", + fname, 0, 0 ); #else Debug( LDAP_DEBUG_CONFIG, "Config: opening config file \"%s\"\n", fname, 0, 0 ); @@ -87,8 +88,8 @@ slurpd_read_config( } #ifdef NEW_LOGGING - LDAP_LOG (( "config", LDAP_LEVEL_DETAIL1, - "slurpd_read_config: Config: (%s)\n", line )); + LDAP_LOG ( CONFIG, DETAIL1, + "slurpd_read_config: Config: (%s)\n", line, 0, 0 ); #else Debug( LDAP_DEBUG_CONFIG, "Config: (%s)\n", line, 0, 0 ); #endif @@ -132,9 +133,9 @@ slurpd_read_config( if ( cargc < 2 ) { #ifdef NEW_LOGGING - LDAP_LOG(( "config", LDAP_LEVEL_CRIT, + LDAP_LOG( CONFIG, CRIT, "%s: line %d: missing filename in \"include " - "\" line.\n", fname, lineno )); + "\" line.\n", fname, lineno , 0 ); #else Debug( LDAP_DEBUG_ANY, "%s: line %d: missing filename in \"include \" line\n", @@ -156,9 +157,9 @@ slurpd_read_config( } fclose( fp ); #ifdef NEW_LOGGING - LDAP_LOG (( "config", LDAP_LEVEL_RESULTS, + LDAP_LOG ( CONFIG, RESULTS, "slurpd_read_config: Config: " - "** configuration file successfully read and parsed\n" )); + "** configuration file successfully read and parsed\n", 0, 0, 0 ); #else Debug( LDAP_DEBUG_CONFIG, "Config: ** configuration file successfully read and parsed\n", @@ -344,11 +345,11 @@ add_replica( sglob->num_replicas--; } else { #ifdef NEW_LOGGING - LDAP_LOG (( "config", LDAP_LEVEL_RESULTS, + LDAP_LOG ( CONFIG, RESULTS, "add_replica: Config: ** successfully added replica \"%s%d\"\n", sglob->replicas[ nr - 1 ]->ri_hostname == NULL ? "(null)" : sglob->replicas[ nr - 1 ]->ri_hostname, - sglob->replicas[ nr - 1 ]->ri_port, 0 )); + sglob->replicas[ nr - 1 ]->ri_port, 0 ); #else Debug( LDAP_DEBUG_CONFIG, "Config: ** successfully added replica \"%s:%d\"\n", diff --git a/servers/slurpd/fm.c b/servers/slurpd/fm.c index 36fab6540e..30ac5845d6 100644 --- a/servers/slurpd/fm.c +++ b/servers/slurpd/fm.c @@ -92,8 +92,8 @@ fm( if ( file_nonempty( sglob->slapd_replogfile )) { /* New work found - copy to slurpd replog file */ #ifdef NEW_LOGGING - LDAP_LOG (( "fm", LDAP_LEVEL_ARGS, - "fm: new work in %s\n", sglob->slapd_replogfile )); + LDAP_LOG ( SLURPD, ARGS, + "fm: new work in %s\n", sglob->slapd_replogfile, 0, 0 ); #else Debug( LDAP_DEBUG_ARGS, "new work in %s\n", sglob->slapd_replogfile, 0, 0 ); @@ -104,8 +104,8 @@ fm( } else { if ( rc < 0 ) { #ifdef NEW_LOGGING - LDAP_LOG (( "fm", LDAP_LEVEL_CRIT, - "fm: Fatal error while copying replication log\n" )); + LDAP_LOG ( SLURPD, CRIT, + "fm: Fatal error while copying replication log\n" , 0, 0, 0); #else Debug( LDAP_DEBUG_ANY, "Fatal error while copying replication log\n", @@ -127,9 +127,9 @@ fm( if (( rc = acquire_lock( sglob->slurpd_replogfile, &fp, &lfp )) < 0 ) { #ifdef NEW_LOGGING - LDAP_LOG (( "fm", LDAP_LEVEL_ERR, + LDAP_LOG ( SLURPD, ERR, "fm: Error: cannot acquire lock on \"%s\" for trimming\n", - sglob->slurpd_replogfile )); + sglob->slurpd_replogfile, 0, 0 ); #else Debug( LDAP_DEBUG_ANY, "Error: cannot acquire lock on \"%s\" for trimming\n", @@ -142,7 +142,7 @@ fm( } } #ifdef NEW_LOGGING - LDAP_LOG (( "fm", LDAP_LEVEL_RESULTS, "fm: exiting\n" )); + LDAP_LOG ( SLURPD, RESULTS, "fm: exiting\n", 0, 0, 0 ); #else Debug( LDAP_DEBUG_ARGS, "fm: exiting\n", 0, 0, 0 ); #endif @@ -200,9 +200,9 @@ populate_queue( if ( acquire_lock( f, &fp, &lfp ) < 0 ) { #ifdef NEW_LOGGING - LDAP_LOG (( "fm", LDAP_LEVEL_ERR, + LDAP_LOG ( SLURPD, ERR, "populate_queue: error: can't lock file \"%s\": %s\n", - f, sys_errlist[ errno ] )); + f, sys_errlist[ errno ], 0 ); #else Debug( LDAP_DEBUG_ANY, "error: can't lock file \"%s\": %s\n", @@ -217,9 +217,9 @@ populate_queue( */ if ( fseek( fp, sglob->srpos, 0 ) < 0 ) { #ifdef NEW_LOGGING - LDAP_LOG (( "fm", LDAP_LEVEL_ERR, + LDAP_LOG ( SLURPD, ERR, "populate_queue: error: can't seek to offset %ld in file \"%s\"\n", - sglob->srpos, f )); + sglob->srpos, f, 0 ); #else Debug( LDAP_DEBUG_ANY, "error: can't seek to offset %ld in file \"%s\"\n", @@ -234,9 +234,9 @@ populate_queue( *t = '\0'; } #ifdef NEW_LOGGING - LDAP_LOG (( "fm", LDAP_LEVEL_ERR, + LDAP_LOG ( SLURPD, ERR, "populate_queue: error: malformed replog entry " - "(begins with \"%s\")\n", p )); + "(begins with \"%s\")\n", p, 0, 0 ); #else Debug( LDAP_DEBUG_ANY, "error: malformed replog entry (begins with \"%s\")\n", diff --git a/servers/slurpd/ldap_op.c b/servers/slurpd/ldap_op.c index 577950e4b0..38882a1b42 100644 --- a/servers/slurpd/ldap_op.c +++ b/servers/slurpd/ldap_op.c @@ -85,9 +85,10 @@ do_ldap( lderr = op_ldap_add( ri, re, errmsg ); if ( lderr != LDAP_SUCCESS ) { #ifdef NEW_LOGGING - LDAP_LOG (( "operation", LDAP_LEVEL_ERR, "do_ldap: " + LDAP_LOG ( OPERATION, ERR, "do_ldap: " "Error: ldap_add_s failed adding \"%s\": %s\n", - *errmsg ? *errmsg : ldap_err2string( lderr ), re->re_dn )); + *errmsg ? *errmsg : ldap_err2string( lderr ), + re->re_dn, 0 ); #else Debug( LDAP_DEBUG_ANY, "Error: ldap_add_s failed adding \"%s\": %s\n", @@ -101,9 +102,10 @@ do_ldap( lderr = op_ldap_modify( ri, re, errmsg ); if ( lderr != LDAP_SUCCESS ) { #ifdef NEW_LOGGING - LDAP_LOG (( "operation", LDAP_LEVEL_ERR, "do_ldap: " + LDAP_LOG ( OPERATION, ERR, "do_ldap: " "Error: ldap_modify_s failed modifying \"%s\": %s\n", - *errmsg ? *errmsg : ldap_err2string( lderr ), re->re_dn )); + *errmsg ? *errmsg : ldap_err2string( lderr ), + re->re_dn, 0 ); #else Debug( LDAP_DEBUG_ANY, "Error: ldap_modify_s failed modifying \"%s\": %s\n", @@ -117,9 +119,10 @@ do_ldap( lderr = op_ldap_delete( ri, re, errmsg ); if ( lderr != LDAP_SUCCESS ) { #ifdef NEW_LOGGING - LDAP_LOG (( "operation", LDAP_LEVEL_ERR, "do_ldap: " + LDAP_LOG ( OPERATION, ERR, "do_ldap: " "Error: ldap_delete_s failed deleting \"%s\": %s\n", - *errmsg ? *errmsg : ldap_err2string( lderr ), re->re_dn )); + *errmsg ? *errmsg : ldap_err2string( lderr ), + re->re_dn, 0 ); #else Debug( LDAP_DEBUG_ANY, "Error: ldap_delete_s failed deleting \"%s\": %s\n", @@ -133,9 +136,10 @@ do_ldap( lderr = op_ldap_modrdn( ri, re, errmsg ); if ( lderr != LDAP_SUCCESS ) { #ifdef NEW_LOGGING - LDAP_LOG (( "operation", LDAP_LEVEL_ERR, "do_ldap: " + LDAP_LOG ( OPERATION, ERR, "do_ldap: " "Error: ldap_modrdn_s failed modifying %s: %s\n", - *errmsg ? *errmsg : ldap_err2string( lderr ), re->re_dn )); + *errmsg ? *errmsg : ldap_err2string( lderr ), + re->re_dn, 0 ); #else Debug( LDAP_DEBUG_ANY, "Error: ldap_modrdn_s failed modifying %s: %s\n", @@ -147,9 +151,9 @@ do_ldap( default: #ifdef NEW_LOGGING - LDAP_LOG (( "operation", LDAP_LEVEL_ERR, "do_ldap: " + LDAP_LOG ( OPERATION, ERR, "do_ldap: " "Error: bad op \"%d\", dn = \"%s\"\n", - re->re_changetype, re->re_dn )); + re->re_changetype, re->re_dn, 0 ); #else Debug( LDAP_DEBUG_ANY, "Error: do_ldap: bad op \"%d\", dn = \"%s\"\n", @@ -221,9 +225,9 @@ op_ldap_add( /* Perform the operation */ #ifdef NEW_LOGGING - LDAP_LOG (( "operation", LDAP_LEVEL_ARGS, + LDAP_LOG ( OPERATION, ARGS, "op_ldap_add: replica %s:%d - add dn \"%s\"\n", - ri->ri_hostname, ri->ri_port, re->re_dn )); + ri->ri_hostname, ri->ri_port, re->re_dn ); #else Debug( LDAP_DEBUG_ARGS, "replica %s:%d - add dn \"%s\"\n", ri->ri_hostname, ri->ri_port, re->re_dn ); @@ -235,8 +239,8 @@ op_ldap_add( } else { *errmsg = "No modifications to do"; #ifdef NEW_LOGGING - LDAP_LOG (( "operation", LDAP_LEVEL_ERR, - "op_ldap_add: Error: no mods to do (%s)!\n", re->re_dn )); + LDAP_LOG ( OPERATION, ERR, + "op_ldap_add: Error: no mods to do (%s)!\n", re->re_dn, 0, 0 ); #else Debug( LDAP_DEBUG_ANY, "Error: op_ldap_add: no mods to do (%s)!\n", re->re_dn, 0, 0 ); @@ -277,8 +281,8 @@ op_ldap_modify( if ( re->re_mods == NULL ) { *errmsg = "No arguments given"; #ifdef NEW_LOGGING - LDAP_LOG (( "operation", LDAP_LEVEL_ERR, - "op_ldap_modify: Error: no arguments\n" )); + LDAP_LOG ( OPERATION, ERR, + "op_ldap_modify: Error: no arguments\n" , 0, 0, 0 ); #else Debug( LDAP_DEBUG_ANY, "Error: op_ldap_modify: no arguments\n", 0, 0, 0 ); @@ -330,8 +334,8 @@ op_ldap_modify( default: if ( state == AWAITING_OP ) { #ifdef NEW_LOGGING - LDAP_LOG (( "operation", LDAP_LEVEL_ERR, - "op_ldap_modify: Error: unknown mod type \"%s\"\n", type )); + LDAP_LOG ( OPERATION, ERR, + "op_ldap_modify: Error: unknown mod type \"%s\"\n", type, 0, 0 ); #else Debug( LDAP_DEBUG_ANY, "Error: op_ldap_modify: unknown mod type \"%s\"\n", @@ -348,10 +352,10 @@ op_ldap_modify( */ if ( strcasecmp( type, ldm->mod_type )) { #ifdef NEW_LOGGING - LDAP_LOG (( "operation", LDAP_LEVEL_ERR, + LDAP_LOG ( OPERATION, ERR, "op_ldap_modify: Error: " "malformed modify op, %s: %s (expecting \"%s\")\n", - type, value, ldm->mod_type )); + type, value, ldm->mod_type ); #else Debug( LDAP_DEBUG_ANY, "Error: malformed modify op, %s: %s (expecting %s:)\n", @@ -375,9 +379,9 @@ op_ldap_modify( if ( nops > 0 ) { /* Actually perform the LDAP operation */ #ifdef NEW_LOGGING - LDAP_LOG (( "operation", LDAP_LEVEL_DETAIL1, + LDAP_LOG ( OPERATION, DETAIL1, "op_ldap_modify: replica %s:%d - modify dn \"%s\"\n", - ri->ri_hostname, ri->ri_port, re->re_dn )); + ri->ri_hostname, ri->ri_port, re->re_dn ); #else Debug( LDAP_DEBUG_ARGS, "replica %s:%d - modify dn \"%s\"\n", ri->ri_hostname, ri->ri_port, re->re_dn ); @@ -404,9 +408,9 @@ op_ldap_delete( int rc; #ifdef NEW_LOGGING - LDAP_LOG (( "operation", LDAP_LEVEL_ARGS, + LDAP_LOG ( OPERATION, ARGS, "op_ldap_delete: replica %s:%d - delete dn \"%s\"\n", - ri->ri_hostname, ri->ri_port, re->re_dn )); + ri->ri_hostname, ri->ri_port, re->re_dn ); #else Debug( LDAP_DEBUG_ARGS, "replica %s:%d - delete dn \"%s\"\n", ri->ri_hostname, ri->ri_port, re->re_dn ); @@ -447,8 +451,8 @@ op_ldap_modrdn( if ( re->re_mods == NULL ) { *errmsg = "No arguments given"; #ifdef NEW_LOGGING - LDAP_LOG (( "operation", LDAP_LEVEL_ERR, - "op_ldap_modrdn: Error: no arguments\n" )); + LDAP_LOG ( OPERATION, ERR, + "op_ldap_modrdn: Error: no arguments\n" , 0, 0, 0 ); #else Debug( LDAP_DEBUG_ANY, "Error: op_ldap_modrdn: no arguments\n", 0, 0, 0 ); @@ -463,9 +467,9 @@ op_ldap_modrdn( if ( !strcmp( mi[ i ].mi_type, T_NEWRDNSTR )) { if( state & GOT_NEWRDN ) { #ifdef NEW_LOGGING - LDAP_LOG (( "operation", LDAP_LEVEL_ERR, + LDAP_LOG ( OPERATION, ERR, "op_ldap_modrdn: Error: multiple newrdn arg \"%s\"\n", - mi[ i ].mi_val )); + mi[ i ].mi_val, 0, 0 ); #else Debug( LDAP_DEBUG_ANY, "Error: op_ldap_modrdn: multiple newrdn arg \"%s\"\n", @@ -481,9 +485,9 @@ op_ldap_modrdn( } else if ( !strcmp( mi[ i ].mi_type, T_DELOLDRDNSTR )) { if( state & GOT_DELOLDRDN ) { #ifdef NEW_LOGGING - LDAP_LOG (( "operation", LDAP_LEVEL_ERR, + LDAP_LOG ( OPERATION, ERR, "op_ldap_modrdn: Error: multiple deleteoldrdn arg \"%s\"\n", - mi[ i ].mi_val )); + mi[ i ].mi_val, 0, 0 ); #else Debug( LDAP_DEBUG_ANY, "Error: op_ldap_modrdn: multiple deleteoldrdn arg \"%s\"\n", @@ -500,9 +504,9 @@ op_ldap_modrdn( drdnflag = 1; } else { #ifdef NEW_LOGGING - LDAP_LOG (( "operation", LDAP_LEVEL_ERR, + LDAP_LOG ( OPERATION, ERR, "op_ldap_modrdn: Error: bad deleteoldrdn arg \"%s\"\n", - mi[ i ].mi_val )); + mi[ i ].mi_val, 0, 0 ); #else Debug( LDAP_DEBUG_ANY, "Error: op_ldap_modrdn: bad deleteoldrdn arg \"%s\"\n", @@ -515,9 +519,9 @@ op_ldap_modrdn( } else if ( !strcmp( mi[ i ].mi_type, T_NEWSUPSTR )) { if( state & GOT_NEWSUP ) { #ifdef NEW_LOGGING - LDAP_LOG (( "operation", LDAP_LEVEL_ERR, + LDAP_LOG ( OPERATION, ERR, "op_ldap_modrdn: Error: multiple newsuperior arg \"%s\"\n", - mi[ i ].mi_val )); + mi[ i ].mi_val, 0, 0 ); #else Debug( LDAP_DEBUG_ANY, "Error: op_ldap_modrdn: multiple newsuperior arg \"%s\"\n", @@ -532,9 +536,9 @@ op_ldap_modrdn( } else { #ifdef NEW_LOGGING - LDAP_LOG (( "operation", LDAP_LEVEL_ERR, + LDAP_LOG ( OPERATION, ERR, "op_ldap_modrdn: Error: bad type \"%s\"\n", - mi[ i ].mi_type )); + mi[ i ].mi_type, 0, 0 ); #else Debug( LDAP_DEBUG_ANY, "Error: op_ldap_modrdn: bad type \"%s\"\n", mi[ i ].mi_type, 0, 0 ); @@ -549,8 +553,8 @@ op_ldap_modrdn( */ if ( !GOT_ALL_MODDN(state) ) { #ifdef NEW_LOGGING - LDAP_LOG (( "operation", LDAP_LEVEL_ERR, - "op_ldap_modrdn: Error: missing arguments\n" )); + LDAP_LOG ( OPERATION, ERR, + "op_ldap_modrdn: Error: missing arguments\n" , 0, 0, 0 ); #else Debug( LDAP_DEBUG_ANY, "Error: op_ldap_modrdn: missing arguments\n", 0, 0, 0 ); @@ -571,9 +575,9 @@ op_ldap_modrdn( snprintf( buf2, buf2len, "(\"%s\" -> \"%s\")", re->re_dn, mi->mi_val ); #ifdef NEW_LOGGING - LDAP_LOG (( "operation", LDAP_LEVEL_ARGS, + LDAP_LOG ( OPERATION, ARGS, "op_ldap_modrdn: replica %s - modify rdn %s (flag: %d)\n", - buf, buf2, drdnflag )); + buf, buf2, drdnflag ); #else Debug( LDAP_DEBUG_ARGS, "replica %s - modify rdn %s (flag: %d)\n", @@ -712,9 +716,9 @@ do_unbind( rc = ldap_unbind( ri->ri_ldp ); if ( rc != LDAP_SUCCESS ) { #ifdef NEW_LOGGING - LDAP_LOG (( "operation", LDAP_LEVEL_ERR, + LDAP_LOG ( OPERATION, ERR, "do_unbind: ldap_unbind failed for %s:%d: %s\n", - ri->ri_hostname, ri->ri_port, ldap_err2string( rc ) )); + ri->ri_hostname, ri->ri_port, ldap_err2string( rc ) ); #else Debug( LDAP_DEBUG_ANY, "Error: do_unbind: ldap_unbind failed for %s:%d: %s\n", @@ -751,7 +755,7 @@ do_bind( if ( ri == NULL ) { #ifdef NEW_LOGGING - LDAP_LOG (( "operation", LDAP_LEVEL_ERR, "do_bind: null ri ptr\n" )); + LDAP_LOG ( OPERATION, ERR, "do_bind: null ri ptr\n" , 0, 0, 0 ); #else Debug( LDAP_DEBUG_ANY, "Error: do_bind: null ri ptr\n", 0, 0, 0 ); #endif @@ -762,8 +766,8 @@ do_bind( ldrc = ldap_unbind( ri->ri_ldp ); if ( ldrc != LDAP_SUCCESS ) { #ifdef NEW_LOGGING - LDAP_LOG (( "operation", LDAP_LEVEL_ERR, - "do_bind: ldap_unbind failed: %s\n", ldap_err2string( ldrc ) )); + LDAP_LOG ( OPERATION, ERR, + "do_bind: ldap_unbind failed: %s\n", ldap_err2string( ldrc ), 0, 0 ); #else Debug( LDAP_DEBUG_ANY, "Error: do_bind: ldap_unbind failed: %s\n", @@ -774,9 +778,9 @@ do_bind( } #ifdef NEW_LOGGING - LDAP_LOG (( "operation", LDAP_LEVEL_ARGS, + LDAP_LOG ( OPERATION, ARGS, "do_bind: Initializing session to %s:%d\n", - ri->ri_hostname, ri->ri_port )); + ri->ri_hostname, ri->ri_port, 0 ); #else Debug( LDAP_DEBUG_ARGS, "Initializing session to %s:%d\n", ri->ri_hostname, ri->ri_port, 0 ); @@ -785,9 +789,9 @@ do_bind( ri->ri_ldp = ldap_init( ri->ri_hostname, ri->ri_port ); if ( ri->ri_ldp == NULL ) { #ifdef NEW_LOGGING - LDAP_LOG (( "operation", LDAP_LEVEL_ERR, + LDAP_LOG ( OPERATION, ERR, "do_bind: ldap_init (%s, %d) failed: %s\n", - ri->ri_hostname, ri->ri_port, sys_errlist[ errno ] )); + ri->ri_hostname, ri->ri_port, sys_errlist[ errno ] ); #else Debug( LDAP_DEBUG_ANY, "Error: ldap_init(%s, %d) failed: %s\n", ri->ri_hostname, ri->ri_port, sys_errlist[ errno ] ); @@ -802,9 +806,9 @@ do_bind( if( err != LDAP_OPT_SUCCESS ) { #ifdef NEW_LOGGING - LDAP_LOG (( "operation", LDAP_LEVEL_ERR, "do_bind: ", + LDAP_LOG ( OPERATION, ERR, "do_bind: " "Error: ldap_set_option(%s, LDAP_OPT_VERSION, 3) failed!\n", - ri->ri_hostname )); + ri->ri_hostname, 0, 0 ); #else Debug( LDAP_DEBUG_ANY, "Error: ldap_set_option(%s, LDAP_OPT_VERSION, 3) failed!\n", @@ -827,9 +831,9 @@ do_bind( if( err != LDAP_OPT_SUCCESS ) { #ifdef NEW_LOGGING - LDAP_LOG (( "operation", LDAP_LEVEL_ERR, "do_bind: ", + LDAP_LOG ( OPERATION, ERR, "do_bind: " "Error: ldap_set_option(%s, REFERRALS, OFF) failed!\n", - ri->ri_hostname )); + ri->ri_hostname, 0, 0 ); #else Debug( LDAP_DEBUG_ANY, "Error: ldap_set_option(%s,REFERRALS, OFF) failed!\n", @@ -848,10 +852,10 @@ do_bind( if( err != LDAP_SUCCESS ) { #ifdef NEW_LOGGING - LDAP_LOG (( "operation", LDAP_LEVEL_ERR, "do_bind: ", + LDAP_LOG ( OPERATION, ERR, "do_bind: " "%s: ldap_start_tls failed: %s (%d)\n", ri->ri_tls == TLS_CRITICAL ? "Error" : "Warning", - ldap_err2string( err ), err )); + ldap_err2string( err ), err ); #else Debug( LDAP_DEBUG_ANY, "%s: ldap_start_tls failed: %s (%d)\n", @@ -873,9 +877,9 @@ do_bind( * Bind with a plaintext password. */ #ifdef NEW_LOGGING - LDAP_LOG (( "operation", LDAP_LEVEL_ARGS, + LDAP_LOG ( OPERATION, ARGS, "do_bind: bind to %s:%d as %s (simple)\n", - ri->ri_hostname, ri->ri_port, ri->ri_bind_dn )); + ri->ri_hostname, ri->ri_port, ri->ri_bind_dn ); #else Debug( LDAP_DEBUG_ARGS, "bind to %s:%d as %s (simple)\n", ri->ri_hostname, ri->ri_port, ri->ri_bind_dn ); @@ -884,9 +888,9 @@ do_bind( ri->ri_password ); if ( ldrc != LDAP_SUCCESS ) { #ifdef NEW_LOGGING - LDAP_LOG (( "operation", LDAP_LEVEL_ERR, "do_bind: " + LDAP_LOG ( OPERATION, ERR, "do_bind: " "Error: ldap_simple_bind_s for %s:%d failed: %s\n", - ri->ri_hostname, ri->ri_port, ldap_err2string( ldrc ) )); + ri->ri_hostname, ri->ri_port, ldap_err2string( ldrc ) ); #else Debug( LDAP_DEBUG_ANY, "Error: ldap_simple_bind_s for %s:%d failed: %s\n", @@ -901,11 +905,11 @@ do_bind( case AUTH_SASL: #ifdef NEW_LOGGING - LDAP_LOG (( "operation", LDAP_LEVEL_ARGS, + LDAP_LOG ( OPERATION, ARGS, "do_bind: bind to %s as %s via %s (SASL)\n", ri->ri_hostname, ri->ri_authcId ? ri->ri_authcId : "-", - ri->ri_saslmech )); + ri->ri_saslmech ); #else Debug( LDAP_DEBUG_ARGS, "bind to %s as %s via %s (SASL)\n", ri->ri_hostname, @@ -921,9 +925,9 @@ do_bind( if( err != LDAP_OPT_SUCCESS ) { #ifdef NEW_LOGGING - LDAP_LOG (( "operation", LDAP_LEVEL_ERR, "do_bind: " + LDAP_LOG ( OPERATION, ERR, "do_bind: " "Error: ldap_set_option(%s,SECPROPS,\"%s\") failed!\n", - ri->ri_hostname, ri->ri_secprops )); + ri->ri_hostname, ri->ri_secprops, 0 ); #else Debug( LDAP_DEBUG_ANY, "Error: ldap_set_option(%s,SECPROPS,\"%s\") failed!\n", @@ -945,9 +949,9 @@ do_bind( LDAP_SASL_QUIET, lutil_sasl_interact, defaults ); if ( ldrc != LDAP_SUCCESS ) { #ifdef NEW_LOGGING - LDAP_LOG (( "operation", LDAP_LEVEL_ERR, "do_bind: " + LDAP_LOG ( OPERATION, ERR, "do_bind: " "Error: LDAP SASL for %s:%d failed: %s\n", - ri->ri_hostname, ri->ri_port, ldap_err2string( ldrc ) )); + ri->ri_hostname, ri->ri_port, ldap_err2string( ldrc ) ); #else Debug( LDAP_DEBUG_ANY, "Error: LDAP SASL for %s:%d failed: %s\n", ri->ri_hostname, ri->ri_port, ldap_err2string( ldrc )); @@ -964,9 +968,9 @@ do_bind( break; #else #ifdef NEW_LOGGING - LDAP_LOG (( "operation", LDAP_LEVEL_ERR, "do_bind: " + LDAP_LOG ( OPERATION, ERR, "do_bind: " "Error: do_bind: SASL not supported %s:%d\n", - ri->ri_hostname, ri->ri_port )); + ri->ri_hostname, ri->ri_port, 0 ); #else Debug( LDAP_DEBUG_ANY, "Error: do_bind: SASL not supported %s:%d\n", @@ -979,9 +983,9 @@ do_bind( default: #ifdef NEW_LOGGING - LDAP_LOG (( "operation", LDAP_LEVEL_ERR, "do_bind: " + LDAP_LOG ( OPERATION, ERR, "do_bind: " "Error: do_bind: unknown auth type \"%d\" for %s:%d\n", - ri->ri_bind_method, ri->ri_hostname, ri->ri_port )); + ri->ri_bind_method, ri->ri_hostname, ri->ri_port ); #else Debug( LDAP_DEBUG_ANY, "Error: do_bind: unknown auth type \"%d\" for %s:%d\n", @@ -1008,9 +1012,9 @@ do_bind( if( err != LDAP_OPT_SUCCESS ) { #ifdef NEW_LOGGING - LDAP_LOG (( "operation", LDAP_LEVEL_ERR, "do_bind: " + LDAP_LOG ( OPERATION, ERR, "do_bind: " "ldap_set_option(%s, SERVER_CONTROLS, ManageDSAit) failed!\n", - ri->ri_hostname )); + ri->ri_hostname, 0, 0 ); #else Debug( LDAP_DEBUG_ANY, "Error: " "ldap_set_option(%s, SERVER_CONTROLS, ManageDSAit) failed!\n", @@ -1045,15 +1049,15 @@ dump_ldm_array( for ( i = 0; ldmarr[ i ] != NULL; i++ ) { ldm = ldmarr[ i ]; #ifdef NEW_LOGGING - LDAP_LOG (( "operation", LDAP_LEVEL_INFO, "dump_ldm_array: " + LDAP_LOG ( OPERATION, INFO, "dump_ldm_array: " "Trace (%ld): *** ldmarr[ %d ] contents:\n", - (long) getpid(), i )); - LDAP_LOG (( "operation", LDAP_LEVEL_INFO, "dump_ldm_array: " + (long) getpid(), i, 0 ); + LDAP_LOG ( OPERATION, INFO, "dump_ldm_array: " "Trace (%ld): *** ldm->mod_op: %d\n", - (long) getpid(), ldm->mod_op )); - LDAP_LOG (( "operation", LDAP_LEVEL_INFO, "dump_ldm_array: " + (long) getpid(), ldm->mod_op, 0 ); + LDAP_LOG ( OPERATION, INFO, "dump_ldm_array: " "Trace (%ld): *** ldm->mod_type: %s\n", - (long) getpid(), ldm->mod_type )); + (long) getpid(), ldm->mod_type, 0 ); #else Debug( LDAP_DEBUG_TRACE, "Trace (%ld): *** ldmarr[ %d ] contents:\n", @@ -1071,8 +1075,8 @@ dump_ldm_array( sprintf( msgbuf, "***** bv[ %d ] len = %ld, val = <%s>", j, b->bv_len, b->bv_val ); #ifdef NEW_LOGGING - LDAP_LOG (( "operation", LDAP_LEVEL_INFO, "dump_ldm_array: " - "Trace (%ld):%s\n", (long) getpid(), msgbuf )); + LDAP_LOG ( OPERATION, INFO, "dump_ldm_array: " + "Trace (%ld):%s\n", (long) getpid(), msgbuf, 0 ); #else Debug( LDAP_DEBUG_TRACE, "Trace (%ld):%s\n", (long) getpid(), msgbuf, 0 ); diff --git a/servers/slurpd/lock.c b/servers/slurpd/lock.c index d457cdfc21..ce6fffb031 100644 --- a/servers/slurpd/lock.c +++ b/servers/slurpd/lock.c @@ -51,8 +51,8 @@ lock_fopen( strcat( buf, ".lock" ); if ( (*lfp = fopen( buf, "w" )) == NULL ) { #ifdef NEW_LOGGING - LDAP_LOG (( "lock", LDAP_LEVEL_ERR, "lock_fopen: " - "Error: could not open \"%s\"\n", buf )); + LDAP_LOG ( SLURPD, ERR, "lock_fopen: " + "Error: could not open \"%s\"\n", buf, 0, 0 ); #else Debug( LDAP_DEBUG_ANY, "Error: could not open \"%s\"\n", buf, 0, 0 ); @@ -66,8 +66,8 @@ lock_fopen( /* open the log file */ if ( (fp = fopen( fname, type )) == NULL ) { #ifdef NEW_LOGGING - LDAP_LOG (( "lock", LDAP_LEVEL_ERR, "lock_fopen: " - "Error: could not open \"%s\"\n", fname )); + LDAP_LOG ( SLURPD, ERR, "lock_fopen: " + "Error: could not open \"%s\"\n", fname, 0, 0 ); #else Debug( LDAP_DEBUG_ANY, "Error: could not open \"%s\"\n", fname, 0, 0 ); @@ -110,9 +110,9 @@ acquire_lock( { if (( *rfp = lock_fopen( file, "r+", lfp )) == NULL ) { #ifdef NEW_LOGGING - LDAP_LOG (( "lock", LDAP_LEVEL_ERR, "acquire_lock: " + LDAP_LOG ( SLURPD, ERR, "acquire_lock: " "Error: acquire_lock(%ld): Could not acquire lock on \"%s\"\n", - (long) getpid(), file )); + (long) getpid(), file, 0 ); #else Debug( LDAP_DEBUG_ANY, "Error: acquire_lock(%ld): Could not acquire lock on \"%s\"\n", @@ -138,9 +138,9 @@ relinquish_lock( { if ( lock_fclose( rfp, lfp ) == EOF ) { #ifdef NEW_LOGGING - LDAP_LOG (( "lock", LDAP_LEVEL_ERR, "relinguish_lock: " + LDAP_LOG ( SLURPD, ERR, "relinguish_lock: " "Error: relinquish_lock (%ld): Error closing \"%s\"\n", - (long) getpid(), file )); + (long) getpid(), file, 0 ); #else Debug( LDAP_DEBUG_ANY, "Error: relinquish_lock (%ld): Error closing \"%s\"\n", diff --git a/servers/slurpd/main.c b/servers/slurpd/main.c index 8965ff0f79..41d7fc3f2f 100644 --- a/servers/slurpd/main.c +++ b/servers/slurpd/main.c @@ -22,9 +22,9 @@ #include "portable.h" -#include - #include +#include +#include #include "slurp.h" #include "globals.h" @@ -123,8 +123,8 @@ main( 0, fm, (void *) NULL ) != 0 ) { #ifdef NEW_LOGGING - LDAP_LOG (( "main", LDAP_LEVEL_ERR, - "main: file manager ldap_pvt_thread_create failed\n" )); + LDAP_LOG ( SLURPD, ERR, + "main: file manager ldap_pvt_thread_create failed\n" , 0, 0, 0 ); #else Debug( LDAP_DEBUG_ANY, "file manager ldap_pvt_thread_create failed\n", 0, 0, 0 ); @@ -165,8 +165,7 @@ main( ldap_pvt_thread_destroy(); #ifdef NEW_LOGGING - LDAP_LOG (( "main", LDAP_LEVEL_RESULTS, - "main: slurpd terminated\n" )); + LDAP_LOG ( SLURPD, RESULTS, "main: slurpd terminated\n", 0, 0, 0 ); #else Debug( LDAP_DEBUG_ANY, "slurpd: terminated.\n", 0, 0, 0 ); #endif diff --git a/servers/slurpd/re.c b/servers/slurpd/re.c index b921728ef0..dbde0bc43d 100644 --- a/servers/slurpd/re.c +++ b/servers/slurpd/re.c @@ -83,8 +83,8 @@ Re_free( } if ( re->re_refcnt > 0 ) { #ifdef NEW_LOGGING - LDAP_LOG (( "re", LDAP_LEVEL_WARNING, "Re_free: " - "Warning: freeing re (dn: %s) with nonzero refcnt\n", re->re_dn )); + LDAP_LOG ( SLURPD, WARNING, "Re_free: " + "Warning: freeing re (dn: %s) with nonzero refcnt\n", re->re_dn, 0, 0 ); #else Debug( LDAP_DEBUG_ANY, "Warning: freeing re (dn: %s) with nonzero refcnt\n", @@ -142,7 +142,7 @@ Re_parse( if ( re == NULL ) { #ifdef NEW_LOGGING - LDAP_LOG (( "re", LDAP_LEVEL_ERR, "Re_parse: Error: re is NULL\n" )); + LDAP_LOG ( SLURPD, ERR, "Re_parse: Error: re is NULL\n", 0, 0, 0 ); #else Debug( LDAP_DEBUG_ANY, "Re_parse: error: re is NULL\n", 0, 0, 0 ); #endif @@ -150,7 +150,7 @@ Re_parse( } if ( replbuf == NULL ) { #ifdef NEW_LOGGING - LDAP_LOG (( "re", LDAP_LEVEL_ERR, "Re_parse: Error: replbuf is NULL\n" )); + LDAP_LOG ( SLURPD, ERR, "Re_parse: Error: replbuf is NULL\n", 0, 0, 0 ); #else Debug( LDAP_DEBUG_ANY, "Re_parse: error: replbuf is NULL\n", 0, 0, 0 ); #endif @@ -179,8 +179,8 @@ Re_parse( buflen = strlen( buf ); if ( ldif_parse_line( buf, &type, &value, &len ) < 0 ) { #ifdef NEW_LOGGING - LDAP_LOG (( "re", LDAP_LEVEL_ERR, - "Re_parse: Error: malformed replog file\n" )); + LDAP_LOG ( SLURPD, ERR, + "Re_parse: Error: malformed replog file\n", 0, 0, 0 ); #else Debug( LDAP_DEBUG_ANY, "Error: Re_parse: malformed replog file\n", @@ -213,8 +213,8 @@ Re_parse( default: if ( !( state == GOT_ALL )) { #ifdef NEW_LOGGING - LDAP_LOG (( "re", LDAP_LEVEL_ERR, - "Re_parse: Error: bad type <%s>\n", type )); + LDAP_LOG ( SLURPD, ERR, + "Re_parse: Error: bad type <%s>\n", type, 0, 0 ); #else Debug( LDAP_DEBUG_ANY, "Error: Re_parse: bad type <%s>\n", @@ -233,8 +233,8 @@ Re_parse( if ( state != GOT_ALL ) { #ifdef NEW_LOGGING - LDAP_LOG (( "re", LDAP_LEVEL_ERR, - "Re_parse: Error: malformed replog file\n" )); + LDAP_LOG ( SLURPD, ERR, + "Re_parse: Error: malformed replog file\n", 0, 0, 0 ); #else Debug( LDAP_DEBUG_ANY, "Error: Re_parse: malformed replog file\n", @@ -256,8 +256,8 @@ Re_parse( } else { if ( ldif_parse_line( buf, &type, &value, &len ) < 0 ) { #ifdef NEW_LOGGING - LDAP_LOG (( "re", LDAP_LEVEL_ERR, - "Re_parse: Error: malformed replog line \"%s\"\n", buf )); + LDAP_LOG ( SLURPD, ERR, + "Re_parse: Error: malformed replog line \"%s\"\n", buf, 0, 0 ); #else Debug( LDAP_DEBUG_ANY, "Error: malformed replog line \"%s\"\n", @@ -375,8 +375,8 @@ get_repl_hosts( rh = (Rh *) ch_realloc((char *) rh, ( nreplicas + 2 ) * sizeof( Rh )); if ( rh == NULL ) { #ifdef NEW_LOGGING - LDAP_LOG (( "re", LDAP_LEVEL_ERR, - "get_repl_hosts: Out of memory\n" )); + LDAP_LOG ( SLURPD, ERR, + "get_repl_hosts: Out of memory\n", 0, 0, 0 ); #else Debug( LDAP_DEBUG_ANY, "Out of memory in get_repl_hosts\n", 0, 0, 0 ); @@ -497,7 +497,7 @@ Re_dump( if ( re == NULL ) { #ifdef NEW_LOGGING - LDAP_LOG (( "re", LDAP_LEVEL_ERR, "Re_dump: re is NULL\n" )); + LDAP_LOG ( SLURPD, ERR, "Re_dump: re is NULL\n", 0, 0, 0 ); #else Debug( LDAP_DEBUG_TRACE, "Re_dump: re is NULL\n", 0, 0, 0 ); #endif @@ -567,8 +567,8 @@ Re_write( if ( re == NULL || fp == NULL ) { #ifdef NEW_LOGGING - LDAP_LOG (( "re", LDAP_LEVEL_ERR, - "Re_write: Internal error: NULL argument\n" )); + LDAP_LOG ( SLURPD, ERR, + "Re_write: Internal error: NULL argument\n", 0, 0, 0 ); #else Debug( LDAP_DEBUG_ANY, "Internal error: Re_write: NULL argument\n", 0, 0, 0 ); @@ -661,8 +661,8 @@ Re_write( bad: if ( rc != 0 ) { #ifdef NEW_LOGGING - LDAP_LOG (( "re", LDAP_LEVEL_ERR, - "Re_write: Error while writing: %s\n", sys_errlist[ errno ] )); + LDAP_LOG ( SLURPD, ERR, + "Re_write: Error while writing: %s\n", sys_errlist[ errno ], 0, 0 ); #else Debug( LDAP_DEBUG_ANY, "Error while writing: %s\n", sys_errlist[ errno ], 0, 0 ); @@ -804,9 +804,9 @@ warn_unknown_replica( } if ( !found ) { #ifdef NEW_LOGGING - LDAP_LOG (( "re", LDAP_LEVEL_WARNING, "warn_unknown_replica: " + LDAP_LOG ( SLURPD, WARNING, "warn_unknown_replica: " "Warning: unknown replica %s:%d found in replication log\n", - host, port )); + host, port, 0 ); #else Debug( LDAP_DEBUG_ANY, "Warning: unknown replica %s:%d found in replication log\n", diff --git a/servers/slurpd/reject.c b/servers/slurpd/reject.c index a8f2f657b7..91e1c6a11e 100644 --- a/servers/slurpd/reject.c +++ b/servers/slurpd/reject.c @@ -66,9 +66,9 @@ write_reject( if (( rjfd = open( rejfile, O_RDWR | O_APPEND | O_CREAT, S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP )) < 0 ) { #ifdef NEW_LOGGING - LDAP_LOG (( "reject", LDAP_LEVEL_ERR, "write_reject: " + LDAP_LOG ( SLURPD, ERR, "write_reject: " "Error: Cannot create \"%s\":%s\n", - rejfile, sys_errlist[ errno ] )); + rejfile, sys_errlist[ errno ], 0 ); #else Debug( LDAP_DEBUG_ANY, "Error: write_reject: Cannot create \"%s\": %s\n", @@ -82,8 +82,8 @@ write_reject( } if (( rc = acquire_lock( rejfile, &rfp, &lfp )) < 0 ) { #ifdef NEW_LOGGING - LDAP_LOG (( "reject", LDAP_LEVEL_ERR, "write_reject: " - "Error: Cannot open reject file \"%s\"\n", rejfile )); + LDAP_LOG ( SLURPD, ERR, "write_reject: " + "Error: Cannot open reject file \"%s\"\n", rejfile, 0, 0 ); #else Debug( LDAP_DEBUG_ANY, "Error: cannot open reject file \"%s\"\n", rejfile, 0, 0 ); @@ -97,8 +97,8 @@ write_reject( } if ((rc = re->re_write( ri, re, rfp )) < 0 ) { #ifdef NEW_LOGGING - LDAP_LOG (( "reject", LDAP_LEVEL_ERR, "write_reject: " - "Error: Cannot write reject file \"%s\"\n", rejfile )); + LDAP_LOG ( SLURPD, ERR, "write_reject: " + "Error: Cannot write reject file \"%s\"\n", rejfile, 0, 0 ); #else Debug( LDAP_DEBUG_ANY, "Error: cannot write reject file \"%s\"\n", @@ -107,8 +107,9 @@ write_reject( } (void) relinquish_lock( rejfile, rfp, lfp ); #ifdef NEW_LOGGING - LDAP_LOG (( "reject", LDAP_LEVEL_ERR, "write_reject: " - "Error: ldap operation failed, data written to \"%s\"\n", rejfile )); + LDAP_LOG ( SLURPD, ERR, "write_reject: " + "Error: ldap operation failed, data written to \"%s\"\n", + rejfile, 0, 0 ); #else Debug( LDAP_DEBUG_ANY, "Error: ldap operation failed, data written to \"%s\"\n", diff --git a/servers/slurpd/replica.c b/servers/slurpd/replica.c index f5bf393cb1..49fc9e178e 100644 --- a/servers/slurpd/replica.c +++ b/servers/slurpd/replica.c @@ -28,7 +28,6 @@ #include "slurp.h" #include "globals.h" - /* * Just invoke the Ri's process() member function, and log the start and * finish. @@ -41,9 +40,9 @@ replicate( Ri *ri = (Ri *) ri_arg; #ifdef NEW_LOGGING - LDAP_LOG (( "replica", LDAP_LEVEL_ARGS, "replicate: " + LDAP_LOG ( SLURPD, ARGS, "replicate: " "begin replication thread for %s:%d\n", - ((Ri *)ri)->ri_hostname, ((Ri *)ri)->ri_port )); + ((Ri *)ri)->ri_hostname, ((Ri *)ri)->ri_port, 0 ); #else Debug( LDAP_DEBUG_ARGS, "begin replication thread for %s:%d\n", ((Ri *)ri)->ri_hostname, ((Ri *)ri)->ri_port, 0 ); @@ -52,9 +51,9 @@ replicate( ri->ri_process( ri ); #ifdef NEW_LOGGING - LDAP_LOG (( "replica", LDAP_LEVEL_ARGS, "replicate: " + LDAP_LOG ( SLURPD, ARGS, "replicate: " "begin replication thread for %s:%d\n", - ri->ri_hostname, ri->ri_port )); + ri->ri_hostname, ri->ri_port, 0 ); #else Debug( LDAP_DEBUG_ARGS, "end replication thread for %s:%d\n", ri->ri_hostname, ri->ri_port, 0 ); @@ -76,9 +75,9 @@ start_replica_thread( if ( ldap_pvt_thread_create( &(ri->ri_tid), 0, replicate, (void *) ri ) != 0 ) { #ifdef NEW_LOGGING - LDAP_LOG (( "replica", LDAP_LEVEL_ERR, "start_replica_thread: " + LDAP_LOG ( SLURPD, ERR, "start_replica_thread: " "replica %s:%d ldap_pvt_thread_create failed\n", - ri->ri_hostname, ri->ri_port )); + ri->ri_hostname, ri->ri_port, 0 ); #else Debug( LDAP_DEBUG_ANY, "replica \"%s:%d\" ldap_pvt_thread_create failed\n", ri->ri_hostname, ri->ri_port, 0 ); diff --git a/servers/slurpd/replog.c b/servers/slurpd/replog.c index f43965b8e7..d1f63a2295 100644 --- a/servers/slurpd/replog.c +++ b/servers/slurpd/replog.c @@ -59,8 +59,8 @@ copy_replog( char *p; #ifdef NEW_LOGGING - LDAP_LOG (( "replog", LDAP_LEVEL_ARGS, "copy_replog: " - "copy replog \"%s\" to \"%s\"\n", src, dst )); + LDAP_LOG ( SLURPD, ARGS, "copy_replog: " + "copy replog \"%s\" to \"%s\"\n", src, dst, 0 ); #else Debug( LDAP_DEBUG_ARGS, "copy replog \"%s\" to \"%s\"\n", @@ -79,9 +79,9 @@ copy_replog( } if ( access( buf, W_OK ) < 0 ) { #ifdef NEW_LOGGING - LDAP_LOG (( "replog", LDAP_LEVEL_ERR, "copy_replog: " + LDAP_LOG ( SLURPD, ERR, "copy_replog: " "Error: (%ld): Directory %s is not writable\n", - (long) getpid(), buf )); + (long) getpid(), buf, 0 ); #else Debug( LDAP_DEBUG_ANY, "Error: copy_replog (%ld): Directory %s is not writable\n", @@ -97,9 +97,9 @@ copy_replog( } if ( access( buf, W_OK ) < 0 ) { #ifdef NEW_LOGGING - LDAP_LOG (( "replog", LDAP_LEVEL_ERR, "copy_replog: " + LDAP_LOG ( SLURPD, ERR, "copy_replog: " "Error: (%ld): Directory %s is not writable\n", - (long) getpid(), buf )); + (long) getpid(), buf, 0 ); #else Debug( LDAP_DEBUG_ANY, "Error: copy_replog (%ld): Directory %s is not writable\n", @@ -112,9 +112,9 @@ copy_replog( rfp = lock_fopen( src, "r", &lfp ); if ( rfp == NULL ) { #ifdef NEW_LOGGING - LDAP_LOG (( "replog", LDAP_LEVEL_ERR, "copy_replog: " + LDAP_LOG ( SLURPD, ERR, "copy_replog: " "Error: Can't lock replog \"%s\" for read: %s\n", - src, sys_errlist[ errno ] )); + src, sys_errlist[ errno ], 0 ); #else Debug( LDAP_DEBUG_ANY, "Error: copy_replog: Can't lock replog \"%s\" for read: %s\n", @@ -127,9 +127,9 @@ copy_replog( dfp = lock_fopen( dst, "a", &dlfp ); if ( dfp == NULL ) { #ifdef NEW_LOGGING - LDAP_LOG (( "replog", LDAP_LEVEL_ERR, "copy_replog: " + LDAP_LOG ( SLURPD, ERR, "copy_replog: " "Error: Can't lock replog \"%s\" for write: %s\n", - src, sys_errlist[ errno ] )); + src, sys_errlist[ errno ], 0 ); #else Debug( LDAP_DEBUG_ANY, "Error: copy_replog: Can't lock replog \"%s\" for write: %s\n", @@ -153,8 +153,8 @@ copy_replog( if ( lock_fclose( dfp, dlfp ) == EOF ) { #ifdef NEW_LOGGING - LDAP_LOG (( "replog", LDAP_LEVEL_ERR, "copy_replog: " - "Error: Error closing \"%s\"\n", src )); + LDAP_LOG ( SLURPD, ERR, "copy_replog: " + "Error: Error closing \"%s\"\n", src, 0, 0 ); #else Debug( LDAP_DEBUG_ANY, "Error: copy_replog: Error closing \"%s\"\n", @@ -163,8 +163,8 @@ copy_replog( } if ( lock_fclose( rfp, lfp ) == EOF ) { #ifdef NEW_LOGGING - LDAP_LOG (( "replog", LDAP_LEVEL_ERR, "copy_replog: " - "Error: Error closing \"%s\"\n", src )); + LDAP_LOG ( SLURPD, ERR, "copy_replog: " + "Error: Error closing \"%s\"\n", src, 0, 0 ); #else Debug( LDAP_DEBUG_ANY, "Error: copy_replog: Error closing \"%s\"\n", diff --git a/servers/slurpd/ri.c b/servers/slurpd/ri.c index f7f2227875..c9f0a4ffa1 100644 --- a/servers/slurpd/ri.c +++ b/servers/slurpd/ri.c @@ -58,8 +58,8 @@ Ri_process( #endif if ( ri == NULL ) { #ifdef NEW_LOGGING - LDAP_LOG (( "ri", LDAP_LEVEL_ERR, "Ri_process: " - "Error: ri == NULL!\n" )); + LDAP_LOG ( SLURPD, ERR, "Ri_process: " + "Error: ri == NULL!\n", 0, 0, 0 ); #else Debug( LDAP_DEBUG_ANY, "Error: Ri_process: ri == NULL!\n", 0, 0, 0 ); #endif @@ -93,9 +93,9 @@ Ri_process( if ( !ismine( ri, re )) { /* The Re doesn't list my host:port */ #ifdef NEW_LOGGING - LDAP_LOG (( "ri", LDAP_LEVEL_DETAIL1, "Ri_process: " + LDAP_LOG ( SLURPD, DETAIL1, "Ri_process: " "Replica %s:%d, skip repl record for %s (not mine)\n", - ri->ri_hostname, ri->ri_port, re->re_dn )); + ri->ri_hostname, ri->ri_port, re->re_dn ); #else Debug( LDAP_DEBUG_TRACE, "Replica %s:%d, skip repl record for %s (not mine)\n", @@ -104,9 +104,9 @@ Ri_process( } else if ( !isnew( ri, re )) { /* This Re is older than my saved status information */ #ifdef NEW_LOGGING - LDAP_LOG (( "ri", LDAP_LEVEL_DETAIL1, "Ri_process: " + LDAP_LOG ( SLURPD, DETAIL1, "Ri_process: " "Replica %s:%d, skip repl record for %s (old)\n", - ri->ri_hostname, ri->ri_port, re->re_dn )); + ri->ri_hostname, ri->ri_port, re->re_dn ); #else Debug( LDAP_DEBUG_TRACE, "Replica %s:%d, skip repl record for %s (old)\n", @@ -118,9 +118,9 @@ Ri_process( case DO_LDAP_ERR_RETRYABLE: ldap_pvt_thread_sleep( RETRY_SLEEP_TIME ); #ifdef NEW_LOGGING - LDAP_LOG (( "ri", LDAP_LEVEL_DETAIL1, "Ri_process: " + LDAP_LOG ( SLURPD, DETAIL1, "Ri_process: " "Retrying operation for DN %s on replica %s:%d\n", - re->re_dn, ri->ri_hostname, ri->ri_port )); + re->re_dn, ri->ri_hostname, ri->ri_port ); #else Debug( LDAP_DEBUG_ANY, "Retrying operation for DN %s on replica %s:%d\n", @@ -148,8 +148,8 @@ Ri_process( } } else { #ifdef NEW_LOGGING - LDAP_LOG (( "ri", LDAP_LEVEL_ERR, "Ri_process: " - "Error: re is null in Ri_process\n" )); + LDAP_LOG ( SLURPD, ERR, "Ri_process: " + "Error: re is null in Ri_process\n", 0, 0, 0 ); #else Debug( LDAP_DEBUG_ANY, "Error: re is null in Ri_process\n", 0, 0, 0 ); diff --git a/servers/slurpd/rq.c b/servers/slurpd/rq.c index 37098c9f36..87f2daeb59 100644 --- a/servers/slurpd/rq.c +++ b/servers/slurpd/rq.c @@ -55,7 +55,6 @@ #include "slurp.h" #include "globals.h" - /* * Lock the replication queue. */ @@ -134,8 +133,8 @@ Rq_delhead( if ( savedhead->re_getrefcnt( savedhead ) != 0 ) { #ifdef NEW_LOGGING - LDAP_LOG (( "rq", LDAP_LEVEL_WARNING, "Rq_delhead: " - "Warning: attempt to delete when refcnt != 0\n" )); + LDAP_LOG ( SLURPD, WARNING, "Rq_delhead: " + "Warning: attempt to delete when refcnt != 0\n", 0, 0, 0 ); #else Debug( LDAP_DEBUG_ANY, "Warning: attempt to delete when refcnt != 0\n", 0, 0, 0 ); @@ -223,7 +222,7 @@ Rq_gc( { if ( rq == NULL ) { #ifdef NEW_LOGGING - LDAP_LOG (( "rq", LDAP_LEVEL_DETAIL1, "Rq_gc: rq is NULL!\n" )); + LDAP_LOG ( SLURPD, DETAIL1, "Rq_gc: rq is NULL!\n", 0, 0, 0 ); #else Debug( LDAP_DEBUG_ANY, "Rq_gc: rq is NULL!\n", 0, 0, 0 ); #endif @@ -255,7 +254,7 @@ Rq_dump( if ( rq == NULL ) { #ifdef NEW_LOGGING - LDAP_LOG (( "rq", LDAP_LEVEL_ARGS, "Rq_dump: rq is NULL!\n" )); + LDAP_LOG ( SLURPD, ARGS, "Rq_dump: rq is NULL!\n", 0, 0, 0 ); #else Debug( LDAP_DEBUG_ANY, "Rq_dump: rq is NULL!\n", 0, 0, 0 ); #endif @@ -264,8 +263,8 @@ Rq_dump( if (unlink(SLURPD_DUMPFILE) == -1 && errno != ENOENT) { #ifdef NEW_LOGGING - LDAP_LOG (( "rq", LDAP_LEVEL_ERR, "Rq_dump: " - "\"%s\" exists, cannot unlink\n", SLURPD_DUMPFILE )); + LDAP_LOG ( SLURPD, ERR, "Rq_dump: " + "\"%s\" exists, cannot unlink\n", SLURPD_DUMPFILE, 0, 0 ); #else Debug( LDAP_DEBUG_ANY, "Rq_dump: \"%s\" exists, and cannot unlink\n", SLURPD_DUMPFILE, 0, 0 ); @@ -274,8 +273,8 @@ Rq_dump( } if (( tmpfd = open(SLURPD_DUMPFILE, O_CREAT|O_RDWR|O_EXCL, 0600)) == -1) { #ifdef NEW_LOGGING - LDAP_LOG (( "rq", LDAP_LEVEL_ERR, "Rq_dump: " - "cannot open \"%s\" for write\n", SLURPD_DUMPFILE )); + LDAP_LOG ( SLURPD, ERR, "Rq_dump: " + "cannot open \"%s\" for write\n", SLURPD_DUMPFILE, 0, 0 ); #else Debug( LDAP_DEBUG_ANY, "Rq_dump: cannot open \"%s\" for write\n", SLURPD_DUMPFILE, 0, 0 ); @@ -284,8 +283,8 @@ Rq_dump( } if (( fp = fdopen( tmpfd, "w" )) == NULL ) { #ifdef NEW_LOGGING - LDAP_LOG (( "rq", LDAP_LEVEL_ERR, "Rq_dump: " - "cannot fdopen \"%s\" for write\n", SLURPD_DUMPFILE )); + LDAP_LOG ( SLURPD, ERR, "Rq_dump: " + "cannot fdopen \"%s\" for write\n", SLURPD_DUMPFILE, 0, 0 ); #else Debug( LDAP_DEBUG_ANY, "Rq_dump: cannot fdopen \"%s\" for write\n", SLURPD_DUMPFILE, 0, 0 ); @@ -322,8 +321,8 @@ Rq_write( } #ifdef NEW_LOGGING - LDAP_LOG (( "rq", LDAP_LEVEL_ENTRY, "Rq_write: " - "re-write on-disk replication log\n" )); + LDAP_LOG ( SLURPD, ENTRY, "Rq_write: " + "re-write on-disk replication log\n", 0, 0, 0 ); #else Debug( LDAP_DEBUG_ARGS, "re-write on-disk replication log\n", 0, 0, 0 ); @@ -346,8 +345,8 @@ Rq_write( /* and truncate to correct len */ if ( ftruncate( fileno( fp ), sglob->srpos ) < 0 ) { #ifdef NEW_LOGGING - LDAP_LOG (( "rq", LDAP_LEVEL_ERR, "Rq_write: " - "Error truncating replication log: %s\n", sys_errlist[ errno ] )); + LDAP_LOG ( SLURPD, ERR, "Rq_write: " + "Error truncating replication log: %s\n", sys_errlist[ errno ], 0, 0 ); #else Debug( LDAP_DEBUG_ANY, "Error truncating replication log: %s\n", sys_errlist[ errno ], 0, 0 ); diff --git a/servers/slurpd/st.c b/servers/slurpd/st.c index ffe150ea24..f6cc685fff 100644 --- a/servers/slurpd/st.c +++ b/servers/slurpd/st.c @@ -98,9 +98,9 @@ St_write ( &(st->st_lfp))) < 0 ) { if ( !st->st_err_logged ) { #ifdef NEW_LOGGING - LDAP_LOG (( "st", LDAP_LEVEL_ERR, "St_write: " + LDAP_LOG ( SLURPD, ERR, "St_write: " "Error: cannot open status file \"%s\":%s\n", - sglob->slurpd_status_file, sys_errlist[ errno ] )); + sglob->slurpd_status_file, sys_errlist[ errno ], 0 ); #else Debug( LDAP_DEBUG_ANY, "Error: cannot open status file \"%s\": %s\n", @@ -184,9 +184,9 @@ St_read( */ if (( fp = fopen( sglob->slurpd_status_file, "w" )) == NULL ) { #ifdef NEW_LOGGING - LDAP_LOG (( "st", LDAP_LEVEL_ERR, "St_write: " + LDAP_LOG ( SLURPD, ERR, "St_write: " "Error: cannot create status file \"%s\"\n", - sglob->slurpd_status_file )); + sglob->slurpd_status_file, 0, 0 ); #else Debug( LDAP_DEBUG_ANY, "Error: cannot create status file \"%s\"\n", sglob->slurpd_status_file, 0, 0 ); @@ -197,8 +197,8 @@ St_read( (void) fclose( fp ); ldap_pvt_thread_mutex_unlock( &(st->st_mutex )); #ifdef NEW_LOGGING - LDAP_LOG (( "st", LDAP_LEVEL_DETAIL1, "St_write: " - "No status file found, defaulting values\n" )); + LDAP_LOG ( SLURPD, DETAIL1, "St_write: " + "No status file found, defaulting values\n", 0, 0, 0 ); #else Debug( LDAP_DEBUG_ARGS, "No status file found, defaulting values\n", 0, 0, 0 ); @@ -248,17 +248,17 @@ St_read( sprintf( tbuf, "%s:%s (timestamp %s.%s)", hostname, port, timestamp, seq ); #ifdef NEW_LOGGING - LDAP_LOG (( "st", LDAP_LEVEL_DETAIL1, "St_write: " - "Retrieved state information for %s\n", tbuf )); + LDAP_LOG ( SLURPD, DETAIL1, "St_write: " + "Retrieved state information for %s\n", tbuf, 0, 0 ); #else Debug( LDAP_DEBUG_ARGS, "Retrieved state information for %s\n", tbuf, 0, 0 ); #endif } else { #ifdef NEW_LOGGING - LDAP_LOG (( "st", LDAP_LEVEL_WARNING, "St_write: " + LDAP_LOG ( SLURPD, WARNING, "St_write: " "Warning: saved state for %s:%s, not a known replica\n", - hostname, port )); + hostname, port, 0 ); #else Debug( LDAP_DEBUG_ANY, "Warning: saved state for %s:%s, not a known replica\n", -- 2.39.5