]> git.sur5r.net Git - openldap/commitdiff
Mostly new logging changes
authorKurt Zeilenga <kurt@openldap.org>
Sun, 28 Jul 2002 21:05:15 +0000 (21:05 +0000)
committerKurt Zeilenga <kurt@openldap.org>
Sun, 28 Jul 2002 21:05:15 +0000 (21:05 +0000)
13 files changed:
servers/slurpd/args.c
servers/slurpd/config.c
servers/slurpd/fm.c
servers/slurpd/ldap_op.c
servers/slurpd/lock.c
servers/slurpd/main.c
servers/slurpd/re.c
servers/slurpd/reject.c
servers/slurpd/replica.c
servers/slurpd/replog.c
servers/slurpd/ri.c
servers/slurpd/rq.c
servers/slurpd/st.c

index 42629525241d2da007d2b8c62565f58050362deb..76b3cb8b6272a44a5c0d524c3a76a2a07e5c7acd 100644 (file)
@@ -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);
index bd47c26a61348ca92c9301008c6648510f4afd9e..cff77048992f51c5217df8aaa8f5e97a0913a2e8 100644 (file)
@@ -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 "
-                        "<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",
@@ -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",
index 36fab6540e346a8588ca56e9adb4f3c1fcfeffea..30ac5845d6428a5f073e816967dc942e97da02e9 100644 (file)
@@ -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",
index 577950e4b0af14e1cddc4ec89999182c68c12309..38882a1b42226351b564a2174a60d21276f683c3 100644 (file)
@@ -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 );
index d457cdfc21ae62aa655692e0bef074e06d05c21f..ce6fffb03102febd4d16b6a6ba0928252bd5f69d 100644 (file)
@@ -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",
index 8965ff0f79e1f4b0f031f63dba700d53a11a513a..41d7fc3f2f35e2c762bfadfd03c31baa7402ef6c 100644 (file)
@@ -22,9 +22,9 @@
 
 #include "portable.h"
 
-#include <ac/stdlib.h>
-
 #include <stdio.h>
+#include <sys/stat.h>
+#include <ac/stdlib.h>
 
 #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
index b921728ef0c0ce9760a3fa9280e4f407336a72bc..dbde0bc43dbd947cdb62e61bd858f0b19e659e03 100644 (file)
@@ -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",
index a8f2f657b79dca972b265e5f224bdb7144b872ec..91e1c6a11e42daaf4075f738db85893930d7e6f8 100644 (file)
@@ -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",
index f5bf393cb1ddbe21bd727fac61a1b5afaf0fcd2a..49fc9e178e0ba0d7cca7408b62505e01c31e2fdb 100644 (file)
@@ -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 );
index f43965b8e7687d74569f9c66381d6efe07f0fa25..d1f63a2295f7668b69af411fb984d5637f01e532 100644 (file)
@@ -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",
index f7f2227875e3ebdfacbc804fa8b3029245007ff1..c9f0a4ffa1ce5a9e17500e5bc1d14fa1887f69aa 100644 (file)
@@ -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 );
index 37098c9f3649e23aa29a1a943c8d63350d922039..87f2daeb59ee07ce0b8f22d40dba17937334cc96 100644 (file)
@@ -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 );
index ffe150ea241b505aa705b89e42a3e39f5a164e49..f6cc685fff707f09ae6b80d1bf3000aed072c2e0 100644 (file)
@@ -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",