Operation **oo;
int rc, notfound;
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "operation", LDAP_LEVEL_ENTRY, "conn: %d do_abandon\n", conn->c_connid));
+#else
Debug( LDAP_DEBUG_TRACE, "do_abandon\n", 0, 0, 0 );
+#endif
/*
* Parse the abandon request. It looks like this:
*/
if ( ber_scanf( op->o_ber, "i", &id ) == LBER_ERROR ) {
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "operation", LDAP_LEVEL_ERR,
+ "conn: %d do_abandon: ber_scanf failed\n",
+ conn->c_connid ));
+#else
Debug( LDAP_DEBUG_ANY, "do_abandon: ber_scanf failed\n", 0, 0 ,0 );
+#endif
send_ldap_disconnect( conn, op,
LDAP_PROTOCOL_ERROR, "decoding error" );
return -1;
return rc;
}
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "operation", LDAP_LEVEL_ARGS,
+ "do_abandon: conn: %d id=%ld\n", conn->c_connid, (long) id ));
+#else
Debug( LDAP_DEBUG_ARGS, "do_abandon: id=%ld\n", (long) id, 0 ,0 );
+#endif
if( id <= 0 ) {
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "operation", LDAP_LEVEL_ERR,
+ "do_abandon: conn: %d bad msgid %ld\n", conn->c_connid, (long) id ));
+#else
Debug( LDAP_DEBUG_ANY,
"do_abandon: bad msgid %ld\n", (long) id, 0, 0 );
+#endif
return LDAP_SUCCESS;
}
done:
ldap_pvt_thread_mutex_unlock( &conn->c_mutex );
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "operation", LDAP_LEVEL_ENTRY,
+ "do_abandon: conn: %d op=%ld %sfound\n",
+ conn->c_connid, (long)id, notfound ? "not " : "" ));
+#else
Debug( LDAP_DEBUG_TRACE, "do_abandon: op=%ld %sfound\n",
(long) id, notfound ? "not " : "", 0 );
-
+#endif
return LDAP_SUCCESS;
}
regmatch_t matches[MAXREMATCHES];
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "acl", LDAP_LEVEL_ENTRY,
+ "access_allowed: conn %d %s access to \"%s\" \"%s\" requested\n",
+ conn->c_connid, access2str( access ), e->e_dn, attr ));
+#else
Debug( LDAP_DEBUG_ACL,
"=> access_allowed: %s access to \"%s\" \"%s\" requested\n",
access2str( access ),
e->e_dn, attr );
+#endif
assert( be != NULL );
assert( e != NULL );
/* grant database root access */
if ( be != NULL && be_isroot( be, op->o_ndn ) ) {
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "acl", LDAP_LEVEL_INFO,
+ "access_allowed: conn %d root access granted\n",
+ conn->c_connid));
+#else
Debug( LDAP_DEBUG_ACL,
"<= root access granted\n",
0, 0, 0 );
+#endif
return 1;
}
&& desc != slap_schema.si_ad_entry
&& desc != slap_schema.si_ad_children )
{
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "acl", LDAP_LEVEL_DETAIL1,
+ "access_allowed: conn %d NoUserMod Operational attribute: %s access granted\n",
+ conn->c_connid, attr ));
+#else
Debug( LDAP_DEBUG_ACL, "NoUserMod Operational attribute:"
" %s access granted\n",
attr, 0, 0 );
+#endif
return 1;
}
/* use backend default access if no backend acls */
if( be != NULL && be->be_acl == NULL ) {
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "acl", LDAP_LEVEL_DETAIL1,
+ "access_allowed: conn %d backend default %s access %s to \"%s\"\n",
+ conn->c_connid, access2str( access ),
+ be->be_dfltaccess >= access ? "granted" : "denied", op->o_dn ));
+#else
Debug( LDAP_DEBUG_ACL,
"=> access_allowed: backend default %s access %s to \"%s\"\n",
access2str( access ),
be->be_dfltaccess >= access ? "granted" : "denied", op->o_dn );
-
+#endif
return be->be_dfltaccess >= access;
#ifdef notdef
/* be is always non-NULL */
/* use global default access if no global acls */
} else if ( be == NULL && global_acl == NULL ) {
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "acl", LDAP_LEVEL_DETAIL1,
+ "access_allowed: conn %d global default %s access %s to \"%s\"\n",
+ conn->c_connid, access2str( access ),
+ global_default_access >= access ? "granted" : "denied", op->o_dn ));
+#else
Debug( LDAP_DEBUG_ACL,
"=> access_allowed: global default %s access %s to \"%s\"\n",
access2str( access ),
global_default_access >= access ? "granted" : "denied", op->o_dn );
-
+#endif
return global_default_access >= access;
#endif
}
int i;
for (i = 0; i < MAXREMATCHES && matches[i].rm_so > 0; i++) {
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "acl", LDAP_LEVEL_DETAIL1,
+ "access_allowed: conn %d match[%d]: %d %d ",
+ conn->c_connid, i, (int)matches[i].rm_so, (int)matches[i].rm_eo ));
+#else
Debug( LDAP_DEBUG_ACL, "=> match[%d]: %d %d ", i,
(int)matches[i].rm_so, (int)matches[i].rm_eo );
-
+#endif
if( matches[i].rm_so <= matches[0].rm_eo ) {
int n;
for ( n = matches[i].rm_so; n < matches[i].rm_eo; n++) {
Debug( LDAP_DEBUG_ACL, "%c", e->e_ndn[n], 0, 0 );
}
}
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "acl", LDAP_LEVEL_ARGS, "\n" ));
+#else
Debug( LDAP_DEBUG_ARGS, "\n", 0, 0, 0 );
+#endif
}
control = acl_mask( a, &mask, be, conn, op,
}
if ( ACL_IS_INVALID( mask ) ) {
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "acl", LDAP_LEVEL_DETAIL1,
+ "access_allowed: conn %d \"%s\" (%s) invalid!\n",
+ conn->c_connid, e->e_dn, attr ));
+#else
Debug( LDAP_DEBUG_ACL,
"=> access_allowed: \"%s\" (%s) invalid!\n",
e->e_dn, attr, 0 );
+#endif
ACL_INIT( mask );
} else if ( control == ACL_BREAK ) {
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "acl", LDAP_LEVEL_DETAIL1,
+ "access_allowed: conn %d no more rules\n", conn->c_connid ));
+#else
Debug( LDAP_DEBUG_ACL,
"=> access_allowed: no more rules\n", 0, 0, 0);
+#endif
ACL_INIT( mask );
}
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "acl", LDAP_LEVEL_ENTRY,
+ "access_allowed: conn %d %s access %s by %s\n",
+ access2str( access ),
+ ACL_GRANT( mask, access ) ? "granted" : "denied",
+ accessmask2str( mask, accessmaskbuf ) ));
+#else
Debug( LDAP_DEBUG_ACL,
"=> access_allowed: %s access %s by %s\n",
access2str( access ),
ACL_GRANT(mask, access) ? "granted" : "denied",
accessmask2str( mask, accessmaskbuf ) );
-
+#endif
return ACL_GRANT(mask, access);
}
if (a->acl_dn_pat != NULL) {
if ( a->acl_dn_style == ACL_STYLE_REGEX ) {
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "acl", LDAP_LEVEL_DETAIL1,
+ "acl_get: dnpat [%d] %s nsub: %d\n",
+ *count, a->acl_dn_pat, (int) a->acl_dn_re.re_nsub ));
+#else
Debug( LDAP_DEBUG_ACL, "=> dnpat: [%d] %s nsub: %d\n",
*count, a->acl_dn_pat, (int) a->acl_dn_re.re_nsub );
-
+#endif
if (regexec(&a->acl_dn_re, e->e_ndn, nmatch, matches, 0))
continue;
} else {
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "acl", LDAP_LEVEL_DETAIL1,
+ "acl_get: dn [%d] %s\n",
+ *count, a->acl_dn_pat ));
+#else
Debug( LDAP_DEBUG_ACL, "=> dn: [%d] %s\n",
*count, a->acl_dn_pat, 0 );
-
+#endif
patlen = strlen( a->acl_dn_pat );
if ( dnlen < patlen )
continue;
continue;
}
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "acl", LDAP_LEVEL_DETAIL1,
+ "acl_get: [%d] matched\n",
+ *count ));
+#else
Debug( LDAP_DEBUG_ACL, "=> acl_get: [%d] matched\n",
*count, 0, 0 );
+#endif
}
if ( a->acl_filter != NULL ) {
}
}
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "acl", LDAP_LEVEL_DETAIL1,
+ "acl_get: [%d] check attr %s\n",
+ *count, attr ));
+#else
Debug( LDAP_DEBUG_ACL, "=> acl_get: [%d] check attr %s\n",
*count, attr, 0);
-
+#endif
if ( attr == NULL || a->acl_attrs == NULL ||
ad_inlist( desc, a->acl_attrs ) )
{
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "acl", LDAP_LEVEL_DETAIL1,
+ "acl_get: [%d] acl %s attr: %s\n",
+ *count, e->e_dn, attr ));
+#else
Debug( LDAP_DEBUG_ACL,
"<= acl_get: [%d] acl %s attr: %s\n",
*count, e->e_dn, attr );
+#endif
return a;
}
matches[0].rm_so = matches[0].rm_eo = -1;
}
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "acl", LDAP_LEVEL_ENTRY,
+ "acl_get: done.\n" ));
+#else
Debug( LDAP_DEBUG_ACL, "<= acl_get: done.\n", 0, 0, 0 );
+#endif
return( NULL );
}
assert( a != NULL );
assert( mask != NULL );
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "acl", LDAP_LEVEL_ENTRY,
+ "acl_mask: conn %d access to entry \"%s\", attr \"%s\" requested\n",
+ conn->c_connid, e->e_dn, attr ));
+
+ LDAP_LOG(( "acl", LDAP_LEVEL_ARGS,
+ " to %s by \"%s\", (%s) \n",
+ val ? "value" : "all values",
+ op->o_ndn ? op->o_ndn : "",
+ accessmask2str( *mask, accessmaskbuf ) ));
+#else
Debug( LDAP_DEBUG_ACL,
"=> acl_mask: access to entry \"%s\", attr \"%s\" requested\n",
e->e_dn, attr, 0 );
val ? "value" : "all values",
op->o_ndn ? op->o_ndn : "",
accessmask2str( *mask, accessmaskbuf ) );
+#endif
for ( i = 1, b = a->acl_access; b != NULL; b = b->a_next, i++ ) {
slap_mask_t oldmask, modmask;
/* AND <who> clauses */
if ( b->a_dn_pat != NULL ) {
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "acl", LDAP_LEVEL_DETAIL1,
+ "acl_mask: conn %d check a_dn_pat: %s\n",
+ conn->c_connid, b->a_dn_pat ));
+#else
Debug( LDAP_DEBUG_ACL, "<= check a_dn_pat: %s\n",
b->a_dn_pat, 0, 0);
+#endif
/*
* if access applies to the entry itself, and the
* user is bound as somebody in the same namespace as
}
if ( b->a_sockurl_pat != NULL ) {
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "acl", LDAP_LEVEL_DETAIL1,
+ "acl_mask: conn %d check a_sockurl_pat: %s\n",
+ conn->c_connid, b->a_sockurl_pat ));
+#else
Debug( LDAP_DEBUG_ACL, "<= check a_sockurl_pat: %s\n",
b->a_sockurl_pat, 0, 0 );
+#endif
if ( strcmp( b->a_sockurl_pat, "*" ) != 0) {
if ( b->a_sockurl_style == ACL_STYLE_REGEX) {
}
if ( b->a_domain_pat != NULL ) {
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "acl", LDAP_LEVEL_DETAIL1,
+ "acl_mask: conn %d check a_domain_pat: %s\n",
+ conn->c_connid, b->a_domain_pat ));
+#else
Debug( LDAP_DEBUG_ACL, "<= check a_domain_pat: %s\n",
b->a_domain_pat, 0, 0 );
-
+#endif
if ( strcmp( b->a_domain_pat, "*" ) != 0) {
if ( b->a_domain_style == ACL_STYLE_REGEX) {
if (!regex_matches( b->a_domain_pat, conn->c_peer_domain,
}
if ( b->a_peername_pat != NULL ) {
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "acl", LDAP_LEVEL_DETAIL1,
+ "acl_mask: conn %d check a_perrname_path: %s\n",
+ conn->c_connid, b->a_peername_pat ));
+#else
Debug( LDAP_DEBUG_ACL, "<= check a_peername_path: %s\n",
b->a_peername_pat, 0, 0 );
-
+#endif
if ( strcmp( b->a_peername_pat, "*" ) != 0) {
if ( b->a_peername_style == ACL_STYLE_REGEX) {
if (!regex_matches( b->a_peername_pat, conn->c_peer_name,
}
if ( b->a_sockname_pat != NULL ) {
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "acl", LDAP_LEVEL_DETAIL1,
+ "acl_mask: conn %d check a_sockname_path: %s\n",
+ conn->c_connid, b->a_sockname_pat ));
+#else
Debug( LDAP_DEBUG_ACL, "<= check a_sockname_path: %s\n",
b->a_sockname_pat, 0, 0 );
-
+#endif
if ( strcmp( b->a_sockname_pat, "*" ) != 0) {
if ( b->a_sockname_style == ACL_STYLE_REGEX) {
if (!regex_matches( b->a_sockname_pat, conn->c_sock_name,
const char *text;
const char *desc = b->a_dn_at->ad_cname->bv_val;
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "acl", LDAP_LEVEL_DETAIL1,
+ "acl_mask: conn %d check a_dn_pat: %s\n",
+ conn->c_connid, desc ));
+#else
Debug( LDAP_DEBUG_ACL, "<= check a_dn_at: %s\n",
desc, 0, 0);
-
+#endif
bv.bv_val = op->o_ndn;
bv.bv_len = strlen( bv.bv_val );
}
if ( b->a_authz.sai_ssf ) {
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "acl", LDAP_LEVEL_DETAIL1,
+ "acl_mask: conn %d check a_authz.sai_ssf: ACL %u > OP %u\n",
+ conn->c_connid, b->a_authz.sai_ssf, op->o_ssf ));
+#else
Debug( LDAP_DEBUG_ACL, "<= check a_authz.sai_ssf: ACL %u > OP %u\n",
b->a_authz.sai_ssf, op->o_ssf, 0 );
-
+#endif
if ( b->a_authz.sai_ssf > op->o_ssf ) {
continue;
}
}
if ( b->a_authz.sai_transport_ssf ) {
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "acl", LDAP_LEVEL_DETAIL1,
+ "acl_mask: conn %d check a_authz.sai_transport_ssf: ACL %u > OP %u\n",
+ conn->c_connid, b->a_authz.sai_transport_ssf, op->o_transport_ssf ));
+#else
Debug( LDAP_DEBUG_ACL,
"<= check a_authz.sai_transport_ssf: ACL %u > OP %u\n",
b->a_authz.sai_transport_ssf, op->o_transport_ssf, 0 );
-
+#endif
if ( b->a_authz.sai_transport_ssf > op->o_transport_ssf ) {
continue;
}
}
if ( b->a_authz.sai_tls_ssf ) {
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "acl", LDAP_LEVEL_DETAIL1,
+ "acl_mask: conn %d check a_authz.sai_tls_ssf: ACL %u > OP %u\n",
+ conn->c_connid, b->a_authz.sai_tls_ssf, op->o_tls_ssf ));
+#else
Debug( LDAP_DEBUG_ACL,
"<= check a_authz.sai_tls_ssf: ACL %u > OP %u\n",
b->a_authz.sai_tls_ssf, op->o_tls_ssf, 0 );
-
+#endif
if ( b->a_authz.sai_tls_ssf > op->o_tls_ssf ) {
continue;
}
}
if ( b->a_authz.sai_sasl_ssf ) {
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "acl", LDAP_LEVEL_DETAIL1,
+ "acl_mask: conn %d check a_authz.sai_sasl_ssf: ACL %u > OP %u\n",
+ conn->c_connid, b->a_authz.sai_sasl_ssf, op->o_sasl_ssf ));
+#else
Debug( LDAP_DEBUG_ACL,
"<= check a_authz.sai_sasl_ssf: ACL %u > OP %u\n",
b->a_authz.sai_sasl_ssf, op->o_sasl_ssf, 0 );
-
+#endif
if ( b->a_authz.sai_sasl_ssf > op->o_sasl_ssf ) {
continue;
}
modmask = b->a_access_mask;
}
-
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "acl", LDAP_LEVEL_RESULTS,
+ "acl_mask: conn %d [%d] applying %s (%s)\n",
+ conn->c_connid, i, accessmask2str( modmask, accessmaskbuf),
+ b->a_type == ACL_CONTINUE ? "continue" : b->a_type == ACL_BREAK
+ ? "break" : "stop" ));
+#else
Debug( LDAP_DEBUG_ACL,
"<= acl_mask: [%d] applying %s (%s)\n",
i, accessmask2str( modmask, accessmaskbuf ),
: b->a_type == ACL_BREAK
? "break"
: "stop" );
-
+#endif
/* save old mask */
oldmask = *mask;
*mask = modmask;
}
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "aci", LDAP_LEVEL_DETAIL1,
+ "acl_mask: conn %d [%d] mask: %s\n",
+ conn->c_connid, i, accessmask2str( *mask, accessmaskbuf) ));
+#else
Debug( LDAP_DEBUG_ACL,
"<= acl_mask: [%d] mask: %s\n",
i, accessmask2str(*mask, accessmaskbuf), 0 );
+#endif
if( b->a_type == ACL_CONTINUE ) {
continue;
}
}
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "aci", LDAP_LEVEL_RESULTS,
+ "acl_mask: conn %d no more <who> clauses, returning %d (stop)\n",
+ conn->c_connid, accessmask2str( *mask, accessmaskbuf) ));
+#else
Debug( LDAP_DEBUG_ACL,
"<= acl_mask: no more <who> clauses, returning %s (stop)\n",
accessmask2str(*mask, accessmaskbuf), 0, 0 );
+#endif
return ACL_STOP;
}
/* short circuit root database access */
if ( be_isroot( be, op->o_ndn ) ) {
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "acl", LDAP_LEVEL_DETAIL1,
+ "acl_check_modlist: conn %d access granted to root user\n",
+ conn->c_connid ));
+#else
Debug( LDAP_DEBUG_ACL,
"<= acl_access_allowed: granted to database root\n",
0, 0, 0 );
+#endif
return 1;
}
/* use backend default access if no backend acls */
if( be != NULL && be->be_acl == NULL ) {
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "aci", LDAP_LEVEL_DETAIL1,
+ "acl_check_modlist: conn %d backend default %s access %s to \"%s\"\n",
+ conn->c_connid, access2str( ACL_WRITE ),
+ be->be_dfltaccess >= ACL_WRITE ? "granted" : "denied", op->o_dn ));
+#else
Debug( LDAP_DEBUG_ACL,
"=> access_allowed: backend default %s access %s to \"%s\"\n",
access2str( ACL_WRITE ),
be->be_dfltaccess >= ACL_WRITE ? "granted" : "denied", op->o_dn );
-
+#endif
return be->be_dfltaccess >= ACL_WRITE;
#ifdef notdef
/* be is always non-NULL */
/* use global default access if no global acls */
} else if ( be == NULL && global_acl == NULL ) {
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "aci", LDAP_LEVEL_DETAIL1,
+ "acl_check_modlist: conn %d global default %s access %s to \"%s\"\n",
+ conn->c_connid, access2str( ACL_WRITE ),
+ global_default_access >= ACL_WRITE ? "granted" : "denied", op->o_dn ));
+#else
Debug( LDAP_DEBUG_ACL,
"=> access_allowed: global default %s access %s to \"%s\"\n",
access2str( ACL_WRITE ),
global_default_access >= ACL_WRITE ? "granted" : "denied", op->o_dn );
-
+#endif
return global_default_access >= ACL_WRITE;
#endif
}
* by the user
*/
if ( is_at_no_user_mod( mlist->sml_desc->ad_type ) ) {
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "aci", LDAP_LEVEL_DETAIL1,
+ "acl_check_modlist: conn %d no-user-mod %s: modify access granted\n",
+ conn->c_connid, mlist->sml_desc->ad_cname->bv_val ));
+#else
Debug( LDAP_DEBUG_ACL, "acl: no-user-mod %s:"
" modify access granted\n",
mlist->sml_desc->ad_cname->bv_val, 0, 0 );
+#endif
continue;
}
*dp = '\0';
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "aci", LDAP_LEVEL_DETAIL1,
+ "string_expand: pattern = %s\n", pat ));
+ LDAP_LOG(( "aci", LDAP_LEVEL_DETAIL1,
+ "string_expand: expanded = %s\n", newbuf ));
+#else
Debug( LDAP_DEBUG_TRACE, "=> string_expand: pattern: %s\n", pat, 0, 0 );
Debug( LDAP_DEBUG_TRACE, "=> string_expand: expanded: %s\n", newbuf, 0, 0 );
+#endif
}
static int
char error[512];
regerror(rc, &re, error, sizeof(error));
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "aci", LDAP_LEVEL_ERR,
+ "regex_matches: compile( \"%s\", \"%s\") failed %s\n",
+ pat, str, error ));
+#else
Debug( LDAP_DEBUG_TRACE,
"compile( \"%s\", \"%s\") failed %s\n",
pat, str, error );
+#endif
return( 0 );
}
rc = regexec(&re, str, 0, NULL, 0);
regfree( &re );
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "aci", LDAP_LEVEL_DETAIL2,
+ "regex_matches: string: %s\n", str ));
+ LDAP_LOG(( "aci", LDAP_LEVEL_DETAIL2,
+ "regex_matches: rc: %d %s\n",
+ rc, rc ? "matches" : "no matches" ));
+#else
Debug( LDAP_DEBUG_TRACE,
"=> regex_matches: string: %s\n", str, 0, 0 );
Debug( LDAP_DEBUG_TRACE,
"=> regex_matches: rc: %d %s\n",
rc, !rc ? "matches" : "no matches", 0 );
+#endif
return( !rc );
}
int rc = LDAP_SUCCESS;
int manageDSAit;
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "operation", LDAP_LEVEL_ENTRY,
+ "do_add: conn %d enter\n", conn->c_connid ));
+#else
Debug( LDAP_DEBUG_TRACE, "do_add\n", 0, 0, 0 );
-
+#endif
/*
* Parse the add request. It looks like this:
*
/* get the name */
if ( ber_scanf( ber, "{a", /*}*/ &dn ) == LBER_ERROR ) {
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "operation", LDAP_LEVEL_ERR,
+ "do_add: conn %d ber_scanf failed\n", conn->c_connid ));
+#else
Debug( LDAP_DEBUG_ANY, "do_add: ber_scanf failed\n", 0, 0, 0 );
+#endif
send_ldap_disconnect( conn, op,
LDAP_PROTOCOL_ERROR, "decoding error" );
return -1;
ndn = ch_strdup( dn );
if ( dn_normalize( ndn ) == NULL ) {
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "operation", LDAP_LEVEL_ERR,
+ "do_add: conn %d invalid dn (%s)\n", conn->c_connid, dn ));
+#else
Debug( LDAP_DEBUG_ANY, "do_add: invalid dn (%s)\n", dn, 0, 0 );
+#endif
send_ldap_result( conn, op, LDAP_INVALID_DN_SYNTAX, NULL,
"invalid DN", NULL, NULL );
free( dn );
e->e_attrs = NULL;
e->e_private = NULL;
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "operation", LDAP_LEVEL_ARGS,
+ "do_add: conn %d ndn (%s)\n", conn->c_connid, e->e_ndn ));
+#else
Debug( LDAP_DEBUG_ARGS, "do_add: ndn (%s)\n", e->e_ndn, 0, 0 );
+#endif
/* get the attrs */
for ( tag = ber_first_element( ber, &len, &last ); tag != LBER_DEFAULT;
rc = ber_scanf( ber, "{a{V}}", &mod->ml_type, &mod->ml_bvalues );
if ( rc == LBER_ERROR ) {
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "operation", LDAP_LEVEL_ERR,
+ "do_add: conn %d decoding error \n", conn->c_connid ));
+#else
Debug( LDAP_DEBUG_ANY, "do_add: decoding error\n", 0, 0, 0 );
+#endif
send_ldap_disconnect( conn, op,
LDAP_PROTOCOL_ERROR, "decoding error" );
rc = -1;
}
if ( mod->ml_bvalues == NULL ) {
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "operation", LDAP_LEVEL_INFO,
+ "do_add: conn %d no values for type %s\n",
+ conn->c_connid, mod->ml_type ));
+#else
Debug( LDAP_DEBUG_ANY, "no values for type %s\n",
mod->ml_type, 0, 0 );
+#endif
send_ldap_result( conn, op, rc = LDAP_PROTOCOL_ERROR,
NULL, "no values for attribute type", NULL, NULL );
free( mod->ml_type );
}
if ( ber_scanf( ber, /*{*/ "}") == LBER_ERROR ) {
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "operation", LDAP_LEVEL_ERR,
+ "do_add: conn %d ber_scanf failed\n", conn->c_connid ));
+#else
Debug( LDAP_DEBUG_ANY, "do_add: ber_scanf failed\n", 0, 0, 0 );
+#endif
send_ldap_disconnect( conn, op,
LDAP_PROTOCOL_ERROR, "decoding error" );
rc = -1;
}
if( (rc = get_ctrls( conn, op, 1 )) != LDAP_SUCCESS ) {
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "operation", LDAP_LEVEL_INFO,
+ "do_add: conn %d get_ctrls failed\n", conn->c_connid ));
+#else
Debug( LDAP_DEBUG_ANY, "do_add: get_ctrls failed\n", 0, 0, 0 );
+#endif
goto done;
}
#endif
}
} else {
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "operation", LDAP_LEVEL_INFO,
+ "do_add: conn %d no backend support\n", conn->c_connid ));
+#else
Debug( LDAP_DEBUG_ARGS, " do_add: no backend support\n", 0, 0, 0 );
- send_ldap_result( conn, op, rc = LDAP_UNWILLING_TO_PERFORM,
- NULL, "operation not supported within namingContext", NULL, NULL );
+#endif
+ send_ldap_result( conn, op, rc = LDAP_UNWILLING_TO_PERFORM,
+ NULL, "operation not supported within namingContext", NULL, NULL );
}
done:
if((nBackendInfo != 0) || (backendInfo != NULL)) {
/* already initialized */
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "backend", LDAP_LEVEL_ERR,
+ "backend_init: backend already initialized\n" ));
+#else
Debug( LDAP_DEBUG_ANY,
"backend_init: already initialized.\n", 0, 0, 0 );
+#endif
return -1;
}
rc = binfo[nBackendInfo].bi_init( &binfo[nBackendInfo] );
if(rc != 0) {
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "backend", LDAP_LEVEL_INFO,
+ "backend_init: initialized for type \"%s\"\n",
+ binfo[nBackendInfo].bi_type ));
+#else
Debug( LDAP_DEBUG_ANY,
"backend_init: initialized for type \"%s\"\n",
binfo[nBackendInfo].bi_type, 0, 0 );
-
+#endif
/* destroy those we've already inited */
for( nBackendInfo--;
nBackendInfo >= 0 ;
#ifdef SLAPD_MODULES
return 0;
#else
- Debug( LDAP_DEBUG_ANY,
+
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "backend", LDAP_LEVEL_ERR,
+ "backend_init: failed\n" ));
+#else
+ Debug( LDAP_DEBUG_ANY,
"backend_init: failed\n",
0, 0, 0 );
+#endif
return rc;
#endif /* SLAPD_MODULES */
int rc = 0;
if ((rc = aBackendInfo->bi_init(aBackendInfo)) != 0) {
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "backend", LDAP_LEVEL_ERR,
+ "backend_add: initialization for type \"%s\" failed\n",
+ aBackendInfo->bi_type ));
+#else
Debug( LDAP_DEBUG_ANY,
"backend_add: initialization for type \"%s\" failed\n",
aBackendInfo->bi_type, 0, 0 );
+#endif
return rc;
}
if( ! ( nBackendDB > 0 ) ) {
/* no databases */
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "backend", LDAP_LEVEL_INFO,
+ "backend_startup: %d databases to startup. \n",
+ nBackendDB ));
+#else
Debug( LDAP_DEBUG_ANY,
"backend_startup: %d databases to startup.\n",
nBackendDB, 0, 0 );
+#endif
return 1;
}
if(be != NULL) {
/* startup a specific backend database */
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "backend", LDAP_LEVEL_DETAIL1,
+ "backend_startup: starting \"%s\"\n",
+ be->be_suffix[0] ));
+#else
Debug( LDAP_DEBUG_TRACE,
"backend_startup: starting \"%s\"\n",
be->be_suffix[0], 0, 0 );
+#endif
if ( be->bd_info->bi_open ) {
rc = be->bd_info->bi_open( be->bd_info );
}
if(rc != 0) {
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "backend", LDAP_LEVEL_CRIT,
+ "backend_startup: bi_open failed!\n" ));
+#else
Debug( LDAP_DEBUG_ANY,
"backend_startup: bi_open failed!\n",
0, 0, 0 );
+#endif
+
return rc;
}
}
if(rc != 0) {
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "backend", LDAP_LEVEL_CRIT,
+ "backend_startup: bi_db_open failed!\n" ));
+#else
Debug( LDAP_DEBUG_ANY,
"backend_startup: bi_db_open failed!\n",
0, 0, 0 );
+#endif
return rc;
}
}
if(rc != 0) {
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "backend", LDAP_LEVEL_CRIT,
+ "backend_startup: bi_open %d failed!\n", i ));
+#else
Debug( LDAP_DEBUG_ANY,
"backend_startup: bi_open %d failed!\n",
i, 0, 0 );
+#endif
return rc;
}
}
}
if(rc != 0) {
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "backend", LDAP_LEVEL_CRIT,
+ "backend_startup: bi_db_open %d failed!\n", i ));
+#else
Debug( LDAP_DEBUG_ANY,
"backend_startup: bi_db_open %d failed!\n",
i, 0, 0 );
+#endif
return rc;
}
}
}
if(rc != 0) {
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "backend", LDAP_LEVEL_NOTICE,
+ "backend_shutdown: bi_close %s failed!\n",
+ backendDB[i].be_type ));
+#else
Debug( LDAP_DEBUG_ANY,
"backend_close: bi_close %s failed!\n",
backendDB[i].be_type, 0, 0 );
+#endif
}
}
struct berval cred;
Backend *be;
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "operation", LDAP_LEVEL_ENTRY, "do_bind: conn %d\n", conn->c_connid ));
+#else
Debug( LDAP_DEBUG_TRACE, "do_bind\n", 0, 0, 0 );
+#endif
dn = NULL;
ndn = NULL;
tag = ber_scanf( ber, "{iat" /*}*/, &version, &dn, &method );
if ( tag == LBER_ERROR ) {
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "operation", LDAP_LEVEL_ERR,
+ "do_bind: conn %d ber_scanf failed\n", conn->c_connid ));
+#else
Debug( LDAP_DEBUG_ANY, "bind: ber_scanf failed\n", 0, 0, 0 );
+#endif
send_ldap_disconnect( conn, op,
LDAP_PROTOCOL_ERROR, "decoding error" );
rc = -1;
}
if( (rc = get_ctrls( conn, op, 1 )) != LDAP_SUCCESS ) {
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "operation", LDAP_LEVEL_INFO,
+ "do_bind: conn %d get_ctrls failed\n", conn->c_connid ));
+#else
Debug( LDAP_DEBUG_ANY, "do_bind: get_ctrls failed\n", 0, 0, 0 );
+#endif
goto cleanup;
}
ndn = ch_strdup( dn );
if ( dn_normalize( ndn ) == NULL ) {
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "operation", LDAP_LEVEL_INFO,
+ "do_bind: conn %d invalid dn (%s)\n", conn->c_connid, dn ));
+#else
Debug( LDAP_DEBUG_ANY, "bind: invalid dn (%s)\n", dn, 0, 0 );
+#endif
send_ldap_result( conn, op, rc = LDAP_INVALID_DN_SYNTAX, NULL,
"invalid DN", NULL, NULL );
goto cleanup;
}
if( method == LDAP_AUTH_SASL ) {
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "operation", LDAP_LEVEL_DETAIL1,
+ "do_sasl_bind: conn %d dn (%s) mech %s\n", conn->c_connid,
+ dn, mech ));
+#else
Debug( LDAP_DEBUG_TRACE, "do_sasl_bind: dn (%s) mech %s\n",
dn, mech, NULL );
+#endif
} else {
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "operation", LDAP_LEVEL_DETAIL1,
+ "do_bind: conn %d version=%ld dn=\"%s\" method=%ld\n",
+ conn->c_connid, (unsigned long) version, dn, (unsigned long)method ));
+#else
Debug( LDAP_DEBUG_TRACE, "do_bind: version=%ld dn=\"%s\" method=%ld\n",
(unsigned long) version, dn, (unsigned long) method );
+#endif
}
- Statslog( LDAP_DEBUG_STATS, "conn=%ld op=%d BIND dn=\"%s\" method=%ld\n",
+ Statslog( LDAP_DEBUG_STATS, "conn=%ld op=%d BIND dn=\"%s\" method=%ld\n",
op->o_connid, op->o_opid, ndn, (unsigned long) method, 0 );
if ( version < LDAP_VERSION_MIN || version > LDAP_VERSION_MAX ) {
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "operation", LDAP_LEVEL_INFO,
+ "do_bind: conn %d unknown version = %ld\n",
+ conn->c_connid, (unsigned long)version ));
+#else
Debug( LDAP_DEBUG_ANY, "do_bind: unknown version=%ld\n",
(unsigned long) version, 0, 0 );
+#endif
send_ldap_result( conn, op, rc = LDAP_PROTOCOL_ERROR,
NULL, "requested protocol version not supported", NULL, NULL );
goto cleanup;
slap_ssf_t ssf = 0;
if ( version < LDAP_VERSION3 ) {
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "operation", LDAP_LEVEL_INFO,
+ "do_bind: conn %d sasl with LDAPv%ld\n",
+ conn->c_connid, (unsigned long)version ));
+#else
Debug( LDAP_DEBUG_ANY, "do_bind: sasl with LDAPv%ld\n",
(unsigned long) version, 0, 0 );
+#endif
send_ldap_disconnect( conn, op,
LDAP_PROTOCOL_ERROR, "SASL bind requires LDAPv3" );
rc = SLAPD_DISCONNECT;
}
if( mech == NULL || *mech == '\0' ) {
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "operation", LDAP_LEVEL_INFO,
+ "do_bind: conn %d no SASL mechanism provided\n",
+ conn->c_connid ));
+#else
Debug( LDAP_DEBUG_ANY,
"do_bind: no sasl mechanism provided\n",
0, 0, 0 );
+#endif
send_ldap_result( conn, op, rc = LDAP_AUTH_METHOD_NOT_SUPPORTED,
NULL, "no SASL mechanism provided", NULL, NULL );
goto cleanup;
*/
send_ldap_result( conn, op, rc,
NULL, text, NULL, NULL );
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "operation", LDAP_LEVEL_DETAIL1,
+ "do_bind: conn %d v%d anonymous bind\n",
+ conn->c_connid, version ));
+#else
Debug( LDAP_DEBUG_TRACE, "do_bind: v%d anonymous bind\n",
version, 0, 0 );
+#endif
goto cleanup;
} else if ( global_disallows & SLAP_DISALLOW_BIND_SIMPLE ) {
send_ldap_result( conn, op, rc,
NULL, text, NULL, NULL );
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "operation", LDAP_LEVEL_INFO,
+ "do_bind: conn %d v%d simple bind(%s) disallowed\n",
+ conn->c_connid, version, ndn ));
+#else
Debug( LDAP_DEBUG_TRACE,
"do_bind: v%d simple bind(%s) disallowed\n",
version, ndn, 0 );
+#endif
goto cleanup;
}
send_ldap_result( conn, op, rc,
NULL, text, NULL, NULL );
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "operation", LDAP_LEVEL_DETAIL1,
+ "do_bind: conn %d v%d Kerberos V4 bind\n",
+ conn->c_connid, version ));
+#else
Debug( LDAP_DEBUG_TRACE, "do_bind: v%d Kerberos V4 bind\n",
version, 0, 0 );
+#endif
goto cleanup;
}
#endif
send_ldap_result( conn, op, rc,
NULL, text, NULL, NULL );
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "operation", LDAP_LEVEL_INFO,
+ "do_bind: conn %d v%d unknown authentication method (%d)\n",
+ conn->c_connid, version, method ));
+#else
Debug( LDAP_DEBUG_TRACE,
"do_bind: v%d unknown authentication method (%d)\n",
version, method, 0 );
+#endif
goto cleanup;
}
ndn = NULL;
}
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "operation", LDAP_LEVEL_DETAIL1,
+ "do_bind: conn %d v%d bind: \"%s\" to \"%s\" \n",
+ conn->c_connid, version, conn->c_cdn, conn->c_dn ));
+#else
Debug( LDAP_DEBUG_TRACE, "do_bind: v%d bind: \"%s\" to \"%s\"\n",
version, conn->c_cdn, conn->c_dn );
+#endif
ldap_pvt_thread_mutex_unlock( &conn->c_mutex );
void *new;
if ( (new = (void *) ber_memalloc( size )) == NULL ) {
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "operation", LDAP_LEVEL_ERR,
+ "ch_malloc: allocation of %lu bytes failed\n",
+ (long)size ));
+#else
Debug( LDAP_DEBUG_ANY, "ch_malloc of %lu bytes failed\n",
(long) size, 0, 0 );
+#endif
assert( 0 );
exit( EXIT_FAILURE );
}
}
if ( (new = (void *) ber_memrealloc( block, size )) == NULL ) {
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "operation", LDAP_LEVEL_ERR,
+ "ch_realloc: reallocation of %lu bytes failed\n", (long)size ));
+#else
Debug( LDAP_DEBUG_ANY, "ch_realloc of %lu bytes failed\n",
(long) size, 0, 0 );
+#endif
assert( 0 );
exit( EXIT_FAILURE );
}
void *new;
if ( (new = (void *) ber_memcalloc( nelem, size )) == NULL ) {
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "operation", LDAP_LEVEL_ERR,
+ "ch_calloc: allocation of %lu elements of %lu bytes faild\n",
+ (long)nelem, (long)size ));
+#else
Debug( LDAP_DEBUG_ANY, "ch_calloc of %lu elems of %lu bytes failed\n",
(long) nelem, (long) size, 0 );
+#endif
assert( 0 );
exit( EXIT_FAILURE );
}
char *new;
if ( (new = ber_strdup( string )) == NULL ) {
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "operation", LDAP_LEVEL_ERR,
+ "chr_strdup: duplication of \"%s\" failed\n", string ));
+#else
Debug( LDAP_DEBUG_ANY, "ch_strdup(%s) failed\n", string, 0, 0 );
+#endif
assert( 0 );
exit( EXIT_FAILURE );
}
desc.bv_val = NULL;
value.bv_val = NULL;
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "operation", LDAP_LEVEL_ENTRY,
+ "do_compare: conn %d\n", conn->c_connid ));
+#else
Debug( LDAP_DEBUG_TRACE, "do_compare\n", 0, 0, 0 );
-
+#endif
/*
* Parse the compare request. It looks like this:
*
*/
if ( ber_scanf( op->o_ber, "{a" /*}*/, &dn ) == LBER_ERROR ) {
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "operation", LDAP_LEVEL_ERR,
+ "do_compare: conn %d ber_scanf failed\n", conn->c_connid ));
+#else
Debug( LDAP_DEBUG_ANY, "ber_scanf failed\n", 0, 0, 0 );
+#endif
send_ldap_disconnect( conn, op,
LDAP_PROTOCOL_ERROR, "decoding error" );
return SLAPD_DISCONNECT;
}
if ( ber_scanf( op->o_ber, "{oo}", &desc, &value ) == LBER_ERROR ) {
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "operation", LDAP_LEVEL_ERR,
+ "do_compare: conn %d get ava failed\n", conn->c_connid ));
+#else
Debug( LDAP_DEBUG_ANY, "do_compare: get ava failed\n", 0, 0, 0 );
+#endif
send_ldap_disconnect( conn, op,
LDAP_PROTOCOL_ERROR, "decoding error" );
rc = SLAPD_DISCONNECT;
}
if ( ber_scanf( op->o_ber, /*{*/ "}" ) == LBER_ERROR ) {
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "operation", LDAP_LEVEL_ERR,
+ "do_compare: conn %d ber_scanf failed\n", conn->c_connid ));
+#else
Debug( LDAP_DEBUG_ANY, "ber_scanf failed\n", 0, 0, 0 );
+#endif
send_ldap_disconnect( conn, op,
LDAP_PROTOCOL_ERROR, "decoding error" );
rc = SLAPD_DISCONNECT;
}
if( ( rc = get_ctrls( conn, op, 1 )) != LDAP_SUCCESS ) {
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "operation", LDAP_LEVEL_INFO,
+ "do_compare: conn %d get_ctrls failed\n", conn->c_connid ));
+#else
Debug( LDAP_DEBUG_ANY, "do_compare: get_ctrls failed\n", 0, 0, 0 );
+#endif
goto cleanup;
}
ndn = ch_strdup( dn );
if( dn_normalize( ndn ) == NULL ) {
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "operation", LDAP_LEVEL_INFO,
+ "do_compare: conn %d invalid dn (%s)\n",
+ conn->c_connid, dn ));
+#else
Debug( LDAP_DEBUG_ANY, "do_compare: invalid dn (%s)\n", dn, 0, 0 );
+#endif
send_ldap_result( conn, op, rc = LDAP_INVALID_DN_SYNTAX, NULL,
"invalid DN", NULL, NULL );
goto cleanup;
}
if( ndn == '\0' ) {
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "operation", LDAP_LEVEL_DETAIL1,
+ "do_compare: conn %d compare to root DSE!\n",
+ conn->c_connid ));
+#else
Debug( LDAP_DEBUG_ANY, "do_compare: root dse!\n", 0, 0, 0 );
+#endif
send_ldap_result( conn, op, rc = LDAP_UNWILLING_TO_PERFORM,
NULL, "compare upon the root DSE not supported", NULL, NULL );
goto cleanup;
ava.aa_value = nvalue;
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "operation", LDAP_LEVEL_ARGS,
+ "do_compare: conn %d dn (%s) attr(%s) value (%s)\n",
+ conn->c_connid, dn, ava.aa_desc->ad_cname->bv_val,
+ ava.aa_value->bv_val ));
+#else
Debug( LDAP_DEBUG_ARGS, "do_compare: dn (%s) attr (%s) value (%s)\n",
dn, ava.aa_desc->ad_cname->bv_val, ava.aa_value->bv_val );
+#endif
Statslog( LDAP_DEBUG_STATS, "conn=%ld op=%d CMP dn=\"%s\" attr=\"%s\"\n",
op->o_connid, op->o_opid, dn, ava.aa_desc->ad_cname->bv_val, 0 );
cargv[1], 0, 0 );
return( 1 );
}
-
- /* start of a new database definition */
} else if ( strcasecmp( cargv[0], "database" ) == 0 ) {
if ( cargc < 2 ) {
Debug( LDAP_DEBUG_ANY,
return( 1 );
}
}
-
-
/* where to send clients when we don't hold it */
} else if ( strcasecmp( cargv[0], "referral" ) == 0 ) {
if ( cargc < 2 ) {
vals[0]->bv_len = strlen( vals[0]->bv_val );
value_add( &default_referral, vals );
- } else if ( strcasecmp( cargv[0], "debug" ) == 0 ) {
- int level;
- if ( cargc < 3 ) {
- Debug( LDAP_DEBUG_ANY,
- "%s: line %d: Error in debug directive, \"debug subsys level\"\n",
- fname, lineno, 0 );
- return( 1 );
- }
- level = atoi( cargv[2] );
- if ( level <= 0 ) level = lutil_mnem2level( cargv[2] );
- lutil_set_debug_level( cargv[1], level );
- /* specify an Object Identifier macro */
#ifdef NEW_LOGGING
} else if ( strcasecmp( cargv[0], "logfile" ) == 0 ) {
FILE *logfile;
if ( logfile != NULL ) lutil_debug_file( logfile );
#endif
+ /* start of a new database definition */
+ } else if ( strcasecmp( cargv[0], "debug" ) == 0 ) {
+ int level;
+ if ( cargc < 3 ) {
+ Debug( LDAP_DEBUG_ANY,
+ "%s: line %d: Error in debug directive, \"debug subsys level\"\n",
+ fname, lineno, 0 );
+ return( 1 );
+ }
+ level = atoi( cargv[2] );
+ if ( level <= 0 ) level = lutil_mnem2level( cargv[2] );
+ lutil_set_debug_level( cargv[1], level );
+ /* specify an Object Identifier macro */
} else if ( strcasecmp( cargv[0], "objectidentifier" ) == 0 ) {
parse_oidm( fname, lineno, cargc, cargv );
assert( connections == NULL );
if( connections != NULL) {
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "connection", LDAP_LEVEL_INFO,
+ "connections_init: already initialized.\n" ));
+#else
Debug( LDAP_DEBUG_ANY, "connections_init: already initialized.\n",
0, 0, 0 );
+#endif
return -1;
}
connections = (Connection *) calloc( dtblsize, sizeof(Connection) );
if( connections == NULL ) {
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "connection", LDAP_LEVEL_ERR,
+ "connections_init: allocation (%d * %ld) of connection array failed\n",
+ dtblsize, (long) sizeof(Connection) ));
+#else
Debug( LDAP_DEBUG_ANY,
"connections_init: allocation (%d*%ld) of connection array failed\n",
dtblsize, (long) sizeof(Connection), 0 );
+#endif
return -1;
}
/* should check return of every call */
if( connections == NULL) {
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "connection", LDAP_LEVEL_INFO,
+ "connections_destroy: nothing to destroy.\n"));
+#else
Debug( LDAP_DEBUG_ANY, "connections_destroy: nothing to destroy.\n",
0, 0, 0 );
+#endif
return -1;
}
Connection *c;
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "connection", LDAP_LEVEL_ENTRY,
+ "connection_get: socket %ld\n", (long)s ));
+#else
Debug( LDAP_DEBUG_ARGS,
"connection_get(%ld)\n",
(long) s, 0, 0 );
+#endif
assert( connections != NULL );
assert( c->c_conn_state == SLAP_C_INVALID );
assert( sd == AC_SOCKET_INVALID );
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "connection", LDAP_LEVEL_ARGS,
+ "connection_get: connection %d not used\n", s ));
+#else
Debug( LDAP_DEBUG_TRACE,
"connection_get(%d): connection not used\n",
s, 0, 0 );
+#endif
ldap_pvt_thread_mutex_unlock( &c->c_mutex );
return NULL;
}
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "connection", LDAP_LEVEL_RESULTS,
+ "connection_get: get for %d got connid %ld\n",s, c->c_connid ));
+#else
Debug( LDAP_DEBUG_TRACE,
"connection_get(%d): got connid=%ld\n",
s, c->c_connid, 0 );
+#endif
c->c_n_get++;
#endif
if( s == AC_SOCKET_INVALID ) {
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "connection", LDAP_LEVEL_INFO,
+ "connection_init: init of socket %ld invalid.\n", (long)s ));
+#else
Debug( LDAP_DEBUG_ANY,
"connection_init(%ld): invalid.\n",
(long) s, 0, 0 );
+#endif
return -1;
}
}
if( c == NULL ) {
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "connection", LDAP_LEVEL_INFO,
+ "connection_init: skt %d connection table full (%d/%d)\n",
+ s, i, dtblsize ));
+#else
Debug( LDAP_DEBUG_ANY,
"connection_init(%d): connection table full (%d/%d)\n",
s, i, dtblsize);
+#endif
ldap_pvt_thread_mutex_unlock( &connections_mutex );
return -1;
}
if( ber_sockbuf_ctrl( c->c_sb, LBER_SB_OPT_SET_NONBLOCK,
c /* non-NULL */ ) < 0 )
{
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "connection", LDAP_LEVEL_INFO,
+ "connection_init: conn %d set nonblocking failed\n",
+ c->c_connid ));
+#else
Debug( LDAP_DEBUG_ANY,
"connection_init(%d, %s): set nonblocking failed\n",
s, c->c_peer_name, 0 );
+#endif
}
id = c->c_connid = conn_nextid++;
ber_socket_t sd;
ber_sockbuf_ctrl( c->c_sb, LBER_SB_OPT_GET_FD, &sd );
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "connection", LDAP_LEVEL_DETAIL1,
+ "connection_closing: conn %d readying socket %d for close.\n",
+ c->c_connid, sd ));
+#else
Debug( LDAP_DEBUG_TRACE,
"connection_closing: readying conn=%ld sd=%d for close\n",
c->c_connid, sd, 0 );
-
+#endif
/* update state to closing */
c->c_conn_state = SLAP_C_CLOSING;
ber_sockbuf_ctrl( c->c_sb, LBER_SB_OPT_GET_FD, &sd );
if( c->c_ops != NULL ) {
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "connection", LDAP_LEVEL_DETAIL1,
+ "connection_close: conn %d deferring sd %d\n",
+ c->c_connid, sd ));
+#else
Debug( LDAP_DEBUG_TRACE,
"connection_close: deferring conn=%ld sd=%d\n",
c->c_connid, sd, 0 );
-
+#endif
return;
}
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "connection", LDAP_LEVEL_RESULTS,
+ "connection_close: conn %d sd %d\n",
+ c->c_connid, sd ));
+#else
Debug( LDAP_DEBUG_TRACE, "connection_close: conn=%ld sd=%d\n",
c->c_connid, sd, 0 );
-
+#endif
connection_destroy( c );
}
ldap_pvt_thread_mutex_unlock( &num_ops_mutex );
if( conn->c_sasl_bind_in_progress && tag != LDAP_REQ_BIND ) {
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "connection", LDAP_LEVEL_ERR,
+ "connection_operation: conn %d SASL bind in progress (tag=%ld).\n",
+ conn->c_connid, (long)tag ));
+#else
Debug( LDAP_DEBUG_ANY, "connection_operation: "
"error: SASL bind in progress (tag=%ld).\n",
(long) tag, 0, 0 );
+#endif
send_ldap_result( conn, arg->co_op,
rc = LDAP_OPERATIONS_ERROR,
NULL, "SASL bind in progress", NULL, NULL );
break;
default:
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "connection", LDAP_LEVEL_INFO,
+ "connection_operation: conn %d unknown LDAP request 0x%lx\n",
+ conn->c_connid, tag ));
+#else
Debug( LDAP_DEBUG_ANY, "unknown LDAP request 0x%lx\n",
tag, 0, 0 );
+#endif
arg->co_op->o_tag = LBER_ERROR;
send_ldap_disconnect( conn, arg->co_op,
LDAP_PROTOCOL_ERROR, "unknown LDAP request" );
c = connection_get( s );
if( c == NULL ) {
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "connection", LDAP_LEVEL_INFO,
+ "connection_read: sock %ld no connection\n",
+ (long)s ));
+#else
Debug( LDAP_DEBUG_ANY,
"connection_read(%ld): no connection!\n",
(long) s, 0, 0 );
-
+#endif
slapd_remove(s, 0);
ldap_pvt_thread_mutex_unlock( &connections_mutex );
c->c_n_read++;
if( c->c_conn_state == SLAP_C_CLOSING ) {
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "connection", LDAP_LEVEL_INFO,
+ "connection_read: conn %d connection closing, ignoring input\n",
+ c->c_connid));
+#else
Debug( LDAP_DEBUG_TRACE,
"connection_read(%d): closing, ignoring input for id=%ld\n",
s, c->c_connid, 0 );
-
+#endif
connection_return( c );
ldap_pvt_thread_mutex_unlock( &connections_mutex );
return 0;
}
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "connection", LDAP_LEVEL_DETAIL1,
+ "connection_read: conn %d checking for input.\n", c->c_connid ));
+#else
Debug( LDAP_DEBUG_TRACE,
"connection_read(%d): checking for input on id=%ld\n",
s, c->c_connid, 0 );
+#endif
#ifdef HAVE_TLS
if ( c->c_is_tls && c->c_needs_tls_accept ) {
struct timeval tv;
fd_set rfd;
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "connection", LDAP_LEVEL_ERR,
+ "connection_read: conn %d TLS accept error, error %d\n",
+ c->c_connid, rc ));
+#else
Debug( LDAP_DEBUG_TRACE,
"connection_read(%d): TLS accept error "
"error=%d id=%ld, closing\n",
s, rc, c->c_connid );
-
+#endif
c->c_needs_tls_accept = 0;
/* connections_mutex and c_mutex are locked */
connection_closing( c );
rc = ldap_pvt_sasl_install( c->c_sb, c->c_sasl_context );
if( rc != LDAP_SUCCESS ) {
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "connection", LDAP_LEVEL_ERR,
+ "connection_read: conn %d SASL install error %d, closing\n",
+ c->c_connid, rc ));
+#else
Debug( LDAP_DEBUG_TRACE,
"connection_read(%d): SASL install error "
"error=%d id=%ld, closing\n",
s, rc, c->c_connid );
-
+#endif
/* connections_mutex and c_mutex are locked */
connection_closing( c );
connection_close( c );
}
if( rc < 0 ) {
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "connection", LDAP_LEVEL_ERR,
+ "connection_read: conn %d input error %d, closing.\n",
+ c->c_connid, rc ));
+#else
Debug( LDAP_DEBUG_TRACE,
"connection_read(%d): input error=%d id=%ld, closing.\n",
s, rc, c->c_connid );
-
+#endif
/* connections_mutex and c_mutex are locked */
connection_closing( c );
connection_close( c );
if ( conn->c_currentber == NULL && (conn->c_currentber = ber_alloc())
== NULL ) {
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "connection", LDAP_LEVEL_ERR,
+ "connection_input: conn %d ber_alloc failed.\n", conn->c_connid ));
+#else
Debug( LDAP_DEBUG_ANY, "ber_alloc failed\n", 0, 0, 0 );
+#endif
return -1;
}
ber_sockbuf_ctrl( conn->c_sb, LBER_SB_OPT_GET_FD, &sd );
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "connection", LDAP_LEVEL_ERR,
+ "connection_input: conn %d ber_get_next failed, errno %d (%s).\n",
+ conn->c_connid, err, sock_errstr(err) ));
+#else
Debug( LDAP_DEBUG_TRACE,
"ber_get_next on fd %d failed errno=%d (%s)\n",
sd, err, sock_errstr(err) );
-
+#endif
if ( err != EWOULDBLOCK && err != EAGAIN ) {
/* log, close and send error */
ber_free( conn->c_currentber, 1 );
if ( (tag = ber_get_int( ber, &msgid )) != LDAP_TAG_MSGID ) {
/* log, close and send error */
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "connection", LDAP_LEVEL_ERR,
+ "connection_input: conn %d ber_get_int returns 0x%lx.\n",
+ conn->c_connid, tag ));
+#else
Debug( LDAP_DEBUG_ANY, "ber_get_int returns 0x%lx\n", tag, 0,
0 );
+#endif
ber_free( ber, 1 );
return -1;
}
if ( (tag = ber_peek_tag( ber, &len )) == LBER_ERROR ) {
/* log, close and send error */
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "connection", LDAP_LEVEL_ERR,
+ "connection_input: conn %d ber_peek_tag returns 0x%lx.\n",
+ conn->c_connid, tag ));
+#else
Debug( LDAP_DEBUG_ANY, "ber_peek_tag returns 0x%lx\n", tag, 0,
0 );
+#endif
ber_free( ber, 1 );
return -1;
if ( conn->c_conn_state == SLAP_C_BINDING
|| conn->c_conn_state == SLAP_C_CLOSING )
{
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "connection", LDAP_LEVEL_INFO,
+ "connection_input: conn %d deferring operation\n",
+ conn->c_connid ));
+#else
Debug( LDAP_DEBUG_ANY, "deferring operation\n", 0, 0, 0 );
+#endif
conn->c_n_ops_pending++;
slap_op_add( &conn->c_pending_ops, op );
rc = ldap_pvt_thread_mutex_trylock( &connections_mutex );
if( rc ) {
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "connection", LDAP_LEVEL_DETAIL1,
+ "connection_resched: conn %d reaquiring locks.\n",
+ conn->c_connid ));
+#else
Debug( LDAP_DEBUG_TRACE,
"connection_resched: reaquiring locks conn=%ld sd=%d\n",
conn->c_connid, sd, 0 );
+#endif
/*
* reaquire locks in the right order...
* this may allow another thread to close this connection,
}
if( conn->c_conn_state != SLAP_C_CLOSING ) {
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "connection", LDAP_LEVEL_INFO,
+ "connection_resched: conn %d closed by other thread.\n",
+ conn->c_connid ));
+#else
Debug( LDAP_DEBUG_TRACE, "connection_resched: "
"closed by other thread conn=%ld sd=%d\n",
conn->c_connid, sd, 0 );
-
+#endif
} else {
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "connection", LDAP_LEVEL_DETAIL1,
+ "connection_resched: conn %d attempting closing.\n",
+ conn->c_connid ));
+#else
Debug( LDAP_DEBUG_TRACE, "connection_resched: "
"attempting closing conn=%ld sd=%d\n",
conn->c_connid, sd, 0 );
-
+#endif
connection_close( conn );
}
connection_operation, (void *) arg );
if ( status != 0 ) {
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "connection", LDAP_LEVEL_ERR,
+ "connection_op_activate: conn %d thread pool submit failed.\n",
+ conn->c_connid ));
+#else
Debug( LDAP_DEBUG_ANY,
"ldap_pvt_thread_pool_submit failed (%d)\n", status, 0, 0 );
+#endif
/* should move op to pending list */
}
slapd_clr_write( s, 0);
if( c == NULL ) {
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "connection", LDAP_LEVEL_ERR,
+ "connection_write: sock %ld no connection!\n",(long)s));
+#else
Debug( LDAP_DEBUG_ANY,
"connection_write(%ld): no connection!\n",
(long) s, 0, 0 );
+#endif
slapd_remove(s, 0);
ldap_pvt_thread_mutex_unlock( &connections_mutex );
return -1;
c->c_n_write++;
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "connection", LDAP_LEVEL_DETAIL1,
+ "connection_write conn %d waking output.\n",
+ c->c_connid ));
+#else
Debug( LDAP_DEBUG_TRACE,
"connection_write(%d): waking output for id=%ld\n",
s, c->c_connid, 0 );
-
+#endif
ldap_pvt_thread_cond_signal( &c->c_write_cv );
if ( ber_sockbuf_ctrl( c->c_sb, LBER_SB_OPT_NEEDS_READ, NULL ) )
goto return_results;
}
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "operation", LDAP_LEVEL_ENTRY,
+ "get_ctrls: conn %d\n", conn->c_connid ));
+#else
Debug( LDAP_DEBUG_TRACE, "=> get_ctrls\n", 0, 0, 0 );
-
+#endif
if( op->o_protocol < LDAP_VERSION3 ) {
rc = SLAPD_DISCONNECT;
errmsg = "controls require LDAPv3";
tag = ber_scanf( ber, "{a" /*}*/, &tctrl->ldctl_oid );
if( tag == LBER_ERROR ) {
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "operation", LDAP_LEVEL_INFO,
+ "get_ctrls: conn %d get OID failed.\n",
+ conn->c_connid ));
+#else
Debug( LDAP_DEBUG_TRACE, "=> get_ctrls: get oid failed.\n",
0, 0, 0 );
+#endif
*ctrls = NULL;
ldap_controls_free( tctrls );
rc = SLAPD_DISCONNECT;
tag = ber_scanf( ber, "b", &crit );
if( tag == LBER_ERROR ) {
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "operation", LDAP_LEVEL_INFO,
+ "get_ctrls: conn %d get crit failed.\n",
+ conn->c_connid ));
+#else
Debug( LDAP_DEBUG_TRACE, "=> get_ctrls: get crit failed.\n",
0, 0, 0 );
+#endif
*ctrls = NULL;
ldap_controls_free( tctrls );
rc = SLAPD_DISCONNECT;
tag = ber_peek_tag( ber, &len );
}
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "operation", LDAP_LEVEL_INFO,
+ "get_ctrls: conn %d oid=\"%s\" (%scritical)\n",
+ conn->c_connid, tctrl->ldctl_oid,
+ tctrl->ldctl_iscritical ? "" : "non" ));
+#else
Debug( LDAP_DEBUG_TRACE, "=> get_ctrls: oid=\"%s\" (%scritical)\n",
tctrl->ldctl_oid,
tctrl->ldctl_iscritical ? "" : "non",
0 );
-
+#endif
if( tag == LBER_OCTETSTRING ) {
tag = ber_scanf( ber, "o", &tctrl->ldctl_value );
if( tag == LBER_ERROR ) {
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "operation", LDAP_LEVEL_INFO,
+ "get_ctrls: conn %d get value failed.\n", conn->c_connid ));
+#else
Debug( LDAP_DEBUG_TRACE, "=> get_ctrls: get value failed.\n",
0, 0, 0 );
+#endif
*ctrls = NULL;
ldap_controls_free( tctrls );
rc = SLAPD_DISCONNECT;
}
return_results:
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "operation", LDAP_LEVEL_RESULTS,
+ "get_ctrls: conn %s %d %d %s\n",
+ conn->c_connid, nctrls, rc, errmsg ? errmsg : "" ));
+#else
Debug( LDAP_DEBUG_TRACE, "<= get_ctrls: %d %d %s\n",
nctrls, rc, errmsg ? errmsg : "");
-
+#endif
if( sendres && rc != LDAP_SUCCESS ) {
if( rc == SLAPD_DISCONNECT ) {
send_ldap_disconnect( conn, op, rc, errmsg );