]> git.sur5r.net Git - openldap/commitdiff
ITS#6566 use Debug, not fprintf(stderr)
authorHoward Chu <hyc@openldap.org>
Wed, 2 Jun 2010 00:18:32 +0000 (00:18 +0000)
committerHoward Chu <hyc@openldap.org>
Wed, 2 Jun 2010 00:18:32 +0000 (00:18 +0000)
servers/slapd/overlays/ppolicy.c
servers/slapd/overlays/rwm.c
servers/slapd/overlays/rwmconf.c
servers/slapd/overlays/sssvlv.c
servers/slapd/overlays/valsort.c

index ec5992b82caed30a50c3018c90dfad75f2870087..924071255cf52d6e6e2b5678287fd4fa08beeaef 100644 (file)
@@ -2234,7 +2234,7 @@ ppolicy_db_init(
                if ( cr ){
                        snprintf( cr->msg, sizeof(cr->msg), 
                                "slapo-ppolicy cannot be global" );
-                       fprintf( stderr, "%s\n", cr->msg );
+                       Debug( LDAP_DEBUG_ANY, "%s\n", cr->msg, 0, 0 );
                }
                return 1;
        }
@@ -2251,7 +2251,7 @@ ppolicy_db_init(
                                        snprintf( cr->msg, sizeof(cr->msg), 
                                                "User Schema load failed for attribute \"%s\". Error code %d: %s",
                                                pwd_UsSchema[i].def, code, err );
-                                       fprintf( stderr, "%s\n", cr->msg );
+                                       Debug( LDAP_DEBUG_ANY, "%s\n", cr->msg, 0, 0 );
                                }
                                return code;
                        }
@@ -2344,7 +2344,7 @@ int ppolicy_initialize()
                SLAP_CTRL_ADD|SLAP_CTRL_BIND|SLAP_CTRL_MODIFY|SLAP_CTRL_HIDE, extops,
                ppolicy_parseCtrl, &ppolicy_cid );
        if ( code != LDAP_SUCCESS ) {
-               fprintf( stderr, "Failed to register control %d\n", code );
+               Debug( LDAP_DEBUG_ANY, "Failed to register control %d\n", code, 0, 0 );
                return code;
        }
 
index 1c1acc819b46dfa6798c7ac1d1883a0039486f86..46c2b739407291b9c4effa9d02f6ea74b0ea3b71 100644 (file)
@@ -122,7 +122,7 @@ rwm_op_rollback( Operation *op, SlapReply *rs, rwm_op_state *ros )
 #if 0
                        ldap_pvt_thread_mutex_lock( &op->o_conn->c_mutex );
                        /* too late, c_mutex released */
