]> git.sur5r.net Git - openldap/blobdiff - servers/slurpd/ldap_op.c
Listener commit broke test048, skip listener check on Hidden DBs
[openldap] / servers / slurpd / ldap_op.c
index 3d7311080b0c9059fc70985d329e3accdc3e944b..dc06b2d310e215eb600257e9e56855cbd35e418c 100644 (file)
@@ -1,7 +1,7 @@
 /* $OpenLDAP$ */
 /* This work is part of OpenLDAP Software <http://www.openldap.org/>.
  *
- * Copyright 1998-2005 The OpenLDAP Foundation.
+ * Copyright 1998-2007 The OpenLDAP Foundation.
  * Portions Copyright 2003 Mark Benson.
  * All rights reserved.
  *
@@ -61,7 +61,9 @@ static LDAPMod *alloc_ldapmod LDAP_P(( void ));
 static void free_ldapmod LDAP_P(( LDAPMod * ));
 static void free_ldmarr LDAP_P(( LDAPMod ** ));
 static int getmodtype LDAP_P(( char * ));
+#ifdef SLAPD_UNUSED
 static void dump_ldm_array LDAP_P(( LDAPMod ** ));
+#endif
 static int do_bind LDAP_P(( Ri *, int * ));
 static int do_unbind LDAP_P(( Ri * ));
 
@@ -103,9 +105,9 @@ do_ldap(
                        lderr = op_ldap_add( ri, re, errmsg, errfree );
                        if ( lderr != LDAP_SUCCESS ) {
                                Debug( LDAP_DEBUG_ANY,
-                                       "Error: ldap_add_s failed adding \"%s\": %s\n",
-                                       *errmsg ? *errmsg : ldap_err2string( lderr ),
-                                       re->re_dn, 0 );
+                                       "Error: ldap_add_s failed adding DN \"%s\": %s\n",
+                                       re->re_dn, *errmsg && (*errmsg)[0] ?
+                                       *errmsg : ldap_err2string( lderr ), 0 );
                        }
                        break;
 
@@ -113,9 +115,9 @@ do_ldap(
                        lderr = op_ldap_modify( ri, re, errmsg, errfree );
                        if ( lderr != LDAP_SUCCESS ) {
                                Debug( LDAP_DEBUG_ANY,
-                                       "Error: ldap_modify_s failed modifying \"%s\": %s\n",
-                                       *errmsg ? *errmsg : ldap_err2string( lderr ),
-                                       re->re_dn, 0 );
+                                       "Error: ldap_modify_s failed modifying DN \"%s\": %s\n",
+                                       re->re_dn, *errmsg && (*errmsg)[0] ?
+                                       *errmsg : ldap_err2string( lderr ), 0 );
                        }
                        break;
 
@@ -123,9 +125,9 @@ do_ldap(
                        lderr = op_ldap_delete( ri, re, errmsg, errfree );
                        if ( lderr != LDAP_SUCCESS ) {
                                Debug( LDAP_DEBUG_ANY,
-                                       "Error: ldap_delete_s failed deleting \"%s\": %s\n",
-                                       *errmsg ? *errmsg : ldap_err2string( lderr ),
-                                       re->re_dn, 0 );
+                                       "Error: ldap_delete_s failed deleting DN \"%s\": %s\n",
+                                       re->re_dn, *errmsg && (*errmsg)[0] ?
+                                       *errmsg : ldap_err2string( lderr ), 0 );
                        }
                        break;
 
@@ -133,15 +135,15 @@ do_ldap(
                        lderr = op_ldap_modrdn( ri, re, errmsg, errfree );
                        if ( lderr != LDAP_SUCCESS ) {
                                Debug( LDAP_DEBUG_ANY,
-                                       "Error: ldap_modrdn_s failed modifying %s: %s\n",
-                                       *errmsg ? *errmsg : ldap_err2string( lderr ),
-                                       re->re_dn, 0 );
+                                       "Error: ldap_modrdn_s failed modifying DN \"%s\": %s\n",
+                                       re->re_dn, *errmsg && (*errmsg)[0] ?
+                                       *errmsg : ldap_err2string( lderr ), 0 );
                        }
                        break;
 
                default:
                        Debug( LDAP_DEBUG_ANY,
-                               "Error: do_ldap: bad op \"%d\", dn = \"%s\"\n",
+                               "Error: do_ldap: bad op \"%d\", DN \"%s\"\n",
                                re->re_changetype, re->re_dn, 0 );
                        return DO_LDAP_ERR_FATAL;
                }
@@ -213,8 +215,8 @@ op_ldap_add(
                ri->ri_hostname, ri->ri_port, re->re_dn );
        rc = ldap_add_s( ri->ri_ldp, re->re_dn, ldmarr );
 
-       ldap_get_option( ri->ri_ldp, LDAP_OPT_ERROR_NUMBER, &lderr);
-       ldap_get_option( ri->ri_ldp, LDAP_OPT_ERROR_STRING, errmsg);
+       ldap_get_option( ri->ri_ldp, LDAP_OPT_RESULT_CODE, &lderr);
+       ldap_get_option( ri->ri_ldp, LDAP_OPT_DIAGNOSTIC_MESSAGE, errmsg);
        *errfree = 1;
 
     } else {
@@ -321,7 +323,7 @@ op_ldap_modify(
                continue;
            }
 
-           assert( ldm );
+           assert( ldm != NULL );
 
            /*
             * We should have an attribute: value pair here.
@@ -351,7 +353,7 @@ op_ldap_modify(
        Debug( LDAP_DEBUG_ARGS, "replica %s:%d - modify dn \"%s\"\n",
                ri->ri_hostname, ri->ri_port, re->re_dn );
        rc = ldap_modify_s( ri->ri_ldp, re->re_dn, ldmarr );
-       ldap_get_option( ri->ri_ldp, LDAP_OPT_ERROR_STRING, errmsg);
+       ldap_get_option( ri->ri_ldp, LDAP_OPT_DIAGNOSTIC_MESSAGE, errmsg);
        *errfree = 1;
     }
     free_ldmarr( ldmarr );
@@ -377,7 +379,7 @@ op_ldap_delete(
     Debug( LDAP_DEBUG_ARGS, "replica %s:%d - delete dn \"%s\"\n",
            ri->ri_hostname, ri->ri_port, re->re_dn );
     rc = ldap_delete_s( ri->ri_ldp, re->re_dn );
-    ldap_get_option( ri->ri_ldp, LDAP_OPT_ERROR_STRING, errmsg);
+    ldap_get_option( ri->ri_ldp, LDAP_OPT_DIAGNOSTIC_MESSAGE, errmsg);
     *errfree = 1;
 
     return( rc );
@@ -505,13 +507,13 @@ op_ldap_modrdn(
     }
 #endif /* LDAP_DEBUG */
 
