LDAPMod **attrs;
char *mdn = NULL, *mapped;
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "backend", LDAP_LEVEL_ENTRY, "ldap_back_add: %s\n",
+ e->e_dn ));
+#else /* !NEW_LOGGING */
+ Debug(LDAP_DEBUG_ARGS, "==> ldap_back_add: %s\n", e->e_dn, 0, 0);
+#endif /* !NEW_LOGGING */
+
lc = ldap_back_getconn(li, conn, op);
if ( !lc || !ldap_back_dobind( lc, op ) ) {
return( -1 );
#ifdef ENABLE_REWRITE
switch (rewrite_session( li->rwinfo, "addDn", e->e_dn, conn, &mdn )) {
case REWRITE_REGEXEC_OK:
- if ( mdn == NULL ) {
+ if ( mdn == NULL ) {
mdn = e->e_dn;
}
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "backend", LDAP_LEVEL_DETAIL1,
+ "[rw] addDn: \"%s\" -> \"%s\"\n",
+ e->e_dn, mdn ));
+#else /* !NEW_LOGGING */
Debug( LDAP_DEBUG_ARGS, "rw> addDn: \"%s\" -> \"%s\"\n%s",
e->e_dn, mdn, "" );
+#endif /* !NEW_LOGGING */
break;
case REWRITE_REGEXEC_UNWILLING:
send_ldap_result( conn, op, LDAP_UNWILLING_TO_PERFORM,
NULL, "Unwilling to perform", NULL, NULL );
+ return( -1 );
case REWRITE_REGEXEC_ERR:
+ send_ldap_result( conn, op, LDAP_OPERATIONS_ERROR,
+ NULL, "Operations error", NULL, NULL );
return( -1 );
}
#else /* !ENABLE_REWRITE */
/* no substitution */
continue;
}
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "backend", LDAP_LEVEL_DETAIL1,
+ "[rw] bindDn (in add of dn-valued"
+ " attr): \"%s\" -> \"%s\"\n",
+ a_vals[ j ]->bv_val, mattr ));
+#else /* !NEW_LOGGING */
Debug( LDAP_DEBUG_ARGS,
"rw> bindDn (in add of dn-valued attr):"
" \"%s\" -> \"%s\"\n%s",
a_vals[ j ]->bv_val, mattr, "" );
-
+#endif /* !NEW_LOGGING */
+
free( a_vals[ j ]->bv_val );
a_vals[ j ]->bv_val = mattr;
a_vals[ j ]->bv_len = strlen( mattr );
if ( mdn == NULL ) {
mdn = ( char * )dn;
}
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "backend", LDAP_LEVEL_DETAIL1,
+ "[rw] bindDn: \"%s\" -> \"%s\"\n", dn, mdn ));
+#else /* !NEW_LOGGING */
Debug( LDAP_DEBUG_ARGS, "rw> bindDn: \"%s\" -> \"%s\"\n%s",
dn, mdn, "" );
+#endif /* !NEW_LOGGING */
break;
case REWRITE_REGEXEC_UNWILLING:
send_ldap_result( conn, op, LDAP_UNWILLING_TO_PERFORM,
NULL, "Unwilling to perform", NULL, NULL );
+ return( -1 );
case REWRITE_REGEXEC_ERR:
+ send_ldap_result( conn, op, LDAP_OPERATIONS_ERROR,
+ NULL, "Operations error", NULL, NULL );
return( -1 );
}
#else /* !ENABLE_REWRITE */
lc->bound_dn =
ch_strdup( lc->conn->c_cdn );
}
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "backend", LDAP_LEVEL_DETAIL1,
+ "[rw] bindDn: \"%s\" ->"
+ " \"%s\"\n%s",
+ lc->conn->c_cdn,
+ lc->bound_dn ));
+#else /* !NEW_LOGGING */
Debug( LDAP_DEBUG_ARGS,
"rw> bindDn: \"%s\" ->"
- " \"%s\"\n%s",
+ " \"%s\"\n%s",
lc->conn->c_cdn,
lc->bound_dn, "" );
+#endif /* !NEW_LOGGING */
break;
case REWRITE_REGEXEC_UNWILLING:
LDAP_UNWILLING_TO_PERFORM,
NULL, "Unwilling to perform",
NULL, NULL );
+ return( NULL );
case REWRITE_REGEXEC_ERR:
+ send_ldap_result( conn, op,
+ LDAP_OPERATIONS_ERROR,
+ NULL, "Operations error",
+ NULL, NULL );
return( NULL );
}
#else /* !ENABLE_REWRITE */
ldap_pvt_thread_mutex_unlock( &li->conn_mutex );
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "backend", LDAP_LEVEL_INFO,
+ "ldap_back_getconn: conn %ld inserted\n",
+ lc->conn->c_connid ));
+#else /* !NEW_LOGGING */
Debug( LDAP_DEBUG_TRACE,
- "=>ldap_back_getconn: conn %ld inserted%s%s\n",
+ "=>ldap_back_getconn: conn %ld inserted\n%s%s",
lc->conn->c_connid, "", "" );
+#endif /* !NEW_LOGGING */
/* Err could be -1 in case a duplicate ldapconn is inserted */
if ( err != 0 ) {
return( NULL );
}
} else {
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "backend", LDAP_LEVEL_INFO,
+ "ldap_back_getconn: conn %ld inserted\n",
+ lc->conn->c_connid ));
+#else /* !NEW_LOGGING */
Debug( LDAP_DEBUG_TRACE,
"=>ldap_back_getconn: conn %ld fetched%s%s\n",
lc->conn->c_connid, "", "" );
+#endif /* !NEW_LOGGING */
}
return( lc );
if ( mdn == NULL ) {
mdn = ( char * )dn;
}
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "backend", LDAP_LEVEL_DETAIL1,
+ "[rw] compareDn: \"%s\" -> \"%s\"\n",
+ dn, mdn ));
+#else /* !NEW_LOGGING */
Debug( LDAP_DEBUG_ARGS, "rw> compareDn: \"%s\" -> \"%s\"\n%s",
dn, mdn, "" );
+#endif /* !NEW_LOGGING */
break;
case REWRITE_REGEXEC_UNWILLING:
send_ldap_result( conn, op, LDAP_UNWILLING_TO_PERFORM,
NULL, "Unwilling to perform", NULL, NULL );
+ return( -1 );
case REWRITE_REGEXEC_ERR:
+ send_ldap_result( conn, op, LDAP_OPERATIONS_ERROR,
+ NULL, "Operations error", NULL, NULL );
return( -1 );
}
#else /* !ENABLE_REWRITE */
if ( mdn == NULL ) {
mdn = ( char * )dn;
}
- Debug( LDAP_DEBUG_ARGS, "rw> deleteDn: \"%s\" -> \"%s\"\n%s",
- dn, mdn, "" );
- break;
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "backend", LDAP_LEVEL_DETAIL1,
+ "[rw] deleteDn: \"%s\" -> \"%s\"\n", dn, mdn ));
+#else /* !NEW_LOGGING */
+ Debug( LDAP_DEBUG_ARGS, "rw> deleteDn: \"%s\" -> \"%s\"\n%s",
+ dn, mdn, "" );
+#endif /* !NEW_LOGGING */
+ break;
case REWRITE_REGEXEC_UNWILLING:
send_ldap_result( conn, op, LDAP_UNWILLING_TO_PERFORM,
NULL, "Unwilling to perform", NULL, NULL );
+ return( -1 );
case REWRITE_REGEXEC_ERR:
+ send_ldap_result( conn, op, LDAP_OPERATIONS_ERROR,
+ NULL, "Operations error", NULL, NULL );
return( -1 );
}
#else /* !ENABLE_REWRITE */
if ( mop_ndn == NULL ) {
mop_ndn = ( char * )op_ndn;
}
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "backend", LDAP_LEVEL_DETAIL1,
+ "[rw] bindDn (op ndn in group):"
+ " \"%s\" -> \"%s\"\n", op_ndn, mop_ndn ));
+#else /* !NEW_LOGGING */
Debug( LDAP_DEBUG_ARGS,
"rw> bindDn (op ndn in group): \"%s\" -> \"%s\"\n%s",
op_ndn, mop_ndn, "" );
+#endif /* !NEW_LOGGING */
break;
case REWRITE_REGEXEC_UNWILLING:
if ( mgr_ndn == NULL ) {
mgr_ndn = ( char * )gr_ndn;
}
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "backend", LDAP_LEVEL_DETAIL1,
+ "[rw] searchBase (gr ndn in group):"
+ " \"%s\" -> \"%s\"\n%s", gr_ndn, mgr_ndn ));
+#else /* !NEW_LOGGING */
Debug( LDAP_DEBUG_ARGS,
"rw> searchBase (gr ndn in group):"
" \"%s\" -> \"%s\"\n%s",
gr_ndn, mgr_ndn, "" );
+#endif /* !NEW_LOGGING */
break;
case REWRITE_REGEXEC_UNWILLING:
if ( mdn == NULL ) {
mdn = ( char * )dn;
}
- Debug( LDAP_DEBUG_ARGS, "rw> modifyDN: \"%s\" -> \"%s\"\n%s",
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "backend", LDAP_LEVEL_DETAIL1,
+ "[rw] modifyDn: \"%s\" -> \"%s\"\n", dn, mdn ));
+#else /* !NEW_LOGGING */
+ Debug( LDAP_DEBUG_ARGS, "rw> modifyDn: \"%s\" -> \"%s\"\n%s",
dn, mdn, "" );
+#endif /* !NEW_LOGGING */
break;
case REWRITE_REGEXEC_UNWILLING:
send_ldap_result( conn, op, LDAP_UNWILLING_TO_PERFORM,
NULL, "Unwilling to perform", NULL, NULL );
+ return( -1 );
case REWRITE_REGEXEC_ERR:
+ send_ldap_result( conn, op, LDAP_OPERATIONS_ERROR,
+ NULL, "Operations error", NULL, NULL );
return( -1 );
}
#else /* !ENABLE_REWRITE */
if ( mnewSuperior == NULL ) {
mnewSuperior = ( char * )newSuperior;
}
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "backend", LDAP_LEVEL_DETAIL1,
+ "[rw] newSuperiorDn:"
+ " \"%s\" -> \"%s\"\n",
+ newSuperior, mnewSuperior ));
+#else /* !NEW_LOGGING */
Debug( LDAP_DEBUG_ARGS, "rw> newSuperiorDn:"
" \"%s\" -> \"%s\"\n%s",
newSuperior, mnewSuperior, "" );
+#endif /* !NEW_LOGGING */
break;
case REWRITE_REGEXEC_UNWILLING:
send_ldap_result( conn, op, LDAP_UNWILLING_TO_PERFORM,
NULL, "Unwilling to perform",
NULL, NULL );
+ return( -1 );
case REWRITE_REGEXEC_ERR:
+ send_ldap_result( conn, op, LDAP_OPERATIONS_ERROR,
+ NULL, "Operations error",
+ NULL, NULL );
return( -1 );
}
#else /* !ENABLE_REWRITE */
if ( mdn == NULL ) {
mdn = ( char * )dn;
}
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "backend", LDAP_LEVEL_DETAIL1,
+ "[rw] modrDn: \"%s\" -> \"%s\"\n", dn, mdn ));
+#else /* !NEW_LOGGING */
Debug( LDAP_DEBUG_ARGS, "rw> modrDn: \"%s\" -> \"%s\"\n%s",
dn, mdn, "" );
+#endif /* !NEW_LOGGING */
break;
case REWRITE_REGEXEC_UNWILLING:
send_ldap_result( conn, op, LDAP_UNWILLING_TO_PERFORM,
NULL, "Unwilling to perform", NULL, NULL );
+ return( -1 );
case REWRITE_REGEXEC_ERR:
+ send_ldap_result( conn, op, LDAP_OPERATIONS_ERROR,
+ NULL, "Operations error", NULL, NULL );
return( -1 );
}
#else /* !ENABLE_REWRITE */
if ( mbase == NULL ) {
mbase = ( char * )base;
}
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "backend", LDAP_LEVEL_DETAIL1,
+ "[rw] searchBase: \"%s\" -> \"%s\"\n%",
+ base, mbase ));
+#else /* !NEW_LOGGING */
Debug( LDAP_DEBUG_ARGS, "rw> searchBase: \"%s\" -> \"%s\"\n%s",
base, mbase, "" );
+#endif /* !NEW_LOGGING */
break;
case REWRITE_REGEXEC_UNWILLING:
send_ldap_result( conn, op, LDAP_UNWILLING_TO_PERFORM,
NULL, "Unwilling to perform", NULL, NULL );
+ rc = -1;
+ goto finish;
case REWRITE_REGEXEC_ERR:
+ send_ldap_result( conn, op, LDAP_OPERATIONS_ERROR,
+ NULL, "Operations error", NULL, NULL );
rc = -1;
goto finish;
}
}
mfilter = ( char * )filterstr;
}
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "backend", LDAP_LEVEL_DETAIL1,
+ "[rw] searchFilter: \"%s\" -> \"%s\"\n",
+ filterstr, mfilter ));
+#else /* !NEW_LOGGING */
Debug( LDAP_DEBUG_ARGS,
"rw> searchFilter: \"%s\" -> \"%s\"\n%s",
filterstr, mfilter, "" );
+#endif /* !NEW_LOGGING */
break;
case REWRITE_REGEXEC_UNWILLING:
if ( mmatch == NULL ) {
mmatch = ( char * )match;
}
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "backend", LDAP_LEVEL_DETAIL1,
+ "[rw] matchedDn:"
+ " \"%s\" -> \"%s\"\n",
+ match, mmatch ));
+#else /* !NEW_LOGGING */
Debug( LDAP_DEBUG_ARGS, "rw> matchedDn:"
- " \"%s\" -> \"%s\"\n%s",
- match, mmatch, "" );
+ " \"%s\" -> \"%s\"\n%s",
+ match, mmatch, "" );
+#endif /* !NEW_LOGGING */
break;
case REWRITE_REGEXEC_UNWILLING:
if ( ent.e_dn == NULL ) {
ent.e_dn = dn;
} else {
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "backend", LDAP_LEVEL_DETAIL1,
+ "[rw] searchResult: \"%s\""
+ " -> \"%s\"\n", dn, ent.e_dn ));
+#else /* !NEW_LOGGING */
Debug( LDAP_DEBUG_ARGS, "rw> searchResult: \"%s\""
" -> \"%s\"\n%s", dn, ent.e_dn, "" );
+#endif /* !NEW_LOGGING */
free( dn );
dn = NULL;
}
if ( newval == NULL ) {
break;
}
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "backend",
+ LDAP_LEVEL_DETAIL1,
+ "[rw] searchResult on"
+ " attr=%s:"
+ " \"%s\" -> \"%s\"\n",
+ attr->a_desc->ad_type->sat_cname,
+ bv->bv_val, newval ));
+#else /* !NEW_LOGGING */
Debug( LDAP_DEBUG_ARGS,
"rw> searchResult on attr=%s: \"%s\" -> \"%s\"\n",
attr->a_desc->ad_type->sat_cname,
bv->bv_val, newval );
+#endif /* !NEW_LOGGING */
free( bv->bv_val );
bv->bv_val = newval;
struct ldapinfo *li = (struct ldapinfo *) be->be_private;
struct ldapconn *lc, lc_curr;
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "backend", LDAP_LEVEL_INFO,
+ "ldap_back_conn_destroy: fetching conn %d\n",
+ conn->c_connid ));
+#else /* !NEW_LOGGING */
Debug( LDAP_DEBUG_TRACE,
"=>ldap_back_conn_destroy: fetching conn %d\n",
conn->c_connid, 0, 0 );
-
+#endif /* !NEW_LOGGING */
lc_curr.conn = conn;