-                       fprintf( stderr, "*** DN: \"%s\" => \"%s\"\n",
+                       Debug( LDAP_DEBUG_ANY, "*** DN: \"%s\" => \"%s\"\n",
                                op->o_conn->c_ndn.bv_val,
                                op->o_req_ndn.bv_val );
                        ber_bvreplace( &op->o_conn->c_ndn,
@@ -1626,12 +1626,12 @@ rwm_suffixmassage_config(
         */
        if ( argc == 2 ) {
                if ( be->be_suffix == NULL ) {
-                       fprintf( stderr, "%s: line %d: "
+                       Debug( LDAP_DEBUG_ANY, "%s: line %d: "
                                       " \"suffixMassage [<suffix>]"
                                       " <massaged suffix>\" without "
                                       "<suffix> part requires database "
                                       "suffix be defined first.\n",
-                               fname, lineno );
+                               fname, lineno, 0 );
                        return 1;
                }
                bvnc = be->be_suffix[ 0 ];
@@ -1642,22 +1642,22 @@ rwm_suffixmassage_config(
                massaged = 2;
 
        } else  {
-               fprintf( stderr, "%s: line %d: syntax is"
+               Debug( LDAP_DEBUG_ANY, "%s: line %d: syntax is"
                               " \"suffixMassage [<suffix>]"
                               " <massaged suffix>\"\n",
-                       fname, lineno );
+                       fname, lineno, 0 );
                return 1;
        }
 
        if ( dnPrettyNormal( NULL, &bvnc, &pvnc, &nvnc, NULL ) != LDAP_SUCCESS ) {
-               fprintf( stderr, "%s: line %d: suffix DN %s is invalid\n",
+               Debug( LDAP_DEBUG_ANY, "%s: line %d: suffix DN %s is invalid\n",
                        fname, lineno, bvnc.bv_val );
                return 1;
        }
 
        ber_str2bv( argv[ massaged ], 0, 0, &brnc );
        if ( dnPrettyNormal( NULL, &brnc, &prnc, &nrnc, NULL ) != LDAP_SUCCESS ) {
-               fprintf( stderr, "%s: line %d: suffix DN %s is invalid\n",
+               Debug( LDAP_DEBUG_ANY, "%s: line %d: suffix DN %s is invalid\n",
                                fname, lineno, brnc.bv_val );
                free( nvnc.bv_val );
                free( pvnc.bv_val );
@@ -1776,9 +1776,9 @@ rwm_db_config(
 
        } else if ( strcasecmp( argv[0], "t-f-support" ) == 0 ) {
                if ( argc != 2 ) {
-                       fprintf( stderr,
+                       Debug( LDAP_DEBUG_ANY,
                "%s: line %d: \"t-f-support {no|yes|discover}\" needs 1 argument.\n",
-                                       fname, lineno );
+                                       fname, lineno, 0 );
                        return( 1 );
                }
 
@@ -1790,17 +1790,17 @@ rwm_db_config(
 
                /* TODO: not implemented yet */
                } else if ( strcasecmp( argv[ 1 ], "discover" ) == 0 ) {
-                       fprintf( stderr,
+                       Debug( LDAP_DEBUG_ANY,
                "%s: line %d: \"discover\" not supported yet "
                "in \"t-f-support {no|yes|discover}\".\n",
-                                       fname, lineno );
+                                       fname, lineno, 0 );
                        return( 1 );
 #if 0
                        rwmap->rwm_flags |= RWM_F_SUPPORT_T_F_DISCOVER;
 #endif
 
                } else {
-                       fprintf( stderr,
+                       Debug( LDAP_DEBUG_ANY,
        "%s: line %d: unknown value \"%s\" for \"t-f-support {no|yes|discover}\".\n",
                                fname, lineno, argv[ 1 ] );
                        return 1;
@@ -1808,9 +1808,9 @@ rwm_db_config(
 
        } else if ( strcasecmp( argv[0], "normalize-mapped-attrs" ) ==  0 ) {
                if ( argc !=2 ) { 
-                       fprintf( stderr,
+                       Debug( LDAP_DEBUG_ANY,
                "%s: line %d: \"normalize-mapped-attrs {no|yes}\" needs 1 argument.\n",
-                                       fname, lineno );
+                                       fname, lineno, 0 );
                        return( 1 );
                }
 
index bc9fe8114c67fa5e770b3aa8a36475530cb222c2..c39ed65f56ce7b7cccdc1225a2a60d7e61736bde 100644 (file)
@@ -50,9 +50,9 @@ rwm_map_config(
        int                     rc = 0;
 
        if ( argc < 3 || argc > 4 ) {
-               fprintf( stderr,
+               Debug( LDAP_DEBUG_ANY,
        "%s: line %d: syntax is \"map {objectclass | attribute} [<local> | *] {<foreign> | *}\"\n",
-                       fname, lineno );
+                       fname, lineno, 0 );
                return 1;
        }
 
@@ -64,10 +64,10 @@ rwm_map_config(
                map = at_map;
 
        } else {
-               fprintf( stderr, "%s: line %d: syntax is "
+               Debug( LDAP_DEBUG_ANY, "%s: line %d: syntax is "
                        "\"map {objectclass | attribute} [<local> | *] "
                        "{<foreign> | *}\"\n",
-                       fname, lineno );
+                       fname, lineno, 0 );
                return 1;
        }
 
@@ -98,18 +98,18 @@ rwm_map_config(
                        && ( strcasecmp( src, "objectclass" ) == 0
                        || strcasecmp( dst, "objectclass" ) == 0 ) )
        {
-               fprintf( stderr,
+               Debug( LDAP_DEBUG_ANY,
                        "%s: line %d: objectclass attribute cannot be mapped\n",
-                       fname, lineno );
+                       fname, lineno, 0 );
                return 1;
        }
 
        mapping = (struct ldapmapping *)ch_calloc( 2,
                sizeof(struct ldapmapping) );
        if ( mapping == NULL ) {
-               fprintf( stderr,
+               Debug( LDAP_DEBUG_ANY,
                        "%s: line %d: out of memory\n",
-                       fname, lineno );
+                       fname, lineno, 0 );
                return 1;
        }
        ber_str2bv( src, 0, 1, &mapping[0].m_src );
@@ -127,7 +127,7 @@ rwm_map_config(
                if ( src[0] != '\0' ) {
                        mapping[0].m_src_oc = oc_bvfind( &mapping[0].m_src );
                        if ( mapping[0].m_src_oc == NULL ) {
-                               fprintf( stderr,
+                               Debug( LDAP_DEBUG_ANY,
        "%s: line %d: warning, source objectClass '%s' "
        "should be defined in schema\n",
                                        fname, lineno, src );
@@ -145,14 +145,14 @@ rwm_map_config(
 
                mapping[0].m_dst_oc = oc_bvfind( &mapping[0].m_dst );
                if ( mapping[0].m_dst_oc == NULL ) {
-                       fprintf( stderr,
+                       Debug( LDAP_DEBUG_ANY,
        "%s: line %d: warning, destination objectClass '%s' "
        "is not defined in schema\n",
                                fname, lineno, dst );
 
                        mapping[0].m_dst_oc = oc_bvfind_undef( &mapping[0].m_dst );
                        if ( mapping[0].m_dst_oc == NULL ) {
-                               fprintf( stderr, "%s: line %d: unable to mimic destination objectClass '%s'\n",
+                               Debug( LDAP_DEBUG_ANY, "%s: line %d: unable to mimic destination objectClass '%s'\n",
                                        fname, lineno, dst );
                                goto error_return;
                        }
@@ -170,7 +170,7 @@ rwm_map_config(
                        rc = slap_bv2ad( &mapping[0].m_src,
                                        &mapping[0].m_src_ad, &text );
                        if ( rc != LDAP_SUCCESS ) {
-                               fprintf( stderr,
+                               Debug( LDAP_DEBUG_ANY,
        "%s: line %d: warning, source attributeType '%s' "
        "should be defined in schema\n",
                                        fname, lineno, src );
@@ -184,9 +184,12 @@ rwm_map_config(
                                                &mapping[0].m_src_ad, &text,
                                                SLAP_AD_PROXIED );
                                if ( rc != LDAP_SUCCESS ) {
-                                       fprintf( stderr,
-       "%s: line %d: source attributeType '%s': %d (%s)\n",
-                                               fname, lineno, src, rc, text ? text : "null" );
+                                       char prefix[1024];
+                                       snprintf( prefix, sizeof(prefix),
+       "%s: line %d: source attributeType '%s': %d",
+                                               fname, lineno, src, rc );
+                                       Debug( LDAP_DEBUG_ANY, "%s (%s)\n",
+                                               prefix, text ? text : "null", 0 );
                                        goto error_return;
                                }
 
@@ -196,7 +199,7 @@ rwm_map_config(
 
                rc = slap_bv2ad( &mapping[0].m_dst, &mapping[0].m_dst_ad, &text );
                if ( rc != LDAP_SUCCESS ) {
-                       fprintf( stderr,
+                       Debug( LDAP_DEBUG_ANY,
        "%s: line %d: warning, destination attributeType '%s' "
        "is not defined in schema\n",
                                fname, lineno, dst );
@@ -205,9 +208,12 @@ rwm_map_config(
                                        &mapping[0].m_dst_ad, &text,
                                        SLAP_AD_PROXIED );
                        if ( rc != LDAP_SUCCESS ) {
-                               fprintf( stderr,
-       "%s: line %d: destination attributeType '%s': %d (%s)\n",
-                                       fname, lineno, dst, rc, text ? text : "null" );
+                               char prefix[1024];
+                               snprintf( prefix, sizeof(prefix), 
+       "%s: line %d: destination attributeType '%s': %d",
+                                       fname, lineno, dst, rc );
+                               Debug( LDAP_DEBUG_ANY, "%s (%s)\n",
+                                       prefix, text ? text : "null", 0 );
                                goto error_return;
                        }
                }
@@ -217,9 +223,9 @@ rwm_map_config(
        if ( ( src[0] != '\0' && avl_find( map->map, (caddr_t)mapping, rwm_mapping_cmp ) != NULL)
                        || avl_find( map->remap, (caddr_t)&mapping[1], rwm_mapping_cmp ) != NULL)
        {
-               fprintf( stderr,
+               Debug( LDAP_DEBUG_ANY,
                        "%s: line %d: duplicate mapping found.\n",
-                       fname, lineno );
+                       fname, lineno, 0 );
                /* FIXME: free stuff */
                goto error_return;
        }
index a024db2cc0bb585675475464e8d5cb28dd97a0eb..10dde1f2498b28cd3d886960e12b86fee49a21ce 100644 (file)
@@ -1236,11 +1236,11 @@ int sssvlv_initialize()
        if ( rc == LDAP_SUCCESS ) {
                rc = overlay_register( &sssvlv );
                if ( rc != LDAP_SUCCESS ) {
-                       fprintf( stderr, "Failed to register server side sort overlay\n" );
+                       Debug( LDAP_DEBUG_ANY, "Failed to register server side sort overlay\n", 0, 0, 0 );
                }
        }
        else {
-               fprintf( stderr, "Failed to register control %d\n", rc );
+               Debug( LDAP_DEBUG_ANY, "Failed to register control %d\n", rc, 0, 0 );
        }
 
        return rc;
index 5f5c2e10bc66457eef8a79ea2d3fc669fef767b5..9f57ece910b491371abc80c90fce3babd3387193 100644 (file)
@@ -568,7 +568,7 @@ int valsort_initialize( void )
                SLAP_CTRL_SEARCH | SLAP_CTRL_HIDE, NULL, valsort_parseCtrl,
                &valsort_cid );
        if ( rc != LDAP_SUCCESS ) {
-               fprintf( stderr, "Failed to register control %d\n", rc );
+               Debug( LDAP_DEBUG_ANY, "Failed to register control %d\n", rc, 0, 0 );
                return rc;
        }