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 );
}
/* 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);
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 );
}
#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
if ( cargc < 2 ) {
#ifdef NEW_LOGGING
- LDAP_LOG(( "config", LDAP_LEVEL_CRIT,
+ LDAP_LOG( CONFIG, CRIT,
"%s: line %d: missing filename in \"include "
- "<filename>\" line.\n", fname, lineno ));
+ "<filename>\" line.\n", fname, lineno , 0 );
#else
Debug( LDAP_DEBUG_ANY,
"%s: line %d: missing filename in \"include <filename>\" line\n",
}
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",
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",
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 );
} 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",
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",
}
}
#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
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",
*/
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",
*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",
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",
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",
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",
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",
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",
/* 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 );
} 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 );
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 );
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",
*/
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",
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 );
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 );
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 );
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",
} 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",
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",
} 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",
} 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 );
*/
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 );
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",
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",
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
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",
}
#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 );
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 ] );
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",
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",
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",
* 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 );
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",
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,
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",
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 ));
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",
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",
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",
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",
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 );
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 );
/* 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 );
{
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",
{
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",
#include "portable.h"
-#include <ac/stdlib.h>
-
#include <stdio.h>
+#include <sys/stat.h>
+#include <ac/stdlib.h>
#include "slurp.h"
#include "globals.h"
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 );
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
}
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",
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
}
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
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",
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",
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",
} 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",
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 );
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
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 );
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 );
}
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",
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",
}
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 );
}
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",
}
(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",
#include "slurp.h"
#include "globals.h"
-
/*
* Just invoke the Ri's process() member function, and log the start and
* finish.
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 );
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 );
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 );
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",
}
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",
}
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",
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",
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",
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",
}
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",
#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
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",
} 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",
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",
}
} 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 );
#include "slurp.h"
#include "globals.h"
-
/*
* Lock the replication queue.
*/
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 );
{
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
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
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 );
}
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 );
}
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 );
}
#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 );
/* 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 );
&(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",
*/
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 );
(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 );
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",