-    assert( newrdn );
+    assert( newrdn != NULL );
 
     /* Do the modrdn */
     rc = ldap_rename2_s( ri->ri_ldp, re->re_dn, newrdn, newsup, drdnflag );
 
-       ldap_get_option( ri->ri_ldp, LDAP_OPT_ERROR_NUMBER, &lderr);
-       ldap_get_option( ri->ri_ldp, LDAP_OPT_ERROR_STRING, errmsg);
+       ldap_get_option( ri->ri_ldp, LDAP_OPT_RESULT_CODE, &lderr);
+       ldap_get_option( ri->ri_ldp, LDAP_OPT_DIAGNOSTIC_MESSAGE, errmsg);
        *errfree = 1;
     return( lderr );
 }
@@ -667,7 +669,7 @@ do_bind(
 )
 {
     int                ldrc;
-    int                do_tls = ri->ri_tls;
+    int                do_tls;
 
     *lderr = 0;
 
@@ -676,6 +678,8 @@ do_bind(
        return( BIND_ERR_BADRI );
     }
 
+    do_tls = ri->ri_tls;
+
 retry:
     if ( ri->ri_ldp != NULL ) {
        ldrc = ldap_unbind( ri->ri_ldp );
@@ -711,7 +715,7 @@ retry:
     }
 
        {       /* set version 3 */
-               int err, version = 3;
+               int err, version = LDAP_VERSION3;
                err = ldap_set_option(ri->ri_ldp,
                        LDAP_OPT_PROTOCOL_VERSION, &version);
 
@@ -877,6 +881,7 @@ retry:
 /*
  * For debugging.  Print the contents of an ldmarr array.
  */
+#ifdef SLAPD_UNUSED
 static void
 dump_ldm_array(
     LDAPMod **ldmarr
@@ -910,3 +915,4 @@ dump_ldm_array(
        }
     }
 }
+#endif