X-Git-Url: https://git.sur5r.net/?a=blobdiff_plain;f=servers%2Fslurpd%2Fldap_op.c;h=dc06b2d310e215eb600257e9e56855cbd35e418c;hb=59d4b38a7c9247d13bbff43c73c253929e348fdf;hp=8b68c15c5778ce359f32367d8b4bc3e15107f2ee;hpb=1989cf6f4234a3c7e3c3411a563fdd3aa255f897;p=openldap
diff --git a/servers/slurpd/ldap_op.c b/servers/slurpd/ldap_op.c
index 8b68c15c57..dc06b2d310 100644
--- a/servers/slurpd/ldap_op.c
+++ b/servers/slurpd/ldap_op.c
@@ -1,10 +1,19 @@
/* $OpenLDAP$ */
-/*
- * Copyright 1998-2003 The OpenLDAP Foundation, All Rights Reserved.
- * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
+/* This work is part of OpenLDAP Software .
+ *
+ * Copyright 1998-2007 The OpenLDAP Foundation.
+ * Portions Copyright 2003 Mark Benson.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted only as authorized by the OpenLDAP
+ * Public License.
+ *
+ * A copy of this license is available in file LICENSE in the
+ * top-level directory of the distribution or, alternatively, at
+ * .
*/
-/*
- * Copyright (c) 1996 Regents of the University of Michigan.
+/* Portions Copyright (c) 1996 Regents of the University of Michigan.
* All rights reserved.
*
* Redistribution and use in source and binary forms are permitted
@@ -14,6 +23,12 @@
* software without specific prior written permission. This software
* is provided ``as is'' without express or implied warranty.
*/
+/* ACKNOWLEDGEMENTS:
+ * This work was originally developed by the University of Michigan
+ * (as part of U-MICH LDAP). Additional significant contributors
+ * include:
+ * Mark Benson
+ */
/*
* ldap_op.c - routines to perform LDAP operations
@@ -31,6 +46,7 @@
#include
#include
+#define LDAP_DEPRECATED 1
#include
#include "lutil_ldap.h"
#include "slurp.h"
@@ -45,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 * ));
@@ -86,81 +104,47 @@ do_ldap(
case T_ADDCT:
lderr = op_ldap_add( ri, re, errmsg, errfree );
if ( lderr != LDAP_SUCCESS ) {
-#ifdef NEW_LOGGING
- LDAP_LOG ( OPERATION, ERR, "do_ldap: "
- "Error: ldap_add_s failed adding \"%s\": %s\n",
- *errmsg ? *errmsg : ldap_err2string( lderr ),
- re->re_dn, 0 );
-#else
Debug( LDAP_DEBUG_ANY,
- "Error: ldap_add_s failed adding \"%s\": %s\n",
- *errmsg ? *errmsg : ldap_err2string( lderr ),
- re->re_dn, 0 );
-#endif
+ "Error: ldap_add_s failed adding DN \"%s\": %s\n",
+ re->re_dn, *errmsg && (*errmsg)[0] ?
+ *errmsg : ldap_err2string( lderr ), 0 );
}
break;
case T_MODIFYCT:
lderr = op_ldap_modify( ri, re, errmsg, errfree );
if ( lderr != LDAP_SUCCESS ) {
-#ifdef NEW_LOGGING
- LDAP_LOG ( OPERATION, ERR, "do_ldap: "
- "Error: ldap_modify_s failed modifying \"%s\": %s\n",
- *errmsg ? *errmsg : ldap_err2string( lderr ),
- re->re_dn, 0 );
-#else
Debug( LDAP_DEBUG_ANY,
- "Error: ldap_modify_s failed modifying \"%s\": %s\n",
- *errmsg ? *errmsg : ldap_err2string( lderr ),
- re->re_dn, 0 );
-#endif
+ "Error: ldap_modify_s failed modifying DN \"%s\": %s\n",
+ re->re_dn, *errmsg && (*errmsg)[0] ?
+ *errmsg : ldap_err2string( lderr ), 0 );
}
break;
case T_DELETECT:
lderr = op_ldap_delete( ri, re, errmsg, errfree );
if ( lderr != LDAP_SUCCESS ) {
-#ifdef NEW_LOGGING
- LDAP_LOG ( OPERATION, ERR, "do_ldap: "
- "Error: ldap_delete_s failed deleting \"%s\": %s\n",
- *errmsg ? *errmsg : ldap_err2string( lderr ),
- re->re_dn, 0 );
-#else
Debug( LDAP_DEBUG_ANY,
- "Error: ldap_delete_s failed deleting \"%s\": %s\n",
- *errmsg ? *errmsg : ldap_err2string( lderr ),
- re->re_dn, 0 );
-#endif
+ "Error: ldap_delete_s failed deleting DN \"%s\": %s\n",
+ re->re_dn, *errmsg && (*errmsg)[0] ?
+ *errmsg : ldap_err2string( lderr ), 0 );
}
break;
case T_MODRDNCT:
lderr = op_ldap_modrdn( ri, re, errmsg, errfree );
if ( lderr != LDAP_SUCCESS ) {
-#ifdef NEW_LOGGING
- LDAP_LOG ( OPERATION, ERR, "do_ldap: "
- "Error: ldap_modrdn_s failed modifying %s: %s\n",
- *errmsg ? *errmsg : ldap_err2string( lderr ),
- re->re_dn, 0 );
-#else
Debug( LDAP_DEBUG_ANY,
- "Error: ldap_modrdn_s failed modifying %s: %s\n",
- *errmsg ? *errmsg : ldap_err2string( lderr ),
- re->re_dn, 0 );
-#endif
+ "Error: ldap_modrdn_s failed modifying DN \"%s\": %s\n",
+ re->re_dn, *errmsg && (*errmsg)[0] ?
+ *errmsg : ldap_err2string( lderr ), 0 );
}
break;
default:
-#ifdef NEW_LOGGING
- LDAP_LOG ( OPERATION, ERR, "do_ldap: "
- "Error: bad op \"%d\", dn = \"%s\"\n",
- re->re_changetype, re->re_dn, 0 );
-#else
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 );
-#endif
return DO_LDAP_ERR_FATAL;
}
@@ -227,29 +211,18 @@ op_ldap_add(
ldmarr[ nattrs ] = NULL;
/* Perform the operation */
-#ifdef NEW_LOGGING
- LDAP_LOG ( OPERATION, ARGS,
- "op_ldap_add: replica %s:%d - add dn \"%s\"\n",
- 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 );
-#endif
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 {
*errmsg = "No modifications to do";
-#ifdef NEW_LOGGING
- 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 );
-#endif
}
free_ldmarr( ldmarr );
return( lderr );
@@ -286,13 +259,8 @@ op_ldap_modify(
if ( re->re_mods == NULL ) {
*errmsg = "No arguments given";
-#ifdef NEW_LOGGING
- 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 );
-#endif
return -1;
}
@@ -349,34 +317,22 @@ op_ldap_modify(
break;
default:
if ( state == AWAITING_OP ) {
-#ifdef NEW_LOGGING
- 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",
type, 0, 0 );
-#endif
continue;
}
- assert( ldm );
+ assert( ldm != NULL );
/*
* We should have an attribute: value pair here.
* Construct the mod_bvalues part of the ldapmod struct.
*/
if ( strcasecmp( type, ldm->mod_type )) {
-#ifdef NEW_LOGGING
- LDAP_LOG ( OPERATION, ERR,
- "op_ldap_modify: Error: "
- "malformed modify op, %s: %s (expecting \"%s\")\n",
- type, value, ldm->mod_type );
-#else
Debug( LDAP_DEBUG_ANY,
"Error: malformed modify op, %s: %s (expecting %s:)\n",
type, value, ldm->mod_type );
-#endif
continue;
}
ldm->mod_bvalues = ( struct berval ** )
@@ -394,16 +350,10 @@ op_ldap_modify(
if ( nops > 0 ) {
/* Actually perform the LDAP operation */
-#ifdef NEW_LOGGING
- LDAP_LOG ( OPERATION, DETAIL1,
- "op_ldap_modify: replica %s:%d - modify dn \"%s\"\n",
- 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 );
-#endif
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 );
@@ -426,16 +376,10 @@ op_ldap_delete(
{
int rc;
-#ifdef NEW_LOGGING
- LDAP_LOG ( OPERATION, ARGS,
- "op_ldap_delete: replica %s:%d - delete dn \"%s\"\n",
- 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 );
-#endif
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 );
@@ -472,13 +416,8 @@ op_ldap_modrdn(
if ( re->re_mods == NULL ) {
*errmsg = "No arguments given";
-#ifdef NEW_LOGGING
- 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 );
-#endif
return -1;
}
@@ -488,15 +427,9 @@ op_ldap_modrdn(
for ( mi = re->re_mods, i = 0; mi[ i ].mi_type != NULL; i++ ) {
if ( !strcmp( mi[ i ].mi_type, T_NEWRDNSTR )) {
if( state & GOT_NEWRDN ) {
-#ifdef NEW_LOGGING
- LDAP_LOG ( OPERATION, ERR,
- "op_ldap_modrdn: Error: multiple newrdn arg \"%s\"\n",
- mi[ i ].mi_val, 0, 0 );
-#else
Debug( LDAP_DEBUG_ANY,
"Error: op_ldap_modrdn: multiple newrdn arg \"%s\"\n",
mi[ i ].mi_val, 0, 0 );
-#endif
*errmsg = "Multiple newrdn argument";
return -1;
}
@@ -506,15 +439,9 @@ op_ldap_modrdn(
} else if ( !strcmp( mi[ i ].mi_type, T_DELOLDRDNSTR )) {
if( state & GOT_DELOLDRDN ) {
-#ifdef NEW_LOGGING
- LDAP_LOG ( OPERATION, ERR,
- "op_ldap_modrdn: Error: multiple deleteoldrdn arg \"%s\"\n",
- mi[ i ].mi_val, 0, 0 );
-#else
Debug( LDAP_DEBUG_ANY,
"Error: op_ldap_modrdn: multiple deleteoldrdn arg \"%s\"\n",
mi[ i ].mi_val, 0, 0 );
-#endif
*errmsg = "Multiple newrdn argument";
return -1;
}
@@ -525,30 +452,18 @@ op_ldap_modrdn(
} else if ( !strcmp( mi[ i ].mi_val, "1" )) {
drdnflag = 1;
} else {
-#ifdef NEW_LOGGING
- LDAP_LOG ( OPERATION, ERR,
- "op_ldap_modrdn: Error: bad deleteoldrdn arg \"%s\"\n",
- mi[ i ].mi_val, 0, 0 );
-#else
Debug( LDAP_DEBUG_ANY,
"Error: op_ldap_modrdn: bad deleteoldrdn arg \"%s\"\n",
mi[ i ].mi_val, 0, 0 );
-#endif
*errmsg = "Incorrect argument to deleteoldrdn";
return -1;
}
} else if ( !strcmp( mi[ i ].mi_type, T_NEWSUPSTR )) {
if( state & GOT_NEWSUP ) {
-#ifdef NEW_LOGGING
- LDAP_LOG ( OPERATION, ERR,
- "op_ldap_modrdn: Error: multiple newsuperior arg \"%s\"\n",
- mi[ i ].mi_val, 0, 0 );
-#else
Debug( LDAP_DEBUG_ANY,
"Error: op_ldap_modrdn: multiple newsuperior arg \"%s\"\n",
mi[ i ].mi_val, 0, 0 );
-#endif
*errmsg = "Multiple newsuperior argument";
return -1;
}
@@ -557,14 +472,8 @@ op_ldap_modrdn(
state |= GOT_NEWSUP;
} else {
-#ifdef NEW_LOGGING
- LDAP_LOG ( OPERATION, ERR,
- "op_ldap_modrdn: Error: bad type \"%s\"\n",
- 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 );
-#endif
*errmsg = "Bad value in replication log entry";
return -1;
}
@@ -574,13 +483,8 @@ op_ldap_modrdn(
* Punt if we don't have all the args.
*/
if ( !GOT_ALL_MODDN(state) ) {
-#ifdef NEW_LOGGING
- 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 );
-#endif
*errmsg = "Missing argument: requires \"newrdn\" and \"deleteoldrdn\"";
return -1;
}
@@ -596,26 +500,20 @@ op_ldap_modrdn(
buf2 = (char *) ch_malloc( buf2len );
snprintf( buf2, buf2len, "(\"%s\" -> \"%s\")", re->re_dn, mi->mi_val );
-#ifdef NEW_LOGGING
- LDAP_LOG ( OPERATION, ARGS,
- "op_ldap_modrdn: replica %s - modify rdn %s (flag: %d)\n",
- buf, buf2, drdnflag );
-#else
Debug( LDAP_DEBUG_ARGS,
"replica %s - modify rdn %s (flag: %d)\n",
buf, buf2, drdnflag );
-#endif
free( buf2 );
}
#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 );
}
@@ -742,15 +640,9 @@ do_unbind(
if (( ri != NULL ) && ( ri->ri_ldp != NULL )) {
rc = ldap_unbind( ri->ri_ldp );
if ( rc != LDAP_SUCCESS ) {
-#ifdef NEW_LOGGING
- LDAP_LOG ( OPERATION, ERR,
- "do_unbind: ldap_unbind failed for %s:%d: %s\n",
- 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",
ri->ri_hostname, ri->ri_port, ldap_err2string( rc ) );
-#endif
}
ri->ri_ldp = NULL;
}
@@ -777,97 +669,60 @@ do_bind(
)
{
int ldrc;
- int do_tls = ri->ri_tls;
+ int do_tls;
*lderr = 0;
if ( ri == NULL ) {
-#ifdef NEW_LOGGING
- 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
return( BIND_ERR_BADRI );
}
+ do_tls = ri->ri_tls;
+
retry:
if ( ri->ri_ldp != NULL ) {
ldrc = ldap_unbind( ri->ri_ldp );
if ( ldrc != LDAP_SUCCESS ) {
-#ifdef NEW_LOGGING
- 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",
ldap_err2string( ldrc ), 0, 0 );
-#endif
}
ri->ri_ldp = NULL;
}
if ( ri->ri_uri != NULL ) { /* new URI style */
-#ifdef NEW_LOGGING
- LDAP_LOG ( OPERATION, ARGS,
- "do_bind: Initializing session to %s\n",
- ri->ri_uri, 0, 0);
-#else
Debug( LDAP_DEBUG_ARGS, "Initializing session to %s\n",
ri->ri_uri, 0, 0 );
-#endif
ldrc = ldap_initialize( &(ri->ri_ldp), ri->ri_uri);
if (ldrc != LDAP_SUCCESS) {
-#ifdef NEW_LOGGING
- LDAP_LOG ( OPERATION, ERR,
- "do_bind: ldap_initalize (0, %s) failed: %s\n",
- ri->ri_uri, ldap_err2string(ldrc), 0 );
-#else
Debug( LDAP_DEBUG_ANY, "Error: ldap_initialize(0, %s) failed: %s\n",
ri->ri_uri, ldap_err2string(ldrc), 0 );
-#endif
return( BIND_ERR_OPEN );
}
} else { /* old HOST style */
-#ifdef NEW_LOGGING
- LDAP_LOG ( OPERATION, ARGS,
- "do_bind: Initializing session to %s:%d\n",
- 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 );
-#endif
ri->ri_ldp = ldap_init( ri->ri_hostname, ri->ri_port );
if ( ri->ri_ldp == NULL ) {
-#ifdef NEW_LOGGING
- LDAP_LOG ( OPERATION, ERR,
- "do_bind: ldap_init (%s, %d) failed: %s\n",
- 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 ] );
-#endif
return( BIND_ERR_OPEN );
}
}
{ /* set version 3 */
- int err, version = 3;
+ int err, version = LDAP_VERSION3;
err = ldap_set_option(ri->ri_ldp,
LDAP_OPT_PROTOCOL_VERSION, &version);
if( err != LDAP_OPT_SUCCESS ) {
-#ifdef NEW_LOGGING
- LDAP_LOG ( OPERATION, ERR, "do_bind: "
- "Error: ldap_set_option(%s, LDAP_OPT_VERSION, 3) failed!\n",
- ri->ri_hostname, 0, 0 );
-#else
Debug( LDAP_DEBUG_ANY,
"Error: ldap_set_option(%s, LDAP_OPT_VERSION, 3) failed!\n",
ri->ri_hostname, NULL, NULL );
-#endif
ldap_unbind( ri->ri_ldp );
ri->ri_ldp = NULL;
@@ -884,15 +739,9 @@ retry:
err = ldap_set_option(ri->ri_ldp, LDAP_OPT_REFERRALS, LDAP_OPT_OFF);
if( err != LDAP_OPT_SUCCESS ) {
-#ifdef NEW_LOGGING
- LDAP_LOG ( OPERATION, ERR, "do_bind: "
- "Error: ldap_set_option(%s, REFERRALS, OFF) failed!\n",
- ri->ri_hostname, 0, 0 );
-#else
Debug( LDAP_DEBUG_ANY,
"Error: ldap_set_option(%s,REFERRALS, OFF) failed!\n",
ri->ri_hostname, NULL, NULL );
-#endif
ldap_unbind( ri->ri_ldp );
ri->ri_ldp = NULL;
return BIND_ERR_REFERRALS;
@@ -904,17 +753,10 @@ retry:
int err = ldap_start_tls_s(ri->ri_ldp, NULL, NULL);
if( err != LDAP_SUCCESS ) {
-#ifdef NEW_LOGGING
- 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 );
-#else
Debug( LDAP_DEBUG_ANY,
"%s: ldap_start_tls failed: %s (%d)\n",
ri->ri_tls == TLS_CRITICAL ? "Error" : "Warning",
ldap_err2string( err ), err );
-#endif
if( ri->ri_tls == TLS_CRITICAL ) {
*lderr = err;
@@ -932,26 +774,14 @@ retry:
/*
* Bind with a plaintext password.
*/
-#ifdef NEW_LOGGING
- LDAP_LOG ( OPERATION, ARGS,
- "do_bind: bind to %s:%d as %s (simple)\n",
- 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 );
-#endif
ldrc = ldap_simple_bind_s( ri->ri_ldp, ri->ri_bind_dn,
ri->ri_password );
if ( ldrc != LDAP_SUCCESS ) {
-#ifdef NEW_LOGGING
- 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 ) );
-#else
Debug( LDAP_DEBUG_ANY,
"Error: ldap_simple_bind_s for %s:%d failed: %s\n",
ri->ri_hostname, ri->ri_port, ldap_err2string( ldrc ));
-#endif
*lderr = ldrc;
ldap_unbind( ri->ri_ldp );
ri->ri_ldp = NULL;
@@ -960,18 +790,10 @@ retry:
break;
case LDAP_AUTH_SASL:
-#ifdef NEW_LOGGING
- 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 );
-#else
Debug( LDAP_DEBUG_ARGS, "bind to %s as %s via %s (SASL)\n",
ri->ri_hostname,
ri->ri_authcId ? ri->ri_authcId : "-",
ri->ri_saslmech );
-#endif
#ifdef HAVE_CYRUS_SASL
if( ri->ri_secprops != NULL ) {
@@ -979,15 +801,9 @@ retry:
LDAP_OPT_X_SASL_SECPROPS, ri->ri_secprops);
if( err != LDAP_OPT_SUCCESS ) {
-#ifdef NEW_LOGGING
- LDAP_LOG ( OPERATION, ERR, "do_bind: "
- "Error: ldap_set_option(%s,SECPROPS,\"%s\") failed!\n",
- ri->ri_hostname, ri->ri_secprops, 0 );
-#else
Debug( LDAP_DEBUG_ANY,
"Error: ldap_set_option(%s,SECPROPS,\"%s\") failed!\n",
ri->ri_hostname, ri->ri_secprops, NULL );
-#endif
ldap_unbind( ri->ri_ldp );
ri->ri_ldp = NULL;
return BIND_ERR_SASL_FAILED;
@@ -1004,14 +820,8 @@ retry:
lutil_sasl_freedefs( defaults );
if ( ldrc != LDAP_SUCCESS ) {
-#ifdef NEW_LOGGING
- LDAP_LOG ( OPERATION, ERR, "do_bind: "
- "Error: LDAP SASL for %s:%d failed: %s\n",
- 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 ));
-#endif
*lderr = ldrc;
ldap_unbind( ri->ri_ldp );
ri->ri_ldp = NULL;
@@ -1019,31 +829,19 @@ retry:
}
}
break;
-#else
-#ifdef NEW_LOGGING
- LDAP_LOG ( OPERATION, ERR, "do_bind: "
- "Error: do_bind: SASL not supported %s:%d\n",
- ri->ri_hostname, ri->ri_port, 0 );
#else
Debug( LDAP_DEBUG_ANY,
"Error: do_bind: SASL not supported %s:%d\n",
ri->ri_hostname, ri->ri_port, NULL );
-#endif
ldap_unbind( ri->ri_ldp );
ri->ri_ldp = NULL;
return( BIND_ERR_BAD_ATYPE );
#endif
default:
-#ifdef NEW_LOGGING
- 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 );
-#else
Debug( LDAP_DEBUG_ANY,
"Error: do_bind: unknown auth type \"%d\" for %s:%d\n",
ri->ri_bind_method, ri->ri_hostname, ri->ri_port );
-#endif
ldap_unbind( ri->ri_ldp );
ri->ri_ldp = NULL;
return( BIND_ERR_BAD_ATYPE );
@@ -1064,15 +862,9 @@ retry:
err = ldap_set_option(ri->ri_ldp, LDAP_OPT_SERVER_CONTROLS, &ctrls);
if( err != LDAP_OPT_SUCCESS ) {
-#ifdef NEW_LOGGING
- LDAP_LOG ( OPERATION, ERR, "do_bind: "
- "ldap_set_option(%s, SERVER_CONTROLS, ManageDSAit) failed!\n",
- ri->ri_hostname, 0, 0 );
-#else
Debug( LDAP_DEBUG_ANY, "Error: "
"ldap_set_option(%s, SERVER_CONTROLS, ManageDSAit) failed!\n",
ri->ri_hostname, NULL, NULL );
-#endif
ldap_unbind( ri->ri_ldp );
ri->ri_ldp = NULL;
return BIND_ERR_MANAGEDSAIT;
@@ -1089,6 +881,7 @@ retry:
/*
* For debugging. Print the contents of an ldmarr array.
*/
+#ifdef SLAPD_UNUSED
static void
dump_ldm_array(
LDAPMod **ldmarr
@@ -1101,17 +894,6 @@ dump_ldm_array(
for ( i = 0; ldmarr[ i ] != NULL; i++ ) {
ldm = ldmarr[ i ];
-#ifdef NEW_LOGGING
- LDAP_LOG ( OPERATION, INFO, "dump_ldm_array: "
- "Trace (%ld): *** ldmarr[ %d ] contents:\n",
- (long) getpid(), i, 0 );
- LDAP_LOG ( OPERATION, INFO, "dump_ldm_array: "
- "Trace (%ld): *** ldm->mod_op: %d\n",
- (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, 0 );
-#else
Debug( LDAP_DEBUG_TRACE,
"Trace (%ld): *** ldmarr[ %d ] contents:\n",
(long) getpid(), i, 0 );
@@ -1121,21 +903,16 @@ dump_ldm_array(
Debug( LDAP_DEBUG_TRACE,
"Trace (%ld): *** ldm->mod_type: %s\n",
(long) getpid(), ldm->mod_type, 0 );
-#endif
if ( ldm->mod_bvalues != NULL ) {
for ( j = 0; ( b = ldm->mod_bvalues[ j ] ) != NULL; j++ ) {
msgbuf = ch_malloc( b->bv_len + 512 );
sprintf( msgbuf, "***** bv[ %d ] len = %ld, val = <%s>",
j, b->bv_len, b->bv_val );
-#ifdef NEW_LOGGING
- 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 );
-#endif
free( msgbuf );
}
}
}
}
+#endif