int rc;
#ifdef NEW_LOGGING
- LDAP_LOG(( "operation", LDAP_LEVEL_ENTRY, "conn: %d do_abandon\n",
- conn->c_connid));
+ LDAP_LOG( OPERATION, ENTRY, "conn: %d do_abandon\n", conn->c_connid, 0, 0);
#else
Debug( LDAP_DEBUG_TRACE, "do_abandon\n", 0, 0, 0 );
#endif
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 ));
+ LDAP_LOG( OPERATION, ERR,
+ "conn: %d do_abandon: ber_scanf failed\n", conn->c_connid, 0, 0 );
#else
Debug( LDAP_DEBUG_ANY, "do_abandon: ber_scanf failed\n", 0, 0 ,0 );
#endif
}
#ifdef NEW_LOGGING
- LDAP_LOG(( "operation", LDAP_LEVEL_ARGS,
- "do_abandon: conn: %d id=%ld\n", conn->c_connid, (long) id ));
+ LDAP_LOG( OPERATION, ARGS, "do_abandon: conn: %d id=%ld\n",
+ conn->c_connid, (long) id, 0 );
#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 ));
+ LDAP_LOG( OPERATION, ERR,
+ "do_abandon: conn: %d bad msgid %ld\n",
+ conn->c_connid, (long) id, 0 );
#else
Debug( LDAP_DEBUG_ANY,
"do_abandon: bad msgid %ld\n", (long) id, 0, 0 );
ldap_pvt_thread_mutex_unlock( &conn->c_mutex );
#ifdef NEW_LOGGING
- LDAP_LOG(( "operation", LDAP_LEVEL_ENTRY,
+ LDAP_LOG( OPERATION, ENTRY,
"do_abandon: conn: %d op=%ld %sfound\n",
- conn->c_connid, (long)id, o ? "" : "not " ));
+ conn->c_connid, (long)id, o ? "" : "not " );
#else
Debug( LDAP_DEBUG_TRACE, "do_abandon: op=%ld %sfound\n",
(long) id, o ? "" : "not ", 0 );
#define ACL_BUF_SIZE 1024 /* use most appropriate size */
-
/*
* speed up compares
*/
int ret = 1;
int count;
AccessControl *a;
+
#ifdef LDAP_DEBUG
char accessmaskbuf[ACCESSMASK_MAXLEN];
#endif
}
#ifdef NEW_LOGGING
- LDAP_LOG(( "acl", LDAP_LEVEL_ENTRY,
- "access_allowed: conn %lu %s access to \"%s\" \"%s\" requested\n",
- conn ? conn->c_connid : -1, access2str( access ), e->e_dn, attr ));
+ LDAP_LOG( ACL, ENTRY,
+ "access_allowed: %s access to \"%s\" \"%s\" requested\n",
+ access2str( access ), e->e_dn, attr );
#else
Debug( LDAP_DEBUG_ACL,
"=> access_allowed: %s access to \"%s\" \"%s\" requested\n",
/* 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 %lu root access granted\n",
- conn->c_connid));
+ LDAP_LOG( ACL, INFO,
+ "access_allowed: conn %lu root access granted\n",
+ conn->c_connid, 0, 0 );
#else
Debug( LDAP_DEBUG_ACL,
"<= root access granted\n",
&& desc != slap_schema.si_ad_children )
{
#ifdef NEW_LOGGING
- LDAP_LOG(( "acl", LDAP_LEVEL_DETAIL1,
- "access_allowed: conn %lu NoUserMod Operational attribute: %s access granted\n",
- conn->c_connid, attr ));
+ LDAP_LOG( ACL, DETAIL1,
+ "access_allowed: conn %lu NoUserMod Operational attribute: %s "
+ "access granted\n", conn->c_connid, attr , 0 );
#else
Debug( LDAP_DEBUG_ACL, "NoUserMod Operational attribute:"
" %s access granted\n",
/* 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 %lu backend default %s access %s to \"%s\"\n",
- conn->c_connid, access2str( access ),
- be->be_dfltaccess >= access ? "granted" : "denied", op->o_dn.bv_val ));
+ LDAP_LOG( ACL, DETAIL1,
+ "access_allowed: backend default %s access %s to \"%s\"\n",
+ access2str( access ),
+ be->be_dfltaccess >= access ? "granted" : "denied",
+ op->o_dn.bv_val );
#else
Debug( LDAP_DEBUG_ACL,
"=> access_allowed: backend default %s access %s to \"%s\"\n",
/* 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 %lu global default %s access %s to \"%s\"\n",
- conn->c_connid, access2str( access ),
- global_default_access >= access ? "granted" : "denied", op->o_dn.bv_val ));
+ LDAP_LOG( ACL, DETAIL1,
+ "access_allowed: global default %s access %s to \"%s\"\n",
+ access2str( access ),
+ global_default_access >= access ? "granted" : "denied",
+ op->o_dn.bv_val );
#else
Debug( LDAP_DEBUG_ACL,
"=> access_allowed: global default %s access %s to \"%s\"\n",
for (i = 0; i < MAXREMATCHES && matches[i].rm_so > 0; i++) {
#ifdef NEW_LOGGING
- LDAP_LOG(( "acl", LDAP_LEVEL_DETAIL1,
- "access_allowed: conn %lu match[%d]: %d %d ",
- conn->c_connid, i,
- (int)matches[i].rm_so, (int)matches[i].rm_eo ));
+ LDAP_LOG( ACL, DETAIL1,
+ "access_allowed: match[%d]: %d %d ",
+ 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 );
}
}
#ifdef NEW_LOGGING
- LDAP_LOG(( "acl", LDAP_LEVEL_ARGS, "\n" ));
+ LDAP_LOG( ACL, ARGS, "\n" , 0, 0, 0 );
#else
Debug( LDAP_DEBUG_ARGS, "\n", 0, 0, 0 );
#endif
if ( ACL_IS_INVALID( mask ) ) {
#ifdef NEW_LOGGING
- LDAP_LOG(( "acl", LDAP_LEVEL_DETAIL1,
- "access_allowed: conn %lu \"%s\" (%s) invalid!\n",
- conn->c_connid, e->e_dn, attr ));
+ LDAP_LOG( ACL, DETAIL1,
+ "access_allowed: conn %lu \"%s\" (%s) invalid!\n",
+ conn->c_connid, e->e_dn, attr );
#else
Debug( LDAP_DEBUG_ACL,
"=> access_allowed: \"%s\" (%s) invalid!\n",
} else if ( control == ACL_BREAK ) {
#ifdef NEW_LOGGING
- LDAP_LOG(( "acl", LDAP_LEVEL_DETAIL1,
- "access_allowed: conn %lu no more rules\n",
- conn->c_connid ));
+ LDAP_LOG( ACL, DETAIL1,
+ "access_allowed: conn %lu no more rules\n", conn->c_connid, 0,0 );
#else
Debug( LDAP_DEBUG_ACL,
"=> access_allowed: no more rules\n", 0, 0, 0);
}
#ifdef NEW_LOGGING
- LDAP_LOG(( "acl", LDAP_LEVEL_ENTRY,
- "access_allowed: conn %lu %s access %s by %s\n",
- conn->c_connid,
- access2str( access ),
- ACL_GRANT( mask, access ) ? "granted" : "denied",
- accessmask2str( mask, accessmaskbuf ) ));
+ LDAP_LOG( ACL, ENTRY,
+ "access_allowed: %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",
if ( a->acl_dn_pat.bv_len || ( a->acl_dn_style != ACL_STYLE_REGEX )) {
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.bv_val, (int) a->acl_dn_re.re_nsub ));
+ LDAP_LOG( ACL, DETAIL1,
+ "acl_get: dnpat [%d] %s nsub: %d\n",
+ *count, a->acl_dn_pat.bv_val,
+ (int) a->acl_dn_re.re_nsub );
#else
Debug( LDAP_DEBUG_ACL, "=> dnpat: [%d] %s nsub: %d\n",
*count, a->acl_dn_pat.bv_val, (int) a->acl_dn_re.re_nsub );
} else {
#ifdef NEW_LOGGING
- LDAP_LOG(( "acl", LDAP_LEVEL_DETAIL1,
- "acl_get: dn [%d] %s\n",
- *count, a->acl_dn_pat.bv_val ));
+ LDAP_LOG( ACL, DETAIL1, "acl_get: dn [%d] %s\n",
+ *count, a->acl_dn_pat.bv_val, 0 );
#else
Debug( LDAP_DEBUG_ACL, "=> dn: [%d] %s\n",
*count, a->acl_dn_pat.bv_val, 0 );
}
#ifdef NEW_LOGGING
- LDAP_LOG(( "acl", LDAP_LEVEL_DETAIL1,
- "acl_get: [%d] matched\n",
- *count ));
+ LDAP_LOG( ACL, DETAIL1,
+ "acl_get: [%d] matched\n", *count, 0, 0 );
#else
Debug( LDAP_DEBUG_ACL, "=> acl_get: [%d] matched\n",
*count, 0, 0 );
}
#ifdef NEW_LOGGING
- LDAP_LOG(( "acl", LDAP_LEVEL_DETAIL1,
- "acl_get: [%d] check attr %s\n",
- *count, attr ));
+ LDAP_LOG( ACL, DETAIL1,
+ "acl_get: [%d] check attr %s\n", *count, attr ,0 );
#else
Debug( LDAP_DEBUG_ACL, "=> acl_get: [%d] check attr %s\n",
*count, attr, 0);
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 ));
+ LDAP_LOG( ACL, 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",
}
#ifdef NEW_LOGGING
- LDAP_LOG(( "acl", LDAP_LEVEL_ENTRY,
- "acl_get: done.\n" ));
+ LDAP_LOG( ACL, RESULTS, "acl_get: done.\n", 0, 0, 0 );
#else
Debug( LDAP_DEBUG_ACL, "<= acl_get: done.\n", 0, 0, 0 );
#endif
assert( attr != NULL );
#ifdef NEW_LOGGING
- LDAP_LOG(( "acl", LDAP_LEVEL_ENTRY,
- "acl_mask: conn %lu 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.bv_val ? op->o_ndn.bv_val : "",
- accessmask2str( *mask, accessmaskbuf ) ));
+ LDAP_LOG( ACL, ENTRY,
+ "acl_mask: conn %lu access to entry \"%s\", attr \"%s\" requested\n",
+ conn->c_connid, e->e_dn, attr );
+
+ LDAP_LOG( ACL, ARGS,
+ " to %s by \"%s\", (%s) \n", val ? "value" : "all values",
+ op->o_ndn.bv_val ? op->o_ndn.bv_val : "",
+ accessmask2str( *mask, accessmaskbuf ) );
#else
Debug( LDAP_DEBUG_ACL,
"=> acl_mask: access to entry \"%s\", attr \"%s\" requested\n",
/* AND <who> clauses */
if ( b->a_dn_pat.bv_len != 0 ) {
#ifdef NEW_LOGGING
- LDAP_LOG(( "acl", LDAP_LEVEL_DETAIL1,
- "acl_mask: conn %lu check a_dn_pat: %s\n",
- conn->c_connid, b->a_dn_pat.bv_val ));
+ LDAP_LOG( ACL, DETAIL1,
+ "acl_mask: conn %lu check a_dn_pat: %s\n",
+ conn->c_connid, b->a_dn_pat.bv_val ,0 );
#else
Debug( LDAP_DEBUG_ACL, "<= check a_dn_pat: %s\n",
b->a_dn_pat.bv_val, 0, 0);
if ( b->a_sockurl_pat.bv_len ) {
#ifdef NEW_LOGGING
- LDAP_LOG(( "acl", LDAP_LEVEL_DETAIL1,
+ LDAP_LOG( ACL, DETAIL1,
"acl_mask: conn %lu check a_sockurl_pat: %s\n",
- conn->c_connid, b->a_sockurl_pat.bv_val ));
+ conn->c_connid, b->a_sockurl_pat.bv_val , 0 );
#else
Debug( LDAP_DEBUG_ACL, "<= check a_sockurl_pat: %s\n",
b->a_sockurl_pat.bv_val, 0, 0 );
if ( b->a_domain_pat.bv_len ) {
#ifdef NEW_LOGGING
- LDAP_LOG(( "acl", LDAP_LEVEL_DETAIL1,
+ LDAP_LOG( ACL, DETAIL1,
"acl_mask: conn %lu check a_domain_pat: %s\n",
- conn->c_connid, b->a_domain_pat.bv_val ));
+ conn->c_connid, b->a_domain_pat.bv_val , 0 );
#else
Debug( LDAP_DEBUG_ACL, "<= check a_domain_pat: %s\n",
b->a_domain_pat.bv_val, 0, 0 );
if ( b->a_peername_pat.bv_len ) {
#ifdef NEW_LOGGING
- LDAP_LOG(( "acl", LDAP_LEVEL_DETAIL1,
+ LDAP_LOG( ACL, DETAIL1,
"acl_mask: conn %lu check a_perrname_path: %s\n",
- conn->c_connid, b->a_peername_pat.bv_val ));
+ conn->c_connid, b->a_peername_pat.bv_val , 0 );
#else
Debug( LDAP_DEBUG_ACL, "<= check a_peername_path: %s\n",
b->a_peername_pat.bv_val, 0, 0 );
if ( b->a_sockname_pat.bv_len ) {
#ifdef NEW_LOGGING
- LDAP_LOG(( "acl", LDAP_LEVEL_DETAIL1,
+ LDAP_LOG( ACL, DETAIL1,
"acl_mask: conn %lu check a_sockname_path: %s\n",
- conn->c_connid, b->a_sockname_pat.bv_val ));
+ conn->c_connid, b->a_sockname_pat.bv_val , 0 );
#else
Debug( LDAP_DEBUG_ACL, "<= check a_sockname_path: %s\n",
b->a_sockname_pat.bv_val, 0, 0 );
}
#ifdef NEW_LOGGING
- LDAP_LOG(( "acl", LDAP_LEVEL_DETAIL1,
+ LDAP_LOG( ACL, DETAIL1,
"acl_mask: conn %lu check a_dn_pat: %s\n",
- conn->c_connid, attr ));
+ conn->c_connid, attr , 0 );
#else
Debug( LDAP_DEBUG_ACL, "<= check a_dn_at: %s\n",
attr, 0, 0);
if ( b->a_authz.sai_ssf ) {
#ifdef NEW_LOGGING
- LDAP_LOG(( "acl", LDAP_LEVEL_DETAIL1,
- "acl_mask: conn %lu check a_authz.sai_ssf: ACL %u > OP %u\n",
- conn->c_connid, b->a_authz.sai_ssf, op->o_ssf ));
+ LDAP_LOG( ACL, DETAIL1,
+ "acl_mask: conn %lu 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 );
if ( b->a_authz.sai_transport_ssf ) {
#ifdef NEW_LOGGING
- LDAP_LOG(( "acl", LDAP_LEVEL_DETAIL1,
- "acl_mask: conn %lu check a_authz.sai_transport_ssf: ACL %u > OP %u\n",
- conn->c_connid, b->a_authz.sai_transport_ssf, op->o_transport_ssf ));
+ LDAP_LOG( ACL, DETAIL1,
+ "acl_mask: conn %lu 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",
if ( b->a_authz.sai_tls_ssf ) {
#ifdef NEW_LOGGING
- LDAP_LOG(( "acl", LDAP_LEVEL_DETAIL1,
- "acl_mask: conn %lu check a_authz.sai_tls_ssf: ACL %u > OP %u\n",
- conn->c_connid, b->a_authz.sai_tls_ssf, op->o_tls_ssf ));
+ LDAP_LOG( ACL, DETAIL1,
+ "acl_mask: conn %lu 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",
if ( b->a_authz.sai_sasl_ssf ) {
#ifdef NEW_LOGGING
- LDAP_LOG(( "acl", LDAP_LEVEL_DETAIL1,
- "acl_mask: conn %lu check a_authz.sai_sasl_ssf: ACL %u > OP %u\n",
- conn->c_connid, b->a_authz.sai_sasl_ssf, op->o_sasl_ssf ));
+ LDAP_LOG( ACL, DETAIL1,
+ "acl_mask: conn %lu 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",
}
#ifdef NEW_LOGGING
- LDAP_LOG(( "acl", LDAP_LEVEL_RESULTS,
- "acl_mask: conn %lu [%d] applying %s (%s)\n",
- conn->c_connid, i, accessmask2str( modmask, accessmaskbuf),
+ LDAP_LOG( ACL, RESULTS,
+ "acl_mask: [%d] applying %s (%s)\n",
+ i, accessmask2str( modmask, accessmaskbuf),
b->a_type == ACL_CONTINUE ? "continue" : b->a_type == ACL_BREAK
- ? "break" : "stop" ));
+ ? "break" : "stop" );
#else
Debug( LDAP_DEBUG_ACL,
"<= acl_mask: [%d] applying %s (%s)\n",
}
#ifdef NEW_LOGGING
- LDAP_LOG(( "aci", LDAP_LEVEL_DETAIL1,
+ LDAP_LOG( ACL, DETAIL1,
"acl_mask: conn %lu [%d] mask: %s\n",
- conn->c_connid, i, accessmask2str( *mask, accessmaskbuf) ));
+ conn->c_connid, i, accessmask2str( *mask, accessmaskbuf) );
#else
Debug( LDAP_DEBUG_ACL,
"<= acl_mask: [%d] mask: %s\n",
ACL_INIT(*mask);
#ifdef NEW_LOGGING
- LDAP_LOG(( "acl", LDAP_LEVEL_RESULTS,
+ LDAP_LOG( ACL, RESULTS,
"acl_mask: conn %lu no more <who> clauses, returning %d (stop)\n",
- conn->c_connid, accessmask2str( *mask, accessmaskbuf) ));
+ conn->c_connid, accessmask2str( *mask, accessmaskbuf) , 0 );
#else
Debug( LDAP_DEBUG_ACL,
"<= acl_mask: no more <who> clauses, returning %s (stop)\n",
/* short circuit root database access */
if ( be_isroot( be, &op->o_ndn ) ) {
#ifdef NEW_LOGGING
- LDAP_LOG(( "acl", LDAP_LEVEL_DETAIL1,
+ LDAP_LOG( ACL, DETAIL1,
"acl_check_modlist: conn %lu access granted to root user\n",
- conn->c_connid ));
+ conn->c_connid, 0, 0 );
#else
Debug( LDAP_DEBUG_ACL,
"<= acl_access_allowed: granted to database root\n",
/* 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 %lu backend default %s access %s to \"%s\"\n",
- conn->c_connid, access2str( ACL_WRITE ),
- be->be_dfltaccess >= ACL_WRITE ? "granted" : "denied", op->o_dn.bv_val ));
+ LDAP_LOG( ACL, DETAIL1,
+ "acl_check_modlist: backend default %s access %s to \"%s\"\n",
+ access2str( ACL_WRITE ),
+ be->be_dfltaccess >= ACL_WRITE ? "granted" : "denied",
+ op->o_dn.bv_val );
#else
Debug( LDAP_DEBUG_ACL,
"=> access_allowed: backend default %s access %s to \"%s\"\n",
/* 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 %lu global default %s access %s to \"%s\"\n",
- conn->c_connid, access2str( ACL_WRITE ),
- global_default_access >= ACL_WRITE ? "granted" : "denied", op->o_dn ));
+ LDAP_LOG( ACL, DETAIL1,
+ "acl_check_modlist: global default %s access %s to \"%s\"\n",
+ 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",
*/
if ( is_at_no_user_mod( mlist->sml_desc->ad_type ) ) {
#ifdef NEW_LOGGING
- LDAP_LOG(( "aci", LDAP_LEVEL_DETAIL1,
+ LDAP_LOG( ACL, DETAIL1,
"acl_check_modlist: conn %lu no-user-mod %s: modify access granted\n",
- conn->c_connid, mlist->sml_desc->ad_cname.bv_val ));
+ conn->c_connid, mlist->sml_desc->ad_cname.bv_val , 0 );
#else
Debug( LDAP_DEBUG_ACL, "acl: no-user-mod %s:"
" modify access granted\n",
flag = 0;
for ( dp = bv->bv_val, sp = pat->bv_val; size < bv->bv_len &&
- sp < pat->bv_val + pat->bv_len ; sp++) {
+ sp < pat->bv_val + pat->bv_len ; sp++ )
+ {
/* did we previously see a $ */
if ( flag ) {
if ( flag == 1 && *sp == '$' ) {
size++;
flag = 0;
- } else if ( flag == 1 && *sp == '{') {
+ } else if ( flag == 1 && *sp == '{' /*'}'*/) {
flag = 2;
} else if ( *sp >= '0' && *sp <= '9' ) {
n = *sp - '0';
if ( flag == 2 ) {
- for ( sp++; *sp != '\0' && *sp != /* { */ '}'; sp++ ) {
+ for ( sp++; *sp != '\0' && *sp != /*'{'*/ '}'; sp++ ) {
if ( *sp >= '0' && *sp <= '9' ) {
n = 10*n + ( *sp - '0' );
}
}
- if ( *sp != /* { */ '}' ) {
+ if ( *sp != /*'{'*/ '}' ) {
/* error */
}
}
bv->bv_len = size;
#ifdef NEW_LOGGING
- LDAP_LOG(( "aci", LDAP_LEVEL_DETAIL1,
- "string_expand: pattern = %.*s\n", (int)pat->bv_len, pat->bv_val ));
- LDAP_LOG(( "aci", LDAP_LEVEL_DETAIL1,
- "string_expand: expanded = %s\n", bv->bv_val ));
+ LDAP_LOG( ACL, DETAIL1,
+ "string_expand: pattern = %.*s\n", (int)pat->bv_len, pat->bv_val, 0 );
+ LDAP_LOG( ACL, DETAIL1, "string_expand: expanded = %s\n", bv->bv_val, 0, 0 );
#else
Debug( LDAP_DEBUG_TRACE, "=> string_expand: pattern: %.*s\n", (int)pat->bv_len, pat->bv_val, 0 );
Debug( LDAP_DEBUG_TRACE, "=> string_expand: expanded: %s\n", bv->bv_val, 0, 0 );
)
{
regex_t re;
- char newbuf[512];
+ char newbuf[ACL_BUF_SIZE];
struct berval bv;
int rc;
string_expand(&bv, pat, buf, matches);
if (( rc = regcomp(&re, newbuf, REG_EXTENDED|REG_ICASE))) {
- char error[512];
+ char error[ACL_BUF_SIZE];
regerror(rc, &re, error, sizeof(error));
#ifdef NEW_LOGGING
- LDAP_LOG(( "aci", LDAP_LEVEL_ERR,
+ LDAP_LOG( ACL, ERR,
"regex_matches: compile( \"%s\", \"%s\") failed %s\n",
- pat->bv_val, str, error ));
+ pat->bv_val, str, error );
#else
Debug( LDAP_DEBUG_TRACE,
"compile( \"%s\", \"%s\") failed %s\n",
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" ));
+ LDAP_LOG( ACL, DETAIL2, "regex_matches: string: %s\n", str, 0, 0 );
+ LDAP_LOG( ACL, DETAIL2, "regex_matches: rc: %d %s\n",
+ rc, rc ? "matches" : "no matches", 0 );
#else
Debug( LDAP_DEBUG_TRACE,
"=> regex_matches: string: %s\n", str, 0, 0 );
}
if ( strcasecmp( left, "filter" ) == 0 ) {
- if ( (a->acl_filter = str2filter(
- right )) == NULL ) {
+ if ( (a->acl_filter = str2filter( right )) == NULL ) {
fprintf( stderr,
"%s: line %d: bad filter \"%s\" in to clause\n",
fname, lineno, right );
}
if ( a->acl_dn_pat.bv_len != 0 &&
- strcmp(a->acl_dn_pat.bv_val, "*") == 0)
+ strcmp(a->acl_dn_pat.bv_val, "*") == 0 )
{
free( a->acl_dn_pat.bv_val );
a->acl_dn_pat.bv_val = NULL;
if ( ACL_IS_LEVEL( mask ) ) {
if ( ACL_LVL_IS_NONE(mask) ) {
- ptr = slap_strcopy( ptr, "none" );
+ ptr = lutil_strcopy( ptr, "none" );
} else if ( ACL_LVL_IS_AUTH(mask) ) {
- ptr = slap_strcopy( ptr, "auth" );
+ ptr = lutil_strcopy( ptr, "auth" );
} else if ( ACL_LVL_IS_COMPARE(mask) ) {
- ptr = slap_strcopy( ptr, "compare" );
+ ptr = lutil_strcopy( ptr, "compare" );
} else if ( ACL_LVL_IS_SEARCH(mask) ) {
- ptr = slap_strcopy( ptr, "search" );
+ ptr = lutil_strcopy( ptr, "search" );
} else if ( ACL_LVL_IS_READ(mask) ) {
- ptr = slap_strcopy( ptr, "read" );
+ ptr = lutil_strcopy( ptr, "read" );
} else if ( ACL_LVL_IS_WRITE(mask) ) {
- ptr = slap_strcopy( ptr, "write" );
+ ptr = lutil_strcopy( ptr, "write" );
} else {
- ptr = slap_strcopy( ptr, "unknown" );
+ ptr = lutil_strcopy( ptr, "unknown" );
}
*ptr++ = '(';
int manageDSAit;
#ifdef NEW_LOGGING
- LDAP_LOG(( "operation", LDAP_LEVEL_ENTRY,
- "do_add: conn %d enter\n", conn->c_connid ));
+ LDAP_LOG( OPERATION, ENTRY, "do_add: conn %d enter\n", conn->c_connid,0,0 );
#else
Debug( LDAP_DEBUG_TRACE, "do_add\n", 0, 0, 0 );
#endif
/* get the name */
if ( ber_scanf( ber, "{m", /*}*/ &dn ) == LBER_ERROR ) {
#ifdef NEW_LOGGING
- LDAP_LOG(( "operation", LDAP_LEVEL_ERR,
- "do_add: conn %d ber_scanf failed\n", conn->c_connid ));
+ LDAP_LOG( OPERATION, ERR,
+ "do_add: conn %d ber_scanf failed\n", conn->c_connid,0,0 );
#else
Debug( LDAP_DEBUG_ANY, "do_add: ber_scanf failed\n", 0, 0, 0 );
#endif
if( rc != LDAP_SUCCESS ) {
#ifdef NEW_LOGGING
- LDAP_LOG(( "operation", LDAP_LEVEL_ERR,
- "do_add: conn %d invalid dn (%s)\n", conn->c_connid,
- dn.bv_val ));
+ LDAP_LOG( OPERATION, ERR,
+ "do_add: conn %d invalid dn (%s)\n", conn->c_connid, dn.bv_val, 0 );
#else
Debug( LDAP_DEBUG_ANY, "do_add: invalid dn (%s)\n", dn.bv_val, 0, 0 );
#endif
}
#ifdef NEW_LOGGING
- LDAP_LOG(( "operation", LDAP_LEVEL_ARGS,
- "do_add: conn %d dn (%s)\n", conn->c_connid, e->e_dn ));
+ LDAP_LOG( OPERATION, ARGS,
+ "do_add: conn %d dn (%s)\n", conn->c_connid, e->e_dn, 0 );
#else
Debug( LDAP_DEBUG_ARGS, "do_add: dn (%s)\n", e->e_dn, 0, 0 );
#endif
if ( rtag == LBER_ERROR ) {
#ifdef NEW_LOGGING
- LDAP_LOG(( "operation", LDAP_LEVEL_ERR,
- "do_add: conn %d decoding error \n", conn->c_connid ));
+ LDAP_LOG( OPERATION, ERR,
+ "do_add: conn %d decoding error \n", conn->c_connid, 0, 0 );
#else
Debug( LDAP_DEBUG_ANY, "do_add: decoding error\n", 0, 0, 0 );
#endif
if ( tmp.sml_bvalues == NULL ) {
#ifdef NEW_LOGGING
- LDAP_LOG(( "operation", LDAP_LEVEL_INFO,
+ LDAP_LOG( OPERATION, INFO,
"do_add: conn %d no values for type %s\n",
- conn->c_connid, tmp.sml_type.bv_val ));
+ conn->c_connid, tmp.sml_type.bv_val, 0 );
#else
Debug( LDAP_DEBUG_ANY, "no values for type %s\n",
tmp.sml_type.bv_val, 0, 0 );
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 ));
+ LDAP_LOG( OPERATION, ERR,
+ "do_add: conn %d ber_scanf failed\n", conn->c_connid, 0, 0 );
#else
Debug( LDAP_DEBUG_ANY, "do_add: ber_scanf failed\n", 0, 0, 0 );
#endif
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 ));
+ LDAP_LOG( OPERATION, INFO,
+ "do_add: conn %d get_ctrls failed\n", conn->c_connid, 0, 0 );
#else
Debug( LDAP_DEBUG_ANY, "do_add: get_ctrls failed\n", 0, 0, 0 );
#endif
}
} else {
#ifdef NEW_LOGGING
- LDAP_LOG(( "operation", LDAP_LEVEL_INFO,
- "do_add: conn %d no backend support\n", conn->c_connid ));
+ LDAP_LOG( OPERATION, INFO,
+ "do_add: conn %d no backend support\n", conn->c_connid, 0, 0 );
#else
Debug( LDAP_DEBUG_ARGS, " do_add: no backend support\n", 0, 0, 0 );
#endif
if( rtag == LBER_ERROR ) {
#ifdef NEW_LOGGING
- LDAP_LOG(( "filter", LDAP_LEVEL_ERR,
- "get_ava: ber_scanf failure\n" ));
+ LDAP_LOG( FILTER, ERR, "get_ava: ber_scanf failure\n", 0, 0, 0 );
#else
Debug( LDAP_DEBUG_ANY, " get_ava ber_scanf\n", 0, 0, 0 );
#endif
#endif
#ifdef NEW_LOGGING
- LDAP_LOG (( "add", LDAP_LEVEL_ARGS, "==> bdb_add: %s\n", e->e_dn ));
+ LDAP_LOG ( OPERATION, ARGS, "==> bdb_add: %s\n", e->e_dn, 0, 0 );
#else
Debug(LDAP_DEBUG_ARGS, "==> bdb_add: %s\n", e->e_dn, 0, 0);
#endif
rc = entry_schema_check( be, e, NULL, &text, textbuf, textlen );
if ( rc != LDAP_SUCCESS ) {
#ifdef NEW_LOGGING
- LDAP_LOG (( "add", LDAP_LEVEL_ERR, "bdb_add: entry failed schema check: %s (%d)\n", text, rc ));
+ LDAP_LOG ( OPERATION, ERR,
+ "bdb_add: entry failed schema check: %s (%d)\n", text, rc, 0 );
#else
Debug( LDAP_DEBUG_TRACE,
"bdb_add: entry failed schema check: %s (%d)\n",
rc = bdb_next_id( be, NULL, &e->e_id );
if( rc != 0 ) {
#ifdef NEW_LOGGING
- LDAP_LOG (( "add", LDAP_LEVEL_ERR, "bdb_add: next_id failed (%d)\n", rc ));
+ LDAP_LOG ( OPERATION, ERR,
+ "bdb_add: next_id failed (%d)\n", rc, 0, 0 );
#else
Debug( LDAP_DEBUG_TRACE,
"bdb_add: next_id failed (%d)\n",
text = NULL;
if( rc != 0 ) {
#ifdef NEW_LOGGING
- LDAP_LOG (( "add", LDAP_LEVEL_ERR, "bdb_add: txn_begin failed: %s (%d)\n", db_strerror(rc), rc ));
+ LDAP_LOG ( OPERATION, ERR,
+ "bdb_add: txn_begin failed: %s (%d)\n", db_strerror(rc), rc, 0 );
#else
Debug( LDAP_DEBUG_TRACE,
"bdb_add: txn_begin failed: %s (%d)\n",
}
#ifdef NEW_LOGGING
- LDAP_LOG (( "add", LDAP_LEVEL_DETAIL1, "bdb_add: parent does not exist\n" ));
+ LDAP_LOG ( OPERATION, DETAIL1,
+ "bdb_add: parent does not exist\n", 0, 0, 0 );
#else
Debug( LDAP_DEBUG_TRACE, "bdb_add: parent does not exist\n",
0, 0, 0 );
if ( ! rc ) {
#ifdef NEW_LOGGING
- LDAP_LOG (( "add", LDAP_LEVEL_DETAIL1, "bdb_add: no write access to parent\n" ));
+ LDAP_LOG ( OPERATION, DETAIL1,
+ "bdb_add: no write access to parent\n", 0, 0, 0 );
#else
Debug( LDAP_DEBUG_TRACE, "bdb_add: no write access to parent\n",
0, 0, 0 );
if ( is_entry_subentry( p ) ) {
/* parent is a subentry, don't allow add */
#ifdef NEW_LOGGING
- LDAP_LOG (( "add", LDAP_LEVEL_DETAIL1, "bdb_add: parent is subentry\n" ));
+ LDAP_LOG ( OPERATION, DETAIL1,
+ "bdb_add: parent is subentry\n", 0, 0, 0 );
#else
Debug( LDAP_DEBUG_TRACE, "bdb_add: parent is subentry\n",
0, 0, 0 );
if ( is_entry_alias( p ) ) {
/* parent is an alias, don't allow add */
#ifdef NEW_LOGGING
- LDAP_LOG (( "add", LDAP_LEVEL_DETAIL1, "bdb_add: parent is alias\n" ));
+ LDAP_LOG ( OPERATION, DETAIL1,
+ "bdb_add: parent is alias\n", 0, 0, 0 );
#else
Debug( LDAP_DEBUG_TRACE, "bdb_add: parent is alias\n",
0, 0, 0 );
BerVarray refs = get_entry_referrals( be, conn, op, p );
#ifdef NEW_LOGGING
- LDAP_LOG (( "add", LDAP_LEVEL_DETAIL1, "bdb_add: parent is referral\n" ));
+ LDAP_LOG ( OPERATION, DETAIL1,
+ "bdb_add: parent is referral\n", 0, 0, 0 );
#else
Debug( LDAP_DEBUG_TRACE, "bdb_add: parent is referral\n",
0, 0, 0 );
if ( ! rc ) {
#ifdef NEW_LOGGING
- LDAP_LOG (( "add", LDAP_LEVEL_DETAIL1, "bdb_add: no write access to parent\n" ));
+ LDAP_LOG ( OPERATION, DETAIL1,
+ "bdb_add: no write access to parent\n", 0, 0, 0 );
#else
Debug( LDAP_DEBUG_TRACE,
"bdb_add: no write access to parent\n",
} else {
#ifdef NEW_LOGGING
- LDAP_LOG (( "add", LDAP_LEVEL_DETAIL1, "bdb_add: %s denied\n", pdn.bv_len == 0 ? "suffix" : "entry at root" ));
+ LDAP_LOG ( OPERATION, DETAIL1, "bdb_add: %s denied\n",
+ pdn.bv_len == 0 ? "suffix" : "entry at root", 0, 0 );
#else
Debug( LDAP_DEBUG_TRACE, "bdb_add: %s denied\n",
pdn.bv_len == 0 ? "suffix" : "entry at root",
#ifdef BDB_SUBENTRIES
if( subentry ) {
#ifdef NEW_LOGGING
- LDAP_LOG (( "add", LDAP_LEVEL_DETAIL1, "bdb_add: no parent, cannot add subentry\n" ));
+ LDAP_LOG ( OPERATION, DETAIL1,
+ "bdb_add: no parent, cannot add subentry\n", 0, 0, 0 );
#else
Debug( LDAP_DEBUG_TRACE,
"bdb_add: no parent, cannot add subentry\n",
rc = bdb_dn2id_add( be, ltid, &pdn, e );
if ( rc != 0 ) {
#ifdef NEW_LOGGING
- LDAP_LOG (( "add", LDAP_LEVEL_ERR, "bdb_add: dn2id_add failed: %s (%d)\n", db_strerror(rc), rc ));
+ LDAP_LOG ( OPERATION, ERR,
+ "bdb_add: dn2id_add failed: %s (%d)\n", db_strerror(rc), rc, 0 );
#else
Debug( LDAP_DEBUG_TRACE, "bdb_add: dn2id_add failed: %s (%d)\n",
db_strerror(rc), rc, 0 );
rc = bdb_id2entry_add( be, ltid, e );
if ( rc != 0 ) {
#ifdef NEW_LOGGING
- LDAP_LOG (( "add", LDAP_LEVEL_ERR, "bdb_add: id2entry_add failed\n" ));
+ LDAP_LOG ( OPERATION, ERR, "bdb_add: id2entry_add failed\n", 0, 0, 0 );
#else
Debug( LDAP_DEBUG_TRACE, "bdb_add: id2entry_add failed\n",
0, 0, 0 );
rc = bdb_index_entry_add( be, ltid, e, e->e_attrs );
if ( rc != LDAP_SUCCESS ) {
#ifdef NEW_LOGGING
- LDAP_LOG (( "add", LDAP_LEVEL_ERR, "bdb_add: index_entry_add failed\n" ));
+ LDAP_LOG ( OPERATION, ERR,
+ "bdb_add: index_entry_add failed\n", 0, 0, 0 );
#else
Debug( LDAP_DEBUG_TRACE, "bdb_add: index_entry_add failed\n",
0, 0, 0 );
if (rc == LDAP_SUCCESS) {
#ifdef NEW_LOGGING
- LDAP_LOG (( "add", LDAP_LEVEL_RESULTS, "bdb_add: added%s id=%08lx dn=\"%s\"\n", op->o_noop ? " (no-op)" : "", e->e_id, e->e_dn ));
+ LDAP_LOG ( OPERATION, RESULTS,
+ "bdb_add: added%s id=%08lx dn=\"%s\"\n",
+ op->o_noop ? " (no-op)" : "", e->e_id, e->e_dn );
#else
Debug(LDAP_DEBUG_TRACE, "bdb_add: added%s id=%08lx dn=\"%s\"\n",
op->o_noop ? " (no-op)" : "", e->e_id, e->e_dn );
}
else {
#ifdef NEW_LOGGING
- LDAP_LOG (( "add", LDAP_LEVEL_ERR, "bdb_add: %s : %s (%d)\n", text, db_strerror(rc), rc ));
+ LDAP_LOG ( OPERATION, ERR,
+ "bdb_add: %s : %s (%d)\n", text, db_strerror(rc), rc );
#else
Debug( LDAP_DEBUG_TRACE, "bdb_add: %s : %s (%d)\n",
text, db_strerror(rc), rc );
}
#ifdef NEW_LOGGING
- LDAP_LOG(( "backend", LDAP_LEVEL_DETAIL1,
+ LDAP_LOG( BACK_BDB, DETAIL1,
"attr_index_config: index %s 0x%04lx\n",
- ad->ad_cname.bv_val, mask ));
+ ad->ad_cname.bv_val, mask, 0 );
#else
Debug( LDAP_DEBUG_CONFIG, "index %s 0x%04lx\n",
ad->ad_cname.bv_val, mask, 0 );
DB_LOCK lock;
#ifdef NEW_LOGGING
- LDAP_LOG(( "backend", LDAP_LEVEL_ARGS,
- "bdb_attribute: gr dn: \"%s\"\n", entry_ndn->bv_val ));
- LDAP_LOG(( "backend", LDAP_LEVEL_ARGS,
- "bdb_attribute: at: \"%s\"\n", entry_at_name));
- LDAP_LOG(( "backend", LDAP_LEVEL_ARGS,
- "bdb_attribute: tr dn: \"%s\"\n",
- target ? target->e_ndn : "" ));
+ LDAP_LOG( BACK_BDB, ARGS,
+ "bdb_attribute: gr dn: \"%s\"\n", entry_ndn->bv_val, 0, 0 );
+ LDAP_LOG( BACK_BDB, ARGS,
+ "bdb_attribute: at: \"%s\"\n", entry_at_name, 0, 0);
+ LDAP_LOG( BACK_BDB, ARGS, "bdb_attribute: tr dn: \"%s\"\n",
+ target ? target->e_ndn : "", 0, 0 );
#else
Debug( LDAP_DEBUG_ARGS,
"=> bdb_attribute: gr dn: \"%s\"\n",
/* we already have a LOCKED copy of the entry */
e = target;
#ifdef NEW_LOGGING
- LDAP_LOG(( "backend", LDAP_LEVEL_DETAIL1,
- "bdb_attribute: target is LOCKED (%s)\n",
- entry_ndn->bv_val ));
+ LDAP_LOG( BACK_BDB, DETAIL1,
+ "bdb_attribute: target is LOCKED (%s)\n", entry_ndn->bv_val, 0, 0 );
#else
Debug( LDAP_DEBUG_ARGS,
"=> bdb_attribute: target is entry: \"%s\"\n",
}
if (e == NULL) {
#ifdef NEW_LOGGING
- LDAP_LOG(( "backend", LDAP_LEVEL_INFO,
- "bdb_attribute: cannot find entry (%s)\n",
- entry_ndn->bv_val ));
+ LDAP_LOG( BACK_BDB, INFO,
+ "bdb_attribute: cannot find entry (%s)\n",
+ entry_ndn->bv_val, 0, 0 );
#else
Debug( LDAP_DEBUG_ACL,
"=> bdb_attribute: cannot find entry: \"%s\"\n",
}
#ifdef NEW_LOGGING
- LDAP_LOG(( "backend", LDAP_LEVEL_DETAIL1,
- "bdb_attribute: found entry (%s)\n",
- entry_ndn->bv_val ));
+ LDAP_LOG( BACK_BDB, DETAIL1, "bdb_attribute: found entry (%s)\n",
+ entry_ndn->bv_val, 0, 0 );
#else
Debug( LDAP_DEBUG_ACL,
"=> bdb_attribute: found entry: \"%s\"\n",
/* find attribute values */
if( is_entry_alias( e ) ) {
#ifdef NEW_LOGGING
- LDAP_LOG(( "backend", LDAP_LEVEL_INFO,
- "bdb_attribute: entry (%s) is an alias\n", e->e_dn ));
+ LDAP_LOG( BACK_BDB, INFO,
+ "bdb_attribute: entry (%s) is an alias\n", e->e_dn, 0, 0 );
#else
Debug( LDAP_DEBUG_ACL,
"<= bdb_attribute: entry is an alias\n", 0, 0, 0 );
if( is_entry_referral( e ) ) {
#ifdef NEW_LOGGING
- LDAP_LOG(( "backend", LDAP_LEVEL_INFO,
- "bdb_attribute: entry (%s) is a referral.\n", e->e_dn ));
+ LDAP_LOG( BACK_BDB, INFO,
+ "bdb_attribute: entry (%s) is a referral.\n", e->e_dn, 0, 0);
#else
Debug( LDAP_DEBUG_ACL,
"<= bdb_attribute: entry is a referral\n", 0, 0, 0 );
if ((attr = attr_find(e->e_attrs, entry_at)) == NULL) {
#ifdef NEW_LOGGING
- LDAP_LOG(( "backend", LDAP_LEVEL_INFO,
- "bdb_attribute: failed to find %s.\n", entry_at_name ));
+ LDAP_LOG( BACK_BDB, INFO,
+ "bdb_attribute: failed to find %s.\n", entry_at_name, 0, 0 );
#else
Debug( LDAP_DEBUG_ACL,
"<= bdb_attribute: failed to find %s\n",
}
#ifdef NEW_LOGGING
- LDAP_LOG(( "backend", LDAP_LEVEL_ENTRY,
- "bdb_attribute: rc=%d nvals=%d.\n",
- rc, j ));
+ LDAP_LOG( BACK_BDB, ENTRY, "bdb_attribute: rc=%d nvals=%d.\n", rc, j, 0 );
#else
Debug( LDAP_DEBUG_TRACE,
"bdb_attribute: rc=%d nvals=%d\n",
DB_LOCK lock;
#ifdef NEW_LOGGING
- LDAP_LOG (( "bind", LDAP_LEVEL_ARGS, "==> bdb_bind: dn: %s\n", dn->bv_val ));
+ LDAP_LOG ( OPERATION, ARGS, "==> bdb_bind: dn: %s\n", dn->bv_val, 0, 0 );
#else
Debug( LDAP_DEBUG_ARGS, "==> bdb_bind: dn: %s\n", dn->bv_val, 0, 0);
#endif
if ( is_entry_subentry( e ) ) {
/* entry is an subentry, don't allow bind */
#ifdef NEW_LOGGING
- LDAP_LOG (( "bind", LDAP_LEVEL_DETAIL1, "bdb_bind: entry is subentry\n" ));
+ LDAP_LOG ( OPERATION, DETAIL1,
+ "bdb_bind: entry is subentry\n", 0, 0, 0 );
#else
Debug( LDAP_DEBUG_TRACE, "entry is subentry\n", 0,
0, 0 );
if ( is_entry_alias( e ) ) {
/* entry is an alias, don't allow bind */
#ifdef NEW_LOGGING
- LDAP_LOG (( "bind", LDAP_LEVEL_DETAIL1, "bdb_bind: entry is alias\n" ));
+ LDAP_LOG ( OPERATION, DETAIL1, "bdb_bind: entry is alias\n", 0, 0, 0 );
#else
Debug( LDAP_DEBUG_TRACE, "entry is alias\n", 0,
0, 0 );
conn, op, e );
#ifdef NEW_LOGGING
- LDAP_LOG (( "bind", LDAP_LEVEL_DETAIL1, "bdb_bind: entry is referral\n" ));
+ LDAP_LOG ( OPERATION, DETAIL1,
+ "bdb_bind: entry is referral\n", 0, 0, 0 );
#else
Debug( LDAP_DEBUG_TRACE, "entry is referral\n", 0,
0, 0 );
bdb_cache_entry_rdwr_lock(Entry *e, int rw)
{
#ifdef NEW_LOGGING
- LDAP_LOG(( "cache", LDAP_LEVEL_ENTRY,
- "bdb_cache_entry_rdwr_lock: %s lock on ID %ld\n",
- rw ? "w" : "r", e->e_id ));
+ LDAP_LOG( CACHE, ENTRY,
+ "bdb_cache_entry_rdwr_lock: %s lock on ID %ld\n",
+ rw ? "w" : "r", e->e_id, 0 );
#else
Debug( LDAP_DEBUG_ARGS, "entry_rdwr_%slock: ID: %ld\n",
rw ? "w" : "r", e->e_id, 0);
bdb_cache_entry_rdwr_trylock(Entry *e, int rw)
{
#ifdef NEW_LOGGING
- LDAP_LOG(( "cache", LDAP_LEVEL_ENTRY,
- "bdb_cache_entry_rdwr_trylock: try %s lock on ID: %ld.\n",
- rw ? "w" : "r", e->e_id ));
+ LDAP_LOG( CACHE, ENTRY,
+ "bdb_cache_entry_rdwr_trylock: try %s lock on ID: %ld.\n",
+ rw ? "w" : "r", e->e_id, 0 );
#else
Debug( LDAP_DEBUG_ARGS, "entry_rdwr_%strylock: ID: %ld\n",
rw ? "w" : "r", e->e_id, 0);
bdb_cache_entry_rdwr_unlock(Entry *e, int rw)
{
#ifdef NEW_LOGGING
- LDAP_LOG(( "cache", LDAP_LEVEL_ENTRY,
- "bdb_cache_entry_rdwr_unlock: remove %s lock on ID %ld.\n",
- rw ? "w" : "r", e->e_id ));
+ LDAP_LOG( CACHE, ENTRY,
+ "bdb_cache_entry_rdwr_unlock: remove %s lock on ID %ld.\n",
+ rw ? "w" : "r", e->e_id, 0 );
#else
Debug( LDAP_DEBUG_ARGS, "entry_rdwr_%sunlock: ID: %ld\n",
rw ? "w" : "r", e->e_id, 0);
ldap_pvt_thread_rdwr_wunlock( &cache->c_rwlock );
#ifdef NEW_LOGGING
- LDAP_LOG(( "cache", LDAP_LEVEL_DETAIL1,
+ LDAP_LOG( CACHE, DETAIL1,
"bdb_unlocked_cache_return_entry_rw: return (%ld):%s, refcnt=%d\n",
- id, rw ? "w" : "r", refcnt ));
+ id, rw ? "w" : "r", refcnt );
#else
Debug( LDAP_DEBUG_TRACE,
"====> bdb_unlocked_cache_return_entry_%s( %ld ): created (%d)\n",
ldap_pvt_thread_rdwr_wunlock( &cache->c_rwlock );
#ifdef NEW_LOGGING
- LDAP_LOG(( "cache", LDAP_LEVEL_DETAIL1,
+ LDAP_LOG( CACHE, DETAIL1,
"bdb_unlocked_cache_return_entry_rw: %ld, delete pending (%d).\n",
- id, refcnt ));
+ id, refcnt, 0 );
#else
Debug( LDAP_DEBUG_TRACE,
"====> bdb_unlocked_cache_return_entry_%s( %ld ): delete pending (%d)\n",
ldap_pvt_thread_rdwr_wunlock( &cache->c_rwlock );
#ifdef NEW_LOGGING
- LDAP_LOG(( "cache", LDAP_LEVEL_DETAIL1,
+ LDAP_LOG( CACHE, DETAIL1,
"bdb_unlocked_cache_return_entry_rw: (%ld): deleted (%d)\n",
- id, refcnt ));
+ id, refcnt, 0 );
#else
Debug( LDAP_DEBUG_TRACE,
"====> bdb_unlocked_cache_return_entry_%s( %ld ): deleted (%d)\n",
ldap_pvt_thread_rdwr_wunlock( &cache->c_rwlock );
#ifdef NEW_LOGGING
- LDAP_LOG(( "cache", LDAP_LEVEL_DETAIL1,
+ LDAP_LOG( CACHE, DETAIL1,
"bdb_unlocked_cache_return_entry_rw: ID %ld:%s returned (%d)\n",
- id, rw ? "w": "r", refcnt ));
+ id, rw ? "w": "r", refcnt );
#else
Debug( LDAP_DEBUG_TRACE,
"====> bdb_unlocked_cache_return_entry_%s( %ld ): returned (%d)\n",
ldap_pvt_thread_rdwr_wunlock( &cache->c_rwlock );
#ifdef NEW_LOGGING
- LDAP_LOG(( "cache", LDAP_LEVEL_DETAIL1,
+ LDAP_LOG( CACHE, DETAIL1,
"bdb_cache_return_entry_rw: return (%ld):%s, refcnt=%d\n",
- id, rw ? "w" : "r", refcnt ));
+ id, rw ? "w" : "r", refcnt );
#else
Debug( LDAP_DEBUG_TRACE,
"====> bdb_cache_return_entry_%s( %ld ): created (%d)\n",
ldap_pvt_thread_rdwr_wunlock( &cache->c_rwlock );
#ifdef NEW_LOGGING
- LDAP_LOG(( "cache", LDAP_LEVEL_DETAIL1,
+ LDAP_LOG( CACHE, DETAIL1,
"bdb_cache_return_entry_rw: %ld, delete pending (%d).\n",
- id, refcnt ));
+ id, refcnt, 0 );
#else
Debug( LDAP_DEBUG_TRACE,
"====> bdb_cache_return_entry_%s( %ld ): delete pending (%d)\n",
ldap_pvt_thread_rdwr_wunlock( &cache->c_rwlock );
#ifdef NEW_LOGGING
- LDAP_LOG(( "cache", LDAP_LEVEL_DETAIL1,
+ LDAP_LOG( CACHE, DETAIL1,
"bdb_cache_return_entry_rw: (%ld): deleted (%d)\n",
- id, refcnt ));
+ id, refcnt, 0 );
#else
Debug( LDAP_DEBUG_TRACE,
"====> bdb_cache_return_entry_%s( %ld ): deleted (%d)\n",
ldap_pvt_thread_rdwr_wunlock( &cache->c_rwlock );
#ifdef NEW_LOGGING
- LDAP_LOG(( "cache", LDAP_LEVEL_DETAIL1,
+ LDAP_LOG( CACHE, DETAIL1,
"bdb_cache_return_entry_rw: ID %ld:%s returned (%d)\n",
- id, rw ? "w": "r", refcnt ));
+ id, rw ? "w": "r", refcnt );
#else
Debug( LDAP_DEBUG_TRACE,
"====> bdb_cache_return_entry_%s( %ld ): returned (%d)\n",
Entry *ee;
#ifdef NEW_LOGGING
- LDAP_LOG(( "cache", LDAP_LEVEL_ENTRY,
- "bdb_cache_add_entry_rw: add (%s):%s to cache\n",
- e->e_dn, rw ? "w" : "r" ));
+ LDAP_LOG( CACHE, ENTRY,
+ "bdb_cache_add_entry_rw: add (%s):%s to cache\n",
+ e->e_dn, rw ? "w" : "r", 0 );
#endif
/* set cache write lock */
ldap_pvt_thread_rdwr_wlock( &cache->c_rwlock );
ldap_pvt_thread_rdwr_wunlock( &cache->c_rwlock );
#ifdef NEW_LOGGING
- LDAP_LOG(( "cache", LDAP_LEVEL_ERR,
- "bdb_cache_add_entry_rw: add (%s):%ld private init failed!\n",
- e->e_dn, e->e_id ));
+ LDAP_LOG( CACHE, ERR,
+ "bdb_cache_add_entry_rw: add (%s):%ld private init failed!\n",
+ e->e_dn, e->e_id, 0 );
#else
Debug( LDAP_DEBUG_ANY,
"====> bdb_cache_add_entry( %ld ): \"%s\": private init failed!\n",
ldap_pvt_thread_rdwr_wunlock( &cache->c_rwlock );
#ifdef NEW_LOGGING
- LDAP_LOG(( "cache", LDAP_LEVEL_DETAIL1,
- "bdb_cache_add_entry: (%s):%ld already in cache.\n",
- e->e_dn, e->e_id ));
+ LDAP_LOG( CACHE, DETAIL1,
+ "bdb_cache_add_entry: (%s):%ld already in cache.\n",
+ e->e_dn, e->e_id, 0 );
#else
Debug( LDAP_DEBUG_TRACE,
"====> bdb_cache_add_entry( %ld ): \"%s\": already in dn cache\n",
(AVL_CMP) entry_id_cmp, avl_dup_error ) != 0 )
{
#ifdef NEW_LOGGING
- LDAP_LOG(( "cache", LDAP_LEVEL_DETAIL1,
- "bdb_cache_add_entry: (%s):%ls already in cache.\n",
- e->e_dn, e->e_id ));
+ LDAP_LOG( CACHE, DETAIL1,
+ "bdb_cache_add_entry: (%s):%ls already in cache.\n",
+ e->e_dn, e->e_id, 0 );
#else
Debug( LDAP_DEBUG_ANY,
"====> bdb_cache_add_entry( %ld ): \"%s\": already in id cache\n",
(AVL_CMP) entry_dn_cmp ) == NULL )
{
#ifdef NEW_LOGGING
- LDAP_LOG(( "cache", LDAP_LEVEL_INFO,
- "bdb_cache_add_entry: can't delete (%s) from cache.\n",
- e->e_dn ));
+ LDAP_LOG( CACHE, INFO,
+ "bdb_cache_add_entry: can't delete (%s) from cache.\n",
+ e->e_dn, 0, 0 );
#else
Debug( LDAP_DEBUG_ANY, "====> can't delete from dn cache\n",
0, 0, 0 );
if ( avl_delete( &cache->c_idtree, (caddr_t) e,
(AVL_CMP) entry_id_cmp ) == NULL ) {
#ifdef NEW_LOGGING
- LDAP_LOG(( "cache", LDAP_LEVEL_INFO,
- "bdb_cache_add_entry: can't delete (%s) from cache.\n", e->e_dn ));
+ LDAP_LOG( CACHE, INFO,
+ "bdb_cache_add_entry: can't delete (%s) from cache.\n",
+ e->e_dn, 0, 0 );
#else
Debug( LDAP_DEBUG_ANY, "====> can't delete from id cache\n", 0, 0, 0 );
#endif
if ( avl_delete( &cache->c_dntree, (caddr_t) e,
(AVL_CMP) entry_dn_cmp ) == NULL ) {
#ifdef NEW_LOGGING
- LDAP_LOG(( "cache", LDAP_LEVEL_INFO,
- "bdb_cache_add_entry: can't delete (%s) from cache.\n", e->e_dn ));
+ LDAP_LOG( CACHE, INFO,
+ "bdb_cache_add_entry: can't delete (%s) from cache.\n",
+ e->e_dn, 0, 0 );
#else
Debug( LDAP_DEBUG_ANY, "====> can't delete from dn cache\n", 0, 0, 0 );
#endif
(AVL_CMP) entry_dn_cmp, avl_dup_error ) != 0 )
{
#ifdef NEW_LOGGING
- LDAP_LOG(( "cache", LDAP_LEVEL_DETAIL1,
- "bdb_cache_update_entry: (%s):%ld already in dn cache\n",
- e->e_dn, e->e_id ));
+ LDAP_LOG( CACHE, DETAIL1,
+ "bdb_cache_update_entry: (%s):%ld already in dn cache\n",
+ e->e_dn, e->e_id, 0 );
#else
Debug( LDAP_DEBUG_TRACE,
"====> bdb_cache_update_entry( %ld ): \"%s\": already in dn cache\n",
(AVL_CMP) entry_id_cmp, avl_dup_error ) != 0 )
{
#ifdef NEW_LOGGING
- LDAP_LOG(( "cache", LDAP_LEVEL_DETAIL1,
- "bdb_cache_update_entry: (%s)%ld already in id cache\n",
- e->e_dn, e->e_id ));
+ LDAP_LOG( CACHE, DETAIL1,
+ "bdb_cache_update_entry: (%s)%ld already in id cache\n",
+ e->e_dn, e->e_id, 0 );
#else
Debug( LDAP_DEBUG_ANY,
"====> bdb_cache_update_entry( %ld ): \"%s\": already in id cache\n",
(AVL_CMP) entry_dn_cmp ) == NULL )
{
#ifdef NEW_LOGGING
- LDAP_LOG(( "cache", LDAP_LEVEL_INFO,
- "bdb_cache_update_entry: can't delete (%s)%ld from dn cache.\n",
- e->e_dn, e->e_id ));
+ LDAP_LOG( CACHE, INFO,
+ "bdb_cache_update_entry: can't delete (%s)%ld from dn cache.\n",
+ e->e_dn, e->e_id, 0 );
#else
Debug( LDAP_DEBUG_ANY, "====> can't delete from dn cache\n",
0, 0, 0 );
ldap_pvt_thread_rdwr_runlock( &cache->c_rwlock );
#ifdef NEW_LOGGING
- LDAP_LOG(( "cache", LDAP_LEVEL_INFO,
- "bdb_cache_find_entry_dn2id: (%s) %ld not ready: %d\n",
- ndn->bv_val, id, state ));
+ LDAP_LOG( CACHE, INFO,
+ "bdb_cache_find_entry_dn2id: (%s) %ld not ready: %d\n",
+ ndn->bv_val, id, state );
#else
Debug(LDAP_DEBUG_TRACE,
"====> bdb_cache_find_entry_dn2id(\"%s\"): %ld (not ready) %d\n",
ldap_pvt_thread_mutex_unlock( &cache->lru_mutex );
#ifdef NEW_LOGGING
- LDAP_LOG(( "cache", LDAP_LEVEL_DETAIL1,
- "bdb_cache_find_entry_dn2id: (%s): %ld %d tries\n",
- ndn->bv_val, id, count ));
+ LDAP_LOG( CACHE, DETAIL1,
+ "bdb_cache_find_entry_dn2id: (%s): %ld %d tries\n",
+ ndn->bv_val, id, count );
#else
Debug(LDAP_DEBUG_TRACE,
"====> bdb_cache_find_entry_dn2id(\"%s\"): %ld (%d tries)\n",
ldap_pvt_thread_rdwr_runlock( &cache->c_rwlock );
#ifdef NEW_LOGGING
- LDAP_LOG(( "cache", LDAP_LEVEL_INFO,
- "bdb_cache_find_entry_id: (%ld)->%ld not ready (%d).\n",
- id, ep_id, state ));
+ LDAP_LOG( CACHE, INFO,
+ "bdb_cache_find_entry_id: (%ld)->%ld not ready (%d).\n",
+ id, ep_id, state );
#else
Debug(LDAP_DEBUG_TRACE,
ldap_pvt_thread_rdwr_runlock( &cache->c_rwlock );
#ifdef NEW_LOGGING
- LDAP_LOG(( "cache", LDAP_LEVEL_INFO,
- "bdb_cache_find_entry_id: %ld -> %ld (busy) %d.\n",
- id, ep_id, state ));
+ LDAP_LOG( CACHE, INFO,
+ "bdb_cache_find_entry_id: %ld -> %ld (busy) %d.\n",
+ id, ep_id, state );
#else
Debug(LDAP_DEBUG_TRACE,
"====> bdb_cache_find_entry_id( %ld ): %ld (busy) %d\n",
ldap_pvt_thread_mutex_unlock( &cache->lru_mutex );
#ifdef NEW_LOGGING
- LDAP_LOG(( "cache", LDAP_LEVEL_DETAIL1,
- "bdb_cache_find_entry_id: %ld -> %s found %d tries.\n",
- ep_id, ep->e_dn, count ));
+ LDAP_LOG( CACHE, DETAIL1,
+ "bdb_cache_find_entry_id: %ld -> %s found %d tries.\n",
+ ep_id, ep->e_dn, count );
#else
Debug(LDAP_DEBUG_TRACE,
"====> bdb_cache_find_entry_id( %ld ) \"%s\" (found) (%d tries)\n",
assert( e->e_private );
#ifdef NEW_LOGGING
- LDAP_LOG(( "cache", LDAP_LEVEL_ENTRY,
- "bdb_cache_delete_entry: delete %ld.\n", e->e_id ));
+ LDAP_LOG( CACHE, ENTRY,
+ "bdb_cache_delete_entry: delete %ld.\n", e->e_id, 0, 0 );
#else
Debug( LDAP_DEBUG_TRACE, "====> bdb_cache_delete_entry( %ld )\n",
e->e_id, 0, 0 );
ldap_pvt_thread_mutex_lock( &cache->lru_mutex );
#ifdef NEW_LOGGING
- LDAP_LOG(( "cache", LDAP_LEVEL_ENTRY,
- "bdb_cache_release_all: enter\n" ));
+ LDAP_LOG( CACHE, ENTRY, "bdb_cache_release_all: enter\n", 0, 0, 0 );
#else
Debug( LDAP_DEBUG_TRACE, "====> bdb_cache_release_all\n", 0, 0, 0 );
#endif
if ( cache->c_cursize ) {
#ifdef NEW_LOGGING
- LDAP_LOG(( "cache", LDAP_LEVEL_INFO,
- "bdb_cache_release_all: Entry cache could not be emptied.\n" ));
+ LDAP_LOG( CACHE, INFO,
+ "bdb_cache_release_all: Entry cache could not be emptied.\n", 0, 0, 0 );
#else
Debug( LDAP_DEBUG_TRACE, "Entry-cache could not be emptied\n", 0, 0, 0 );
#endif
conn, op, e );
#ifdef NEW_LOGGING
- LDAP_LOG (( "compare", LDAP_LEVEL_DETAIL1,"bdb_compare: entry is referral\n" ));
+ LDAP_LOG ( OPERATION, DETAIL1,
+ "bdb_compare: entry is referral\n", 0, 0, 0 );
#else
Debug( LDAP_DEBUG_TRACE, "entry is referral\n", 0,
0, 0 );
rc = db_create( &db->bdi_db, bdb->bi_dbenv, 0 );
if( rc != 0 ) {
#ifdef NEW_LOGGING
- LDAP_LOG (( "dbcache", LDAP_LEVEL_ERR, "bdb_db_cache: db_create(%s) failed: %s (%d)\n", bdb->bi_dbenv_home, db_strerror(rc), rc ));
+ LDAP_LOG ( CACHE, ERR,
+ "bdb_db_cache: db_create(%s) failed: %s (%d)\n",
+ bdb->bi_dbenv_home, db_strerror(rc), rc );
#else
Debug( LDAP_DEBUG_ANY,
"bdb_db_cache: db_create(%s) failed: %s (%d)\n",
if( rc != 0 ) {
#ifdef NEW_LOGGING
- LDAP_LOG (( "dbcache", LDAP_LEVEL_ERR, "bdb_db_cache: db_open(%s) failed: %s (%d)\n", name, db_strerror(rc), rc ));
+ LDAP_LOG ( CACHE, ERR,
+ "bdb_db_cache: db_open(%s) failed: %s (%d)\n",
+ name, db_strerror(rc), rc );
#else
Debug( LDAP_DEBUG_ANY,
"bdb_db_cache: db_open(%s) failed: %s (%d)\n",
#endif
#ifdef NEW_LOGGING
- LDAP_LOG (( "delete", LDAP_LEVEL_ARGS, "==> bdb_delete: %s\n",
- dn->bv_val ));
+ LDAP_LOG ( OPERATION, ARGS, "==> bdb_delete: %s\n", dn->bv_val, 0, 0 );
#else
Debug( LDAP_DEBUG_ARGS, "==> bdb_delete: %s\n",
dn->bv_val, 0, 0 );
bdb_unlocked_cache_return_entry_w(&bdb->bi_cache, e);
}
#ifdef NEW_LOGGING
- LDAP_LOG (( "delete", LDAP_LEVEL_DETAIL1,
- "==> bdb_delete: retrying...\n" ));
+ LDAP_LOG ( OPERATION, DETAIL1,
+ "==> bdb_delete: retrying...\n", 0, 0, 0 );
#else
Debug( LDAP_DEBUG_TRACE, "==> bdb_delete: retrying...\n",
0, 0, 0 );
text = NULL;
if( rc != 0 ) {
#ifdef NEW_LOGGING
- LDAP_LOG (( "delete", LDAP_LEVEL_ERR,
+ LDAP_LOG ( OPERATION, ERR,
"==> bdb_delete: txn_begin failed: %s (%d)\n",
- db_strerror(rc), rc ));
+ db_strerror(rc), rc, 0 );
#else
Debug( LDAP_DEBUG_TRACE,
"bdb_delete: txn_begin failed: %s (%d)\n",
if( p == NULL) {
#ifdef NEW_LOGGING
- LDAP_LOG (( "delete", LDAP_LEVEL_DETAIL1,
- "<=- bdb_delete: parent does not exist\n" ));
+ LDAP_LOG ( OPERATION, DETAIL1,
+ "<=- bdb_delete: parent does not exist\n", 0, 0, 0 );
#else
Debug( LDAP_DEBUG_TRACE,
"<=- bdb_delete: parent does not exist\n",
if ( !rc ) {
#ifdef NEW_LOGGING
- LDAP_LOG (( "delete", LDAP_LEVEL_DETAIL1,
- "<=- bdb_delete: no access to parent\n" ));
+ LDAP_LOG ( OPERATION, DETAIL1,
+ "<=- bdb_delete: no access to parent\n", 0, 0, 0 );
#else
Debug( LDAP_DEBUG_TRACE,
"<=- bdb_delete: no access to parent\n",
if ( !rc ) {
#ifdef NEW_LOGGING
- LDAP_LOG (( "delete", LDAP_LEVEL_DETAIL1,
- "<=- bdb_delete: no access to parent\n" ));
+ LDAP_LOG ( OPERATION, DETAIL1,
+ "<=- bdb_delete: no access to parent\n", 0, 0, 0 );
#else
Debug( LDAP_DEBUG_TRACE,
"<=- bdb_delete: no access "
} else {
#ifdef NEW_LOGGING
- LDAP_LOG (( "delete", LDAP_LEVEL_DETAIL1,
- "<=- bdb_delete: no parent and not root\n" ));
+ LDAP_LOG ( OPERATION, DETAIL1,
+ "<=- bdb_delete: no parent and not root\n", 0, 0, 0 );
#else
Debug( LDAP_DEBUG_TRACE,
"<=- bdb_delete: no parent "
BerVarray refs;
#ifdef NEW_LOGGING
- LDAP_LOG (( "delete", LDAP_LEVEL_ARGS,
- "<=- bdb_delete: no such object %s\n",
- dn->bv_val ));
+ LDAP_LOG ( OPERATION, ARGS,
+ "<=- bdb_delete: no such object %s\n", dn->bv_val, 0, 0);
#else
Debug( LDAP_DEBUG_ARGS,
"<=- bdb_delete: no such object %s\n",
conn, op, e );
#ifdef NEW_LOGGING
- LDAP_LOG (( "delete", LDAP_LEVEL_DETAIL1,
- "<=- bdb_delete: entry is referral\n" ));
+ LDAP_LOG ( OPERATION, DETAIL1,
+ "<=- bdb_delete: entry is referral\n", 0, 0, 0 );
#else
Debug( LDAP_DEBUG_TRACE,
"bdb_delete: entry is referral\n",
goto retry;
case 0:
#ifdef NEW_LOGGING
- LDAP_LOG (( "delete", LDAP_LEVEL_DETAIL1,
- "<=- bdb_delete: non-leaf %s\n",
- dn->bv_val ));
+ LDAP_LOG ( OPERATION, DETAIL1,
+ "<=- bdb_delete: non-leaf %s\n", dn->bv_val, 0, 0 );
#else
Debug(LDAP_DEBUG_ARGS,
"<=- bdb_delete: non-leaf %s\n",
break;
default:
#ifdef NEW_LOGGING
- LDAP_LOG (( "delete", LDAP_LEVEL_ERR,
+ LDAP_LOG ( OPERATION, ERR,
"<=- bdb_delete: has_children failed %s (%d)\n",
- db_strerror(rc), rc ));
+ db_strerror(rc), rc, 0 );
#else
Debug(LDAP_DEBUG_ARGS,
"<=- bdb_delete: has_children failed: %s (%d)\n",
rc = LDAP_OTHER;
}
#ifdef NEW_LOGGING
- LDAP_LOG (( "delete", LDAP_LEVEL_ERR,
- "<=- bdb_delete: dn2id failed %s (%d)\n",
- db_strerror(rc), rc ));
+ LDAP_LOG ( OPERATION, ERR,
+ "<=- bdb_delete: dn2id failed %s (%d)\n", db_strerror(rc), rc, 0 );
#else
Debug(LDAP_DEBUG_ARGS,
"<=- bdb_delete: dn2id failed: %s (%d)\n",
rc = LDAP_OTHER;
}
#ifdef NEW_LOGGING
- LDAP_LOG (( "delete", LDAP_LEVEL_ERR,
- "<=- bdb_delete: id2entry failed: %s (%d)\n",
- db_strerror(rc), rc ));
+ LDAP_LOG ( OPERATION, ERR,
+ "<=- bdb_delete: id2entry failed: %s (%d)\n",
+ db_strerror(rc), rc, 0 );
#else
Debug(LDAP_DEBUG_ARGS,
"<=- bdb_delete: id2entry failed: %s (%d)\n",
rc = LDAP_OTHER;
}
#ifdef NEW_LOGGING
- LDAP_LOG (( "delete", LDAP_LEVEL_ERR,
- "<=- bdb_delete: entry index delete failed!\n" ));
+ LDAP_LOG ( OPERATION, ERR,
+ "<=- bdb_delete: entry index delete failed!\n", 0, 0, 0 );
#else
Debug( LDAP_DEBUG_ANY, "entry index delete failed!\n",
0, 0, 0 );
if( rc != 0 ) {
#ifdef NEW_LOGGING
- LDAP_LOG (( "delete", LDAP_LEVEL_ERR,
+ LDAP_LOG ( OPERATION, ERR,
"bdb_delete: txn_%s failed: %s (%d)\n",
- op->o_noop ? "abort (no-op)" : "commit",
- db_strerror(rc), rc ));
+ op->o_noop ? "abort (no-op)" : "commit", db_strerror(rc), rc );
#else
Debug( LDAP_DEBUG_TRACE,
"bdb_delete: txn_%s failed: %s (%d)\n",
} else {
#ifdef NEW_LOGGING
- LDAP_LOG (( "delete", LDAP_LEVEL_RESULTS,
+ LDAP_LOG ( OPERATION, RESULTS,
"bdb_delete: deleted%s id=%08lx db=\"%s\"\n",
- op->o_noop ? " (no-op)" : "",
- e->e_id, e->e_dn ));
+ op->o_noop ? " (no-op)" : "", e->e_id, e->e_dn );
#else
Debug( LDAP_DEBUG_TRACE,
"bdb_delete: deleted%s id=%08lx dn=\"%s\"\n",
#include "back-bdb.h"
+
/*
* dn2entry - look up dn in the cache/indexes and return the corresponding
* entry.
ID id, id2 = 0;
#ifdef NEW_LOGGING
- LDAP_LOG (( "db2entry", LDAP_LEVEL_ARGS, "bdb_dn2entry_rw(\"%s\")\n",
- dn->bv_val ));
+ LDAP_LOG ( CACHE, ARGS, "bdb_dn2entry_rw(\"%s\")\n", dn->bv_val, 0, 0 );
#else
Debug(LDAP_DEBUG_TRACE, "bdb_dn2entry_rw(\"%s\")\n",
dn->bv_val, 0, 0 );
struct berval ptr, pdn;
#ifdef NEW_LOGGING
- LDAP_LOG (( "db2id", LDAP_LEVEL_ARGS, "bdb_dn2id_add( \"%s\", 0x%08lx )\n",
- e->e_ndn, (long) e->e_id ));
+ LDAP_LOG ( INDEX, ARGS, "bdb_dn2id_add( \"%s\", 0x%08lx )\n",
+ e->e_ndn, (long) e->e_id, 0 );
#else
Debug( LDAP_DEBUG_TRACE, "=> bdb_dn2id_add( \"%s\", 0x%08lx )\n",
e->e_ndn, (long) e->e_id, 0 );
rc = db->put( db, txn, &key, &data, DB_NOOVERWRITE );
if( rc != 0 ) {
#ifdef NEW_LOGGING
- LDAP_LOG (( "db2id", LDAP_LEVEL_ERR,
- "bdb_dn2id_add: put failed: %s %d\n",
- db_strerror(rc), rc ));
+ LDAP_LOG ( INDEX, ERR, "bdb_dn2id_add: put failed: %s %d\n",
+ db_strerror(rc), rc, 0 );
#else
Debug( LDAP_DEBUG_ANY, "=> bdb_dn2id_add: put failed: %s %d\n",
db_strerror(rc), rc, 0 );
rc = bdb_idl_insert_key( be, db, txn, &key, e->e_id );
if( rc != 0 ) {
#ifdef NEW_LOGGING
- LDAP_LOG (( "db2id", LDAP_LEVEL_ERR,
- "=> bdb_dn2id_add: subtree (%s) insert failed: %d\n",
- ptr.bv_val, rc ));
+ LDAP_LOG ( INDEX, ERR,
+ "=> bdb_dn2id_add: subtree (%s) insert failed: %d\n",
+ ptr.bv_val, rc, 0 );
#else
Debug( LDAP_DEBUG_ANY,
"=> bdb_dn2id_add: subtree (%s) insert failed: %d\n",
if( rc != 0 ) {
#ifdef NEW_LOGGING
- LDAP_LOG (( "db2id", LDAP_LEVEL_ERR,
+ LDAP_LOG ( INDEX, ERR,
"=> bdb_dn2id_add: parent (%s) insert failed: %d\n",
- ptr.bv_val, rc ));
+ ptr.bv_val, rc, 0 );
#else
Debug( LDAP_DEBUG_ANY,
"=> bdb_dn2id_add: parent (%s) insert failed: %d\n",
if( rc != 0 ) {
#ifdef NEW_LOGGING
- LDAP_LOG (( "db2id", LDAP_LEVEL_ERR,
+ LDAP_LOG ( INDEX, ERR,
"=> bdb_dn2id_add: subtree (%s) insert failed: %d\n",
- ptr.bv_val, rc ));
+ ptr.bv_val, rc, 0 );
#else
Debug( LDAP_DEBUG_ANY,
"=> bdb_dn2id_add: subtree (%s) insert failed: %d\n",
done:
ch_free( buf );
#ifdef NEW_LOGGING
- LDAP_LOG (( "db2id", LDAP_LEVEL_RESULTS,
- "<= bdb_dn2id_add: %d\n", rc ));
+ LDAP_LOG ( INDEX, RESULTS, "<= bdb_dn2id_add: %d\n", rc, 0, 0 );
#else
Debug( LDAP_DEBUG_TRACE, "<= bdb_dn2id_add: %d\n", rc, 0, 0 );
#endif
struct berval pdn, ptr;
#ifdef NEW_LOGGING
- LDAP_LOG (( "db2id", LDAP_LEVEL_ARGS,
- "=> bdb_dn2id_delete ( \"%s\", 0x08lx )\n",
- e->e_ndn, e->e_id ));
+ LDAP_LOG ( INDEX, ARGS,
+ "=> bdb_dn2id_delete ( \"%s\", 0x%08lx )\n", e->e_ndn, e->e_id, 0);
#else
Debug( LDAP_DEBUG_TRACE, "=> bdb_dn2id_delete( \"%s\", 0x%08lx )\n",
e->e_ndn, e->e_id, 0 );
rc = db->del( db, txn, &key, 0 );
if( rc != 0 ) {
#ifdef NEW_LOGGING
- LDAP_LOG (( "db2id", LDAP_LEVEL_ERR,
+ LDAP_LOG ( INDEX, ERR,
"=> bdb_dn2id_delete: delete failed: %s %d\n",
- db_strerror(rc), rc ));
+ db_strerror(rc), rc, 0 );
#else
Debug( LDAP_DEBUG_ANY, "=> bdb_dn2id_delete: delete failed: %s %d\n",
db_strerror(rc), rc, 0 );
rc = db->del( db, txn, &key, 0 );
if( rc != 0 ) {
#ifdef NEW_LOGGING
- LDAP_LOG (( "db2id", LDAP_LEVEL_ERR,
- "=> bdb_dn2id_delete: subtree (%s) delete failed: %d\n",
- ptr.bv_val, rc ));
+ LDAP_LOG ( INDEX, ERR,
+ "=> bdb_dn2id_delete: subtree (%s) delete failed: %d\n",
+ ptr.bv_val, rc, 0 );
#else
Debug( LDAP_DEBUG_ANY,
"=> bdb_dn2id_delete: subtree (%s) delete failed: %d\n",
if( rc != 0 ) {
#ifdef NEW_LOGGING
- LDAP_LOG (( "db2id", LDAP_LEVEL_ERR,
+ LDAP_LOG ( INDEX, ERR,
"=> bdb_dn2id_delete: parent (%s) delete failed: %d\n",
- ptr.bv_val, rc ));
+ ptr.bv_val, rc, 0 );
#else
Debug( LDAP_DEBUG_ANY,
"=> bdb_dn2id_delete: parent (%s) delete failed: %d\n",
rc = bdb_idl_delete_key( be, db, txn, &key, e->e_id );
if( rc != 0 ) {
#ifdef NEW_LOGGING
- LDAP_LOG (( "db2id", LDAP_LEVEL_ERR,
+ LDAP_LOG ( INDEX, ERR,
"=> bdb_dn2id_delete: subtree (%s) delete failed: %d\n",
- ptr.bv_val, rc ));
+ ptr.bv_val, rc, 0 );
#else
Debug( LDAP_DEBUG_ANY,
"=> bdb_dn2id_delete: subtree (%s) delete failed: %d\n",
done:
ch_free( buf );
#ifdef NEW_LOGGING
- LDAP_LOG (( "db2id", LDAP_LEVEL_RESULTS, "<= bdb_dn2id_delete %d\n", rc ));
+ LDAP_LOG ( INDEX, RESULTS, "<= bdb_dn2id_delete %d\n", rc, 0, 0 );
#else
Debug( LDAP_DEBUG_TRACE, "<= bdb_dn2id_delete %d\n", rc, 0, 0 );
#endif
DB *db = bdb->bi_dn2id->bdi_db;
#ifdef NEW_LOGGING
- LDAP_LOG (( "db2id", LDAP_LEVEL_ARGS, "=> bdb_dn2id( \"%s\" )\n",
- dn->bv_val ));
+ LDAP_LOG ( INDEX, ARGS, "=> bdb_dn2id( \"%s\" )\n", dn->bv_val, 0, 0 );
#else
Debug( LDAP_DEBUG_TRACE, "=> bdb_dn2id( \"%s\" )\n", dn->bv_val, 0, 0 );
#endif
if( rc != 0 ) {
#ifdef NEW_LOGGING
- LDAP_LOG (( "db2id", LDAP_LEVEL_ERR,
- "<= bdb_dn2id: get failed %s (%d)\n",
- db_strerror(rc), rc ));
+ LDAP_LOG ( INDEX, ERR, "<= bdb_dn2id: get failed %s (%d)\n",
+ db_strerror(rc), rc, 0 );
#else
Debug( LDAP_DEBUG_TRACE, "<= bdb_dn2id: get failed: %s (%d)\n",
db_strerror( rc ), rc, 0 );
#endif
} else {
#ifdef NEW_LOGGING
- LDAP_LOG (( "db2id", LDAP_LEVEL_RESULTS,
- "<= bdb_dn2id: got id=0x%08lx\n", *id ));
+ LDAP_LOG ( INDEX, RESULTS,
+ "<= bdb_dn2id: got id=0x%08lx\n", *id, 0, 0 );
#else
Debug( LDAP_DEBUG_TRACE, "<= bdb_dn2id: got id=0x%08lx\n",
*id, 0, 0 );
ID cached_id;
#ifdef NEW_LOGGING
- LDAP_LOG (( "db2id", LDAP_LEVEL_ARGS,
- "=> bdb_dn2id_matched( \"%s\" )\n", in->bv_val ));
+ LDAP_LOG ( INDEX, ARGS,
+ "=> bdb_dn2id_matched( \"%s\" )\n", in->bv_val, 0, 0 );
#else
Debug( LDAP_DEBUG_TRACE, "=> bdb_dn2id_matched( \"%s\" )\n", in->bv_val, 0, 0 );
#endif
dnParent( &dn, &pdn );
} else {
#ifdef NEW_LOGGING
- LDAP_LOG (( "db2id", LDAP_LEVEL_DETAIL1,
- "<= bdb_dn2id_matched: no match\n" ));
+ LDAP_LOG ( INDEX, DETAIL1,
+ "<= bdb_dn2id_matched: no match\n", 0, 0, 0 );
#else
Debug( LDAP_DEBUG_TRACE,
"<= bdb_dn2id_matched: no match\n",
} else if ( rc == 0 ) {
if( data.size != sizeof( ID ) ) {
#ifdef NEW_LOGGING
- LDAP_LOG (( "db2id", LDAP_LEVEL_DETAIL1,
+ LDAP_LOG ( INDEX, DETAIL1,
"<= bdb_dn2id_matched: get size mismatch:"
"expected %ld, got %ld\n",
- (long) sizeof(ID), (long) data.size ));
+ (long) sizeof(ID), (long) data.size, 0 );
#else
Debug( LDAP_DEBUG_ANY,
"<= bdb_dn2id_matched: get size mismatch: "
}
#ifdef NEW_LOGGING
- LDAP_LOG (( "db2id", LDAP_LEVEL_DETAIL1,
+ LDAP_LOG ( INDEX, DETAIL1,
"<= bdb_dn2id_matched: id=0x%08lx: %s %s\n",
- (long) *id, *id2 == 0 ? "entry" : "matched", dn.bv_val ));
+ (long) *id, *id2 == 0 ? "entry" : "matched", dn.bv_val );
#else
Debug( LDAP_DEBUG_TRACE,
"<= bdb_dn2id_matched: id=0x%08lx: %s %s\n",
} else {
#ifdef NEW_LOGGING
- LDAP_LOG (( "db2id", LDAP_LEVEL_ERR,
+ LDAP_LOG ( INDEX, ERR,
"<= bdb_dn2id_matched: get failed: %s (%d)\n",
- db_strerror(rc), rc ));
+ db_strerror(rc), rc, 0 );
#else
Debug( LDAP_DEBUG_ANY,
"<= bdb_dn2id_matched: get failed: %s (%d)\n",
ID id;
#ifdef NEW_LOGGING
- LDAP_LOG (( "db2id", LDAP_LEVEL_ARGS,
- "=> bdb_dn2id_children( %s )\n", dn->bv_val ));
+ LDAP_LOG ( INDEX, ARGS,
+ "=> bdb_dn2id_children( %s )\n", dn->bv_val, 0, 0 );
#else
Debug( LDAP_DEBUG_TRACE, "=> bdb_dn2id_children( %s )\n",
dn->bv_val, 0, 0 );
free( key.data );
#ifdef NEW_LOGGING
- LDAP_LOG (( "db2id", LDAP_LEVEL_DETAIL1,
+ LDAP_LOG ( INDEX, DETAIL1,
"<= bdb_dn2id_children( %s ): %schildren (%d)\n",
dn->bv_val, rc == 0 ? "" : ( rc == DB_NOTFOUND ? "no " :
- db_strerror(rc)), rc ));
+ db_strerror(rc)), rc );
#else
Debug( LDAP_DEBUG_TRACE, "<= bdb_dn2id_children( %s ): %schildren (%d)\n",
dn->bv_val,
DB *db = bdb->bi_dn2id->bdi_db;
#ifdef NEW_LOGGING
- LDAP_LOG (( "db2id", LDAP_LEVEL_ARGS,
- "=> bdb_dn2ididl( \"%s\" )\n", dn->bv_val ));
+ LDAP_LOG ( INDEX, ARGS,
+ "=> bdb_dn2ididl( \"%s\" )\n", dn->bv_val, 0, 0 );
#else
Debug( LDAP_DEBUG_TRACE, "=> bdb_dn2idl( \"%s\" )\n", dn->bv_val, 0, 0 );
#endif
if( rc != 0 ) {
#ifdef NEW_LOGGING
- LDAP_LOG (( "db2id", LDAP_LEVEL_ERR,
- "<= bdb_dn2ididl: get failed: %s (%d)\n",
- db_strerror(rc), rc ));
+ LDAP_LOG ( INDEX, ERR,
+ "<= bdb_dn2ididl: get failed: %s (%d)\n", db_strerror(rc), rc, 0 );
#else
Debug( LDAP_DEBUG_TRACE,
"<= bdb_dn2idl: get failed: %s (%d)\n",
} else {
#ifdef NEW_LOGGING
- LDAP_LOG (( "db2id", LDAP_LEVEL_RESULTS,
+ LDAP_LOG ( INDEX, RESULTS,
"<= bdb_dn2ididl: id=%ld first=%ld last=%ld\n",
(long) ids[0], (long) BDB_IDL_FIRST( ids ),
- (long) BDB_IDL_LAST( ids ) ));
+ (long) BDB_IDL_LAST( ids ) );
#else
Debug( LDAP_DEBUG_TRACE,
"<= bdb_dn2idl: id=%ld first=%ld last=%ld\n",
ptr = e->e_name.bv_val;
nptr = e->e_nname.bv_val;
for (n = o; n && n->i_parent; n=n->i_parent) {
- ptr = slap_strcopy(ptr, n->i_rdn->rdn.bv_val);
+ ptr = lutil_strcopy(ptr, n->i_rdn->rdn.bv_val);
*ptr++ = ',';
- nptr = slap_strcopy(nptr, n->i_rdn->nrdn.bv_val);
+ nptr = lutil_strcopy(nptr, n->i_rdn->nrdn.bv_val);
*nptr++ = ',';
}
ldap_pvt_thread_rdwr_runlock(&bdb->bi_tree_rdwr);
void bdb_errcall( const char *pfx, char * msg )
{
#ifdef NEW_LOGGING
- LDAP_LOG (( "error", LDAP_LEVEL_INFO, "bdb(%s): %s\n", pfx, msg ));
+ LDAP_LOG ( OPERATION, INFO, "bdb(%s): %s\n", pfx, msg, 0 );
#else
Debug( LDAP_DEBUG_ANY, "bdb(%s): %s\n", pfx, msg, 0 );
#endif
{
int rc = -1;
#ifdef NEW_LOGGING
- LDAP_LOG (( "filterindex", LDAP_LEVEL_ENTRY, "=> bdb_filter_candidates\n"));
+ LDAP_LOG ( INDEX, ENTRY, "=> bdb_filter_candidates\n", 0, 0, 0 );
#else
Debug( LDAP_DEBUG_FILTER, "=> bdb_filter_candidates\n", 0, 0, 0 );
#endif
switch ( f->f_choice ) {
case SLAPD_FILTER_DN_ONE:
#ifdef NEW_LOGGING
- LDAP_LOG (( "filterindex", LDAP_LEVEL_ARGS, "=> bdb_filter_candidates: \tDN ONE\n"));
+ LDAP_LOG ( INDEX, ARGS, "=> bdb_filter_candidates: \tDN ONE\n", 0, 0, 0 );
#else
Debug( LDAP_DEBUG_FILTER, "\tDN ONE\n", 0, 0, 0 );
#endif
case SLAPD_FILTER_DN_SUBTREE:
#ifdef NEW_LOGGING
- LDAP_LOG (( "filterindex", LDAP_LEVEL_ARGS, "=> bdb_filter_candidates: \tDN SUBTREE\n"));
+ LDAP_LOG ( INDEX, ARGS, "=> bdb_filter_candidates: \tDN SUBTREE\n", 0, 0, 0 );
#else
Debug( LDAP_DEBUG_FILTER, "\tDN SUBTREE\n", 0, 0, 0 );
#endif
case LDAP_FILTER_PRESENT:
#ifdef NEW_LOGGING
- LDAP_LOG (( "filterindex", LDAP_LEVEL_ARGS, "=> bdb_filter_candidates: \tPRESENT\n"));
+ LDAP_LOG ( INDEX, ARGS, "=> bdb_filter_candidates: \tPRESENT\n", 0, 0, 0 );
#else
Debug( LDAP_DEBUG_FILTER, "\tPRESENT\n", 0, 0, 0 );
#endif
case LDAP_FILTER_EQUALITY:
#ifdef NEW_LOGGING
- LDAP_LOG (( "filterindex", LDAP_LEVEL_ARGS, "=> bdb_filter_candidates: \tEQUALITY\n"));
+ LDAP_LOG ( INDEX, ARGS, "=> bdb_filter_candidates: \tEQUALITY\n", 0, 0, 0 );
#else
Debug( LDAP_DEBUG_FILTER, "\tEQUALITY\n", 0, 0, 0 );
#endif
case LDAP_FILTER_APPROX:
#ifdef NEW_LOGGING
- LDAP_LOG (( "filterindex", LDAP_LEVEL_ARGS, "=> bdb_filter_candidates: \tAPPROX\n"));
+ LDAP_LOG ( INDEX, ARGS, "=> bdb_filter_candidates: \tAPPROX\n", 0, 0, 0 );
#else
Debug( LDAP_DEBUG_FILTER, "\tAPPROX\n", 0, 0, 0 );
#endif
case LDAP_FILTER_SUBSTRINGS:
#ifdef NEW_LOGGING
- LDAP_LOG (( "filterindex", LDAP_LEVEL_ARGS, "=> bdb_filter_candidates: \tSUBSTRINGS\n"));
+ LDAP_LOG ( INDEX, ARGS, "=> bdb_filter_candidates: \tSUBSTRINGS\n", 0, 0, 0 );
#else
Debug( LDAP_DEBUG_FILTER, "\tSUBSTRINGS\n", 0, 0, 0 );
#endif
case LDAP_FILTER_GE:
/* no GE index, use pres */
#ifdef NEW_LOGGING
- LDAP_LOG (( "filterindex", LDAP_LEVEL_ARGS, "=> bdb_filter_candidates: \tGE\n"));
+ LDAP_LOG ( INDEX, ARGS, "=> bdb_filter_candidates: \tGE\n", 0, 0, 0 );
#else
Debug( LDAP_DEBUG_FILTER, "\tGE\n", 0, 0, 0 );
#endif
case LDAP_FILTER_LE:
/* no LE index, use pres */
#ifdef NEW_LOGGING
- LDAP_LOG (( "filterindex", LDAP_LEVEL_ARGS, "=> bdb_filter_candidates: \tLE\n"));
+ LDAP_LOG ( INDEX, ARGS, "=> bdb_filter_candidates: \tLE\n", 0, 0, 0 );
#else
Debug( LDAP_DEBUG_FILTER, "\tLE\n", 0, 0, 0 );
#endif
case LDAP_FILTER_NOT:
/* no indexing to support NOT filters */
#ifdef NEW_LOGGING
- LDAP_LOG (( "filterindex", LDAP_LEVEL_ARGS, "=> bdb_filter_candidates: \tNOT\n"));
+ LDAP_LOG ( INDEX, ARGS, "=> bdb_filter_candidates: \tNOT\n",0, 0, 0 );
#else
Debug( LDAP_DEBUG_FILTER, "\tNOT\n", 0, 0, 0 );
#endif
case LDAP_FILTER_AND:
#ifdef NEW_LOGGING
- LDAP_LOG (( "filterindex", LDAP_LEVEL_ARGS, "=> bdb_filter_candidates: \tAND\n"));
+ LDAP_LOG ( INDEX, ARGS, "=> bdb_filter_candidates: \tAND\n", 0, 0, 0 );
#else
Debug( LDAP_DEBUG_FILTER, "\tAND\n", 0, 0, 0 );
#endif
case LDAP_FILTER_OR:
#ifdef NEW_LOGGING
- LDAP_LOG (( "filterindex", LDAP_LEVEL_ARGS, "=> bdb_filter_candidates: \tOR\n"));
+ LDAP_LOG ( INDEX, ARGS, "=> bdb_filter_candidates: \tOR\n", 0, 0, 0 );
#else
Debug( LDAP_DEBUG_FILTER, "\tOR\n", 0, 0, 0 );
#endif
default:
#ifdef NEW_LOGGING
- LDAP_LOG (( "filterindex", LDAP_LEVEL_ARGS, "=> bdb_filter_candidates: \tUNKNOWN\n"));
+ LDAP_LOG ( INDEX, ARGS, "=> bdb_filter_candidates: \tUNKNOWN\n", 0, 0, 0 );
#else
Debug( LDAP_DEBUG_FILTER, "\tUNKNOWN %lu\n",
(unsigned long) f->f_choice, 0, 0 );
}
#ifdef NEW_LOGGING
- LDAP_LOG (( "filterindex", LDAP_LEVEL_RESULTS, "=> bdb_filter_candidates: id=%ld first=%ld last=%ld\n", (long) ids[0], (long) BDB_IDL_FIRST( ids ), (long) BDB_IDL_LAST( ids ) ));
+ LDAP_LOG ( INDEX, RESULTS,
+ "=> bdb_filter_candidates: id=%ld first=%ld last=%ld\n",
+ (long)ids[0], (long)BDB_IDL_FIRST( ids ), (long) BDB_IDL_LAST( ids ));
#else
Debug( LDAP_DEBUG_FILTER,
"<= bdb_filter_candidates: id=%ld first=%ld last=%ld\n",
Filter *f;
#ifdef NEW_LOGGING
- LDAP_LOG (( "filterindex", LDAP_LEVEL_ARGS, "=> bdb_list_candidates: 0x%x\n", ftype));
+ LDAP_LOG ( INDEX, ARGS, "=> bdb_list_candidates: 0x%x\n", ftype, 0 , 0 );
#else
Debug( LDAP_DEBUG_FILTER, "=> bdb_list_candidates 0x%x\n", ftype, 0, 0 );
#endif
if( rc ) {
#ifdef NEW_LOGGING
- LDAP_LOG (( "filterindex", LDAP_LEVEL_RESULTS, "<= bdb_list_candidates: id=%ld first=%ld last=%ld\n", (long) ids[0], (long) BDB_IDL_FIRST( ids ), (long) BDB_IDL_LAST( ids ) ));
+ LDAP_LOG ( INDEX, RESULTS,
+ "<= bdb_list_candidates: id=%ld first=%ld last=%ld\n",
+ (long) ids[0], (long) BDB_IDL_FIRST( ids ),
+ (long) BDB_IDL_LAST( ids ) );
#else
Debug( LDAP_DEBUG_FILTER,
"<= bdb_list_candidates: id=%ld first=%ld last=%ld\n",
} else {
#ifdef NEW_LOGGING
- LDAP_LOG (( "filterindex", LDAP_LEVEL_ARGS, "<= bdb_list_candidates: rc=%d\n", rc));
+ LDAP_LOG ( INDEX, ARGS, "<= bdb_list_candidates: rc=%d\n", rc, 0, 0 );
#else
Debug( LDAP_DEBUG_FILTER,
"<= bdb_list_candidates: undefined rc=%d\n",
struct berval prefix = {0};
#ifdef NEW_LOGGING
- LDAP_LOG (( "filterindex", LDAP_LEVEL_ENTRY, "=> bdb_presence_candidates\n"));
+ LDAP_LOG ( INDEX, ENTRY, "=> bdb_presence_candidates\n", 0, 0, 0 );
#else
Debug( LDAP_DEBUG_TRACE, "=> bdb_presence_candidates\n", 0, 0, 0 );
#endif
if( rc != LDAP_SUCCESS ) {
#ifdef NEW_LOGGING
- LDAP_LOG (( "filterindex", LDAP_LEVEL_RESULTS, "=> bdb_presence_candidates: index_parm returned=%d\n", rc ));
+ LDAP_LOG ( INDEX, RESULTS,
+ "=> bdb_presence_candidates: index_parm returned=%d\n", rc, 0, 0 );
#else
Debug( LDAP_DEBUG_TRACE,
"<= bdb_presence_candidates: index_param returned=%d\n",
if( db == NULL ) {
/* not indexed */
#ifdef NEW_LOGGING
- LDAP_LOG (( "filterindex", LDAP_LEVEL_RESULTS, "<= bdb_presence_candidates: not indexed\n" ));
+ LDAP_LOG(INDEX, RESULTS,
+ "<= bdb_presence_candidates: not indexed\n", 0, 0, 0 );
#else
Debug( LDAP_DEBUG_TRACE,
"<= bdb_presence_candidates: not indexed\n",
if( prefix.bv_val == NULL ) {
#ifdef NEW_LOGGING
- LDAP_LOG (( "filterindex", LDAP_LEVEL_RESULTS, "<= bdb_presence_candidates: no prefix\n" ));
+ LDAP_LOG(INDEX, RESULTS,
+ "<= bdb_presence_candidates: no prefix\n", 0, 0, 0 );
#else
Debug( LDAP_DEBUG_TRACE,
"<= bdb_presence_candidates: no prefix\n",
rc = 0;
} else if( rc != LDAP_SUCCESS ) {
#ifdef NEW_LOGGING
- LDAP_LOG (( "filterindex", LDAP_LEVEL_RESULTS, "<= bdb_presence_candidates: key read failed (%d)\n", rc ));
+ LDAP_LOG ( INDEX, RESULTS,
+ "<= bdb_presence_candidates: key read failed (%d)\n", rc, 0, 0 );
#else
Debug( LDAP_DEBUG_TRACE,
"<= bdb_presense_candidates: key read failed (%d)\n",
}
#ifdef NEW_LOGGING
- LDAP_LOG (( "filterindex", LDAP_LEVEL_RESULTS, "<= bdb_presence_candidates: id=%ld first=%ld last=%ld\n", (long) ids[0], (long) BDB_IDL_FIRST( ids ), (long) BDB_IDL_LAST( ids ) ));
+ LDAP_LOG ( INDEX, RESULTS,
+ "<= bdb_presence_candidates: id=%ld first=%ld last=%ld\n",
+ (long)ids[0], (long)BDB_IDL_FIRST( ids ), (long)BDB_IDL_LAST( ids ) );
#else
Debug(LDAP_DEBUG_TRACE,
"<= bdb_presence_candidates: id=%ld first=%ld last=%ld\n",
MatchingRule *mr;
#ifdef NEW_LOGGING
- LDAP_LOG (( "filterindex", LDAP_LEVEL_ENTRY, "=> equality_candidates\n"));
+ LDAP_LOG ( INDEX, ENTRY, "=> equality_candidates\n", 0, 0, 0 );
#else
Debug( LDAP_DEBUG_TRACE, "=> bdb_equality_candidates\n", 0, 0, 0 );
#endif
if( rc != LDAP_SUCCESS ) {
#ifdef NEW_LOGGING
- LDAP_LOG (( "filterindex", LDAP_LEVEL_RESULTS, "=> bdb_equality_candidates: index_param failed (%d)\n", rc));
+ LDAP_LOG ( INDEX, RESULTS,
+ "=> bdb_equality_candidates: index_param failed (%d)\n", rc, 0, 0);
#else
Debug( LDAP_DEBUG_ANY,
"<= bdb_equality_candidates: index_param failed (%d)\n",
if ( db == NULL ) {
#ifdef NEW_LOGGING
- LDAP_LOG (( "filterindex", LDAP_LEVEL_RESULTS, "=> bdb_equality_candidates: not indexed\n"));
+ LDAP_LOG(INDEX, RESULTS,
+ "=> bdb_equality_candidates: not indexed\n", 0, 0, 0 );
#else
Debug( LDAP_DEBUG_ANY,
"<= bdb_equality_candidates: not indexed\n", 0, 0, 0 );
if( rc != LDAP_SUCCESS ) {
#ifdef NEW_LOGGING
- LDAP_LOG (( "filterindex", LDAP_LEVEL_RESULTS, "=> bdb_equality_candidates: MR filter failed (%d)\n", rc));
+ LDAP_LOG ( INDEX, RESULTS,
+ "=> bdb_equality_candidates: MR filter failed (%d)\n", rc, 0, 0);
#else
Debug( LDAP_DEBUG_TRACE,
"<= bdb_equality_candidates: MR filter failed (%d)\n",
if( keys == NULL ) {
#ifdef NEW_LOGGING
- LDAP_LOG (( "filterindex", LDAP_LEVEL_RESULTS, "=> bdb_equality_candidates: no keys\n"));
+ LDAP_LOG ( INDEX, RESULTS,
+ "=> bdb_equality_candidates: no keys\n", 0, 0, 0 );
#else
Debug( LDAP_DEBUG_TRACE,
"<= bdb_equality_candidates: no keys\n",
rc = 0;
} else if( rc != LDAP_SUCCESS ) {
#ifdef NEW_LOGGING
- LDAP_LOG (( "filterindex", LDAP_LEVEL_RESULTS, "<= bdb_equality_candidates: key read failed (%d)\n", rc));
+ LDAP_LOG ( INDEX, RESULTS,
+ "<= bdb_equality_candidates: key read failed (%d)\n", rc, 0, 0);
#else
Debug( LDAP_DEBUG_TRACE,
"<= bdb_equality_candidates key read failed (%d)\n",
if( BDB_IDL_IS_ZERO( tmp ) ) {
#ifdef NEW_LOGGING
- LDAP_LOG (( "filterindex", LDAP_LEVEL_RESULTS, "=> bdb_equality_candidates: NULL\n"));
+ LDAP_LOG ( INDEX, RESULTS, "=> bdb_equality_candidates: NULL\n", 0, 0, 0);
#else
Debug( LDAP_DEBUG_TRACE,
"<= bdb_equality_candidates NULL\n",
ber_bvarray_free( keys );
#ifdef NEW_LOGGING
- LDAP_LOG (( "filterindex", LDAP_LEVEL_RESULTS, "<= bdb_equality_candidates: id=%ld first=%ld last=%ld\n", (long) ids[0], (long) BDB_IDL_FIRST( ids ), (long) BDB_IDL_LAST( ids ) ));
+ LDAP_LOG ( INDEX, RESULTS,
+ "<= bdb_equality_candidates: id=%ld first=%ld last=%ld\n",
+ (long) ids[0], (long) BDB_IDL_FIRST( ids ),
+ (long) BDB_IDL_LAST( ids ) );
#else
Debug( LDAP_DEBUG_TRACE,
"<= bdb_equality_candidates id=%ld, first=%ld, last=%ld\n",
MatchingRule *mr;
#ifdef NEW_LOGGING
- LDAP_LOG (( "filterindex", LDAP_LEVEL_ENTRY, "=> bdb_approx_candidates\n"));
+ LDAP_LOG ( INDEX, ENTRY, "=> bdb_approx_candidates\n", 0, 0, 0 );
#else
Debug( LDAP_DEBUG_TRACE, "=> bdb_approx_candidates\n", 0, 0, 0 );
#endif
if( rc != LDAP_SUCCESS ) {
#ifdef NEW_LOGGING
- LDAP_LOG (( "filterindex", LDAP_LEVEL_RESULTS, "<= bdb_approx_candidates: index_param failed (%d)\n", rc ));
+ LDAP_LOG ( INDEX, RESULTS,
+ "<= bdb_approx_candidates: index_param failed (%d)\n", rc, 0, 0 );
#else
Debug( LDAP_DEBUG_ANY,
"<= bdb_approx_candidates: index_param failed (%d)\n",
if ( db == NULL ) {
#ifdef NEW_LOGGING
- LDAP_LOG (( "filterindex", LDAP_LEVEL_RESULTS, "<= bdb_approx_candidates: not indexed\n" ));
+ LDAP_LOG(INDEX, RESULTS,
+ "<= bdb_approx_candidates: not indexed\n",0, 0, 0 );
#else
Debug( LDAP_DEBUG_ANY,
"<= bdb_approx_candidates: not indexed\n", 0, 0, 0 );
if( rc != LDAP_SUCCESS ) {
#ifdef NEW_LOGGING
- LDAP_LOG (( "filterindex", LDAP_LEVEL_RESULTS, "<= bdb_approx_candidates: MR filter failed (%d)\n", rc ));
+ LDAP_LOG ( INDEX, RESULTS,
+ "<= bdb_approx_candidates: MR filter failed (%d)\n", rc, 0, 0 );
#else
Debug( LDAP_DEBUG_TRACE,
"<= bdb_approx_candidates: (%s) MR filter failed (%d)\n",
if( keys == NULL ) {
#ifdef NEW_LOGGING
- LDAP_LOG (( "filterindex", LDAP_LEVEL_RESULTS, "<= bdb_approx_candidates: no keys (%s)\n", prefix.bv_val ));
+ LDAP_LOG ( INDEX, RESULTS,
+ "<= bdb_approx_candidates: no keys (%s)\n", prefix.bv_val, 0, 0 );
#else
Debug( LDAP_DEBUG_TRACE,
"<= bdb_approx_candidates: no keys (%s)\n",
break;
} else if( rc != LDAP_SUCCESS ) {
#ifdef NEW_LOGGING
- LDAP_LOG (( "filterindex", LDAP_LEVEL_RESULTS, "<= bdb_approx_candidates: key read failed (%d)\n", rc ));
+ LDAP_LOG ( INDEX, RESULTS,
+ "<= bdb_approx_candidates: key read failed (%d)\n", rc, 0, 0);
#else
Debug( LDAP_DEBUG_TRACE, "<= bdb_approx_candidates key read failed (%d)\n",
rc, 0, 0 );
if( BDB_IDL_IS_ZERO( tmp ) ) {
#ifdef NEW_LOGGING
- LDAP_LOG (( "filterindex", LDAP_LEVEL_RESULTS, "<= bdb_approx_candidates: NULL\n" ));
+ LDAP_LOG ( INDEX, RESULTS,
+ "<= bdb_approx_candidates: NULL\n", 0, 0, 0 );
#else
Debug( LDAP_DEBUG_TRACE, "<= bdb_approx_candidates NULL\n",
0, 0, 0 );
ber_bvarray_free( keys );
#ifdef NEW_LOGGING
- LDAP_LOG (( "filterindex", LDAP_LEVEL_RESULTS, "<= bdb_approx_candidates: id=%ld first=%ld last=%ld\n", (long) ids[0], (long) BDB_IDL_FIRST( ids ), (long) BDB_IDL_LAST( ids ) ));
+ LDAP_LOG ( INDEX, RESULTS,
+ "<= bdb_approx_candidates: id=%ld first=%ld last=%ld\n",
+ (long) ids[0], (long) BDB_IDL_FIRST( ids ),
+ (long) BDB_IDL_LAST( ids ) );
#else
Debug( LDAP_DEBUG_TRACE, "<= bdb_approx_candidates %ld, first=%ld, last=%ld\n",
(long) ids[0],
MatchingRule *mr;
#ifdef NEW_LOGGING
- LDAP_LOG (( "filterindex", LDAP_LEVEL_ENTRY, "=> bdb_substring_candidates\n"));
+ LDAP_LOG ( INDEX, ENTRY, "=> bdb_substring_candidates\n", 0, 0, 0 );
#else
Debug( LDAP_DEBUG_TRACE, "=> bdb_substring_candidates\n", 0, 0, 0 );
#endif
if( rc != LDAP_SUCCESS ) {
#ifdef NEW_LOGGING
- LDAP_LOG (( "filterindex", LDAP_LEVEL_RESULTS, "<= bdb_substring_candidates: index_param failed (%d)\n", rc ));
+ LDAP_LOG ( INDEX, RESULTS,
+ "<= bdb_substring_candidates: index_param failed (%d)\n", rc, 0, 0);
#else
Debug( LDAP_DEBUG_ANY,
"<= bdb_substring_candidates: index_param failed (%d)\n",
if ( db == NULL ) {
#ifdef NEW_LOGGING
- LDAP_LOG (( "filterindex", LDAP_LEVEL_RESULTS, "<= bdb_substring_candidates: not indexed\n"));
+ LDAP_LOG ( INDEX, RESULTS,
+ "<= bdb_substring_candidates: not indexed\n", 0, 0, 0 );
#else
Debug( LDAP_DEBUG_ANY,
"<= bdb_substring_candidates not indexed\n",
if( rc != LDAP_SUCCESS ) {
#ifdef NEW_LOGGING
- LDAP_LOG (( "filterindex", LDAP_LEVEL_RESULTS, "<= bdb_substring_candidates: (%s) MR filter failed (%d)\n", sub->sa_desc->ad_cname.bv_val, rc ));
+ LDAP_LOG ( INDEX, RESULTS,
+ "<= bdb_substring_candidates: (%s) MR filter failed (%d)\n",
+ sub->sa_desc->ad_cname.bv_val, rc, 0 );
#else
Debug( LDAP_DEBUG_TRACE,
"<= bdb_substring_candidates: (%s) MR filter failed (%d)\n",
if( keys == NULL ) {
#ifdef NEW_LOGGING
- LDAP_LOG (( "filterindex", LDAP_LEVEL_RESULTS, "<= bdb_substring_candidates: (%s) MR filter failed (%d)\n", mask, sub->sa_desc->ad_cname.bv_val ));
+ LDAP_LOG ( INDEX, RESULTS,
+ "<= bdb_substring_candidates: (%d) MR filter failed (%s)\n",
+ mask, sub->sa_desc->ad_cname.bv_val, 0 );
#else
Debug( LDAP_DEBUG_TRACE,
"<= bdb_substring_candidates: (0x%04lx) no keys (%s)\n",
break;
} else if( rc != LDAP_SUCCESS ) {
#ifdef NEW_LOGGING
- LDAP_LOG (( "filterindex", LDAP_LEVEL_RESULTS, "<= bdb_substring_candidates: key read failed (%d)\n", rc));
+ LDAP_LOG ( INDEX, RESULTS,
+ "<= bdb_substring_candidates: key read failed (%d)\n", rc, 0,0);
#else
Debug( LDAP_DEBUG_TRACE, "<= bdb_substring_candidates key read failed (%d)\n",
rc, 0, 0 );
if( BDB_IDL_IS_ZERO( tmp ) ) {
#ifdef NEW_LOGGING
- LDAP_LOG (( "filterindex", LDAP_LEVEL_RESULTS, "<= bdb_substring_candidates: NULL \n" ));
+ LDAP_LOG ( INDEX, RESULTS,
+ "<= bdb_substring_candidates: NULL \n", 0, 0, 0 );
#else
Debug( LDAP_DEBUG_TRACE, "<= bdb_substring_candidates NULL\n",
0, 0, 0 );
ber_bvarray_free( keys );
#ifdef NEW_LOGGING
- LDAP_LOG (( "filterindex", LDAP_LEVEL_RESULTS, "<= bdb_substring_candidates: id=%ld first=%ld last=%ld\n", (long) ids[0], (long) BDB_IDL_FIRST( ids ), (long) BDB_IDL_LAST( ids ) ));
+ LDAP_LOG ( INDEX, RESULTS,
+ "<= bdb_substring_candidates: id=%ld first=%ld last=%ld\n",
+ (long) ids[0], (long) BDB_IDL_FIRST( ids ),
+ (long) BDB_IDL_LAST( ids ) );
#else
Debug( LDAP_DEBUG_TRACE, "<= bdb_substring_candidates %ld, first=%ld, last=%ld\n",
(long) ids[0],
}
#ifdef NEW_LOGGING
- LDAP_LOG(( "backend", LDAP_LEVEL_ENTRY,
+ LDAP_LOG( BACK_BDB, ENTRY,
"bdb_group: check (%s) member of (%s), oc %s\n",
- op_ndn->bv_val, gr_ndn->bv_val, group_oc_name ));
+ op_ndn->bv_val, gr_ndn->bv_val, group_oc_name );
#else
Debug( LDAP_DEBUG_ARGS,
"=> bdb_group: gr dn: \"%s\"\n",
/* we already have a LOCKED copy of the entry */
e = target;
#ifdef NEW_LOGGING
- LDAP_LOG(( "backend", LDAP_LEVEL_DETAIL1,
- "bdb_group: target is group (%s)\n", gr_ndn->bv_val ));
+ LDAP_LOG( BACK_BDB, DETAIL1,
+ "bdb_group: target is group (%s)\n", gr_ndn->bv_val, 0, 0 );
#else
Debug( LDAP_DEBUG_ARGS,
"=> bdb_group: target is group: \"%s\"\n",
}
if (e == NULL) {
#ifdef NEW_LOGGING
- LDAP_LOG(( "backend", LDAP_LEVEL_DETAIL1,
- "bdb_group: cannot find group (%s)\n",
- gr_ndn->bv_val ));
+ LDAP_LOG( BACK_BDB, DETAIL1,
+ "bdb_group: cannot find group (%s)\n", gr_ndn->bv_val, 0, 0 );
#else
Debug( LDAP_DEBUG_ACL,
"=> bdb_group: cannot find group: \"%s\"\n",
return( 1 );
}
#ifdef NEW_LOGGING
- LDAP_LOG(( "backend", LDAP_LEVEL_DETAIL1,
- "bdb_group: found group (%s)\n", gr_ndn->bv_val ));
+ LDAP_LOG( BACK_BDB, DETAIL1,
+ "bdb_group: found group (%s)\n", gr_ndn->bv_val, 0, 0 );
#else
Debug( LDAP_DEBUG_ACL,
"=> bdb_group: found group: \"%s\"\n",
#ifdef BDB_ALIASES
if( is_entry_alias( e ) ) {
#ifdef NEW_LOGGING
- LDAP_LOG(( "backend", LDAP_LEVEL_INFO,
- "bdb_group: group (%s) is an alias\n", gr_ndn->bv_val ));
+ LDAP_LOG( BACK_BDB, INFO,
+ "bdb_group: group (%s) is an alias\n", gr_ndn->bv_val, 0, 0);
#else
Debug( LDAP_DEBUG_ACL,
"<= bdb_group: group is an alias\n", 0, 0, 0 );
if( is_entry_referral( e ) ) {
#ifdef NEW_LOGGING
- LDAP_LOG(( "backend", LDAP_LEVEL_INFO,
- "bdb_group: group (%s) is a referral.\n", gr_ndn->bv_val ));
+ LDAP_LOG( BACK_BDB, INFO,
+ "bdb_group: group (%s) is a referral.\n", gr_ndn->bv_val, 0, 0 );
#else
Debug( LDAP_DEBUG_ACL,
"<= bdb_group: group is a referral\n", 0, 0, 0 );
if( !is_entry_objectclass( e, group_oc, 0 ) ) {
#ifdef NEW_LOGGING
- LDAP_LOG(( "backend", LDAP_LEVEL_ERR,
- "bdb_group: failed to find %s in objectClass.\n",
- group_oc_name ));
+ LDAP_LOG( BACK_BDB, ERR,
+ "bdb_group: failed to find %s in objectClass.\n",
+ group_oc_name, 0, 0 );
#else
Debug( LDAP_DEBUG_ACL,
"<= bdb_group: failed to find %s in objectClass\n",
if ((attr = attr_find(e->e_attrs, group_at)) == NULL) {
#ifdef NEW_LOGGING
- LDAP_LOG(( "backend", LDAP_LEVEL_INFO,
- "bdb_group: failed to find %s\n", group_at_name ));
+ LDAP_LOG( BACK_BDB, INFO,
+ "bdb_group: failed to find %s\n", group_at_name, 0, 0 );
#else
Debug( LDAP_DEBUG_ACL,
"<= bdb_group: failed to find %s\n",
}
#ifdef NEW_LOGGING
- LDAP_LOG(( "backend", LDAP_LEVEL_ENTRY,
+ LDAP_LOG( BACK_BDB, ENTRY,
"bdb_group: found objectClass %s and %s\n",
- group_oc_name, group_at_name ));
+ group_oc_name, group_at_name, 0 );
#else
Debug( LDAP_DEBUG_ACL,
"<= bdb_group: found objectClass %s and %s\n",
if( value_find( group_at, attr->a_vals, op_ndn ) != LDAP_SUCCESS ) {
#ifdef NEW_LOGGING
- LDAP_LOG(( "backend", LDAP_LEVEL_DETAIL1,
+ LDAP_LOG( BACK_BDB, DETAIL1,
"bdb_group: \"%s\" not in \"%s\": %s\n",
- op_ndn->bv_val, gr_ndn->bv_val, group_at_name ));
+ op_ndn->bv_val, gr_ndn->bv_val, group_at_name );
#else
Debug( LDAP_DEBUG_ACL,
"<= bdb_group: \"%s\" not in \"%s\": %s\n",
}
#ifdef NEW_LOGGING
- LDAP_LOG(( "backend", LDAP_LEVEL_DETAIL1,
- "bdb_group: %s is in %s: %s\n",
- op_ndn->bv_val, gr_ndn->bv_val, group_at_name ));
+ LDAP_LOG( BACK_BDB, DETAIL1, "bdb_group: %s is in %s: %s\n",
+ op_ndn->bv_val, gr_ndn->bv_val, group_at_name );
#else
Debug( LDAP_DEBUG_ACL,
"<= bdb_group: \"%s\" is in \"%s\": %s\n",
}
#ifdef NEW_LOGGING
- LDAP_LOG(( "backend", LDAP_LEVEL_ENTRY,
- "bdb_group: rc=%d\n", rc ));
+ LDAP_LOG( BACK_BDB, ENTRY, "bdb_group: rc=%d\n", rc, 0, 0 );
#else
Debug( LDAP_DEBUG_TRACE, "bdb_group: rc=%d\n", rc, 0, 0 );
#endif
{
if( BDB_IDL_IS_RANGE( ids ) ) {
#ifdef NEW_LOGGING
- LDAP_LOG(( "idl", LDAP_LEVEL_INFO, "IDL: range (%ld - %ld)\n",
+ LDAP_LOG( INDEX, INFO, "IDL: range (%ld - %ld)\n",
(long) BDB_IDL_RANGE_FIRST( ids ),
- (long) BDB_IDL_RANGE_LAST( ids ) ));
+ (long) BDB_IDL_RANGE_LAST( ids ), 0 );
#else
Debug( LDAP_DEBUG_ANY,
"IDL: range ( %ld - %ld )\n",
} else {
ID i;
#ifdef NEW_LOGGING
- LDAP_LOG(( "idl", LDAP_LEVEL_INFO, "IDL: size %ld",
- (long) ids[0] ));
+ LDAP_LOG( INDEX, INFO, "IDL: size %ld", (long) ids[0], 0, 0 );
#else
Debug( LDAP_DEBUG_ANY, "IDL: size %ld", (long) ids[0], 0, 0 );
#endif
Debug( LDAP_DEBUG_ANY, "\n", 0, 0, 0 );
}
#ifdef NEW_LOGGING
- LDAP_LOG(( "idl", LDAP_LEVEL_INFO, "%02lx",(long)ids[i] ));
+ LDAP_LOG( INDEX, INFO, "%02lx",(long)ids[i], 0, 0 );
#else
Debug( LDAP_DEBUG_ANY, " %02lx", (long) ids[i], 0, 0 );
#endif
#if IDL_DEBUG > 1
#ifdef NEW_LOGGING
- LDAP_LOG(( "idl", LDAP_LEVEL_DETAIL1, "insert: %04lx at %d\n",
- (long) id, x ));
+ LDAP_LOG( INDEX, DETAIL1, "insert: %04lx at %d\n", (long) id, x, 0 );
#else
Debug( LDAP_DEBUG_ANY, "insert: %04lx at %d\n", (long) id, x, 0 );
idl_dump( ids );
#if IDL_DEBUG > 1
#ifdef NEW_LOGGING
- LDAP_LOG(( "idl", LDAP_LEVEL_DETAIL1, "delete: %04lx at %d\n",
- (long) id, x ));
+ LDAP_LOG( INDEX, DETAIL1, "delete: %04lx at %d\n", (long) id, x, 0 );
#else
Debug( LDAP_DEBUG_ANY, "delete: %04lx at %d\n", (long) id, x, 0 );
idl_dump( ids );
rc = db->cursor( db, tid, &cursor, bdb->bi_db_opflags );
if( rc != 0 ) {
#ifdef NEW_LOGGING
- LDAP_LOG(( "idl", LDAP_LEVEL_ERR, "bdb_idl_fetch_key: cursor failed: %s (%d)\n", db_strerror(rc), rc ));
+ LDAP_LOG( INDEX, ERR,
+ "bdb_idl_fetch_key: cursor failed: %s (%d)\n",
+ db_strerror(rc), rc, 0 );
#else
Debug( LDAP_DEBUG_ANY, "=> bdb_idl_fetch_key: "
"cursor failed: %s (%d)\n", db_strerror(rc), rc, 0 );
if (ids[1] == 0) {
if (ids[0] != BDB_IDL_RANGE_SIZE) {
#ifdef NEW_LOGGING
- LDAP_LOG(( "idl", LDAP_LEVEL_ERR, "=> bdb_idl_fetch_key: range size mismatch: expected %ld, got %ld\n", BDB_IDL_RANGE_SIZE, ids[0] ));
+ LDAP_LOG( INDEX, ERR,
+ "=> bdb_idl_fetch_key: range size mismatch: "
+ "expected %ld, got %ld\n",
+ BDB_IDL_RANGE_SIZE, ids[0], 0 );
#else
Debug( LDAP_DEBUG_ANY, "=> bdb_idl_fetch_key: "
"range size mismatch: expected %d, got %ld\n",
rc2 = cursor->c_close( cursor );
if (rc2) {
#ifdef NEW_LOGGING
- LDAP_LOG(( "idl", LDAP_LEVEL_ERR, "bdb_idl_fetch_key: close failed: %s (%d)\n", db_strerror(rc2), rc2 ));
+ LDAP_LOG( INDEX, ERR,
+ "bdb_idl_fetch_key: close failed: %s (%d)\n",
+ db_strerror(rc2), rc2, 0 );
#else
Debug( LDAP_DEBUG_ANY, "=> bdb_idl_fetch_key: "
"close failed: %s (%d)\n", db_strerror(rc2), rc2, 0 );
} else if( rc != 0 ) {
#ifdef NEW_LOGGING
- LDAP_LOG(( "idl", LDAP_LEVEL_ERR, "bdb_idl_fetch_key: get failed: %s (%d)\n", db_strerror(rc), rc ));
+ LDAP_LOG( INDEX, ERR,
+ "bdb_idl_fetch_key: get failed: %s (%d)\n",
+ db_strerror(rc), rc, 0 );
#else
Debug( LDAP_DEBUG_ANY, "=> bdb_idl_fetch_key: "
"get failed: %s (%d)\n",
} else if ( data.size == 0 || data.size % sizeof( ID ) ) {
/* size not multiple of ID size */
#ifdef NEW_LOGGING
- LDAP_LOG(( "idl", LDAP_LEVEL_ERR, "bdb_idl_fetch_key: odd size: expected %ld multiple, got %ld\n", (long) sizeof( ID ), (long) data.size ));
+ LDAP_LOG( INDEX, ERR,
+ "bdb_idl_fetch_key: odd size: expected %ld multiple, got %ld\n",
+ (long) sizeof( ID ), (long) data.size, 0 );
#else
Debug( LDAP_DEBUG_ANY, "=> bdb_idl_fetch_key: "
"odd size: expected %ld multiple, got %ld\n",
} else if ( data.size != BDB_IDL_SIZEOF(ids) ) {
/* size mismatch */
#ifdef NEW_LOGGING
- LDAP_LOG(( "idl", LDAP_LEVEL_ERR, "bdb_idl_fetch_key: get size mismatch: expected %ld, got %ld\n", (long) ((1 + ids[0]) * sizeof( ID )), (long) data.size ));
+ LDAP_LOG( INDEX, ERR,
+ "bdb_idl_fetch_key: get size mismatch: expected %ld, got %ld\n",
+ (long) ((1 + ids[0]) * sizeof( ID )), (long) data.size, 0 );
#else
Debug( LDAP_DEBUG_ANY, "=> bdb_idl_fetch_key: "
"get size mismatch: expected %ld, got %ld\n",
#if 0
/* for printable keys only */
#ifdef NEW_LOGGING
- LDAP_LOG(( "idl", LDAP_LEVEL_ARGS, "bdb_idl_insert_key: %s %ld\n", (char *)key->data, (long) id ));
+ LDAP_LOG( INDEX, ARGS, "bdb_idl_insert_key: %s %ld\n",
+ (char *)key->data, (long) id, 0 );
#else
Debug( LDAP_DEBUG_ARGS,
"=> bdb_idl_insert_key: %s %ld\n",
rc = db->cursor( db, tid, &cursor, bdb->bi_db_opflags );
if ( rc != 0 ) {
#ifdef NEW_LOGGING
- LDAP_LOG(( "idl", LDAP_LEVEL_ERR, "bdb_idl_insert_key: cursor failed: %s (%d)\n", db_strerror(rc), rc ));
+ LDAP_LOG( INDEX, ERR,
+ "bdb_idl_insert_key: cursor failed: %s (%d)\n",
+ db_strerror(rc), rc, 0 );
#else
Debug( LDAP_DEBUG_ANY, "=> bdb_idl_insert_key: "
"cursor failed: %s (%d)\n", db_strerror(rc), rc, 0 );
}
if ( count >= BDB_IDL_DB_SIZE ) {
/* No room, convert to a range */
+ DBT key2 = *key;
+
+ key2.dlen = key2.ulen;
+ key2.flags |= DB_DBT_PARTIAL;
+
lo = tmp;
data.data = &hi;
- rc = cursor->c_get( cursor, key, &data, DB_LAST );
- if ( rc != 0 ) {
- err = "c_get last";
+ rc = cursor->c_get( cursor, &key2, &data, DB_NEXT_NODUP );
+ if ( rc != 0 && rc != DB_NOTFOUND ) {
+ err = "c_get next_nodup";
goto fail;
}
+ if ( rc == DB_NOTFOUND ) {
+ rc = cursor->c_get( cursor, key, &data, DB_LAST );
+ if ( rc != 0 ) {
+ err = "c_get last";
+ goto fail;
+ }
+ } else {
+ rc = cursor->c_get( cursor, key, &data, DB_PREV );
+ if ( rc != 0 ) {
+ err = "c_get prev";
+ goto fail;
+ }
+ }
if ( id < lo )
lo = id;
else if ( id > hi )
/* initial c_get failed, nothing was done */
fail:
#ifdef NEW_LOGGING
- LDAP_LOG(( "idl", LDAP_LEVEL_ERR, "bdb_idl_insert_key: %s failed: %s (%d)\n", err, db_strerror(rc), rc ));
+ LDAP_LOG( INDEX, ERR,
+ "bdb_idl_insert_key: %s failed: %s (%d)\n",
+ err, db_strerror(rc), rc );
#else
Debug( LDAP_DEBUG_ANY, "=> bdb_idl_insert_key: "
"%s failed: %s (%d)\n", err, db_strerror(rc), rc );
} else if ( rc != 0 ) {
#ifdef NEW_LOGGING
- LDAP_LOG(( "idl", LDAP_LEVEL_ERR, "bdb_idl_insert_key: get failed: %s (%d)\n", db_strerror(rc), rc ));
+ LDAP_LOG( INDEX, ERR, "bdb_idl_insert_key: get failed: %s (%d)\n",
+ db_strerror(rc), rc, 0 );
#else
Debug( LDAP_DEBUG_ANY, "=> bdb_idl_insert_key: "
"get failed: %s (%d)\n",
} else if ( data.size == 0 || data.size % sizeof( ID ) ) {
/* size not multiple of ID size */
#ifdef NEW_LOGGING
- LDAP_LOG(( "idl", LDAP_LEVEL_ERR, "bdb_idl_insert_key: odd size: expected %ld multiple, got %ld\n", (long) sizeof( ID ), (long) data.size ));
+ LDAP_LOG( INDEX, ERR,
+ "bdb_idl_insert_key: odd size: expected %ld multiple, got %ld\n",
+ (long) sizeof( ID ), (long) data.size, 0 );
#else
Debug( LDAP_DEBUG_ANY, "=> bdb_idl_insert_key: "
"odd size: expected %ld multiple, got %ld\n",
} else if ( data.size != BDB_IDL_SIZEOF(ids) ) {
/* size mismatch */
#ifdef NEW_LOGGING
- LDAP_LOG(( "idl", LDAP_LEVEL_ERR, "bdb_idl_insert_key: odd size: expected %ld multiple, got %ld\n", (long) ((1 + ids[0]) * sizeof( ID )), (long) data.size ));
+ LDAP_LOG( INDEX, ERR,
+ "bdb_idl_insert_key: odd size: expected %ld multiple, got %ld\n",
+ (long) ((1 + ids[0]) * sizeof( ID )), (long) data.size, 0 );
#else
Debug( LDAP_DEBUG_ANY, "=> bdb_idl_insert_key: "
"get size mismatch: expected %ld, got %ld\n",
if( rc == -1 ) {
#ifdef NEW_LOGGING
- LDAP_LOG(( "idl", LDAP_LEVEL_DETAIL1, "bdb_idl_insert_key: dup\n" ));
+ LDAP_LOG( INDEX, DETAIL1, "bdb_idl_insert_key: dup\n", 0, 0, 0 );
#else
Debug( LDAP_DEBUG_TRACE, "=> bdb_idl_insert_key: dup\n",
0, 0, 0 );
}
if( rc != 0 ) {
#ifdef NEW_LOGGING
- LDAP_LOG(( "idl", LDAP_LEVEL_ERR, "bdb_idl_insert_key: insert failed: (%d)\n", rc ));
+ LDAP_LOG( INDEX, ERR,
+ "bdb_idl_insert_key: insert failed: (%d)\n", rc, 0, 0 );
#else
Debug( LDAP_DEBUG_ANY, "=> bdb_idl_insert_key: "
"bdb_idl_insert failed (%d)\n",
if( rc != 0 ) {
#ifdef NEW_LOGGING
- LDAP_LOG(( "idl", LDAP_LEVEL_ERR, "bdb_idl_insert_key: put failed: (%d)\n", db_strerror(rc), rc ));
+ LDAP_LOG( INDEX, ERR,
+ "bdb_idl_insert_key: put failed: %s (%d)\n",
+ db_strerror(rc), rc, 0 );
#else
Debug( LDAP_DEBUG_ANY, "=> bdb_idl_insert_key: "
"put failed: %s (%d)\n",
#if 0
/* for printable keys only */
#ifdef NEW_LOGGING
- LDAP_LOG(( "idl", LDAP_LEVEL_ARGS, "bdb_idl_delete_key: %s %ld\n", (char *)key->data, (long) id ));
+ LDAP_LOG( INDEX, ARGS, "bdb_idl_delete_key: %s %ld\n",
+ (char *)key->data, (long) id, 0 );
#else
Debug( LDAP_DEBUG_ARGS,
"=> bdb_idl_delete_key: %s %ld\n",
rc = db->cursor( db, tid, &cursor, bdb->bi_db_opflags );
if ( rc != 0 ) {
#ifdef NEW_LOGGING
- LDAP_LOG(( "idl", LDAP_LEVEL_ERR, "bdb_idl_delete_key: cursor failed: %s (%d)\n", db_strerror(rc), rc ));
+ LDAP_LOG( INDEX, ERR,
+ "bdb_idl_delete_key: cursor failed: %s (%d)\n",
+ db_strerror(rc), rc, 0 );
#else
Debug( LDAP_DEBUG_ANY, "=> bdb_idl_delete_key: "
"cursor failed: %s (%d)\n", db_strerror(rc), rc, 0 );
/* initial c_get failed, nothing was done */
fail:
#ifdef NEW_LOGGING
- LDAP_LOG(( "idl", LDAP_LEVEL_ERR, "bdb_idl_delete_key: %s failed: %s (%d)\n", err, db_strerror(rc), rc ));
+ LDAP_LOG( INDEX, ERR,
+ "bdb_idl_delete_key: %s failed: %s (%d)\n",
+ err, db_strerror(rc), rc );
#else
Debug( LDAP_DEBUG_ANY, "=> bdb_idl_delete_key: "
"%s failed: %s (%d)\n", err, db_strerror(rc), rc );
if ( rc != 0 ) {
#ifdef NEW_LOGGING
- LDAP_LOG(( "idl", LDAP_LEVEL_ERR, "bdb_idl_delete_key: get failed: %s (%d)\n", db_strerror(rc), rc ));
+ LDAP_LOG( INDEX, ERR, "bdb_idl_delete_key: get failed: %s (%d)\n",
+ db_strerror(rc), rc, 0 );
#else
Debug( LDAP_DEBUG_ANY, "=> bdb_idl_delete_key: "
"get failed: %s (%d)\n",
} else if ( data.size == 0 || data.size % sizeof( ID ) ) {
/* size not multiple of ID size */
#ifdef NEW_LOGGING
- LDAP_LOG(( "idl", LDAP_LEVEL_ERR, "bdb_idl_delete_key: odd size: expected: %ld multiple, got %ld\n", (long) sizeof( ID ), (long) data.size ));
+ LDAP_LOG( INDEX, ERR,
+ "bdb_idl_delete_key: odd size: expected: %ld multiple, got %ld\n",
+ (long) sizeof( ID ), (long) data.size, 0 );
#else
Debug( LDAP_DEBUG_ANY, "=> bdb_idl_delete_key: "
"odd size: expected %ld multiple, got %ld\n",
} else if ( data.size != (1 + ids[0]) * sizeof( ID ) ) {
/* size mismatch */
#ifdef NEW_LOGGING
- LDAP_LOG(( "idl", LDAP_LEVEL_ERR, "bdb_idl_delete_key: get size mismatch: expected: %ld, got %ld\n", (long) ((1 + ids[0]) * sizeof( ID )), (long) data.size ));
+ LDAP_LOG( INDEX, ERR,
+ "bdb_idl_delete_key: get size mismatch: expected: %ld, got %ld\n",
+ (long) ((1 + ids[0]) * sizeof( ID )), (long) data.size, 0 );
#else
Debug( LDAP_DEBUG_ANY, "=> bdb_idl_delete_key: "
"get size mismatch: expected %ld, got %ld\n",
if( rc != 0 ) {
#ifdef NEW_LOGGING
- LDAP_LOG(( "idl", LDAP_LEVEL_ERR, "bdb_idl_delete_key: delete failed: (%d)\n", rc ));
+ LDAP_LOG( INDEX, ERR,
+ "bdb_idl_delete_key: delete failed: (%d)\n", rc, 0, 0 );
#else
Debug( LDAP_DEBUG_ANY, "=> bdb_idl_delete_key: "
"idl_delete failed (%d)\n",
rc = db->del( db, tid, key, 0 );
if( rc != 0 ) {
#ifdef NEW_LOGGING
- LDAP_LOG(( "idl", LDAP_LEVEL_ERR, "bdb_idl_delete_key: delete failed: %s (%d)\n", db_strerror(rc), rc ));
+ LDAP_LOG( INDEX, ERR,
+ "bdb_idl_delete_key: delete failed: %s (%d)\n",
+ db_strerror(rc), rc, 0 );
#else
Debug( LDAP_DEBUG_ANY, "=> bdb_idl_delete_key: "
"delete failed: %s (%d)\n",
if( rc != 0 ) {
#ifdef NEW_LOGGING
- LDAP_LOG(( "idl", LDAP_LEVEL_ERR, "bdb_idl_delete_key: put failed: %s (%d)\n", db_strerror(rc), rc ));
+ LDAP_LOG( INDEX, ERR, "bdb_idl_delete_key: put failed: %s (%d)\n",
+ db_strerror(rc), rc, 0 );
#else
Debug( LDAP_DEBUG_ANY,
"=> bdb_idl_delete_key: put failed: %s (%d)\n",
--- /dev/null
+/* index.c - routines for dealing with attribute indexes */
+/* $OpenLDAP$ */
+/*
+ * Copyright 1998-2002 The OpenLDAP Foundation, All Rights Reserved.
+ * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
+ */
+
+#include "portable.h"
+
+#include <stdio.h>
+
+#include <ac/string.h>
+#include <ac/socket.h>
+
+#include "slap.h"
+#include "back-bdb.h"
+#include "lutil_hash.h"
+
+static char presence_keyval[LUTIL_HASH_BYTES] = {0,0,0,1};
+static struct berval presence_key = {LUTIL_HASH_BYTES, presence_keyval};
+
+static slap_mask_t index_mask(
+ Backend *be,
+ AttributeDescription *desc,
+ char **dbname,
+ struct berval *atname )
+{
+ AttributeType *at;
+ slap_mask_t mask = 0;
+
+ bdb_attr_mask( be->be_private, desc, &mask );
+
+ if( mask ) {
+ *atname = desc->ad_cname;
+ *dbname = desc->ad_cname.bv_val;
+ return mask;
+ }
+
+ /* If there is a language tag, did we ever index the base
+ * type? If so, check for mask, otherwise it's not there.
+ */
+ if( slap_ad_is_lang( desc ) && desc != desc->ad_type->sat_ad ) {
+ /* has language tag */
+ bdb_attr_mask( be->be_private, desc->ad_type->sat_ad, &mask );
+
+ if ( mask && ( mask ^ SLAP_INDEX_NOLANG ) ) {
+ *atname = desc->ad_type->sat_cname;
+ *dbname = desc->ad_type->sat_cname.bv_val;
+ return mask;
+ }
+ }
+
+ /* see if supertype defined mask for its subtypes */
+ for( at = desc->ad_type; at != NULL ; at = at->sat_sup ) {
+ /* If no AD, we've never indexed this type */
+ if ( !at->sat_ad ) continue;
+
+ bdb_attr_mask( be->be_private, at->sat_ad, &mask );
+
+ if ( mask && ( mask ^ SLAP_INDEX_NOSUBTYPES ) ) {
+ *atname = at->sat_cname;
+ *dbname = at->sat_cname.bv_val;
+ return mask;
+ }
+ }
+
+ return 0;
+}
+
+int bdb_index_is_indexed(
+ Backend *be,
+ AttributeDescription *desc )
+{
+ slap_mask_t mask;
+ char *dbname;
+ struct berval prefix;
+
+ mask = index_mask( be, desc, &dbname, &prefix );
+
+ if( mask == 0 ) {
+ return LDAP_INAPPROPRIATE_MATCHING;
+ }
+
+ return LDAP_SUCCESS;
+}
+
+int bdb_index_param(
+ Backend *be,
+ AttributeDescription *desc,
+ int ftype,
+ DB **dbp,
+ slap_mask_t *maskp,
+ struct berval *prefixp )
+{
+ int rc;
+ slap_mask_t mask;
+ DB *db;
+ char *dbname;
+
+ mask = index_mask( be, desc, &dbname, prefixp );
+
+ if( mask == 0 ) {
+ return LDAP_INAPPROPRIATE_MATCHING;
+ }
+
+ rc = bdb_db_cache( be, dbname, &db );
+
+ if( rc != LDAP_SUCCESS ) {
+ return rc;
+ }
+
+ switch( ftype ) {
+ case LDAP_FILTER_PRESENT:
+ if( IS_SLAP_INDEX( mask, SLAP_INDEX_PRESENT ) ) {
+ goto done;
+ }
+ break;
+
+ case LDAP_FILTER_APPROX:
+ if( IS_SLAP_INDEX( mask, SLAP_INDEX_APPROX ) ) {
+ goto done;
+ }
+ /* fall thru */
+
+ case LDAP_FILTER_EQUALITY:
+ if( IS_SLAP_INDEX( mask, SLAP_INDEX_EQUALITY ) ) {
+ goto done;
+ }
+ break;
+
+ case LDAP_FILTER_SUBSTRINGS:
+ if( IS_SLAP_INDEX( mask, SLAP_INDEX_SUBSTR ) ) {
+ goto done;
+ }
+ break;
+
+ default:
+ return LDAP_OTHER;
+ }
+
+ return LDAP_INAPPROPRIATE_MATCHING;
+
+done:
+ *dbp = db;
+ *maskp = mask;
+ return LDAP_SUCCESS;
+}
+
+static int indexer(
+ Backend *be,
+ DB_TXN *txn,
+ char *dbname,
+ struct berval *atname,
+ BerVarray vals,
+ ID id,
+ int op,
+ slap_mask_t mask )
+{
+ int rc, i;
+ const char *text;
+ DB *db;
+ AttributeDescription *ad = NULL;
+ struct berval *keys;
+
+ assert( mask );
+
+ rc = bdb_db_cache( be, dbname, &db );
+
+ if ( rc != LDAP_SUCCESS ) {
+#ifdef NEW_LOGGING
+ LDAP_LOG( INDEX, ERR,
+ "bdb_index_read: Could not open DB %s\n", dbname, 0, 0 );
+#else
+ Debug( LDAP_DEBUG_ANY,
+ "<= bdb_index_read NULL (could not open %s)\n",
+ dbname, 0, 0 );
+#endif
+ return LDAP_OTHER;
+ }
+
+ rc = slap_bv2ad( atname, &ad, &text );
+ if( rc != LDAP_SUCCESS ) return rc;
+
+ if( IS_SLAP_INDEX( mask, SLAP_INDEX_PRESENT ) ) {
+ rc = bdb_key_change( be, db, txn, &presence_key, id, op );
+ if( rc ) {
+ goto done;
+ }
+ }
+
+ if( IS_SLAP_INDEX( mask, SLAP_INDEX_EQUALITY ) ) {
+ rc = ad->ad_type->sat_equality->smr_indexer(
+ LDAP_FILTER_EQUALITY,
+ mask,
+ ad->ad_type->sat_syntax,
+ ad->ad_type->sat_equality,
+ atname, vals, &keys );
+
+ if( rc == LDAP_SUCCESS && keys != NULL ) {
+ for( i=0; keys[i].bv_val != NULL; i++ ) {
+ rc = bdb_key_change( be, db, txn, &keys[i], id, op );
+ if( rc ) {
+ ber_bvarray_free( keys );
+ goto done;
+ }
+ }
+ ber_bvarray_free( keys );
+ }
+ rc = LDAP_SUCCESS;
+ }
+
+ if( IS_SLAP_INDEX( mask, SLAP_INDEX_APPROX ) ) {
+ rc = ad->ad_type->sat_approx->smr_indexer(
+ LDAP_FILTER_APPROX,
+ mask,
+ ad->ad_type->sat_syntax,
+ ad->ad_type->sat_approx,
+ atname, vals, &keys );
+
+ if( rc == LDAP_SUCCESS && keys != NULL ) {
+ for( i=0; keys[i].bv_val != NULL; i++ ) {
+ rc = bdb_key_change( be, db, txn, &keys[i], id, op );
+ if( rc ) {
+ ber_bvarray_free( keys );
+ goto done;
+ }
+ }
+ ber_bvarray_free( keys );
+ }
+
+ rc = LDAP_SUCCESS;
+ }
+
+ if( IS_SLAP_INDEX( mask, SLAP_INDEX_SUBSTR ) ) {
+ rc = ad->ad_type->sat_substr->smr_indexer(
+ LDAP_FILTER_SUBSTRINGS,
+ mask,
+ ad->ad_type->sat_syntax,
+ ad->ad_type->sat_substr,
+ atname, vals, &keys );
+
+ if( rc == LDAP_SUCCESS && keys != NULL ) {
+ for( i=0; keys[i].bv_val != NULL; i++ ) {
+ bdb_key_change( be, db, txn, &keys[i], id, op );
+ if( rc ) {
+ ber_bvarray_free( keys );
+ goto done;
+ }
+ }
+ ber_bvarray_free( keys );
+ }
+
+ rc = LDAP_SUCCESS;
+ }
+
+done:
+ return rc;
+}
+
+static int index_at_values(
+ Backend *be,
+ DB_TXN *txn,
+ AttributeType *type,
+ struct berval *lang,
+ BerVarray vals,
+ ID id,
+ int op )
+{
+ int rc;
+ slap_mask_t mask = 0;
+
+ if( type->sat_sup ) {
+ /* recurse */
+ rc = index_at_values( be, txn,
+ type->sat_sup, lang,
+ vals, id, op );
+
+ if( rc ) return rc;
+ }
+
+ /* If this type has no AD, we've never used it before */
+ if( type->sat_ad ) {
+ bdb_attr_mask( be->be_private, type->sat_ad, &mask );
+ }
+
+ if( mask ) {
+ rc = indexer( be, txn, type->sat_cname.bv_val,
+ &type->sat_cname,
+ vals, id, op,
+ mask );
+
+ if( rc ) return rc;
+ }
+
+ if( lang->bv_len ) {
+ AttributeDescription *desc;
+
+ mask = 0;
+
+ desc = ad_find_lang( type, lang );
+ if( desc ) {
+ bdb_attr_mask( be->be_private, desc, &mask );
+ }
+
+ if( mask ) {
+ rc = indexer( be, txn, desc->ad_cname.bv_val,
+ &desc->ad_cname,
+ vals, id, op,
+ mask );
+
+ if( rc ) {
+ return rc;
+ }
+ }
+ }
+
+ return LDAP_SUCCESS;
+}
+
+int bdb_index_values(
+ Backend *be,
+ DB_TXN *txn,
+ AttributeDescription *desc,
+ BerVarray vals,
+ ID id,
+ int op )
+{
+ int rc;
+
+ rc = index_at_values( be, txn,
+ desc->ad_type, &desc->ad_lang,
+ vals, id, op );
+
+ return rc;
+}
+
+int
+bdb_index_entry(
+ Backend *be,
+ DB_TXN *txn,
+ int op,
+ Entry *e,
+ Attribute *ap )
+{
+ int rc;
+
+#ifdef NEW_LOGGING
+ LDAP_LOG( INDEX, ENTRY, "index_entry: %s (%s) %ld\n",
+ op == SLAP_INDEX_ADD_OP ? "add" : "del", e->e_dn, (long) e->e_id );
+#else
+ Debug( LDAP_DEBUG_TRACE, "=> index_entry_%s( %ld, \"%s\" )\n",
+ op == SLAP_INDEX_ADD_OP ? "add" : "del",
+ (long) e->e_id, e->e_dn );
+#endif
+
+ /* add each attribute to the indexes */
+ for ( ; ap != NULL; ap = ap->a_next ) {
+ rc = bdb_index_values( be, txn,
+ ap->a_desc, ap->a_vals, e->e_id, op );
+
+ if( rc != LDAP_SUCCESS ) {
+#ifdef NEW_LOGGING
+ LDAP_LOG( INDEX, ENTRY,
+ "index_entry: failure (%d)\n", rc, 0, 0 );
+#else
+ Debug( LDAP_DEBUG_TRACE,
+ "<= index_entry_%s( %ld, \"%s\" ) failure\n",
+ op == SLAP_INDEX_ADD_OP ? "add" : "del",
+ (long) e->e_id, e->e_dn );
+#endif
+ return rc;
+ }
+ }
+
+#ifdef NEW_LOGGING
+ LDAP_LOG( INDEX, ENTRY, "index_entry: success\n", 0, 0, 0 );
+#else
+ Debug( LDAP_DEBUG_TRACE, "<= index_entry_%s( %ld, \"%s\" ) success\n",
+ op == SLAP_INDEX_ADD_OP ? "add" : "del",
+ (long) e->e_id, e->e_dn );
+#endif
+
+ return LDAP_SUCCESS;
+}
struct bdb_info *bdb;
#ifdef NEW_LOGGING
- LDAP_LOG(( "init", LDAP_LEVEL_ENTRY, "bdb_db_init" ));
+ LDAP_LOG( BACK_BDB, ENTRY, "bdb_db_init", 0, 0, 0 );
#else
Debug( LDAP_DEBUG_ANY,
"bdb_db_init: Initializing BDB database\n",
}
#ifdef NEW_LOGGING
- LDAP_LOG(( "init", LDAP_LEVEL_ERR, "bdb_db_init: aborted %d locks\n", aborted ));
+ LDAP_LOG( BACK_BDB, ERR, "bdb_db_init: aborted %d locks\n",
+ aborted, 0, 0 );
#else
Debug( LDAP_DEBUG_ANY,
"bdb_lock_detect: aborted %d locks\n",
u_int32_t flags;
#ifdef NEW_LOGGING
- LDAP_LOG(( "init", LDAP_LEVEL_ARGS, "bdb_db_open: %s\n", be->be_suffix[0].bv_val ));
+ LDAP_LOG( BACK_BDB, ARGS,
+ "bdb_db_open: %s\n", be->be_suffix[0].bv_val, 0, 0 );
#else
Debug( LDAP_DEBUG_ARGS,
"bdb_db_open: %s\n",
rc = db_env_create( &bdb->bi_dbenv, 0 );
if( rc != 0 ) {
#ifdef NEW_LOGGING
- LDAP_LOG(( "init", LDAP_LEVEL_ERR, "bdb_db_open: db_env_create failed: %s (%d)\n", db_strerror(rc), rc ));
+ LDAP_LOG( BACK_BDB, ERR,
+ "bdb_db_open: db_env_create failed: %s (%d)\n",
+ db_strerror(rc), rc, 0 );
#else
Debug( LDAP_DEBUG_ANY,
"bdb_db_open: db_env_create failed: %s (%d)\n",
}
flags = DB_INIT_MPOOL | DB_THREAD | DB_CREATE
- | DB_INIT_LOCK | DB_INIT_LOG | DB_INIT_TXN | DB_RECOVER;
+ | DB_INIT_LOCK | DB_INIT_LOG | DB_INIT_TXN;
+
+ /* Only slapd will do recovery, slap-tools won't. Otherwise
+ * running slapcat while slapd is active corrupts the db.
+ */
+ if( !(slapMode & SLAP_TOOL_MODE) ) flags |= DB_RECOVER;
bdb->bi_dbenv->set_errpfx( bdb->bi_dbenv, be->be_suffix[0].bv_val );
bdb->bi_dbenv->set_errcall( bdb->bi_dbenv, bdb_errcall );
rc = bdb->bi_dbenv->set_tmp_dir( bdb->bi_dbenv, dir );
if( rc != 0 ) {
#ifdef NEW_LOGGING
- LDAP_LOG(( "init", LDAP_LEVEL_ERR, "bdb_db_open: set_tmp_dir(%s) failed: %s (%d)\n", dir, db_strerror(rc), rc ));
+ LDAP_LOG( BACK_BDB, ERR,
+ "bdb_db_open: set_tmp_dir(%s) failed: %s (%d)\n",
+ dir, db_strerror(rc), rc );
#else
Debug( LDAP_DEBUG_ANY,
"bdb_db_open: set_tmp_dir(%s) failed: %s (%d)\n",
rc = bdb->bi_dbenv->set_lg_dir( bdb->bi_dbenv, dir );
if( rc != 0 ) {
#ifdef NEW_LOGGING
- LDAP_LOG(( "init", LDAP_LEVEL_ERR, "bdb_db_open: set_lg_dir(%s) failed: %s (%d)\n", dir, db_strerror(rc), rc ));
+ LDAP_LOG( BACK_BDB, ERR,
+ "bdb_db_open: set_lg_dir(%s) failed: %s (%d)\n",
+ dir, db_strerror(rc), rc );
#else
Debug( LDAP_DEBUG_ANY,
"bdb_db_open: set_lg_dir(%s) failed: %s (%d)\n",
rc = bdb->bi_dbenv->set_data_dir( bdb->bi_dbenv, dir );
if( rc != 0 ) {
#ifdef NEW_LOGGING
- LDAP_LOG(( "init", LDAP_LEVEL_ERR, "bdb_db_open: set_data_dir(%s) failed: %s (%d)\n", dir, db_strerror(rc), rc ));
+ LDAP_LOG( BACK_BDB, ERR,
+ "bdb_db_open: set_data_dir(%s) failed: %s (%d)\n",
+ dir, db_strerror(rc), rc );
#else
Debug( LDAP_DEBUG_ANY,
"bdb_db_open: set_data_dir(%s) failed: %s (%d)\n",
#endif
#ifdef NEW_LOGGING
- LDAP_LOG(( "init", LDAP_LEVEL_DETAIL1, "bdb_db_open: dbenv_open %s\n", bdb->bi_dbenv_home ));
+ LDAP_LOG( BACK_BDB, DETAIL1,
+ "bdb_db_open: dbenv_open %s\n", bdb->bi_dbenv_home, 0, 0 );
#else
Debug( LDAP_DEBUG_TRACE,
"bdb_db_open: dbenv_open(%s)\n",
bdb->bi_dbenv_mode );
if( rc != 0 ) {
#ifdef NEW_LOGGING
- LDAP_LOG(( "init", LDAP_LEVEL_ERR, "bdb_db_open: dbenv_open failed: %s (%d)\n", db_strerror(rc), rc ));
+ LDAP_LOG( BACK_BDB, ERR,
+ "bdb_db_open: dbenv_open failed: %s (%d)\n",
+ db_strerror(rc), rc, 0 );
#else
Debug( LDAP_DEBUG_ANY,
"bdb_db_open: dbenv_open failed: %s (%d)\n",
bdb->bi_dbenv_xflags, 1);
if( rc != 0 ) {
#ifdef NEW_LOGGING
- LDAP_LOG(( "init", LDAP_LEVEL_ERR, "bdb_db_open: dbenv_set_flags failed: %s (%d)\n", db_strerror(rc), rc ));
+ LDAP_LOG( BACK_BDB, ERR,
+ "bdb_db_open: dbenv_set_flags failed: %s (%d)\n",
+ db_strerror(rc), rc, 0 );
#else
Debug( LDAP_DEBUG_ANY,
"bdb_db_open: dbenv_set_flags failed: %s (%d)\n",
rc = db_create( &db->bdi_db, bdb->bi_dbenv, 0 );
if( rc != 0 ) {
#ifdef NEW_LOGGING
- LDAP_LOG(( "init", LDAP_LEVEL_ERR, "bdb_db_open: db_create(%s) failed: %s (%d)\n", bdb->bi_dbenv_home, db_strerror(rc), rc ));
+ LDAP_LOG( BACK_BDB, ERR,
+ "bdb_db_open: db_create(%s) failed: %s (%d)\n",
+ bdb->bi_dbenv_home, db_strerror(rc), rc );
#else
Debug( LDAP_DEBUG_ANY,
"bdb_db_open: db_create(%s) failed: %s (%d)\n",
if( rc != 0 ) {
#ifdef NEW_LOGGING
- LDAP_LOG(( "init", LDAP_LEVEL_ERR, "bdb_db_open: db_create(%s) failed: %s (%d)\n", bdb->bi_dbenv_home, db_strerror(rc), rc ));
+ LDAP_LOG( BACK_BDB, ERR,
+ "bdb_db_open: db_create(%s) failed: %s (%d)\n",
+ bdb->bi_dbenv_home, db_strerror(rc), rc );
#else
Debug( LDAP_DEBUG_ANY,
"bdb_db_open: db_open(%s) failed: %s (%d)\n",
rc = bdb_last_id( be, NULL );
if( rc != 0 ) {
#ifdef NEW_LOGGING
- LDAP_LOG(( "init", LDAP_LEVEL_ERR, "bdb_db_open: last_id(%s) failed: %s (%d)\n", bdb->bi_dbenv_home, db_strerror(rc), rc ));
+ LDAP_LOG( BACK_BDB, ERR,
+ "bdb_db_open: last_id(%s) failed: %s (%d)\n",
+ bdb->bi_dbenv_home, db_strerror(rc), rc );
#else
Debug( LDAP_DEBUG_ANY,
"bdb_db_open: last_id(%s) failed: %s (%d)\n",
rc = TXN_CHECKPOINT( bdb->bi_dbenv, 0, 0, DB_FORCE );
if( rc != 0 ) {
#ifdef NEW_LOGGING
- LDAP_LOG(( "init", LDAP_LEVEL_ERR, "bdb_db_destroy: txn_checkpoint failed: %s (%d)\n", db_strerror(rc), rc ));
+ LDAP_LOG( BACK_BDB, ERR,
+ "bdb_db_destroy: txn_checkpoint failed: %s (%d)\n",
+ db_strerror(rc), rc, 0 );
#else
Debug( LDAP_DEBUG_ANY,
"bdb_db_destroy: txn_checkpoint failed: %s (%d)\n",
bdb->bi_dbenv = NULL;
if( rc != 0 ) {
#ifdef NEW_LOGGING
- LDAP_LOG(( "init", LDAP_LEVEL_ERR, "bdb_db_destroy: close failed: %s (%d)\n", db_strerror(rc), rc ));
+ LDAP_LOG( BACK_BDB, ERR,
+ "bdb_db_destroy: close failed: %s (%d)\n",
+ db_strerror(rc), rc, 0 );
#else
Debug( LDAP_DEBUG_ANY,
"bdb_db_destroy: close failed: %s (%d)\n",
/* initialize the underlying database system */
#ifdef NEW_LOGGING
- LDAP_LOG(( "init", LDAP_LEVEL_ENTRY, "bdb_db_initialize\n" ));
+ LDAP_LOG( BACK_BDB, ENTRY, "bdb_db_initialize\n", 0, 0, 0 );
#else
Debug( LDAP_DEBUG_TRACE, "bdb_open: initialize BDB backend\n",
0, 0, 0 );
patch < DB_VERSION_PATCH )
{
#ifdef NEW_LOGGING
- LDAP_LOG(( "init", LDAP_LEVEL_ERR, "bdb_db_initialize: version mismatch: \texpected: %s \tgot: %s\n", DB_VERSION_STRING, version ));
+ LDAP_LOG( BACK_BDB, ERR,
+ "bdb_db_initialize: version mismatch: "
+ "\texpected: %s \tgot: %s\n", DB_VERSION_STRING, version, 0 );
#else
Debug( LDAP_DEBUG_ANY,
"bdb_open: version mismatch\n"
}
#ifdef NEW_LOGGING
- LDAP_LOG(( "init", LDAP_LEVEL_DETAIL1, "bdb_db_initialize: bdb_open: %s\n", version ));
+ LDAP_LOG( BACK_BDB, DETAIL1,
+ "bdb_db_initialize: bdb_open: %s\n", version, 0, 0 );
#else
Debug( LDAP_DEBUG_ANY, "bdb_open: %s\n",
version, 0, 0 );
DBT key;
#ifdef NEW_LOGGING
- LDAP_LOG(( "index", LDAP_LEVEL_ENTRY,
- "key_read: enter\n" ));
+ LDAP_LOG( INDEX, ENTRY, "key_read: enter\n", 0, 0, 0 );
#else
Debug( LDAP_DEBUG_TRACE, "=> key_read\n", 0, 0, 0 );
#endif
if( rc != LDAP_SUCCESS ) {
#ifdef NEW_LOGGING
- LDAP_LOG(( "index", LDAP_LEVEL_ERR,
- "bdb_key_read: failed (%d)\n",
- rc ));
+ LDAP_LOG( INDEX, ERR, "bdb_key_read: failed (%d)\n", rc, 0, 0 );
#else
Debug( LDAP_DEBUG_TRACE, "<= bdb_index_read: failed (%d)\n",
rc, 0, 0 );
#endif
} else {
#ifdef NEW_LOGGING
- LDAP_LOG(( "index", LDAP_LEVEL_DETAIL1,
- "bdb_key_read: %ld candidates\n", (long) BDB_IDL_N(ids) ));
+ LDAP_LOG( INDEX, DETAIL1,
+ "bdb_key_read: %ld candidates\n", (long)BDB_IDL_N(ids), 0, 0);
#else
Debug( LDAP_DEBUG_TRACE, "<= bdb_index_read %ld candidates\n",
(long) BDB_IDL_N(ids), 0, 0 );
DBT key;
#ifdef NEW_LOGGING
- LDAP_LOG(( "index", LDAP_LEVEL_DETAIL1,
- "key_change: %s ID %lx\n",
- op == SLAP_INDEX_ADD_OP ? "Add" : "Delete", (long) id ));
+ LDAP_LOG( INDEX, ENTRY, "key_change: %s ID %lx\n",
+ op == SLAP_INDEX_ADD_OP ? "Add" : "Delete", (long) id, 0 );
#else
Debug( LDAP_DEBUG_TRACE, "=> key_change(%s,%lx)\n",
op == SLAP_INDEX_ADD_OP ? "ADD":"DELETE", (long) id, 0 );
}
#ifdef NEW_LOGGING
- LDAP_LOG(( "index", LDAP_LEVEL_RESULTS,
- "key_change: return %d\n", rc ));
+ LDAP_LOG( INDEX, RESULTS, "key_change: return %d\n", rc, 0, 0 );
#else
Debug( LDAP_DEBUG_TRACE, "<= key_change %d\n", rc, 0, 0 );
#endif
Attribute *ap;
#ifdef NEW_LOGGING
- LDAP_LOG (( "modify", LDAP_LEVEL_ENTRY,"bdb_modify_internal: 0x%08lx: %s\n", e->e_id, e->e_dn ));
+ LDAP_LOG ( OPERATION, ENTRY, "bdb_modify_internal: 0x%08lx: %s\n",
+ e->e_id, e->e_dn, 0 );
#else
Debug( LDAP_DEBUG_TRACE, "bdb_modify_internal: 0x%08lx: %s\n",
e->e_id, e->e_dn, 0);
switch ( mod->sm_op ) {
case LDAP_MOD_ADD:
#ifdef NEW_LOGGING
- LDAP_LOG (( "modify", LDAP_LEVEL_DETAIL1, "bdb_modify_internal: add\n" ));
+ LDAP_LOG ( OPERATION, DETAIL1, "bdb_modify_internal: add\n", 0,0,0);
#else
Debug(LDAP_DEBUG_ARGS, "bdb_modify_internal: add\n", 0, 0, 0);
#endif
err = modify_add_values( e, mod, text, textbuf, textlen );
if( err != LDAP_SUCCESS ) {
#ifdef NEW_LOGGING
- LDAP_LOG (( "modify", LDAP_LEVEL_ERR, "bdb_modify_internal: %d %s\n", err, *text ));
+ LDAP_LOG ( OPERATION, ERR,
+ "bdb_modify_internal: %d %s\n", err, *text, 0 );
#else
Debug(LDAP_DEBUG_ARGS, "bdb_modify_internal: %d %s\n",
err, *text, 0);
case LDAP_MOD_DELETE:
#ifdef NEW_LOGGING
- LDAP_LOG (( "modify", LDAP_LEVEL_DETAIL1, "bdb_modify_internal: delete\n" ));
+ LDAP_LOG ( OPERATION, DETAIL1,
+ "bdb_modify_internal: delete\n", 0, 0, 0 );
#else
Debug(LDAP_DEBUG_ARGS, "bdb_modify_internal: delete\n", 0, 0, 0);
#endif
assert( err != LDAP_TYPE_OR_VALUE_EXISTS );
if( err != LDAP_SUCCESS ) {
#ifdef NEW_LOGGING
- LDAP_LOG (( "modify", LDAP_LEVEL_ERR, "bdb_modify_internal: %d %s\n", err, *text ));
+ LDAP_LOG ( OPERATION, ERR,
+ "bdb_modify_internal: %d %s\n", err, *text, 0 );
#else
Debug(LDAP_DEBUG_ARGS, "bdb_modify_internal: %d %s\n",
err, *text, 0);
case LDAP_MOD_REPLACE:
#ifdef NEW_LOGGING
- LDAP_LOG (( "modify", LDAP_LEVEL_DETAIL1, "bdb_modify_internal: replace\n" ));
+ LDAP_LOG ( OPERATION, DETAIL1,
+ "bdb_modify_internal: replace\n", 0, 0, 0 );
#else
Debug(LDAP_DEBUG_ARGS, "bdb_modify_internal: replace\n", 0, 0, 0);
#endif
err = modify_replace_values( e, mod, text, textbuf, textlen );
if( err != LDAP_SUCCESS ) {
#ifdef NEW_LOGGING
- LDAP_LOG (( "modify", LDAP_LEVEL_ERR, "bdb_modify_internal: %d %s\n", err, *text ));
+ LDAP_LOG ( OPERATION, ERR,
+ "bdb_modify_internal: %d %s\n", err, *text, 0 );
#else
Debug(LDAP_DEBUG_ARGS, "bdb_modify_internal: %d %s\n",
err, *text, 0);
case SLAP_MOD_SOFTADD:
#ifdef NEW_LOGGING
- LDAP_LOG (( "modify", LDAP_LEVEL_DETAIL1, "bdb_modify_internal: softadd\n" ));
+ LDAP_LOG ( OPERATION, DETAIL1,
+ "bdb_modify_internal: softadd\n",0,0,0 );
#else
Debug(LDAP_DEBUG_ARGS, "bdb_modify_internal: softadd\n", 0, 0, 0);
#endif
if( err != LDAP_SUCCESS ) {
#ifdef NEW_LOGGING
- LDAP_LOG (( "modify", LDAP_LEVEL_ERR, "bdb_modify_internal: %d %s\n", err, *text ));
+ LDAP_LOG ( OPERATION, ERR,
+ "bdb_modify_internal: %d %s\n", err, *text, 0 );
#else
Debug(LDAP_DEBUG_ARGS, "bdb_modify_internal: %d %s\n",
err, *text, 0);
default:
#ifdef NEW_LOGGING
- LDAP_LOG (( "modify", LDAP_LEVEL_ERR, "bdb_modify_internal: invalid op %d\n", mod->sm_op ));
+ LDAP_LOG ( OPERATION, ERR,
+ "bdb_modify_internal: invalid op %d\n", mod->sm_op, 0, 0 );
#else
Debug(LDAP_DEBUG_ANY, "bdb_modify_internal: invalid op %d\n",
mod->sm_op, 0, 0);
*text = "Invalid modify operation";
err = LDAP_OTHER;
#ifdef NEW_LOGGING
- LDAP_LOG (( "modify", LDAP_LEVEL_ERR, "bdb_modify_internal: %d %s\n", err, *text ));
+ LDAP_LOG ( OPERATION, ERR,
+ "bdb_modify_internal: %d %s\n", err, *text, 0 );
#else
Debug(LDAP_DEBUG_ARGS, "bdb_modify_internal: %d %s\n",
err, *text, 0);
attrs_free( e->e_attrs );
e->e_attrs = save_attrs;
#ifdef NEW_LOGGING
- LDAP_LOG (( "modify", LDAP_LEVEL_ERR, "bdb_modify_internal: entry failed schema check %s\n", *text ));
+ LDAP_LOG ( OPERATION, ERR,
+ "bdb_modify_internal: entry failed schema check %s\n",
+ *text, 0, 0 );
#else
Debug( LDAP_DEBUG_ANY, "entry failed schema check: %s\n",
*text, 0, 0 );
attrs_free( e->e_attrs );
e->e_attrs = save_attrs;
#ifdef NEW_LOGGING
- LDAP_LOG (( "modify", LDAP_LEVEL_ERR, "bdb_modify_internal: attribute index delete failure\n" ));
+ LDAP_LOG ( OPERATION, ERR,
+ "bdb_modify_internal: attribute index delete failure\n",
+ 0, 0, 0 );
#else
Debug( LDAP_DEBUG_ANY,
"Attribute index delete failure",
attrs_free( e->e_attrs );
e->e_attrs = save_attrs;
#ifdef NEW_LOGGING
- LDAP_LOG (( "modify", LDAP_LEVEL_ERR, "bdb_modify_internal: attribute index add failure\n" ));
+ LDAP_LOG ( OPERATION, ERR,
+ "bdb_modify_internal: attribute index add failure\n",
+ 0, 0, 0 );
#else
Debug( LDAP_DEBUG_ANY,
"Attribute index add failure",
DB_LOCK lock;
#ifdef NEW_LOGGING
- LDAP_LOG (( "modify", LDAP_LEVEL_ENTRY, "bdb_modify: %s\n", dn->bv_val ));
+ LDAP_LOG ( OPERATION, ENTRY, "bdb_modify: %s\n", dn->bv_val, 0, 0 );
#else
Debug( LDAP_DEBUG_ARGS, "bdb_modify: %s\n", dn->bv_val, 0, 0 );
#endif
bdb_unlocked_cache_return_entry_w(&bdb->bi_cache, e);
}
#ifdef NEW_LOGGING
- LDAP_LOG (( "modify", LDAP_LEVEL_DETAIL1, "bdb_modify: retrying...\n" ));
+ LDAP_LOG ( OPERATION, DETAIL1, "bdb_modify: retrying...\n", 0, 0, 0 );
#else
Debug(LDAP_DEBUG_TRACE,
"bdb_modify: retrying...\n", 0, 0, 0);
text = NULL;
if( rc != 0 ) {
#ifdef NEW_LOGGING
- LDAP_LOG (( "modify", LDAP_LEVEL_DETAIL1, "bdb_modify: txn_begin failed: %s (%d)\n", db_strerror(rc), rc ));
+ LDAP_LOG ( OPERATION, DETAIL1,
+ "bdb_modify: txn_begin failed: %s (%d)\n", db_strerror(rc), rc, 0 );
#else
Debug( LDAP_DEBUG_TRACE,
"bdb_modify: txn_begin failed: %s (%d)\n",
if ( rc != 0 ) {
#ifdef NEW_LOGGING
- LDAP_LOG (( "modify", LDAP_LEVEL_DETAIL1, "bdb_modify: dn2entry failed: (%d)\n", rc ));
+ LDAP_LOG ( OPERATION, DETAIL1,
+ "bdb_modify: dn2entry failed: (%d)\n", rc, 0, 0 );
#else
Debug( LDAP_DEBUG_TRACE,
"bdb_modify: dn2entry failed (%d)\n",
conn, op, e );
#ifdef NEW_LOGGING
- LDAP_LOG (( "modify", LDAP_LEVEL_DETAIL1, "bdb_modify: entry is referral\n" ));
+ LDAP_LOG ( OPERATION, DETAIL1, "bdb_modify: entry is referral\n", 0, 0, 0 );
#else
Debug( LDAP_DEBUG_TRACE,
"bdb_modify: entry is referral\n",
if( rc != LDAP_SUCCESS ) {
#ifdef NEW_LOGGING
- LDAP_LOG (( "modify", LDAP_LEVEL_ERR, "bdb_modify: modify failed (%d)\n", rc ));
+ LDAP_LOG ( OPERATION, ERR,
+ "bdb_modify: modify failed (%d)\n", rc, 0, 0 );
#else
Debug( LDAP_DEBUG_TRACE,
"bdb_modify: modify failed (%d)\n",
rc = bdb_id2entry_update( be, ltid, e );
if ( rc != 0 ) {
#ifdef NEW_LOGGING
- LDAP_LOG (( "modify", LDAP_LEVEL_ERR, "bdb_modify: id2entry update failed (%d)\n", rc ));
+ LDAP_LOG ( OPERATION, ERR,
+ "bdb_modify: id2entry update failed (%d)\n", rc, 0, 0 );
#else
Debug( LDAP_DEBUG_TRACE,
"bdb_modify: id2entry update failed (%d)\n",
if( rc != 0 ) {
#ifdef NEW_LOGGING
- LDAP_LOG (( "modify", LDAP_LEVEL_ERR, "bdb_modify: txn_%s failed %s (%d)\n", op->o_noop ? "abort (no_op)" : "commit", db_strerror(rc), rc ));
+ LDAP_LOG ( OPERATION, ERR,
+ "bdb_modify: txn_%s failed %s (%d)\n",
+ op->o_noop ? "abort (no_op)" : "commit", db_strerror(rc), rc );
#else
Debug( LDAP_DEBUG_TRACE,
"bdb_modify: txn_%s failed: %s (%d)\n",
} else {
#ifdef NEW_LOGGING
- LDAP_LOG (( "modify", LDAP_LEVEL_DETAIL1, "bdb_modify: updated%s id=%08lx dn=\"%s\"\n", op->o_noop ? " (no_op)" : "", e->e_id, e->e_dn ));
+ LDAP_LOG ( OPERATION, DETAIL1,
+ "bdb_modify: updated%s id=%08lx dn=\"%s\"\n",
+ op->o_noop ? " (no_op)" : "", e->e_id, e->e_dn );
#else
Debug( LDAP_DEBUG_TRACE,
"bdb_modify: updated%s id=%08lx dn=\"%s\"\n",
DB_LOCK lock;
#ifdef NEW_LOGGING
- LDAP_LOG (( "modrdn", LDAP_LEVEL_ENTRY, "==>bdb_modrdn(%s,%s,%s)\n",
- dn->bv_val,newrdn->bv_val,
- newSuperior ? newSuperior->bv_val : "NULL" ));
+ LDAP_LOG ( OPERATION, ENTRY, "==>bdb_modrdn(%s,%s,%s)\n",
+ dn->bv_val,newrdn->bv_val, newSuperior ? newSuperior->bv_val : "NULL" );
#else
Debug( LDAP_DEBUG_TRACE, "==>bdb_modrdn(%s,%s,%s)\n",
dn->bv_val, newrdn->bv_val,
bdb_unlocked_cache_return_entry_r(&bdb->bi_cache, np);
}
#ifdef NEW_LOGGING
- LDAP_LOG (( "modrdn", LDAP_LEVEL_DETAIL1, "==>bdb_modrdn: retrying...\n"));
+ LDAP_LOG ( OPERATION, DETAIL1, "==>bdb_modrdn: retrying...\n", 0, 0, 0);
#else
Debug( LDAP_DEBUG_TRACE, "==>bdb_modrdn: retrying...\n", 0, 0, 0 );
#endif
text = NULL;
if( rc != 0 ) {
#ifdef NEW_LOGGING
- LDAP_LOG (( "modrdn", LDAP_LEVEL_ERR, "==>bdb_modrdn: txn_begin failed: %s (%d)\n", db_strerror(rc), rc ));
+ LDAP_LOG ( OPERATION, ERR,
+ "==>bdb_modrdn: txn_begin failed: %s (%d)\n",
+ db_strerror(rc), rc, 0 );
#else
Debug( LDAP_DEBUG_TRACE,
"bdb_delete: txn_begin failed: %s (%d)\n",
conn, op, e );
#ifdef NEW_LOGGING
- LDAP_LOG (( "modrdn", LDAP_LEVEL_DETAIL1, "==>bdb_modrdn: entry %s is referral \n", e->e_dn ));
+ LDAP_LOG ( OPERATION, DETAIL1,
+ "==>bdb_modrdn: entry %s is referral \n", e->e_dn, 0, 0 );
#else
Debug( LDAP_DEBUG_TRACE, "bdb_modrdn: entry %s is referral\n",
e->e_dn, 0, 0 );
if( p == NULL) {
#ifdef NEW_LOGGING
- LDAP_LOG (( "modrdn", LDAP_LEVEL_ERR, "==>bdb_modrdn: parent does not exist\n" ));
+ LDAP_LOG ( OPERATION, ERR,
+ "==>bdb_modrdn: parent does not exist\n", 0, 0, 0 );
#else
Debug( LDAP_DEBUG_TRACE, "bdb_modrdn: parent does not exist\n",
0, 0, 0);
children, NULL, ACL_WRITE, NULL ) )
{
#ifdef NEW_LOGGING
- LDAP_LOG (( "modrdn", LDAP_LEVEL_ERR, "==>bdb_modrdn: no access to parent\n" ));
+ LDAP_LOG ( OPERATION, ERR,
+ "==>bdb_modrdn: no access to parent\n", 0, 0, 0 );
#else
Debug( LDAP_DEBUG_TRACE, "no access to parent\n", 0,
0, 0 );
}
#ifdef NEW_LOGGING
- LDAP_LOG (( "modrdn", LDAP_LEVEL_DETAIL1, "==>bdb_modrdn: wr to children %s is OK\n", p_ndn.bv_val ));
+ LDAP_LOG ( OPERATION, DETAIL1,
+ "==>bdb_modrdn: wr to children %s is OK\n", p_ndn.bv_val, 0, 0 );
#else
Debug( LDAP_DEBUG_TRACE,
"bdb_modrdn: wr to children of entry %s OK\n",
}
#ifdef NEW_LOGGING
- LDAP_LOG (( "modrdn", LDAP_LEVEL_DETAIL1, "==>bdb_modrdn: parent dn=%s\n", p_dn.bv_val ));
+ LDAP_LOG ( OPERATION, DETAIL1,
+ "==>bdb_modrdn: parent dn=%s\n", p_dn.bv_val, 0, 0 );
#else
Debug( LDAP_DEBUG_TRACE,
"bdb_modrdn: parent dn=%s\n",
if ( ! rc )
{
#ifdef NEW_LOGGING
- LDAP_LOG (( "modrdn", LDAP_LEVEL_ERR, "==>bdb_modrdn: no access to parent\n" ));
+ LDAP_LOG ( OPERATION, ERR,
+ "==>bdb_modrdn: no access to parent\n", 0, 0, 0 );
#else
Debug( LDAP_DEBUG_TRACE,
"no access to parent\n",
}
#ifdef NEW_LOGGING
- LDAP_LOG (( "modrdn", LDAP_LEVEL_DETAIL1, "==>bdb_modrdn: wr to children of entry \"\" OK\n", p_dn.bv_val ));
+ LDAP_LOG ( OPERATION, DETAIL1,
+ "==>bdb_modrdn: wr to children of entry \"%s\" OK\n",
+ p_dn.bv_val, 0, 0 );
#else
Debug( LDAP_DEBUG_TRACE,
"bdb_modrdn: wr to children of entry \"\" OK\n",
p_dn.bv_len = 0;
#ifdef NEW_LOGGING
- LDAP_LOG (( "modrdn", LDAP_LEVEL_DETAIL1, "==>bdb_modrdn: parent dn=\"\" \n" ));
+ LDAP_LOG ( OPERATION, DETAIL1,
+ "==>bdb_modrdn: parent dn=\"\" \n", 0, 0, 0 );
#else
Debug( LDAP_DEBUG_TRACE,
"bdb_modrdn: parent dn=\"\"\n",
} else {
#ifdef NEW_LOGGING
- LDAP_LOG (( "modrdn", LDAP_LEVEL_ERR, "==>bdb_modrdn: no parent, not root &\"\" is not suffix\n" ));
+ LDAP_LOG ( OPERATION, ERR,
+ "==>bdb_modrdn: no parent, not root &\"\" is not "
+ "suffix\n", 0, 0, 0 );
#else
Debug( LDAP_DEBUG_TRACE,
"bdb_modrdn: no parent, not root "
if ( newSuperior != NULL ) {
#ifdef NEW_LOGGING
- LDAP_LOG (( "modrdn", LDAP_LEVEL_DETAIL1, "==>bdb_modrdn: new parent \"%s\" requested...\n", newSuperior->bv_val ));
+ LDAP_LOG ( OPERATION, DETAIL1,
+ "==>bdb_modrdn: new parent \"%s\" requested...\n",
+ newSuperior->bv_val, 0, 0 );
#else
Debug( LDAP_DEBUG_TRACE,
"bdb_modrdn: new parent \"%s\" requested...\n",
if( np == NULL) {
#ifdef NEW_LOGGING
- LDAP_LOG (( "modrdn", LDAP_LEVEL_DETAIL1, "==>bdb_modrdn: newSup(ndn=%s) not here!\n", np_ndn->bv_val ));
+ LDAP_LOG ( OPERATION, DETAIL1,
+ "==>bdb_modrdn: newSup(ndn=%s) not here!\n",
+ np_ndn->bv_val, 0, 0 );
#else
Debug( LDAP_DEBUG_TRACE,
"bdb_modrdn: newSup(ndn=%s) not here!\n",
}
#ifdef NEW_LOGGING
- LDAP_LOG (( "modrdn", LDAP_LEVEL_DETAIL1, "==>bdb_modrdn: wr to new parent OK np=%p, id=%ld\n", np, (long) np->e_id ));
+ LDAP_LOG ( OPERATION, DETAIL1,
+ "==>bdb_modrdn: wr to new parent OK np=%p, id=%ld\n",
+ np, (long) np->e_id, 0 );
#else
Debug( LDAP_DEBUG_TRACE,
"bdb_modrdn: wr to new parent OK np=%p, id=%ld\n",
/* check newSuperior for "children" acl */
if ( !access_allowed( be, conn, op, np, children, NULL, ACL_WRITE, NULL ) ) {
#ifdef NEW_LOGGING
- LDAP_LOG (( "modrdn", LDAP_LEVEL_DETAIL1, "==>bdb_modrdn: no wr to newSup children\n" ));
+ LDAP_LOG ( OPERATION, DETAIL1,
+ "==>bdb_modrdn: no wr to newSup children\n", 0, 0, 0 );
#else
Debug( LDAP_DEBUG_TRACE,
"bdb_modrdn: no wr to newSup children\n",
if ( is_entry_alias( np ) ) {
/* parent is an alias, don't allow add */
#ifdef NEW_LOGGING
- LDAP_LOG (( "modrdn", LDAP_LEVEL_DETAIL1, "==>bdb_modrdn: entry is alias\n" ));
+ LDAP_LOG ( OPERATION, DETAIL1,
+ "==>bdb_modrdn: entry is alias\n", 0, 0, 0 );
#else
Debug( LDAP_DEBUG_TRACE, "bdb_modrdn: entry is alias\n",
0, 0, 0 );
if ( is_entry_referral( np ) ) {
/* parent is a referral, don't allow add */
#ifdef NEW_LOGGING
- LDAP_LOG (( "modrdn", LDAP_LEVEL_DETAIL1, "==>bdb_modrdn: entry is referral\n" ));
+ LDAP_LOG ( OPERATION, DETAIL1,
+ "==>bdb_modrdn: entry is referral\n", 0, 0, 0 );
#else
Debug( LDAP_DEBUG_TRACE, "bdb_modrdn: entry is referral\n",
0, 0, 0 );
if ( ! rc )
{
#ifdef NEW_LOGGING
- LDAP_LOG (( "modrdn", LDAP_LEVEL_ERR, "==>bdb_modrdn: no access to superior\n" ));
+ LDAP_LOG ( OPERATION, ERR,
+ "==>bdb_modrdn: no access to superior\n", 0, 0, 0 );
#else
Debug( LDAP_DEBUG_TRACE,
"no access to new superior\n",
}
#ifdef NEW_LOGGING
- LDAP_LOG (( "modrdn", LDAP_LEVEL_DETAIL1, "bdb_modrdn: wr to children entry \"\" OK\n" ));
+ LDAP_LOG ( OPERATION, DETAIL1,
+ "bdb_modrdn: wr to children entry \"\" OK\n", 0, 0, 0 );
#else
Debug( LDAP_DEBUG_TRACE,
"bdb_modrdn: wr to children of entry \"\" OK\n",
} else {
#ifdef NEW_LOGGING
- LDAP_LOG (( "modrdn", LDAP_LEVEL_ERR, "bdb_modrdn: new superior=\"\", not root & \"\" is not suffix\n" ));
+ LDAP_LOG ( OPERATION, ERR,
+ "bdb_modrdn: new superior=\"\", not root & \"\" "
+ "is not suffix\n", 0, 0, 0 );
#else
Debug( LDAP_DEBUG_TRACE,
"bdb_modrdn: new superior=\"\", not root "
}
#ifdef NEW_LOGGING
- LDAP_LOG (( "modrdn", LDAP_LEVEL_DETAIL1, "bdb_modrdn: new superior=\"\"\n" ));
+ LDAP_LOG ( OPERATION, DETAIL1,
+ "bdb_modrdn: new superior=\"\"\n", 0, 0, 0 );
#else
Debug( LDAP_DEBUG_TRACE,
"bdb_modrdn: new superior=\"\"\n",
}
#ifdef NEW_LOGGING
- LDAP_LOG (( "modrdn", LDAP_LEVEL_DETAIL1, "bdb_modrdn: wr to new parent's children OK\n" ));
+ LDAP_LOG ( OPERATION, DETAIL1,
+ "bdb_modrdn: wr to new parent's children OK\n", 0, 0, 0 );
#else
Debug( LDAP_DEBUG_TRACE,
"bdb_modrdn: wr to new parent's children OK\n",
dnNormalize2( NULL, &new_dn, &new_ndn );
#ifdef NEW_LOGGING
- LDAP_LOG (( "modrdn", LDAP_LEVEL_RESULTS, "bdb_modrdn: new ndn=%s\n", new_ndn.bv_val ));
+ LDAP_LOG ( OPERATION, RESULTS,
+ "bdb_modrdn: new ndn=%s\n", new_ndn.bv_val, 0, 0 );
#else
Debug( LDAP_DEBUG_TRACE, "bdb_modrdn: new ndn=%s\n",
new_ndn.bv_val, 0, 0 );
}
#ifdef NEW_LOGGING
- LDAP_LOG (( "modrdn", LDAP_LEVEL_ERR, "bdb_modrdn: new ndn=%s does not exist\n", new_ndn.bv_val ));
+ LDAP_LOG ( OPERATION, ERR,
+ "bdb_modrdn: new ndn=%s does not exist\n", new_ndn.bv_val, 0, 0 );
#else
Debug( LDAP_DEBUG_TRACE,
"bdb_modrdn: new ndn=%s does not exist\n",
LDAP_DN_FORMAT_LDAP ) )
{
#ifdef NEW_LOGGING
- LDAP_LOG (( "modrdn", LDAP_LEVEL_ERR, "bdb_modrdn: can't figure out type(s)/values(s) of newrdn\n" ));
+ LDAP_LOG ( OPERATION, ERR,
+ "bdb_modrdn: can't figure out type(s)/values(s) of newrdn\n",
+ 0, 0, 0 );
#else
Debug( LDAP_DEBUG_TRACE,
"bdb_modrdn: can't figure out type(s)/values(s) "
}
#ifdef NEW_LOGGING
- LDAP_LOG (( "modrdn", LDAP_LEVEL_RESULTS, "bdb_modrdn: new_rdn_type=\"%s\", new_rdn_val=\"%s\"\n", new_rdn[0][0]->la_attr.bv_val, new_rdn[0][0]->la_value.bv_val ));
+ LDAP_LOG ( OPERATION, RESULTS,
+ "bdb_modrdn: new_rdn_type=\"%s\", new_rdn_val=\"%s\"\n",
+ new_rdn[0][0]->la_attr.bv_val, new_rdn[0][0]->la_value.bv_val, 0 );
#else
Debug( LDAP_DEBUG_TRACE,
"bdb_modrdn: new_rdn_type=\"%s\", new_rdn_val=\"%s\"\n",
LDAP_DN_FORMAT_LDAP ) )
{
#ifdef NEW_LOGGING
- LDAP_LOG (( "modrdn", LDAP_LEVEL_ERR, "bdb_modrdn: can't figure out type(s)/values(s) of old_rdn\n" ));
+ LDAP_LOG ( OPERATION, ERR,
+ "bdb_modrdn: can't figure out type(s)/values(s) of old_rdn\n",
+ 0, 0, 0 );
#else
Debug( LDAP_DEBUG_TRACE,
"bdb_back_modrdn: can't figure out the old_rdn "
( const char ** )new_rdn_types ) != 0 ) {
/* Not a big deal but we may say something */
#ifdef NEW_LOGGING
- LDAP_LOG (( "modrdn", LDAP_LEVEL_ERR, "bdb_modrdn: old_rdn_type(s)=%s, new_rdn_type(s)=%s do not match\n", old_rdn_types[ 0 ], new_rdn_types[ 0 ] ));
+ LDAP_LOG ( OPERATION, ERR,
+ "bdb_modrdn: old_rdn_type(s)=%s, new_rdn_type(s)=%s do not match\n",
+ old_rdn_types[ 0 ], new_rdn_types[ 0 ], 0 );
#else
Debug( LDAP_DEBUG_TRACE,
"bdb_modrdn: old_rdn_type(s)=%s, new_rdn_type(s)=%s "
if ( rc != LDAP_SUCCESS ) {
#ifdef NEW_LOGGING
- LDAP_LOG (( "modrdn", LDAP_LEVEL_ERR, "bdb_modrdn: %s: %s (new)\n", text, new_rdn[0][a_cnt]->la_attr.bv_val ));
+ LDAP_LOG ( OPERATION, ERR, "bdb_modrdn: %s: %s (new)\n",
+ text, new_rdn[0][a_cnt]->la_attr.bv_val, 0 );
#else
Debug( LDAP_DEBUG_TRACE,
"bdb_modrdn: %s: %s (new)\n",
if ( !access_allowed( be, conn, op, e, desc,
&new_rdn[0][ a_cnt ]->la_value, ACL_WRITE, NULL ) ) {
#ifdef NEW_LOGGING
- LDAP_LOG (( "modrdn", LDAP_LEVEL_ERR, "bdb_modrdn: access to attr \"%s\" (new) not allowed\n", new_rdn[0][a_cnt]->la_attr.bv_val ));
+ LDAP_LOG ( OPERATION, ERR,
+ "bdb_modrdn: access to attr \"%s\" (new) not allowed\n",
+ new_rdn[0][a_cnt]->la_attr.bv_val, 0, 0 );
#else
Debug( LDAP_DEBUG_TRACE,
"bdb_modrdn: access to attr \"%s\" "
/* Get value of old rdn */
if ( old_rdn == NULL) {
#ifdef NEW_LOGGING
- LDAP_LOG (( "modrdn", LDAP_LEVEL_ERR, "bdb_modrdn: can't figure out old RDN values(s) from old RDN\n" ));
+ LDAP_LOG ( OPERATION, ERR,
+ "bdb_modrdn: can't figure out old RDN values(s) "
+ "from old RDN\n", 0, 0, 0 );
#else
Debug( LDAP_DEBUG_TRACE,
"bdb_modrdn: can't figure out old RDN value(s) "
if ( rc != LDAP_SUCCESS ) {
#ifdef NEW_LOGGING
- LDAP_LOG (( "modrdn", LDAP_LEVEL_ERR, "bdb_modrdn: %s: %s (old)\n", text, old_rdn[0][d_cnt]->la_attr.bv_val ));
+ LDAP_LOG ( OPERATION, ERR, "bdb_modrdn: %s: %s (old)\n",
+ text, old_rdn[0][d_cnt]->la_attr.bv_val, 0 );
#else
Debug( LDAP_DEBUG_TRACE,
"bdb_modrdn: %s: %s (old)\n",
if ( !access_allowed( be, conn, op, e, desc,
&old_rdn[0][d_cnt]->la_value, ACL_WRITE, NULL ) ) {
#ifdef NEW_LOGGING
- LDAP_LOG (( "modrdn", LDAP_LEVEL_ERR, "bdb_modrdn: access to attr \"%s\" (old) not allowed\n", old_rdn[0][d_cnt]->la_attr.bv_val ));
+ LDAP_LOG ( OPERATION, ERR,
+ "bdb_modrdn: access to attr \"%s\" (old) not allowed\n",
+ old_rdn[0][d_cnt]->la_attr.bv_val, 0, 0 );
#else
Debug( LDAP_DEBUG_TRACE,
"bdb_modrdn: access to attr \"%s\" "
if( rc == LDAP_SUCCESS ) {
#ifdef NEW_LOGGING
- LDAP_LOG (( "modrdn", LDAP_LEVEL_RESULTS, "bdb_modrdn: rdn modified%s id=%08lx dn=\"%s\"\n", op->o_noop ? " (no-op)" : "", e->e_id, e->e_dn ));
+ LDAP_LOG ( OPERATION, RESULTS,
+ "bdb_modrdn: rdn modified%s id=%08lx dn=\"%s\"\n",
+ op->o_noop ? " (no-op)" : "", e->e_id, e->e_dn );
#else
Debug(LDAP_DEBUG_TRACE,
"bdb_modrdn: rdn modified%s id=%08lx dn=\"%s\"\n",
} else {
#ifdef NEW_LOGGING
- LDAP_LOG (( "modrdn", LDAP_LEVEL_RESULTS, "bdb_modrdn: %s : %s (%d)\n", text, db_strerror(rc), rc ));
+ LDAP_LOG ( OPERATION, RESULTS, "bdb_modrdn: %s : %s (%d)\n",
+ text, db_strerror(rc), rc );
#else
Debug( LDAP_DEBUG_TRACE, "bdb_add: %s : %s (%d)\n",
text, db_strerror(rc), rc );
default:
#ifdef NEW_LOGGING
- LDAP_LOG (( "nextid", LDAP_LEVEL_ERR,
- "bdb_last_id: get failed: %s (%d)\n",
- db_strerror(rc), rc ));
+ LDAP_LOG ( INDEX, ERR, "bdb_last_id: get failed: %s (%d)\n",
+ db_strerror(rc), rc, 0 );
#else
Debug( LDAP_DEBUG_ANY,
"=> bdb_last_id: get failed: %s (%d)\n",
Attribute **aa = a;
int rc;
DB_TXN *ltid = NULL;
- struct bdb_op_info opinfo;
+ struct bdb_op_info opinfo;
assert( e );
}
#endif
#ifdef NEW_LOGGING
- LDAP_LOG (( "operational", LDAP_LEVEL_DETAIL1,
- "=> bdb_operational: retrying...\n" ));
+ LDAP_LOG ( OPERATION, DETAIL1,
+ "=> bdb_operational: retrying...\n", 0, 0, 0 );
#else
Debug( LDAP_DEBUG_TRACE, "==> bdb_operational: retrying...\n",
0, 0, 0 );
rc = TXN_BEGIN( bdb->bi_dbenv, NULL, <id, bdb->bi_db_opflags );
if ( rc != 0 ) {
#ifdef NEW_LOGGING
- LDAP_LOG (( "operational", LDAP_LEVEL_ERR,
+ LDAP_LOG ( OPERATION, ERR,
"=> bdb_operational: txn_begin failed: %s (%d)\n",
- db_strerror(rc), rc ));
+ db_strerror(rc), rc, 0 );
#else
Debug( LDAP_DEBUG_TRACE,
"bdb_operational: txn_begin failed: %s (%d)\n",
default:
#ifdef NEW_LOGGING
- LDAP_LOG (( "operational", LDAP_LEVEL_ERR,
+ LDAP_LOG ( OPERATION, ERR,
"=> bdb_operational: has_children failed: %s (%d)\n",
- db_strerror(rc), rc ));
+ db_strerror(rc), rc, 0 );
#else
Debug(LDAP_DEBUG_ARGS,
"<=- bdb_operational: has_children failed: %s (%d)\n",
&id, NULL, &new, text );
#ifdef NEW_LOGGING
- LDAP_LOG (( "passwd", LDAP_LEVEL_ENTRY, "==>bdb_exop_passwd: \"%s\"\n",
- id.bv_val ? id.bv_val : "" ));
+ LDAP_LOG ( ACL, ENTRY,
+ "==>bdb_exop_passwd: \"%s\"\n", id.bv_val ? id.bv_val : "", 0, 0 );
#else
Debug( LDAP_DEBUG_ARGS, "==> bdb_exop_passwd: \"%s\"\n",
id.bv_val ? id.bv_val : "", 0, 0 );
}
#ifdef NEW_LOGGING
- LDAP_LOG (( "passwd", LDAP_LEVEL_DETAIL1, "bdb_exop_passwd: \"%s\"%s\"\n",
- dn.bv_val, id.bv_len ? " (proxy)" : "" ));
+ LDAP_LOG ( ACL, DETAIL1, "bdb_exop_passwd: \"%s\"%s\"\n",
+ dn.bv_val, id.bv_len ? " (proxy)" : "", 0 );
#else
Debug( LDAP_DEBUG_TRACE, "bdb_exop_passwd: \"%s\"%s\n",
dn.bv_val, id.bv_len ? " (proxy)" : "", 0 );
bdb_cache_return_entry_w(bdb->bi_dbenv, &bdb->bi_cache, e, &lock);
}
#ifdef NEW_LOGGING
- LDAP_LOG (( "passwd", LDAP_LEVEL_DETAIL1, "bdb_exop_passwd: retrying...\n" ));
+ LDAP_LOG ( ACL, DETAIL1, "bdb_exop_passwd: retrying...\n", 0, 0, 0 );
#else
Debug( LDAP_DEBUG_TRACE, "bdb_exop_passwd: retrying...\n", 0, 0, 0 );
#endif
*text = NULL;
if( rc != 0 ) {
#ifdef NEW_LOGGING
- LDAP_LOG (( "passwd", LDAP_LEVEL_ERR, "bdb_exop_passwd: txn_begin failed: %s (%d)\n", db_strerror(rc), rc ));
+ LDAP_LOG ( ACL, ERR,
+ "bdb_exop_passwd: txn_begin failed: %s (%d)\n",
+ db_strerror(rc), rc, 0 );
#else
Debug( LDAP_DEBUG_TRACE,
"bdb_exop_passwd: txn_begin failed: %s (%d)\n",
goto dn2entry_retry;
default:
#ifdef NEW_LOGGING
- LDAP_LOG (( "referral", LDAP_LEVEL_ERR,
- "bdb_referrals: dn2entry failed: %s (%d)\n",
- db_strerror(rc), rc ));
+ LDAP_LOG ( OPERATION, ERR,
+ "bdb_referrals: dn2entry failed: %s (%d)\n",
+ db_strerror(rc), rc, 0 );
#else
Debug( LDAP_DEBUG_TRACE,
"bdb_referrals: dn2entry failed: %s (%d)\n",
matched_dn = ch_strdup( matched->e_dn );
#ifdef NEW_LOGGING
- LDAP_LOG (( "referral", LDAP_LEVEL_DETAIL1,
+ LDAP_LOG ( OPERATION, DETAIL1,
"bdb_referrals: op=%ld target=\"%s\" matched=\"%s\"\n",
- (long) op->o_tag, dn->bv_val, matched_dn ));
+ (long) op->o_tag, dn->bv_val, matched_dn );
#else
Debug( LDAP_DEBUG_TRACE,
"bdb_referrals: op=%ld target=\"%s\" matched=\"%s\"\n",
refs, &e->e_name, dn, LDAP_SCOPE_DEFAULT );
#ifdef NEW_LOGGING
- LDAP_LOG (( "referral", LDAP_LEVEL_DETAIL1,
+ LDAP_LOG ( OPERATION, DETAIL1,
"bdb_referrals: op=%ld target=\"%s\" matched=\"%s\"\n",
- (long) op->o_tag, dn->bv_val, e->e_dn ));
+ (long) op->o_tag, dn->bv_val, e->e_dn );
#else
Debug( LDAP_DEBUG_TRACE,
"bdb_referrals: op=%ld target=\"%s\" matched=\"%s\"\n",
DB_LOCK lock;
#ifdef NEW_LOGGING
- LDAP_LOG (( "search", LDAP_LEVEL_ENTRY,"bdb_back_search\n"));
+ LDAP_LOG ( OPERATION, ENTRY, "bdb_back_search\n", 0, 0, 0 );
#else
Debug( LDAP_DEBUG_TRACE, "=> bdb_back_search\n",
0, 0, 0);
}
#ifdef NEW_LOGGING
- LDAP_LOG (( "search", LDAP_LEVEL_RESULTS,"bdb_search: entry is referral\n"));
+ LDAP_LOG ( OPERATION, RESULTS,
+ "bdb_search: entry is referral\n", 0, 0, 0 );
#else
Debug( LDAP_DEBUG_TRACE, "bdb_search: entry is referral\n",
0, 0, 0 );
if ( candidates[0] == 0 ) {
#ifdef NEW_LOGGING
- LDAP_LOG (( "search", LDAP_LEVEL_RESULTS,"bdb_search: no candidates\n"));
+ LDAP_LOG ( OPERATION, RESULTS, "bdb_search: no candidates\n", 0, 0, 0 );
#else
Debug( LDAP_DEBUG_TRACE, "bdb_search: no candidates\n",
0, 0, 0 );
if( !BDB_IDL_IS_RANGE(candidates) ) {
/* only complain for non-range IDLs */
#ifdef NEW_LOGGING
- LDAP_LOG (( "search", LDAP_LEVEL_RESULTS,"bdb_search: candidate %ld not found\n", (long) id));
+ LDAP_LOG ( OPERATION, RESULTS,
+ "bdb_search: candidate %ld not found\n", (long) id, 0, 0);
#else
Debug( LDAP_DEBUG_TRACE,
"bdb_search: candidate %ld not found\n",
} else if ( dnIsSuffix( &e->e_nname, &realbase ) ) {
/* alias is within scope */
#ifdef NEW_LOGGING
- LDAP_LOG (( "search", LDAP_LEVEL_RESULTS,"bdb_search: \"%s\" in subtree\n", e->edn));
+ LDAP_LOG ( OPERATION, RESULTS,
+ "bdb_search: \"%s\" in subtree\n", e->edn, 0, 0);
#else
Debug( LDAP_DEBUG_TRACE,
"bdb_search: \"%s\" in subtree\n",
} else {
#ifdef NEW_LOGGING
- LDAP_LOG(( "backend", LDAP_LEVEL_DETAIL2,
+ LDAP_LOG(OPERATION, DETAIL2,
"bdb_search: candidate referral %ld scope not okay\n",
- id ));
+ id, 0, 0 );
#else
Debug( LDAP_DEBUG_TRACE,
"bdb_search: candidate referral %ld scope not okay\n",
}
} else {
#ifdef NEW_LOGGING
- LDAP_LOG (( "search", LDAP_LEVEL_RESULTS,"bdb_search: %ld scope not okay\n", (long) id));
+ LDAP_LOG ( OPERATION, RESULTS,
+ "bdb_search: %ld scope not okay\n", (long) id, 0, 0);
#else
Debug( LDAP_DEBUG_TRACE,
"bdb_search: %ld scope not okay\n",
}
} else {
#ifdef NEW_LOGGING
- LDAP_LOG (( "search", LDAP_LEVEL_RESULTS,"bdb_search: %ld does match filter\n", (long) id));
+ LDAP_LOG ( OPERATION, RESULTS,
+ "bdb_search: %ld does match filter\n", (long) id, 0, 0);
#else
Debug( LDAP_DEBUG_TRACE,
"bdb_search: %ld does match filter\n",
ID *ids )
{
#ifdef NEW_LOGGING
- LDAP_LOG (( "search", LDAP_LEVEL_ENTRY,"base_candidate: base: \"%s\" (0x%08lx)\n", e->e_dn, (long) e->e_id));
+ LDAP_LOG ( OPERATION, ENTRY,
+ "base_candidate: base: \"%s\" (0x%08lx)\n", e->e_dn, (long) e->e_id, 0);
#else
Debug(LDAP_DEBUG_ARGS, "base_candidates: base: \"%s\" (0x%08lx)\n",
e->e_dn, (long) e->e_id, 0);
*/
#ifdef NEW_LOGGING
- LDAP_LOG (( "search", LDAP_LEVEL_ENTRY,"search_candidates: base=\"%s\" (0x%08lx) scope=%d\n", e->e_dn, (long) e->e_id, scope));
+ LDAP_LOG ( OPERATION, ENTRY,
+ "search_candidates: base=\"%s\" (0x%08lx) scope=%d\n",
+ e->e_dn, (long) e->e_id, scope);
#else
Debug(LDAP_DEBUG_TRACE,
"search_candidates: base=\"%s\" (0x%08lx) scope=%d\n",
if( rc ) {
#ifdef NEW_LOGGING
- LDAP_LOG (( "search", LDAP_LEVEL_DETAIL1,"bdb_search_candidates: failed (rc=%d)\n", rc));
+ LDAP_LOG ( OPERATION, DETAIL1,
+ "bdb_search_candidates: failed (rc=%d)\n", rc, 0, 0 );
#else
Debug(LDAP_DEBUG_TRACE,
"bdb_search_candidates: failed (rc=%d)\n",
} else {
#ifdef NEW_LOGGING
- LDAP_LOG (( "search", LDAP_LEVEL_DETAIL1,"bdb_search_candidates: id=%ld first=%ld last=%ld\n", (long) ids[0], (long) BDB_IDL_FIRST(ids), (long) BDB_IDL_LAST(ids)));
+ LDAP_LOG ( OPERATION, DETAIL1,
+ "bdb_search_candidates: id=%ld first=%ld last=%ld\n",
+ (long) ids[0], (long) BDB_IDL_FIRST(ids),
+ (long) BDB_IDL_LAST(ids));
#else
Debug(LDAP_DEBUG_TRACE,
"bdb_search_candidates: id=%ld first=%ld last=%ld\n",
assert( text->bv_val[0] == '\0' );
#ifdef NEW_LOGGING
- LDAP_LOG (( "tools", LDAP_LEVEL_ARGS,
- "=> bdb_tool_entry_put( %ld, \"%s\" )\n",
- (long) e->e_id, e->e_dn ));
+ LDAP_LOG ( TOOLS, ARGS, "=> bdb_tool_entry_put( %ld, \"%s\" )\n",
+ (long) e->e_id, e->e_dn, 0 );
#else
Debug( LDAP_DEBUG_TRACE, "=> bdb_tool_entry_put( %ld, \"%s\" )\n",
(long) e->e_id, e->e_dn, 0 );
"txn_begin failed: %s (%d)",
db_strerror(rc), rc );
#ifdef NEW_LOGGING
- LDAP_LOG (( "tools", LDAP_LEVEL_ERR,
- "=> bdb_tool_entry_put: %s\n", text->bv_val ));
+ LDAP_LOG ( TOOLS, ERR, "=> bdb_tool_entry_put: %s\n", text->bv_val, 0, 0 );
#else
Debug( LDAP_DEBUG_ANY,
"=> bdb_tool_entry_put: %s\n",
"next_id failed: %s (%d)",
db_strerror(rc), rc );
#ifdef NEW_LOGGING
- LDAP_LOG (( "tools", LDAP_LEVEL_ERR,
- "=> bdb_tool_entry_put: %s\n", text->bv_val ));
+ LDAP_LOG ( TOOLS, ERR,
+ "=> bdb_tool_entry_put: %s\n", text->bv_val, 0, 0 );
#else
Debug( LDAP_DEBUG_ANY,
"=> bdb_tool_entry_put: %s\n", text->bv_val, 0, 0 );
"dn2id_add failed: %s (%d)",
db_strerror(rc), rc );
#ifdef NEW_LOGGING
- LDAP_LOG (( "tools", LDAP_LEVEL_ERR,
- "=> bdb_tool_entry_put: %s\n", text->bv_val ));
+ LDAP_LOG ( TOOLS, ERR,
+ "=> bdb_tool_entry_put: %s\n", text->bv_val, 0, 0 );
#else
Debug( LDAP_DEBUG_ANY,
"=> bdb_tool_entry_put: %s\n", text->bv_val, 0, 0 );
"id2entry_add failed: %s (%d)",
db_strerror(rc), rc );
#ifdef NEW_LOGGING
- LDAP_LOG (( "tools", LDAP_LEVEL_ERR,
- "=> bdb_tool_entry_put: %s\n", text->bv_val ));
+ LDAP_LOG ( TOOLS, ERR,
+ "=> bdb_tool_entry_put: %s\n", text->bv_val, 0, 0 );
#else
Debug( LDAP_DEBUG_ANY,
"=> bdb_tool_entry_put: %s\n", text->bv_val, 0, 0 );
"index_entry_add failed: %s (%d)",
db_strerror(rc), rc );
#ifdef NEW_LOGGING
- LDAP_LOG (( "tools", LDAP_LEVEL_ERR,
- "=> bdb_tool_entry_put: %s\n", text->bv_val ));
+ LDAP_LOG ( TOOLS, ERR,
+ "=> bdb_tool_entry_put: %s\n", text->bv_val, 0, 0 );
#else
Debug( LDAP_DEBUG_ANY,
"=> bdb_tool_entry_put: %s\n", text->bv_val, 0, 0 );
"txn_commit failed: %s (%d)",
db_strerror(rc), rc );
#ifdef NEW_LOGGING
- LDAP_LOG (( "tools", LDAP_LEVEL_ERR,
- "=> bdb_tool_entry_put: %s\n", text->bv_val ));
+ LDAP_LOG ( TOOLS, ERR,
+ "=> bdb_tool_entry_put: %s\n", text->bv_val, 0, 0 );
#else
Debug( LDAP_DEBUG_ANY,
"=> bdb_tool_entry_put: %s\n",
"txn_aborted! %s (%d)",
db_strerror(rc), rc );
#ifdef NEW_LOGGING
- LDAP_LOG (( "tools", LDAP_LEVEL_ERR,
- "=> bdb_tool_entry_put: %s\n", text->bv_val ));
+ LDAP_LOG ( TOOLS, ERR,
+ "=> bdb_tool_entry_put: %s\n", text->bv_val, 0, 0 );
#else
Debug( LDAP_DEBUG_ANY,
"=> bdb_tool_entry_put: %s\n",
struct berval pdn;
#ifdef NEW_LOGGING
- LDAP_LOG (( "tools", LDAP_LEVEL_ARGS,
- "=> bdb_tool_entry_reindex( %ld )\n", (long) id ));
+ LDAP_LOG ( TOOLS, ARGS,
+ "=> bdb_tool_entry_reindex( %ld )\n", (long) id, 0, 0 );
#else
Debug( LDAP_DEBUG_ARGS, "=> bdb_tool_entry_reindex( %ld )\n",
(long) id, 0, 0 );
if( e == NULL ) {
#ifdef NEW_LOGGING
- LDAP_LOG (( "tools", LDAP_LEVEL_DETAIL1,
+ LDAP_LOG ( TOOLS, DETAIL1,
"bdb_tool_entry_reindex:: could not locate id=%ld\n",
- (long) id ));
+ (long) id, 0, 0 );
#else
Debug( LDAP_DEBUG_ANY,
"bdb_tool_entry_reindex:: could not locate id=%ld\n",
rc = TXN_BEGIN( bi->bi_dbenv, NULL, &tid, bi->bi_db_opflags );
if( rc != 0 ) {
#ifdef NEW_LOGGING
- LDAP_LOG (( "tools", LDAP_LEVEL_ERR,
+ LDAP_LOG ( TOOLS, ERR,
"=> bdb_tool_entry_reindex: txn_begin failed: %s (%d)\n",
- db_strerror(rc), rc ));
+ db_strerror(rc), rc, 0 );
#else
Debug( LDAP_DEBUG_ANY,
"=> bdb_tool_entry_reindex: txn_begin failed: %s (%d)\n",
*/
#ifdef NEW_LOGGING
- LDAP_LOG (( "tools", LDAP_LEVEL_ERR,
- "=> bdb_tool_entry_reindex( %ld, \"%s\" )\n",
- (long) id, e->e_dn ));
+ LDAP_LOG ( TOOLS, ERR,
+ "=> bdb_tool_entry_reindex( %ld, \"%s\" )\n", (long) id, e->e_dn, 0 );
#else
Debug( LDAP_DEBUG_TRACE, "=> bdb_tool_entry_reindex( %ld, \"%s\" )\n",
(long) id, e->e_dn, 0 );
rc = bdb_dn2id_add( be, tid, &pdn, e );
if( rc != 0 && rc != DB_KEYEXIST ) {
#ifdef NEW_LOGGING
- LDAP_LOG (( "tools", LDAP_LEVEL_ERR,
+ LDAP_LOG ( TOOLS, ERR,
"=> bdb_tool_entry_reindex: dn2id_add failed: %s (%d)\n",
- db_strerror(rc), rc ));
+ db_strerror(rc), rc, 0 );
#else
Debug( LDAP_DEBUG_ANY,
"=> bdb_tool_entry_reindex: dn2id_add failed: %s (%d)\n",
rc = TXN_COMMIT( tid, 0 );
if( rc != 0 ) {
#ifdef NEW_LOGGING
- LDAP_LOG (( "tools", LDAP_LEVEL_ERR,
+ LDAP_LOG ( TOOLS, ERR,
"=> bdb_tool_entry_reindex: txn_commit failed: %s (%d)\n",
- db_strerror(rc), rc ));
+ db_strerror(rc), rc, 0 );
#else
Debug( LDAP_DEBUG_ANY,
"=> bdb_tool_entry_reindex: txn_commit failed: %s (%d)\n",
} else {
TXN_ABORT( tid );
#ifdef NEW_LOGGING
- LDAP_LOG (( "tools", LDAP_LEVEL_DETAIL1,
+ LDAP_LOG ( TOOLS, DETAIL1,
"=> bdb_tool_entry_reindex: txn_aborted! %s (%d)\n",
- db_strerror(rc), rc ));
+ db_strerror(rc), rc, 0 );
#else
Debug( LDAP_DEBUG_ANY,
"=> bdb_tool_entry_reindex: txn_aborted! %s (%d)\n",
--- /dev/null
+/* add.c - ldap backend add function */
+/* $OpenLDAP$ */
+/*
+ * Copyright 1998-2002 The OpenLDAP Foundation, All Rights Reserved.
+ * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
+ */
+/* This is an altered version */
+/*
+ * Copyright 1999, Howard Chu, All rights reserved. <hyc@highlandsun.com>
+ *
+ * Permission is granted to anyone to use this software for any purpose
+ * on any computer system, and to alter it and redistribute it, subject
+ * to the following restrictions:
+ *
+ * 1. The author is not responsible for the consequences of use of this
+ * software, no matter how awful, even if they arise from flaws in it.
+ *
+ * 2. The origin of this software must not be misrepresented, either by
+ * explicit claim or by omission. Since few users ever read sources,
+ * credits should appear in the documentation.
+ *
+ * 3. Altered versions must be plainly marked as such, and must not be
+ * misrepresented as being the original software. Since few users
+ * ever read sources, credits should appear in the documentation.
+ *
+ * 4. This notice may not be removed or altered.
+ *
+ *
+ *
+ * Copyright 2000, Pierangelo Masarati, All rights reserved. <ando@sys-net.it>
+ *
+ * This software is being modified by Pierangelo Masarati.
+ * The previously reported conditions apply to the modified code as well.
+ * Changes in the original code are highlighted where required.
+ * Credits for the original code go to the author, Howard Chu.
+ */
+
+#include "portable.h"
+
+#include <stdio.h>
+
+#include <ac/string.h>
+#include <ac/socket.h>
+
+#include "slap.h"
+#include "back-ldap.h"
+
+int
+ldap_back_add(
+ Backend *be,
+ Connection *conn,
+ Operation *op,
+ Entry *e
+)
+{
+ struct ldapinfo *li = (struct ldapinfo *) be->be_private;
+ struct ldapconn *lc;
+ int i, j;
+ Attribute *a;
+ LDAPMod **attrs;
+ struct berval mapped;
+ struct berval mdn = { 0, NULL };
+
+#ifdef NEW_LOGGING
+ LDAP_LOG( BACK_LDAP, ENTRY, "ldap_back_add: %s\n", e->e_dn, 0, 0 );
+#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 );
+ }
+
+ /*
+ * Rewrite the add dn, if needed
+ */
+#ifdef ENABLE_REWRITE
+ switch (rewrite_session( li->rwinfo, "addDn", e->e_dn, conn,
+ &mdn.bv_val )) {
+ case REWRITE_REGEXEC_OK:
+ if ( mdn.bv_val != NULL && mdn.bv_val[ 0 ] != '\0' ) {
+ mdn.bv_len = strlen( mdn.bv_val );
+ } else {
+ mdn = e->e_name;
+ }
+#ifdef NEW_LOGGING
+ LDAP_LOG( BACK_LDAP, DETAIL1,
+ "[rw] addDn: \"%s\" -> \"%s\"\n", e->e_dn, mdn.bv_val, 0 );
+#else /* !NEW_LOGGING */
+ Debug( LDAP_DEBUG_ARGS, "rw> addDn: \"%s\" -> \"%s\"\n%s",
+ e->e_dn, mdn.bv_val, "" );
+#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 */
+ ldap_back_dn_massage( li, &e->e_name, &mdn, 0, 1 );
+#endif /* !ENABLE_REWRITE */
+
+ /* Count number of attributes in entry */
+ for (i = 1, a = e->e_attrs; a; i++, a = a->a_next)
+ ;
+
+ /* Create array of LDAPMods for ldap_add() */
+ attrs = (LDAPMod **)ch_malloc(sizeof(LDAPMod *)*i);
+
+ for (i=0, a=e->e_attrs; a; a=a->a_next) {
+ /*
+ * lastmod should always be <off>, so that
+ * creation/modification operational attrs
+ * of the target directory are used, if available
+ */
+#if 0
+ if ( !strcasecmp( a->a_desc->ad_cname.bv_val,
+ slap_schema.si_ad_creatorsName->ad_cname.bv_val )
+ || !strcasecmp( a->a_desc->ad_cname.bv_val,
+ slap_schema.si_ad_createTimestamp->ad_cname.bv_val )
+ || !strcasecmp( a->a_desc->ad_cname.bv_val,
+ slap_schema.si_ad_modifiersName->ad_cname.bv_val )
+ || !strcasecmp( a->a_desc->ad_cname.bv_val,
+ slap_schema.si_ad_modifyTimestamp->ad_cname.bv_val )
+ ) {
+ continue;
+ }
+#endif
+
+ ldap_back_map(&li->at_map, &a->a_desc->ad_cname, &mapped, 0);
+ if (mapped.bv_val == NULL) {
+ continue;
+ }
+
+ attrs[i] = (LDAPMod *)ch_malloc(sizeof(LDAPMod));
+ if (attrs[i] == NULL) {
+ continue;
+ }
+
+ attrs[i]->mod_op = LDAP_MOD_BVALUES;
+ attrs[i]->mod_type = mapped.bv_val;
+
+#ifdef ENABLE_REWRITE
+ /*
+ * FIXME: dn-valued attrs should be rewritten
+ * to allow their use in ACLs at the back-ldap
+ * level.
+ */
+ if ( strcmp( a->a_desc->ad_type->sat_syntax->ssyn_oid,
+ SLAPD_DN_SYNTAX ) == 0 ) {
+ ldap_dnattr_rewrite( li->rwinfo, a->a_vals, conn );
+ }
+#endif /* ENABLE_REWRITE */
+
+ for (j=0; a->a_vals[j].bv_val; j++);
+ attrs[i]->mod_vals.modv_bvals = ch_malloc((j+1)*sizeof(struct berval *));
+ for (j=0; a->a_vals[j].bv_val; j++)
+ attrs[i]->mod_vals.modv_bvals[j] = &a->a_vals[j];
+ attrs[i]->mod_vals.modv_bvals[j] = NULL;
+ i++;
+ }
+ attrs[i] = NULL;
+
+ ldap_add_s(lc->ld, mdn.bv_val, attrs);
+ for (--i; i>= 0; --i) {
+ ch_free(attrs[i]->mod_vals.modv_bvals);
+ ch_free(attrs[i]);
+ }
+ ch_free(attrs);
+ if ( mdn.bv_val != e->e_dn ) {
+ free( mdn.bv_val );
+ }
+
+ return( ldap_back_op_result( lc, op ) );
+}
+
+#ifdef ENABLE_REWRITE
+int
+ldap_dnattr_rewrite(
+ struct rewrite_info *rwinfo,
+ BerVarray a_vals,
+ void *cookie
+)
+{
+ char *mattr;
+
+ for ( ; a_vals->bv_val != NULL; a_vals++ ) {
+ switch ( rewrite_session( rwinfo, "bindDn", a_vals->bv_val,
+ cookie, &mattr )) {
+ case REWRITE_REGEXEC_OK:
+ if ( mattr == NULL ) {
+ /* no substitution */
+ continue;
+ }
+#ifdef NEW_LOGGING
+ LDAP_LOG( BACK_LDAP, DETAIL1,
+ "[rw] bindDn (in add of dn-valued"
+ " attr): \"%s\" -> \"%s\"\n", a_vals->bv_val, mattr, 0 );
+#else /* !NEW_LOGGING */
+ Debug( LDAP_DEBUG_ARGS,
+ "rw> bindDn (in add of dn-valued attr):"
+ " \"%s\" -> \"%s\"\n%s",
+ a_vals->bv_val, mattr, "" );
+#endif /* !NEW_LOGGING */
+
+ /*
+ * FIXME: replacing server-allocated memory
+ * (ch_malloc) with librewrite allocated memory
+ * (malloc)
+ */
+ ch_free( a_vals->bv_val );
+ a_vals->bv_val = mattr;
+ a_vals->bv_len = strlen( mattr );
+
+ break;
+
+ case REWRITE_REGEXEC_UNWILLING:
+
+ case REWRITE_REGEXEC_ERR:
+ /*
+ * FIXME: better give up,
+ * skip the attribute
+ * or leave it untouched?
+ */
+ break;
+ }
+ }
+
+ return 0;
+}
+#endif /* ENABLE_REWRITE */
+
mdn.bv_val = ( char * )dn->bv_val;
}
#ifdef NEW_LOGGING
- LDAP_LOG(( "backend", LDAP_LEVEL_DETAIL1,
- "[rw] bindDn: \"%s\" -> \"%s\"\n", dn->bv_val, mdn.bv_val ));
+ LDAP_LOG( BACK_LDAP, DETAIL1,
+ "[rw] bindDn: \"%s\" -> \"%s\"\n", dn->bv_val, mdn.bv_val, 0 );
#else /* !NEW_LOGGING */
Debug( LDAP_DEBUG_ARGS, "rw> bindDn: \"%s\" -> \"%s\"\n%s",
dn->bv_val, mdn.bv_val, "" );
ber_dupbv( &lc->bound_dn, &lc->conn->c_dn );
}
#ifdef NEW_LOGGING
- LDAP_LOG(( "backend", LDAP_LEVEL_DETAIL1,
- "[rw] bindDn: \"%s\" ->"
+ LDAP_LOG( BACK_LDAP, DETAIL1,
+ "[rw] bindDn: \"%s\" ->"
" \"%s\"\n%s",
- lc->conn->c_dn.bv_val,
- lc->bound_dn.bv_val ));
+ lc->conn->c_dn.bv_val,
+ lc->bound_dn.bv_val, "" );
#else /* !NEW_LOGGING */
Debug( LDAP_DEBUG_ARGS,
"rw> bindDn: \"%s\" ->"
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 ));
+ LDAP_LOG( BACK_LDAP, INFO,
+ "ldap_back_getconn: conn %ld inserted\n", lc->conn->c_connid, 0, 0);
#else /* !NEW_LOGGING */
Debug( LDAP_DEBUG_TRACE,
"=>ldap_back_getconn: conn %ld inserted\n%s%s",
}
} else {
#ifdef NEW_LOGGING
- LDAP_LOG(( "backend", LDAP_LEVEL_INFO,
- "ldap_back_getconn: conn %ld inserted\n",
- lc->conn->c_connid ));
+ LDAP_LOG( BACK_LDAP, INFO,
+ "ldap_back_getconn: conn %ld inserted\n",
+ lc->conn->c_connid, 0, 0 );
#else /* !NEW_LOGGING */
Debug( LDAP_DEBUG_TRACE,
"=>ldap_back_getconn: conn %ld fetched%s%s\n",
--- /dev/null
+/* compare.c - ldap backend compare function */
+/* $OpenLDAP$ */
+/*
+ * Copyright 1998-2002 The OpenLDAP Foundation, All Rights Reserved.
+ * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
+ */
+/* This is an altered version */
+/*
+ * Copyright 1999, Howard Chu, All rights reserved. <hyc@highlandsun.com>
+ *
+ * Permission is granted to anyone to use this software for any purpose
+ * on any computer system, and to alter it and redistribute it, subject
+ * to the following restrictions:
+ *
+ * 1. The author is not responsible for the consequences of use of this
+ * software, no matter how awful, even if they arise from flaws in it.
+ *
+ * 2. The origin of this software must not be misrepresented, either by
+ * explicit claim or by omission. Since few users ever read sources,
+ * credits should appear in the documentation.
+ *
+ * 3. Altered versions must be plainly marked as such, and must not be
+ * misrepresented as being the original software. Since few users
+ * ever read sources, credits should appear in the documentation.
+ *
+ * 4. This notice may not be removed or altered.
+ *
+ *
+ *
+ * Copyright 2000, Pierangelo Masarati, All rights reserved. <ando@sys-net.it>
+ *
+ * This software is being modified by Pierangelo Masarati.
+ * The previously reported conditions apply to the modified code as well.
+ * Changes in the original code are highlighted where required.
+ * Credits for the original code go to the author, Howard Chu.
+ */
+
+#include "portable.h"
+
+#include <stdio.h>
+
+#include <ac/string.h>
+#include <ac/socket.h>
+
+#include "slap.h"
+#include "back-ldap.h"
+
+int
+ldap_back_compare(
+ Backend *be,
+ Connection *conn,
+ Operation *op,
+ struct berval *dn,
+ struct berval *ndn,
+ AttributeAssertion *ava
+)
+{
+ struct ldapinfo *li = (struct ldapinfo *) be->be_private;
+ struct ldapconn *lc;
+ struct berval mapped_oc, mapped_at;
+ struct berval mdn = { 0, NULL };
+
+ lc = ldap_back_getconn(li, conn, op);
+ if (!lc || !ldap_back_dobind( lc, op ) ) {
+ return( -1 );
+ }
+
+ /*
+ * Rewrite the compare dn, if needed
+ */
+#ifdef ENABLE_REWRITE
+ switch ( rewrite_session( li->rwinfo, "compareDn", dn->bv_val, conn, &mdn.bv_val ) ) {
+ case REWRITE_REGEXEC_OK:
+ if ( mdn.bv_val == NULL ) {
+ mdn.bv_val = ( char * )dn->bv_val;
+ }
+#ifdef NEW_LOGGING
+ LDAP_LOG( BACK_LDAP, DETAIL1,
+ "[rw] compareDn: \"%s\" -> \"%s\"\n", dn->bv_val, mdn.bv_val, 0 );
+#else /* !NEW_LOGGING */
+ Debug( LDAP_DEBUG_ARGS, "rw> compareDn: \"%s\" -> \"%s\"\n%s",
+ dn->bv_val, mdn.bv_val, "" );
+#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 */
+ ldap_back_dn_massage( li, dn, &mdn, 0, 1 );
+ if ( mdn.bv_val == NULL ) {
+ return -1;
+ }
+#endif /* !ENABLE_REWRITE */
+
+ ldap_back_map(&li->oc_map, &ava->aa_desc->ad_cname, &mapped_oc, 0);
+ if (mapped_oc.bv_val == NULL)
+ return( -1 );
+
+ ldap_back_map(&li->at_map, &ava->aa_value, &mapped_at, 0);
+ if (mapped_at.bv_val == NULL)
+ return( -1 );
+
+ ldap_compare_s( lc->ld, mdn.bv_val, mapped_oc.bv_val, mapped_at.bv_val );
+
+ if ( mdn.bv_val != dn->bv_val ) {
+ free( mdn.bv_val );
+ }
+
+ return( ldap_back_op_result( lc, op ) );
+}
res = ch_calloc( sizeof( char ), strlen( s ) + 4 + 4*i + 1 );
- ptr = slap_strcopy( res, "(.*)" );
+ ptr = lutil_strcopy( res, "(.*)" );
for ( i = 0, p = s;
( r = strchr( p, ',' ) ) != NULL;
p = r + 1 , i++ ) {
- ptr = slap_strncopy( ptr, p, r - p + 1 );
- ptr = slap_strcopy( ptr, "[ ]?" );
+ ptr = lutil_strncopy( ptr, p, r - p + 1 );
+ ptr = lutil_strcopy( ptr, "[ ]?" );
if ( r[ 1 ] == ' ' ) {
r++;
}
}
- slap_strcopy( ptr, p );
+ lutil_strcopy( ptr, p );
return res;
}
--- /dev/null
+/* delete.c - ldap backend delete function */
+/* $OpenLDAP$ */
+/*
+ * Copyright 1998-2002 The OpenLDAP Foundation, All Rights Reserved.
+ * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
+ */
+/* This is an altered version */
+/*
+ * Copyright 1999, Howard Chu, All rights reserved. <hyc@highlandsun.com>
+ *
+ * Permission is granted to anyone to use this software for any purpose
+ * on any computer system, and to alter it and redistribute it, subject
+ * to the following restrictions:
+ *
+ * 1. The author is not responsible for the consequences of use of this
+ * software, no matter how awful, even if they arise from flaws in it.
+ *
+ * 2. The origin of this software must not be misrepresented, either by
+ * explicit claim or by omission. Since few users ever read sources,
+ * credits should appear in the documentation.
+ *
+ * 3. Altered versions must be plainly marked as such, and must not be
+ * misrepresented as being the original software. Since few users
+ * ever read sources, credits should appear in the documentation.
+ *
+ * 4. This notice may not be removed or altered.
+ *
+ *
+ *
+ * Copyright 2000, Pierangelo Masarati, All rights reserved. <ando@sys-net.it>
+ *
+ * This software is being modified by Pierangelo Masarati.
+ * The previously reported conditions apply to the modified code as well.
+ * Changes in the original code are highlighted where required.
+ * Credits for the original code go to the author, Howard Chu.
+ */
+
+#include "portable.h"
+
+#include <stdio.h>
+
+#include <ac/string.h>
+#include <ac/socket.h>
+
+#include "slap.h"
+#include "back-ldap.h"
+
+int
+ldap_back_delete(
+ Backend *be,
+ Connection *conn,
+ Operation *op,
+ struct berval *dn,
+ struct berval *ndn
+)
+{
+ struct ldapinfo *li = (struct ldapinfo *) be->be_private;
+ struct ldapconn *lc;
+
+ struct berval mdn = { 0, NULL };
+
+ lc = ldap_back_getconn( li, conn, op );
+
+ if ( !lc || !ldap_back_dobind( lc, op ) ) {
+ return( -1 );
+ }
+
+ /*
+ * Rewrite the compare dn, if needed
+ */
+#ifdef ENABLE_REWRITE
+ switch ( rewrite_session( li->rwinfo, "deleteDn", dn->bv_val, conn, &mdn.bv_val ) ) {
+ case REWRITE_REGEXEC_OK:
+ if ( mdn.bv_val == NULL ) {
+ mdn.bv_val = ( char * )dn->bv_val;
+ }
+#ifdef NEW_LOGGING
+ LDAP_LOG( BACK_LDAP, DETAIL1,
+ "[rw] deleteDn: \"%s\" -> \"%s\"\n", dn->bv_val, mdn.bv_val, 0 );
+#else /* !NEW_LOGGING */
+ Debug( LDAP_DEBUG_ARGS, "rw> deleteDn: \"%s\" -> \"%s\"\n%s",
+ dn->bv_val, mdn.bv_val, "" );
+#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 */
+ ldap_back_dn_massage( li, dn, &mdn, 0, 1 );
+#endif /* !ENABLE_REWRITE */
+
+ ldap_delete_s( lc->ld, mdn.bv_val );
+
+ if ( mdn.bv_val != dn->bv_val ) {
+ free( mdn.bv_val );
+ }
+
+ return( ldap_back_op_result( lc, op ) );
+}
--- /dev/null
+/* group.c - ldap backend acl group routine */
+/* $OpenLDAP$ */
+/*
+ * Copyright 1998-2002 The OpenLDAP Foundation, All Rights Reserved.
+ * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
+ */
+
+#include "portable.h"
+
+#include <stdio.h>
+
+#include <ac/socket.h>
+#include <ac/string.h>
+
+#include "slap.h"
+#include "back-ldap.h"
+
+
+/* return 0 IFF op_dn is a value in group_at (member) attribute
+ * of entry with gr_dn AND that entry has an objectClass
+ * value of group_oc (groupOfNames)
+ */
+int
+ldap_back_group(
+ Backend *be,
+ Connection *conn,
+ Operation *op,
+ Entry *target,
+ struct berval *gr_ndn,
+ struct berval *op_ndn,
+ ObjectClass *group_oc,
+ AttributeDescription* group_at
+)
+{
+ struct ldapinfo *li = (struct ldapinfo *) be->be_private;
+ int rc = 1;
+ Attribute *attr;
+
+ LDAPMessage *result;
+ char *gattr[2];
+ char *filter = NULL, *ptr;
+ LDAP *ld;
+ struct berval mop_ndn = { 0, NULL }, mgr_ndn = { 0, NULL };
+
+ AttributeDescription *ad_objectClass = slap_schema.si_ad_objectClass;
+ struct berval group_oc_name = {0, NULL};
+ struct berval group_at_name = group_at->ad_cname;
+
+ if( group_oc->soc_names && group_oc->soc_names[0] ) {
+ group_oc_name.bv_val = group_oc->soc_names[0];
+ } else {
+ group_oc_name.bv_val = group_oc->soc_oid;
+ }
+ if (group_oc_name.bv_val)
+ group_oc_name.bv_len = strlen(group_oc_name.bv_val);
+
+ if (target != NULL && dn_match( &target->e_nname, gr_ndn ) ) {
+ /* we already have a copy of the entry */
+ /* attribute and objectclass mapping has already been done */
+
+ /*
+ * first we need to check if the objectClass attribute
+ * has been retieved; otherwise we need to repeat the search
+ */
+ attr = attr_find( target->e_attrs, ad_objectClass );
+ if ( attr != NULL ) {
+
+ /*
+ * Now we can check for the group objectClass value
+ */
+ if( !is_entry_objectclass( target, group_oc, 0 ) ) {
+ return(1);
+ }
+
+ /*
+ * This part has been reworked: the group attr compare
+ * fails only if the attribute is PRESENT but the value
+ * is NOT PRESENT; if the attribute is NOT PRESENT, the
+ * search must be repeated as well.
+ * This may happen if a search for an entry has already
+ * been performed (target is not null) but the group
+ * attribute has not been required
+ */
+ if ((attr = attr_find(target->e_attrs, group_at)) != NULL) {
+ if( value_find( group_at, attr->a_vals, op_ndn ) != LDAP_SUCCESS )
+ return(1);
+ return(0);
+ } /* else: repeat the search */
+ } /* else: repeat the search */
+ } /* else: do the search */
+
+ /*
+ * Rewrite the op ndn if needed
+ */
+#ifdef ENABLE_REWRITE
+ switch ( rewrite_session( li->rwinfo, "bindDn",
+ op_ndn->bv_val, conn, &mop_ndn.bv_val ) ) {
+ case REWRITE_REGEXEC_OK:
+ if ( mop_ndn.bv_val == NULL ) {
+ mop_ndn = *op_ndn;
+ }
+#ifdef NEW_LOGGING
+ LDAP_LOG( BACK_LDAP, DETAIL1,
+ "[rw] bindDn (op ndn in group): \"%s\" -> \"%s\"\n",
+ op_ndn->bv_val, mop_ndn.bv_val, 0 );
+#else /* !NEW_LOGGING */
+ Debug( LDAP_DEBUG_ARGS,
+ "rw> bindDn (op ndn in group): \"%s\" -> \"%s\"\n%s",
+ op_ndn->bv_val, mop_ndn.bv_val, "" );
+#endif /* !NEW_LOGGING */
+ break;
+
+ case REWRITE_REGEXEC_UNWILLING:
+
+ case REWRITE_REGEXEC_ERR:
+ goto cleanup;
+ }
+
+ /*
+ * Rewrite the gr ndn if needed
+ */
+ switch ( rewrite_session( li->rwinfo, "searchBase",
+ gr_ndn->bv_val, conn, &mgr_ndn.bv_val ) ) {
+ case REWRITE_REGEXEC_OK:
+ if ( mgr_ndn.bv_val == NULL ) {
+ mgr_ndn = *gr_ndn;
+ }
+#ifdef NEW_LOGGING
+ LDAP_LOG( BACK_LDAP, DETAIL1,
+ "[rw] searchBase (gr ndn in group): \"%s\" -> \"%s\"\n%s",
+ gr_ndn->bv_val, mgr_ndn.bv_val, "" );
+#else /* !NEW_LOGGING */
+ Debug( LDAP_DEBUG_ARGS,
+ "rw> searchBase (gr ndn in group):"
+ " \"%s\" -> \"%s\"\n%s",
+ gr_ndn->bv_val, mgr_ndn.bv_val, "" );
+#endif /* !NEW_LOGGING */
+ break;
+
+ case REWRITE_REGEXEC_UNWILLING:
+
+ case REWRITE_REGEXEC_ERR:
+ goto cleanup;
+ }
+#else /* !ENABLE_REWRITE */
+ ldap_back_dn_massage( li, op_ndn, &mop_ndn, 1, 1 );
+ if ( mop_ndn.bv_val == NULL ) {
+ goto cleanup;
+ }
+ ldap_back_dn_massage( li, gr_ndn, &mgr_ndn, 1, 1 );
+ if ( mgr_ndn.bv_val == NULL ) {
+ goto cleanup;
+ }
+#endif /* !ENABLE_REWRITE */
+
+ ldap_back_map(&li->oc_map, &group_oc_name, &group_oc_name, 0);
+ if (group_oc_name.bv_val == NULL)
+ goto cleanup;
+ ldap_back_map(&li->at_map, &group_at_name, &group_at_name, 0);
+ if (group_at_name.bv_val == NULL)
+ goto cleanup;
+
+ filter = ch_malloc(sizeof("(&(objectclass=)(=))")
+ + group_oc_name.bv_len
+ + group_at_name.bv_len
+ + mop_ndn.bv_len + 1);
+ if (filter == NULL)
+ goto cleanup;
+
+ if (ldap_initialize(&ld, li->url) != LDAP_SUCCESS) {
+ goto cleanup;
+ }
+
+ if (ldap_bind_s(ld, li->binddn, li->bindpw, LDAP_AUTH_SIMPLE)
+ != LDAP_SUCCESS) {
+ goto cleanup;
+ }
+
+ ptr = lutil_strcopy(filter, "(&(objectclass=");
+ ptr = lutil_strcopy(ptr, group_oc_name.bv_val);
+ ptr = lutil_strcopy(ptr, ")(");
+ ptr = lutil_strcopy(ptr, group_at_name.bv_val);
+ ptr = lutil_strcopy(ptr, "=");
+ ptr = lutil_strcopy(ptr, mop_ndn.bv_val);
+ strcpy(ptr, "))");
+
+ gattr[0] = "objectclass";
+ gattr[1] = NULL;
+ if (ldap_search_ext_s(ld, mgr_ndn.bv_val, LDAP_SCOPE_BASE, filter,
+ gattr, 0, NULL, NULL, LDAP_NO_LIMIT,
+ LDAP_NO_LIMIT, &result) == LDAP_SUCCESS) {
+ if (ldap_first_entry(ld, result) != NULL)
+ rc = 0;
+ ldap_msgfree(result);
+ }
+
+cleanup:;
+ if ( ld != NULL ) {
+ ldap_unbind(ld);
+ }
+ ch_free(filter);
+ if ( mop_ndn.bv_val != op_ndn->bv_val ) {
+ free( mop_ndn.bv_val );
+ }
+ if ( mgr_ndn.bv_val != gr_ndn->bv_val ) {
+ free( mgr_ndn.bv_val );
+ }
+ return(rc);
+}
--- /dev/null
+/* modify.c - ldap backend modify function */
+/* $OpenLDAP$ */
+/*
+ * Copyright 1998-2002 The OpenLDAP Foundation, All Rights Reserved.
+ * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
+ */
+/* This is an altered version */
+/*
+ * Copyright 1999, Howard Chu, All rights reserved. <hyc@highlandsun.com>
+ *
+ * Permission is granted to anyone to use this software for any purpose
+ * on any computer system, and to alter it and redistribute it, subject
+ * to the following restrictions:
+ *
+ * 1. The author is not responsible for the consequences of use of this
+ * software, no matter how awful, even if they arise from flaws in it.
+ *
+ * 2. The origin of this software must not be misrepresented, either by
+ * explicit claim or by omission. Since few users ever read sources,
+ * credits should appear in the documentation.
+ *
+ * 3. Altered versions must be plainly marked as such, and must not be
+ * misrepresented as being the original software. Since few users
+ * ever read sources, credits should appear in the documentation.
+ *
+ * 4. This notice may not be removed or altered.
+ *
+ *
+ *
+ * Copyright 2000, Pierangelo Masarati, All rights reserved. <ando@sys-net.it>
+ *
+ * This software is being modified by Pierangelo Masarati.
+ * The previously reported conditions apply to the modified code as well.
+ * Changes in the original code are highlighted where required.
+ * Credits for the original code go to the author, Howard Chu.
+ */
+
+#include "portable.h"
+
+#include <stdio.h>
+
+#include <ac/string.h>
+#include <ac/socket.h>
+
+#include "slap.h"
+#include "back-ldap.h"
+
+int
+ldap_back_modify(
+ Backend *be,
+ Connection *conn,
+ Operation *op,
+ struct berval *dn,
+ struct berval *ndn,
+ Modifications *modlist
+)
+{
+ struct ldapinfo *li = (struct ldapinfo *) be->be_private;
+ struct ldapconn *lc;
+ LDAPMod **modv = NULL;
+ LDAPMod *mods;
+ Modifications *ml;
+ int i, j;
+ struct berval mapped;
+ struct berval mdn = { 0, NULL };
+
+ lc = ldap_back_getconn(li, conn, op);
+ if ( !lc || !ldap_back_dobind( lc, op ) ) {
+ return( -1 );
+ }
+
+ /*
+ * Rewrite the modify dn, if needed
+ */
+#ifdef ENABLE_REWRITE
+ switch ( rewrite_session( li->rwinfo, "modifyDn", dn->bv_val, conn, &mdn.bv_val ) ) {
+ case REWRITE_REGEXEC_OK:
+ if ( mdn.bv_val == NULL ) {
+ mdn.bv_val = ( char * )dn->bv_val;
+ }
+#ifdef NEW_LOGGING
+ LDAP_LOG( BACK_LDAP, DETAIL1,
+ "[rw] modifyDn: \"%s\" -> \"%s\"\n", dn->bv_val, mdn.bv_val, 0 );
+#else /* !NEW_LOGGING */
+ Debug( LDAP_DEBUG_ARGS, "rw> modifyDn: \"%s\" -> \"%s\"\n%s",
+ dn->bv_val, mdn.bv_val, "" );
+#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 */
+ ldap_back_dn_massage( li, dn, &mdn, 0, 1 );
+#endif /* !ENABLE_REWRITE */
+
+ for (i=0, ml=modlist; ml; i++,ml=ml->sml_next)
+ ;
+
+ mods = (LDAPMod *)ch_malloc(i*sizeof(LDAPMod));
+ if (mods == NULL) {
+ goto cleanup;
+ }
+ modv = (LDAPMod **)ch_malloc((i+1)*sizeof(LDAPMod *));
+ if (modv == NULL) {
+ goto cleanup;
+ }
+
+ for (i=0, ml=modlist; ml; ml=ml->sml_next) {
+ ldap_back_map(&li->at_map, &ml->sml_desc->ad_cname, &mapped, 0);
+ if (mapped.bv_val == NULL) {
+ continue;
+ }
+
+ modv[i] = &mods[i];
+ mods[i].mod_op = ml->sml_op | LDAP_MOD_BVALUES;
+ mods[i].mod_type = mapped.bv_val;
+
+#ifdef ENABLE_REWRITE
+ /*
+ * FIXME: dn-valued attrs should be rewritten
+ * to allow their use in ACLs at the back-ldap
+ * level.
+ */
+ if ( strcmp( ml->sml_desc->ad_type->sat_syntax->ssyn_oid,
+ SLAPD_DN_SYNTAX ) == 0 ) {
+ ldap_dnattr_rewrite( li->rwinfo,
+ ml->sml_bvalues, conn );
+ }
+#endif /* ENABLE_REWRITE */
+
+ for (j = 0; ml->sml_bvalues[j].bv_val; j++);
+ mods[i].mod_bvalues = (struct berval **)ch_malloc((j+1) *
+ sizeof(struct berval *));
+ for (j = 0; ml->sml_bvalues[j].bv_val; j++)
+ mods[i].mod_bvalues[j] = &ml->sml_bvalues[j];
+ mods[i].mod_bvalues[j] = NULL;
+ i++;
+ }
+ modv[i] = 0;
+
+ ldap_modify_s( lc->ld, mdn.bv_val, modv );
+
+cleanup:;
+#ifdef ENABLE_REWRITE
+ if ( mdn.bv_val != dn->bv_val ) {
+#endif /* ENABLE_REWRITE */
+ free( mdn.bv_val );
+#ifdef ENABLE_REWRITE
+ }
+#endif /* ENABLE_REWRITE */
+ for (i=0; modv[i]; i++)
+ ch_free(modv[i]->mod_bvalues);
+ ch_free(mods);
+ ch_free(modv);
+ return( ldap_back_op_result( lc, op ));
+}
+
--- /dev/null
+/* modrdn.c - ldap backend modrdn function */
+/* $OpenLDAP$ */
+/*
+ * Copyright 1998-2002 The OpenLDAP Foundation, All Rights Reserved.
+ * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
+ */
+/* This is an altered version */
+/*
+ * Copyright 1999, Howard Chu, All rights reserved. <hyc@highlandsun.com>
+ *
+ * Permission is granted to anyone to use this software for any purpose
+ * on any computer system, and to alter it and redistribute it, subject
+ * to the following restrictions:
+ *
+ * 1. The author is not responsible for the consequences of use of this
+ * software, no matter how awful, even if they arise from flaws in it.
+ *
+ * 2. The origin of this software must not be misrepresented, either by
+ * explicit claim or by omission. Since few users ever read sources,
+ * credits should appear in the documentation.
+ *
+ * 3. Altered versions must be plainly marked as such, and must not be
+ * misrepresented as being the original software. Since few users
+ * ever read sources, credits should appear in the documentation.
+ *
+ * 4. This notice may not be removed or altered.
+ *
+ *
+ *
+ * Copyright 2000, Pierangelo Masarati, All rights reserved. <ando@sys-net.it>
+ *
+ * This software is being modified by Pierangelo Masarati.
+ * The previously reported conditions apply to the modified code as well.
+ * Changes in the original code are highlighted where required.
+ * Credits for the original code go to the author, Howard Chu.
+ */
+
+#include "portable.h"
+
+#include <stdio.h>
+
+#include <ac/socket.h>
+#include <ac/string.h>
+
+#include "slap.h"
+#include "back-ldap.h"
+
+int
+ldap_back_modrdn(
+ Backend *be,
+ Connection *conn,
+ Operation *op,
+ struct berval *dn,
+ struct berval *ndn,
+ struct berval *newrdn,
+ struct berval *nnewrdn,
+ int deleteoldrdn,
+ struct berval *newSuperior,
+ struct berval *nnewSuperior
+)
+{
+ struct ldapinfo *li = (struct ldapinfo *) be->be_private;
+ struct ldapconn *lc;
+
+ struct berval mdn = { 0, NULL }, mnewSuperior = { 0, NULL };
+
+ lc = ldap_back_getconn( li, conn, op );
+ if ( !lc || !ldap_back_dobind(lc, op) ) {
+ return( -1 );
+ }
+
+ if (newSuperior) {
+ int version = LDAP_VERSION3;
+ ldap_set_option( lc->ld, LDAP_OPT_PROTOCOL_VERSION, &version);
+
+ /*
+ * Rewrite the new superior, if defined and required
+ */
+#ifdef ENABLE_REWRITE
+ switch ( rewrite_session( li->rwinfo, "newSuperiorDn",
+ newSuperior->bv_val, conn, &mnewSuperior.bv_val ) ) {
+ case REWRITE_REGEXEC_OK:
+ if ( mnewSuperior.bv_val == NULL ) {
+ mnewSuperior.bv_val = ( char * )newSuperior;
+ }
+#ifdef NEW_LOGGING
+ LDAP_LOG( BACK_LDAP, DETAIL1,
+ "[rw] newSuperiorDn:" " \"%s\" -> \"%s\"\n",
+ newSuperior, mnewSuperior.bv_val, 0 );
+#else /* !NEW_LOGGING */
+ Debug( LDAP_DEBUG_ARGS, "rw> newSuperiorDn:"
+ " \"%s\" -> \"%s\"\n%s",
+ newSuperior->bv_val, mnewSuperior.bv_val, "" );
+#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 */
+ ldap_back_dn_massage( li, newSuperior, &mnewSuperior, 0, 1 );
+ if ( mnewSuperior.bv_val == NULL ) {
+ return( -1 );
+ }
+#endif /* !ENABLE_REWRITE */
+ }
+
+#ifdef ENABLE_REWRITE
+ /*
+ * Rewrite the modrdn dn, if required
+ */
+ switch ( rewrite_session( li->rwinfo, "modrDn", dn->bv_val, conn, &mdn.bv_val ) ) {
+ case REWRITE_REGEXEC_OK:
+ if ( mdn.bv_val == NULL ) {
+ mdn.bv_val = ( char * )dn->bv_val;
+ }
+#ifdef NEW_LOGGING
+ LDAP_LOG( BACK_LDAP, DETAIL1,
+ "[rw] modrDn: \"%s\" -> \"%s\"\n", dn->bv_val, mdn.bv_val, 0 );
+#else /* !NEW_LOGGING */
+ Debug( LDAP_DEBUG_ARGS, "rw> modrDn: \"%s\" -> \"%s\"\n%s",
+ dn->bv_val, mdn.bv_val, "" );
+#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 */
+ ldap_back_dn_massage( li, dn, &mdn, 0, 1 );
+#endif /* !ENABLE_REWRITE */
+
+ ldap_rename2_s( lc->ld, mdn.bv_val, newrdn->bv_val, mnewSuperior.bv_val, deleteoldrdn );
+
+ if ( mdn.bv_val != dn->bv_val ) {
+ free( mdn.bv_val );
+ }
+ if ( mnewSuperior.bv_val != NULL
+ && mnewSuperior.bv_val != newSuperior->bv_val ) {
+ free( mnewSuperior.bv_val );
+ }
+
+ return( ldap_back_op_result( lc, op ) );
+}
mbase = *base;
}
#ifdef NEW_LOGGING
- LDAP_LOG(( "backend", LDAP_LEVEL_DETAIL1,
- "[rw] searchBase: \"%s\" -> \"%s\"\n%",
- base->bv_val, mbase.bv_val ));
+ LDAP_LOG( BACK_LDAP, DETAIL1,
+ "[rw] searchBase: \"%s\" -> \"%s\"\n",
+ base->bv_val, mbase.bv_val, 0 );
#else /* !NEW_LOGGING */
Debug( LDAP_DEBUG_ARGS, "rw> searchBase: \"%s\" -> \"%s\"\n%s",
base->bv_val, mbase.bv_val, "" );
}
#ifdef NEW_LOGGING
- LDAP_LOG(( "backend", LDAP_LEVEL_DETAIL1,
- "[rw] searchFilter: \"%s\" -> \"%s\"\n",
- filterstr->bv_val, mfilter.bv_val ));
+ LDAP_LOG( BACK_LDAP, DETAIL1,
+ "[rw] searchFilter: \"%s\" -> \"%s\"\n",
+ filterstr->bv_val, mfilter.bv_val, 0 );
#else /* !NEW_LOGGING */
Debug( LDAP_DEBUG_ARGS,
"rw> searchFilter: \"%s\" -> \"%s\"\n%s",
mmatch = ( char * )match;
}
#ifdef NEW_LOGGING
- LDAP_LOG(( "backend", LDAP_LEVEL_DETAIL1,
- "[rw] matchedDn:"
- " \"%s\" -> \"%s\"\n",
- match, mmatch ));
+ LDAP_LOG( BACK_LDAP, DETAIL1,
+ "[rw] matchedDn:" " \"%s\" -> \"%s\"\n", match, mmatch, 0 );
#else /* !NEW_LOGGING */
Debug( LDAP_DEBUG_ARGS, "rw> matchedDn:"
" \"%s\" -> \"%s\"\n%s",
ent.e_name = bdn;
} else {
#ifdef NEW_LOGGING
- LDAP_LOG(( "backend", LDAP_LEVEL_DETAIL1,
- "[rw] searchResult: \"%s\""
- " -> \"%s\"\n", bdn.bv_val, ent.e_dn ));
+ LDAP_LOG( BACK_LDAP, DETAIL1,
+ "[rw] searchResult: \"%s\"" " -> \"%s\"\n",
+ bdn.bv_val, ent.e_dn, 0 );
#else /* !NEW_LOGGING */
Debug( LDAP_DEBUG_ARGS, "rw> searchResult: \"%s\""
" -> \"%s\"\n%s", bdn.bv_val, ent.e_dn, "" );
if (slap_bv2undef_ad(&mapped, &attr->a_desc, &text)
!= LDAP_SUCCESS) {
#ifdef NEW_LOGGING
- LDAP_LOG(( "backend", LDAP_LEVEL_DETAIL1,
- "slap_bv2undef_ad(%s): "
- "%s\n", mapped.bv_val, text ));
+ LDAP_LOG( BACK_LDAP, DETAIL1,
+ "slap_bv2undef_ad(%s): %s\n", mapped.bv_val, text, 0 );
#else /* !NEW_LOGGING */
Debug( LDAP_DEBUG_ANY,
"slap_bv2undef_ad(%s): "
}
newval.bv_len = strlen( newval.bv_val );
#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_val,
- bv->bv_val,
- newval.bv_val ));
+ LDAP_LOG( BACK_LDAP, DETAIL1,
+ "[rw] searchResult on attr=%s: \"%s\" -> \"%s\"\n",
+ attr->a_desc->ad_type->sat_cname.bv_val,
+ bv->bv_val, newval.bv_val );
#else /* !NEW_LOGGING */
Debug( LDAP_DEBUG_ARGS,
"rw> searchResult on attr=%s: \"%s\" -> \"%s\"\n",
strncpy( res->bv_val, dn->bv_val, diff );
strcpy( &res->bv_val[diff], li->suffix_massage[i+dst].bv_val );
#ifdef NEW_LOGGING
- LDAP_LOG (( "suffixmassage", LDAP_LEVEL_ARGS,
+ LDAP_LOG ( BACK_LDAP, ARGS,
"ldap_back_dn_massage: converted \"%s\" to \"%s\"\n",
- dn->bv_val, res->bv_val ));
+ dn->bv_val, res->bv_val, 0 );
#else
Debug( LDAP_DEBUG_ARGS,
"ldap_back_dn_massage:"
struct ldapconn *lc, lc_curr;
#ifdef NEW_LOGGING
- LDAP_LOG(( "backend", LDAP_LEVEL_INFO,
- "ldap_back_conn_destroy: fetching conn %ld\n",
- conn->c_connid ));
+ LDAP_LOG( BACK_LDAP, INFO,
+ "ldap_back_conn_destroy: fetching conn %ld\n", conn->c_connid, 0, 0 );
#else /* !NEW_LOGGING */
Debug( LDAP_DEBUG_TRACE,
"=>ldap_back_conn_destroy: fetching conn %ld\n",
if (lc) {
#ifdef NEW_LOGGING
- LDAP_LOG(( "backend", LDAP_LEVEL_DETAIL1,
- "ldap_back_conn_destroy: destroying conn %ld\n",
- conn->c_connid ));
+ LDAP_LOG( BACK_LDAP, DETAIL1,
+ "ldap_back_conn_destroy: destroying conn %ld\n",
+ conn->c_connid, 0, 0 );
#else /* !NEW_LOGGING */
Debug( LDAP_DEBUG_TRACE,
"=>ldap_back_conn_destroy: destroying conn %ld\n",
/* add.c - ldap ldbm back-end add routine */
+/* $OpenLDAP$ */
+/*
+ * Copyright 1998-2002 The OpenLDAP Foundation, All Rights Reserved.
+ * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
+ */
+
+#include "portable.h"
#include <stdio.h>
-#include <string.h>
-#include <sys/types.h>
-#include <sys/socket.h>
+
+#include <ac/socket.h>
+#include <ac/string.h>
+
#include "slap.h"
#include "back-ldbm.h"
-
-extern int global_schemacheck;
-extern char *dn_parent();
-extern char *dn_normalize();
-extern Entry *dn2entry();
+#include "proto-back-ldbm.h"
int
ldbm_back_add(
)
{
struct ldbminfo *li = (struct ldbminfo *) be->be_private;
- char *matched;
- char *dn = NULL, *pdn = NULL;
- Entry *p;
-
- dn = dn_normalize( strdup( e->e_dn ) );
- matched = NULL;
- if ( (p = dn2entry( be, dn, &matched )) != NULL ) {
- cache_return_entry( &li->li_cache, p );
- entry_free( e );
- free( dn );
- send_ldap_result( conn, op, LDAP_ALREADY_EXISTS, "", "" );
- return( -1 );
- }
- if ( matched != NULL ) {
- free( matched );
- }
- /* XXX race condition here til we cache_add_entry_lock below XXX */
+ struct berval pdn;
+ Entry *p = NULL;
+ int rc;
+ ID id = NOID;
+ const char *text = NULL;
+ AttributeDescription *children = slap_schema.si_ad_children;
+ char textbuf[SLAP_TEXT_BUFLEN];
+ size_t textlen = sizeof textbuf;
- if ( global_schemacheck && oc_schema_check( e ) != 0 ) {
- Debug( LDAP_DEBUG_TRACE, "entry failed schema check\n", 0, 0,
- 0 );
- entry_free( e );
- free( dn );
- send_ldap_result( conn, op, LDAP_OBJECT_CLASS_VIOLATION, "",
- "" );
+#ifdef NEW_LOGGING
+ LDAP_LOG( BACK_LDBM, ENTRY, "ldbm_back_add: %s\n", e->e_dn, 0, 0 );
+#else
+ Debug(LDAP_DEBUG_ARGS, "==> ldbm_back_add: %s\n", e->e_dn, 0, 0);
+#endif
+
+ /* grab giant lock for writing */
+ ldap_pvt_thread_rdwr_wlock(&li->li_giant_rwlock);
+
+ if ( ( rc = dn2id( be, &e->e_nname, &id ) ) || id != NOID ) {
+ /* if (rc) something bad happened to ldbm cache */
+ ldap_pvt_thread_rdwr_wunlock(&li->li_giant_rwlock);
+ send_ldap_result( conn, op,
+ rc ? LDAP_OPERATIONS_ERROR : LDAP_ALREADY_EXISTS,
+ NULL, NULL, NULL, NULL );
return( -1 );
}
- /*
- * Try to add the entry to the cache, assign it a new dnid
- * and mark it locked. This should only fail if the entry
- * already exists.
- */
+ rc = entry_schema_check( be, e, NULL, &text, textbuf, textlen );
- e->e_id = next_id( be );
- if ( cache_add_entry_lock( &li->li_cache, e, ENTRY_STATE_CREATING )
- != 0 ) {
- Debug( LDAP_DEBUG_ANY, "cache_add_entry_lock failed\n", 0, 0,
- 0 );
- next_id_return( be, e->e_id );
- entry_free( e );
- free( dn );
- send_ldap_result( conn, op, LDAP_ALREADY_EXISTS, "", "" );
+ if ( rc != LDAP_SUCCESS ) {
+ ldap_pvt_thread_rdwr_wunlock(&li->li_giant_rwlock);
+
+#ifdef NEW_LOGGING
+ LDAP_LOG( BACK_LDBM, ERR,
+ "ldbm_back_add: entry (%s) failed schema check.\n", e->e_dn, 0, 0 );
+#else
+ Debug( LDAP_DEBUG_TRACE, "entry failed schema check: %s\n",
+ text, 0, 0 );
+#endif
+
+ send_ldap_result( conn, op, rc,
+ NULL, text, NULL, NULL );
return( -1 );
}
* add the entry.
*/
- if ( (pdn = dn_parent( be, dn )) != NULL ) {
- /* no parent */
- matched = NULL;
- if ( (p = dn2entry( be, pdn, &matched )) == NULL ) {
- send_ldap_result( conn, op, LDAP_NO_SUCH_OBJECT,
- matched, "" );
+ if ( be_issuffix( be, &e->e_nname ) ) {
+ pdn = slap_empty_bv;
+ } else {
+ dnParent( &e->e_nname, &pdn );
+ }
+
+ if( pdn.bv_len ) {
+ Entry *matched = NULL;
+
+ /* get parent with writer lock */
+ if ( (p = dn2entry_w( be, &pdn, &matched )) == NULL ) {
+ char *matched_dn = NULL;
+ BerVarray refs;
+
if ( matched != NULL ) {
- free( matched );
+ matched_dn = ch_strdup( matched->e_dn );
+ refs = is_entry_referral( matched )
+ ? get_entry_referrals( be, conn, op, matched )
+ : NULL;
+ cache_return_entry_r( &li->li_cache, matched );
+
+ } else {
+ refs = referral_rewrite( default_referral,
+ NULL, &e->e_name, LDAP_SCOPE_DEFAULT );
}
- Debug( LDAP_DEBUG_TRACE, "parent does not exist\n", 0,
+
+ ldap_pvt_thread_rdwr_wunlock(&li->li_giant_rwlock);
+
+#ifdef NEW_LOGGING
+ LDAP_LOG( BACK_LDBM, ERR,
+ "ldbm_back_add: Parent of (%s) does not exist.\n",
+ e->e_dn, 0, 0 );
+#else
+ Debug( LDAP_DEBUG_TRACE, "parent does not exist\n",
+ 0, 0, 0 );
+#endif
+
+ send_ldap_result( conn, op, LDAP_REFERRAL, matched_dn,
+ refs == NULL ? "parent does not exist" : "parent is referral",
+ refs, NULL );
+
+ ber_bvarray_free( refs );
+ free( matched_dn );
+
+ return -1;
+ }
+
+ if ( ! access_allowed( be, conn, op, p,
+ children, NULL, ACL_WRITE, NULL ) )
+ {
+ /* free parent and writer lock */
+ cache_return_entry_w( &li->li_cache, p );
+ ldap_pvt_thread_rdwr_wunlock(&li->li_giant_rwlock);
+
+#ifdef NEW_LOGGING
+ LDAP_LOG( BACK_LDBM, ERR,
+ "ldbm_back_add: No write access to parent (%s).\n",
+ e->e_dn, 0, 0 );
+#else
+ Debug( LDAP_DEBUG_TRACE, "no write access to parent\n", 0,
0, 0 );
- goto error_return;
+#endif
+
+ send_ldap_result( conn, op, LDAP_INSUFFICIENT_ACCESS,
+ NULL, "no write access to parent", NULL, NULL );
+
+ return -1;
}
- if ( matched != NULL ) {
- free( matched );
+
+ if ( is_entry_alias( p ) ) {
+ /* parent is an alias, don't allow add */
+
+ /* free parent and writer lock */
+ cache_return_entry_w( &li->li_cache, p );
+ ldap_pvt_thread_rdwr_wunlock(&li->li_giant_rwlock);
+
+#ifdef NEW_LOGGING
+ LDAP_LOG(BACK_LDBM, ERR,
+ "ldbm_back_add: Parent is an alias.\n", 0, 0, 0 );
+#else
+ Debug( LDAP_DEBUG_TRACE, "parent is alias\n", 0,
+ 0, 0 );
+#endif
+
+
+ send_ldap_result( conn, op, LDAP_ALIAS_PROBLEM,
+ NULL, "parent is an alias", NULL, NULL );
+
+ return -1;
}
- if ( ! access_allowed( be, conn, op, p, "children", NULL,
- op->o_dn, ACL_WRITE ) ) {
- Debug( LDAP_DEBUG_TRACE, "no access to parent\n", 0,
+ if ( is_entry_referral( p ) ) {
+ /* parent is a referral, don't allow add */
+ char *matched_dn = ch_strdup( p->e_dn );
+ BerVarray refs = is_entry_referral( p )
+ ? get_entry_referrals( be, conn, op, p )
+ : NULL;
+
+ /* free parent and writer lock */
+ cache_return_entry_w( &li->li_cache, p );
+ ldap_pvt_thread_rdwr_wunlock(&li->li_giant_rwlock);
+
+#ifdef NEW_LOGGING
+ LDAP_LOG( BACK_LDBM, ERR,
+ "ldbm_back_add: Parent is referral.\n", 0, 0, 0 );
+#else
+ Debug( LDAP_DEBUG_TRACE, "parent is referral\n", 0,
0, 0 );
- send_ldap_result( conn, op, LDAP_INSUFFICIENT_ACCESS,
- "", "" );
- goto error_return;
+#endif
+
+ send_ldap_result( conn, op, LDAP_REFERRAL,
+ matched_dn, NULL, refs, NULL );
+
+ ber_bvarray_free( refs );
+ free( matched_dn );
+ return -1;
}
+
} else {
- if ( ! be_isroot( be, op->o_dn ) ) {
- Debug( LDAP_DEBUG_TRACE, "no parent & not root\n", 0,
- 0, 0 );
- send_ldap_result( conn, op, LDAP_INSUFFICIENT_ACCESS,
- "", "" );
- goto error_return;
+ if(pdn.bv_val != NULL) {
+ assert( *pdn.bv_val == '\0' );
+ }
+
+ /* no parent, must be adding entry to root */
+ if ( !be_isroot( be, &op->o_ndn ) ) {
+ if ( be_issuffix( be, (struct berval *)&slap_empty_bv ) || be_isupdate( be, &op->o_ndn ) ) {
+ p = (Entry *)&slap_entry_root;
+
+ rc = access_allowed( be, conn, op, p,
+ children, NULL, ACL_WRITE, NULL );
+ p = NULL;
+
+ if ( ! rc ) {
+ ldap_pvt_thread_rdwr_wunlock(&li->li_giant_rwlock);
+
+#ifdef NEW_LOGGING
+ LDAP_LOG( BACK_LDBM, ERR,
+ "ldbm_back_add: No write "
+ "access to parent (\"\").\n", 0, 0, 0 );
+#else
+ Debug( LDAP_DEBUG_TRACE,
+ "no write access to parent\n",
+ 0, 0, 0 );
+#endif
+
+ send_ldap_result( conn, op,
+ LDAP_INSUFFICIENT_ACCESS,
+ NULL,
+ "no write access to parent",
+ NULL, NULL );
+
+ return -1;
+ }
+
+ } else {
+ ldap_pvt_thread_rdwr_wunlock(&li->li_giant_rwlock);
+
+#ifdef NEW_LOGGING
+ LDAP_LOG( BACK_LDBM, ERR,
+ "ldbm_back_add: %s add denied.\n",
+ pdn.bv_val == NULL ? "suffix"
+ : "entry at root", 0, 0 );
+#else
+ Debug( LDAP_DEBUG_TRACE, "%s add denied\n",
+ pdn.bv_val == NULL ? "suffix"
+ : "entry at root", 0, 0 );
+#endif
+
+ send_ldap_result( conn, op,
+ LDAP_INSUFFICIENT_ACCESS,
+ NULL, NULL, NULL, NULL );
+
+ return -1;
+ }
}
- p = NULL;
}
- /*
- * add it to the id2children index for the parent
- */
+ if ( next_id( be, &e->e_id ) ) {
+ if( p != NULL) {
+ /* free parent and writer lock */
+ cache_return_entry_w( &li->li_cache, p );
+ }
- if ( id2children_add( be, p, e ) != 0 ) {
- Debug( LDAP_DEBUG_TRACE, "id2children_add failed\n", 0,
- 0, 0 );
- send_ldap_result( conn, op, LDAP_OPERATIONS_ERROR, "",
- "" );
- goto error_return;
+ ldap_pvt_thread_rdwr_wunlock(&li->li_giant_rwlock);
+
+#ifdef NEW_LOGGING
+ LDAP_LOG( BACK_LDBM, ERR,
+ "ldbm_back_add: next_id failed.\n", 0, 0, 0 );
+#else
+ Debug( LDAP_DEBUG_ANY, "ldbm_add: next_id failed\n",
+ 0, 0, 0 );
+#endif
+
+ send_ldap_result( conn, op, LDAP_OTHER,
+ NULL, "next_id add failed", NULL, NULL );
+
+ return( -1 );
}
/*
- * Add the entry to the attribute indexes, then add it to
- * the id2children index, dn2id index, and the id2entry index.
+ * Try to add the entry to the cache, assign it a new dnid.
*/
+ rc = cache_add_entry_rw(&li->li_cache, e, CACHE_WRITE_LOCK);
+
+ if ( rc != 0 ) {
+ if( p != NULL) {
+ /* free parent and writer lock */
+ cache_return_entry_w( &li->li_cache, p );
+ }
+
+ ldap_pvt_thread_rdwr_wunlock(&li->li_giant_rwlock);
+
+#ifdef NEW_LOGGING
+ LDAP_LOG( BACK_LDBM, ERR,
+ "ldbm_back_add: cache_add_entry_lock failed.\n", 0, 0, 0 );
+#else
+ Debug( LDAP_DEBUG_ANY, "cache_add_entry_lock failed\n", 0, 0,
+ 0 );
+#endif
+
+ send_ldap_result( conn, op,
+ rc > 0 ? LDAP_ALREADY_EXISTS : LDAP_OTHER,
+ NULL, rc > 0 ? NULL : "cache add failed", NULL, NULL );
+
+ return( -1 );
+ }
+
+ rc = -1;
/* attribute indexes */
- if ( index_add_entry( be, e ) != 0 ) {
- Debug( LDAP_DEBUG_TRACE, "index_add_entry failed\n", 0,
+ if ( index_entry_add( be, e, e->e_attrs ) != LDAP_SUCCESS ) {
+#ifdef NEW_LOGGING
+ LDAP_LOG( BACK_LDBM, ERR,
+ "ldbm_back_add: index_entry_add failed.\n", 0, 0, 0 );
+#else
+ Debug( LDAP_DEBUG_TRACE, "index_entry_add failed\n", 0,
0, 0 );
- send_ldap_result( conn, op, LDAP_OPERATIONS_ERROR, "", "" );
- goto error_return;
+#endif
+
+ send_ldap_result( conn, op, LDAP_OTHER,
+ NULL, "index generation failed", NULL, NULL );
+
+ goto return_results;
}
/* dn2id index */
- if ( dn2id_add( be, dn, e->e_id ) != 0 ) {
+ if ( dn2id_add( be, &e->e_nname, e->e_id ) != 0 ) {
+#ifdef NEW_LOGGING
+ LDAP_LOG( BACK_LDBM, ERR,
+ "ldbm_back_add: dn2id_add failed.\n", 0, 0, 0 );
+#else
Debug( LDAP_DEBUG_TRACE, "dn2id_add failed\n", 0,
0, 0 );
- send_ldap_result( conn, op, LDAP_OPERATIONS_ERROR, "", "" );
- goto error_return;
+#endif
+ /* FIXME: delete attr indices? */
+
+ send_ldap_result( conn, op, LDAP_OTHER,
+ NULL, "DN index generation failed", NULL, NULL );
+
+ goto return_results;
}
/* id2entry index */
if ( id2entry_add( be, e ) != 0 ) {
+#ifdef NEW_LOGGING
+ LDAP_LOG( BACK_LDBM, ERR,
+ "ldbm_back_add: id2entry_add failed.\n", 0, 0, 0 );
+#else
Debug( LDAP_DEBUG_TRACE, "id2entry_add failed\n", 0,
0, 0 );
- (void) dn2id_delete( be, dn );
- send_ldap_result( conn, op, LDAP_OPERATIONS_ERROR, "", "" );
- goto error_return;
+#endif
+
+ /* FIXME: delete attr indices? */
+ (void) dn2id_delete( be, &e->e_nname, e->e_id );
+
+ send_ldap_result( conn, op, LDAP_OTHER,
+ NULL, "entry store failed", NULL, NULL );
+
+ goto return_results;
+ }
+
+ send_ldap_result( conn, op, LDAP_SUCCESS,
+ NULL, NULL, NULL, NULL );
+
+ /* marks the entry as committed, so it is added to the cache;
+ * otherwise it is removed from the cache, but not destroyed;
+ * it will be destroyed by the caller */
+ rc = 0;
+ cache_entry_commit( e );
+
+return_results:;
+ if (p != NULL) {
+ /* free parent and writer lock */
+ cache_return_entry_w( &li->li_cache, p );
+ }
+
+ if ( rc ) {
+ /*
+ * in case of error, writer lock is freed
+ * and entry's private data is destroyed.
+ * otherwise, this is done when entry is released
+ */
+ cache_return_entry_w( &li->li_cache, e );
+ ldap_pvt_thread_rdwr_wunlock(&li->li_giant_rwlock);
}
- send_ldap_result( conn, op, LDAP_SUCCESS, "", "" );
- if ( dn != NULL )
- free( dn );
- if ( pdn != NULL )
- free( pdn );
- cache_set_state( &li->li_cache, e, 0 );
- cache_return_entry( &li->li_cache, e );
- return( 0 );
-
-error_return:;
- if ( dn != NULL )
- free( dn );
- if ( pdn != NULL )
- free( pdn );
- next_id_return( be, e->e_id );
- cache_delete_entry( &li->li_cache, e );
- cache_return_entry( &li->li_cache, e );
-
- return( -1 );
+ return( rc );
}
/* attr.c - backend routines for dealing with attributes */
+/* $OpenLDAP$ */
+/*
+ * Copyright 1998-2002 The OpenLDAP Foundation, All Rights Reserved.
+ * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
+ */
+
+#include "portable.h"
#include <stdio.h>
-#include <string.h>
-#include <sys/types.h>
-#include <sys/socket.h>
+
+#include <ac/socket.h>
+#include <ac/string.h>
+
#include "slap.h"
#include "back-ldbm.h"
-extern char **str2charray();
+/* for the cache of attribute information (which are indexed, etc.) */
+typedef struct ldbm_attrinfo {
+ AttributeDescription *ai_desc; /* attribute description cn;lang-en */
+ slap_mask_t ai_indexmask; /* how the attr is indexed */
+} AttrInfo;
static int
ainfo_type_cmp(
- char *type,
- struct attrinfo *a
+ AttributeDescription *desc,
+ AttrInfo *a
)
{
- return( strcasecmp( type, a->ai_type ) );
+ return desc - a->ai_desc;
}
static int
ainfo_cmp(
- struct attrinfo *a,
- struct attrinfo *b
+ AttrInfo *a,
+ AttrInfo *b
)
{
- return( strcasecmp( a->ai_type, b->ai_type ) );
-}
-
-/*
- * Called when a duplicate "index" line is encountered.
- *
- * returns 1 => original from init code, indexmask updated
- * 2 => original not from init code, warn the user
- */
-
-static int
-ainfo_dup(
- struct attrinfo *a,
- struct attrinfo *b
-)
-{
- /*
- * if the duplicate definition is because we initialized the attr,
- * just add what came from the config file. otherwise, complain.
- */
- if ( a->ai_indexmask & INDEX_FROMINIT ) {
- a->ai_indexmask |= b->ai_indexmask;
-
- return( 1 );
- }
-
- return( 2 );
+ return a->ai_desc - b->ai_desc;
}
void
-attr_masks(
+attr_mask(
struct ldbminfo *li,
- char *type,
- int *indexmask,
- int *syntaxmask
-)
+ AttributeDescription *desc,
+ slap_mask_t *indexmask )
{
- struct attrinfo *a;
-
- *indexmask = 0;
- *syntaxmask = 0;
- if ( (a = (struct attrinfo *) avl_find( li->li_attrs, type,
- ainfo_type_cmp )) == NULL ) {
- if ( (a = (struct attrinfo *) avl_find( li->li_attrs, "default",
- ainfo_type_cmp )) == NULL ) {
- return;
- }
- }
- *indexmask = a->ai_indexmask;
- if ( strcasecmp( a->ai_type, "default" ) == 0 ) {
- *syntaxmask = attr_syntax( type );
- } else {
- *syntaxmask = a->ai_syntaxmask;
- }
+ AttrInfo *a;
+
+ a = (AttrInfo *) avl_find( li->li_attrs, desc,
+ (AVL_CMP) ainfo_type_cmp );
+
+ *indexmask = a != NULL ? a->ai_indexmask : 0;
}
-void
+int
attr_index_config(
struct ldbminfo *li,
- char *fname,
+ const char *fname,
int lineno,
int argc,
- char **argv,
- int init
-)
+ char **argv )
{
- int i, j;
- char **attrs, **indexes;
- struct attrinfo *a;
+ int rc;
+ int i;
+ slap_mask_t mask;
+ char **attrs;
+ char **indexes = NULL;
attrs = str2charray( argv[0], "," );
+
+ if( attrs == NULL ) {
+ fprintf( stderr, "%s: line %d: "
+ "no attributes specified: %s\n",
+ fname, lineno, argv[0] );
+ return LDAP_PARAM_ERROR;
+ }
+
if ( argc > 1 ) {
indexes = str2charray( argv[1], "," );
+
+ if( indexes == NULL ) {
+ fprintf( stderr, "%s: line %d: "
+ "no indexes specified: %s\n",
+ fname, lineno, argv[1] );
+ return LDAP_PARAM_ERROR;
+ }
}
- for ( i = 0; attrs[i] != NULL; i++ ) {
- a = (struct attrinfo *) ch_malloc( sizeof(struct attrinfo) );
- a->ai_type = strdup( attrs[i] );
- a->ai_syntaxmask = attr_syntax( a->ai_type );
- if ( argc == 1 ) {
- a->ai_indexmask = (INDEX_PRESENCE | INDEX_EQUALITY |
- INDEX_APPROX | INDEX_SUB);
- } else {
- a->ai_indexmask = 0;
- for ( j = 0; indexes[j] != NULL; j++ ) {
- if ( strncasecmp( indexes[j], "pres", 4 )
- == 0 ) {
- a->ai_indexmask |= INDEX_PRESENCE;
- } else if ( strncasecmp( indexes[j], "eq", 2 )
- == 0 ) {
- a->ai_indexmask |= INDEX_EQUALITY;
- } else if ( strncasecmp( indexes[j], "approx",
- 6 ) == 0 ) {
- a->ai_indexmask |= INDEX_APPROX;
- } else if ( strncasecmp( indexes[j], "sub", 3 )
- == 0 ) {
- a->ai_indexmask |= INDEX_SUB;
- } else if ( strncasecmp( indexes[j], "none", 4 )
- == 0 ) {
- if ( a->ai_indexmask != 0 ) {
- fprintf( stderr,
-"%s: line %d: index type \"none\" cannot be combined with other types\n",
- fname, lineno );
- }
- a->ai_indexmask = 0;
- } else {
- fprintf( stderr,
- "%s: line %d: unknown index type \"%s\" (ignored)\n",
- fname, lineno, indexes[j] );
- fprintf( stderr,
- "valid index types are \"pres\", \"eq\", \"approx\", or \"sub\"\n" );
- }
+
+ if( indexes == NULL ) {
+ mask = li->li_defaultmask;
+
+ } else {
+ mask = 0;
+
+ for ( i = 0; indexes[i] != NULL; i++ ) {
+ slap_mask_t index;
+ rc = slap_str2index( indexes[i], &index );
+
+ if( rc != LDAP_SUCCESS ) {
+ fprintf( stderr, "%s: line %d: "
+ "index type \"%s\" undefined\n",
+ fname, lineno, indexes[i] );
+ return LDAP_PARAM_ERROR;
}
+
+ mask |= index;
+ }
+ }
+
+ if( !mask ) {
+ fprintf( stderr, "%s: line %d: "
+ "no indexes selected\n",
+ fname, lineno );
+ return LDAP_PARAM_ERROR;
+ }
+
+ for ( i = 0; attrs[i] != NULL; i++ ) {
+ AttrInfo *a;
+ AttributeDescription *ad;
+ const char *text;
+
+ if( strcasecmp( attrs[i], "default" ) == 0 ) {
+ li->li_defaultmask = mask;
+ continue;
+ }
+
+ a = (AttrInfo *) ch_malloc( sizeof(AttrInfo) );
+
+ ad = NULL;
+ rc = slap_str2ad( attrs[i], &ad, &text );
+
+ if( rc != LDAP_SUCCESS ) {
+ fprintf( stderr, "%s: line %d: "
+ "index attribute \"%s\" undefined\n",
+ fname, lineno, attrs[i] );
+ return rc;
+ }
+
+ if( slap_ad_is_binary( ad ) ) {
+ fprintf( stderr, "%s: line %d: "
+ "index of attribute \"%s\" disallowed\n",
+ fname, lineno, attrs[i] );
+ return LDAP_UNWILLING_TO_PERFORM;
+ }
+
+ if( IS_SLAP_INDEX( mask, SLAP_INDEX_APPROX ) && !(
+ ( ad->ad_type->sat_approx
+ && ad->ad_type->sat_approx->smr_indexer
+ && ad->ad_type->sat_approx->smr_filter )
+ && ( ad->ad_type->sat_equality
+ && ad->ad_type->sat_equality->smr_indexer
+ && ad->ad_type->sat_equality->smr_filter ) ) )
+ {
+ fprintf( stderr, "%s: line %d: "
+ "approx index of attribute \"%s\" disallowed\n",
+ fname, lineno, attrs[i] );
+ return LDAP_INAPPROPRIATE_MATCHING;
+ }
+
+ if( IS_SLAP_INDEX( mask, SLAP_INDEX_EQUALITY ) && !(
+ ad->ad_type->sat_equality
+ && ad->ad_type->sat_equality->smr_indexer
+ && ad->ad_type->sat_equality->smr_filter ) )
+ {
+ fprintf( stderr, "%s: line %d: "
+ "equality index of attribute \"%s\" disallowed\n",
+ fname, lineno, attrs[i] );
+ return LDAP_INAPPROPRIATE_MATCHING;
}
- if ( init ) {
- a->ai_indexmask |= INDEX_FROMINIT;
+
+ if( IS_SLAP_INDEX( mask, SLAP_INDEX_SUBSTR ) && !(
+ ad->ad_type->sat_substr
+ && ad->ad_type->sat_substr->smr_indexer
+ && ad->ad_type->sat_substr->smr_filter ) )
+ {
+ fprintf( stderr, "%s: line %d: "
+ "substr index of attribute \"%s\" disallowed\n",
+ fname, lineno, attrs[i] );
+ return LDAP_INAPPROPRIATE_MATCHING;
}
- switch (avl_insert( &li->li_attrs, a, ainfo_cmp, ainfo_dup )) {
- case 1: /* duplicate - updating init version */
- free( a->ai_type );
- free( (char *) a );
- break;
-
- case 2: /* user duplicate - ignore and warn */
- fprintf( stderr,
- "%s: line %d: duplicate index definition for attr \"%s\" (ignored)\n",
- fname, lineno, a->ai_type );
- free( a->ai_type );
- free( (char *) a );
- break;
-
- default:; /* inserted ok */
- /* FALL */
+#ifdef NEW_LOGGING
+ LDAP_LOG( BACK_LDBM, DETAIL1,
+ "attr_index_config: index %s 0x%04lx\n",
+ ad->ad_cname.bv_val, mask, 0 );
+#else
+ Debug( LDAP_DEBUG_CONFIG, "index %s 0x%04lx\n",
+ ad->ad_cname.bv_val, mask, 0 );
+#endif
+
+
+ a->ai_desc = ad;
+
+ a->ai_indexmask = mask;
+
+ rc = avl_insert( &li->li_attrs, (caddr_t) a,
+ (AVL_CMP) ainfo_cmp, (AVL_DUP) avl_dup_error );
+
+ if( rc ) {
+ fprintf( stderr, "%s: line %d: duplicate index definition "
+ "for attr \"%s\" (ignored)\n",
+ fname, lineno, attrs[i] );
+
+ return LDAP_PARAM_ERROR;
}
}
+
charray_free( attrs );
- if ( argc > 1 )
- charray_free( indexes );
+ if ( indexes != NULL ) charray_free( indexes );
+
+ return LDAP_SUCCESS;
+}
+
+void
+attr_index_destroy( Avlnode *tree )
+{
+ avl_free( tree, free );
}
#include "back-ldbm.h"
#include "proto-back-ldbm.h"
-
/* return LDAP_SUCCESS IFF we can retrieve the attributes
* of entry with e_ndn
*/
int nvals = 0;
#ifdef NEW_LOGGING
- LDAP_LOG(( "backend", LDAP_LEVEL_ARGS,
- "ldbm_back_attribute: gr dn: \"%s\"\n", entry_ndn->bv_val ));
- LDAP_LOG(( "backend", LDAP_LEVEL_ARGS,
- "ldbm_back_attribute: at: \"%s\"\n", entry_at_name));
- LDAP_LOG(( "backend", LDAP_LEVEL_ARGS,
- "ldbm_back_attribute: tr dn: \"%s\"\n",
- target ? target->e_ndn : "" ));
+ LDAP_LOG( BACK_LDBM, ARGS,
+ "ldbm_back_attribute: gr dn: \"%s\"\n", entry_ndn->bv_val, 0, 0 );
+ LDAP_LOG( BACK_LDBM, ARGS,
+ "ldbm_back_attribute: at: \"%s\"\n", entry_at_name, 0, 0);
+ LDAP_LOG( BACK_LDBM, ARGS, "ldbm_back_attribute: tr dn: \"%s\"\n",
+ target ? target->e_ndn : "", 0, 0 );
#else
Debug( LDAP_DEBUG_ARGS,
"=> ldbm_back_attribute: gr dn: \"%s\"\n",
/* we already have a LOCKED copy of the entry */
e = target;
#ifdef NEW_LOGGING
- LDAP_LOG(( "backend", LDAP_LEVEL_DETAIL1,
- "ldbm_back_attribute: target is LOCKED (%s)\n",
- entry_ndn->bv_val ));
+ LDAP_LOG( BACK_LDBM, DETAIL1,
+ "ldbm_back_attribute: target is LOCKED (%s)\n",
+ entry_ndn->bv_val, 0, 0);
#else
Debug( LDAP_DEBUG_ARGS,
"=> ldbm_back_attribute: target is entry: \"%s\"\n",
/* can we find entry with reader lock */
if ((e = dn2entry_r(be, entry_ndn, NULL )) == NULL) {
#ifdef NEW_LOGGING
- LDAP_LOG(( "backend", LDAP_LEVEL_INFO,
+ LDAP_LOG( BACK_LDBM, INFO,
"ldbm_back_attribute: cannot find entry (%s)\n",
- entry_ndn->bv_val ));
+ entry_ndn->bv_val, 0, 0 );
#else
Debug( LDAP_DEBUG_ACL,
"=> ldbm_back_attribute: cannot find entry: \"%s\"\n",
}
#ifdef NEW_LOGGING
- LDAP_LOG(( "backend", LDAP_LEVEL_DETAIL1,
- "ldbm_back_attribute: found entry (%s)\n",
- entry_ndn->bv_val ));
+ LDAP_LOG( BACK_LDBM, DETAIL1,
+ "ldbm_back_attribute: found entry (%s)\n", entry_ndn->bv_val, 0, 0);
#else
Debug( LDAP_DEBUG_ACL,
"=> ldbm_back_attribute: found entry: \"%s\"\n",
if( is_entry_alias( e ) ) {
#ifdef NEW_LOGGING
- LDAP_LOG(( "backend", LDAP_LEVEL_INFO,
- "ldbm_back_attribute: entry (%s) is an alias\n", e->e_dn ));
+ LDAP_LOG( BACK_LDBM, INFO,
+ "ldbm_back_attribute: entry (%s) is an alias\n", e->e_dn, 0, 0 );
#else
Debug( LDAP_DEBUG_ACL,
"<= ldbm_back_attribute: entry is an alias\n", 0, 0, 0 );
if( is_entry_referral( e ) ) {
#ifdef NEW_LOGGING
- LDAP_LOG(( "backend", LDAP_LEVEL_INFO,
- "ldbm_back_attribute: entry (%s) is a referral.\n", e->e_dn ));
+ LDAP_LOG( BACK_LDBM, INFO,
+ "ldbm_back_attribute: entry (%s) is a referral.\n", e->e_dn, 0, 0 );
#else
Debug( LDAP_DEBUG_ACL,
"<= ldbm_back_attribute: entry is an referral\n", 0, 0, 0 );
if ((attr = attr_find(e->e_attrs, entry_at)) == NULL) {
#ifdef NEW_LOGGING
- LDAP_LOG(( "backend", LDAP_LEVEL_INFO,
- "ldbm_back_attribute: failed to find %s.\n", entry_at_name ));
+ LDAP_LOG( BACK_LDBM, INFO,
+ "ldbm_back_attribute: failed to find %s.\n", entry_at_name, 0, 0 );
#else
Debug( LDAP_DEBUG_ACL,
"<= ldbm_back_attribute: failed to find %s\n",
}
#ifdef NEW_LOGGING
- LDAP_LOG(( "backend", LDAP_LEVEL_ENTRY,
- "ldbm_back_attribute: rc=%d nvals=%d.\n",
- rc, nvals ));
+ LDAP_LOG( BACK_LDBM, ENTRY,
+ "ldbm_back_attribute: rc=%d nvals=%d.\n", rc, nvals, 0 );
#else
Debug( LDAP_DEBUG_TRACE,
"ldbm_back_attribute: rc=%d nvals=%d\n",
/* bind.c - ldbm backend bind and unbind routines */
+/* $OpenLDAP$ */
+/*
+ * Copyright 1998-2002 The OpenLDAP Foundation, All Rights Reserved.
+ * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
+ */
+
+#include "portable.h"
#include <stdio.h>
-#include <string.h>
-#include <sys/types.h>
-#include <sys/socket.h>
-#include "slap.h"
-#include "back-ldbm.h"
-#ifdef KERBEROS
-#include "krb.h"
-#endif
-extern Entry *dn2entry();
-extern Attribute *attr_find();
+#include <ac/krb.h>
+#include <ac/socket.h>
+#include <ac/string.h>
+#include <ac/unistd.h>
-#ifdef KERBEROS
-extern int krbv4_ldap_auth();
-#endif
+#include "slap.h"
+#include "back-ldbm.h"
+#include "proto-back-ldbm.h"
int
ldbm_back_bind(
Backend *be,
Connection *conn,
Operation *op,
- char *dn,
+ struct berval *dn,
+ struct berval *ndn,
int method,
- struct berval *cred
+ struct berval *cred,
+ struct berval *edn
)
{
struct ldbminfo *li = (struct ldbminfo *) be->be_private;
Entry *e;
Attribute *a;
int rc;
- char *matched = NULL;
-#ifdef KERBEROS
+ Entry *matched;
+#ifdef LDAP_API_FEATURE_X_OPENLDAP_V2_KBIND
char krbname[MAX_K_NAME_SZ + 1];
+ AttributeDescription *krbattr = slap_schema.si_ad_krbName;
AUTH_DAT ad;
#endif
- if ( (e = dn2entry( be, dn, &matched )) == NULL ) {
- /* allow noauth binds */
- if ( method == LDAP_AUTH_SIMPLE && cred->bv_len == 0 ) {
- /*
- * bind successful, but return 1 so we don't
- * authorize based on noauth credentials
- */
- send_ldap_result( conn, op, LDAP_SUCCESS, NULL, NULL );
- rc = 1;
- } else if ( be_isroot_pw( be, dn, cred ) ) {
- /* front end will send result */
- rc = 0;
+ AttributeDescription *password = slap_schema.si_ad_userPassword;
+
+#ifdef NEW_LOGGING
+ LDAP_LOG( BACK_LDBM, ENTRY,
+ "ldbm_back_bind: dn: %s.\n", dn->bv_val, 0, 0 );
+#else
+ Debug(LDAP_DEBUG_ARGS, "==> ldbm_back_bind: dn: %s\n", dn->bv_val, 0, 0);
+#endif
+
+ dn = ndn;
+
+ /* grab giant lock for reading */
+ ldap_pvt_thread_rdwr_rlock(&li->li_giant_rwlock);
+
+ /* get entry with reader lock */
+ if ( (e = dn2entry_r( be, dn, &matched )) == NULL ) {
+ char *matched_dn = NULL;
+ BerVarray refs = NULL;
+
+ if( matched != NULL ) {
+ matched_dn = ch_strdup( matched->e_dn );
+
+ refs = is_entry_referral( matched )
+ ? get_entry_referrals( be, conn, op, matched )
+ : NULL;
+
+ cache_return_entry_r( &li->li_cache, matched );
+
} else {
- send_ldap_result( conn, op, LDAP_NO_SUCH_OBJECT,
- matched, NULL );
- rc = 1;
+ refs = referral_rewrite( default_referral,
+ NULL, dn, LDAP_SCOPE_DEFAULT );
}
- if ( matched != NULL ) {
- free( matched );
+
+ ldap_pvt_thread_rdwr_runlock(&li->li_giant_rwlock);
+
+ /* allow noauth binds */
+ rc = 1;
+ if ( method == LDAP_AUTH_SIMPLE ) {
+ if ( be_isroot_pw( be, conn, dn, cred ) ) {
+ ber_dupbv( edn, be_root_dn( be ) );
+ rc = 0; /* front end will send result */
+
+ } else if ( refs != NULL ) {
+ send_ldap_result( conn, op, LDAP_REFERRAL,
+ matched_dn, NULL, refs, NULL );
+
+ } else {
+ send_ldap_result( conn, op, LDAP_INVALID_CREDENTIALS,
+ NULL, NULL, NULL, NULL );
+ }
+
+ } else if ( refs != NULL ) {
+ send_ldap_result( conn, op, LDAP_REFERRAL,
+ matched_dn, NULL, refs, NULL );
+
+ } else {
+ send_ldap_result( conn, op, LDAP_INVALID_CREDENTIALS,
+ NULL, NULL, NULL, NULL );
}
+
+ if ( refs ) ber_bvarray_free( refs );
+ if ( matched_dn ) free( matched_dn );
return( rc );
}
+ ber_dupbv( edn, &e->e_name );
+
+ /* check for deleted */
+
+ if ( is_entry_alias( e ) ) {
+ /* entry is an alias, don't allow bind */
+#ifdef NEW_LOGGING
+ LDAP_LOG( BACK_LDBM, INFO,
+ "ldbm_back_bind: entry (%s) is an alias.\n", e->e_dn, 0, 0 );
+#else
+ Debug( LDAP_DEBUG_TRACE, "entry is alias\n", 0,
+ 0, 0 );
+#endif
+
+
+ send_ldap_result( conn, op, LDAP_ALIAS_PROBLEM,
+ NULL, "entry is alias", NULL, NULL );
+
+ rc = 1;
+ goto return_results;
+ }
+
+ if ( is_entry_referral( e ) ) {
+ /* entry is a referral, don't allow bind */
+ BerVarray refs = get_entry_referrals( be,
+ conn, op, e );
+
+#ifdef NEW_LOGGING
+ LDAP_LOG( BACK_LDBM, INFO,
+ "ldbm_back_bind: entry(%s) is a referral.\n", e->e_dn, 0, 0 );
+#else
+ Debug( LDAP_DEBUG_TRACE, "entry is referral\n", 0,
+ 0, 0 );
+#endif
+
+
+ if( refs != NULL ) {
+ send_ldap_result( conn, op, LDAP_REFERRAL,
+ e->e_dn, NULL, refs, NULL );
+
+ } else {
+ send_ldap_result( conn, op, LDAP_INVALID_CREDENTIALS,
+ NULL, NULL, NULL, NULL );
+ }
+
+ ber_bvarray_free( refs );
+
+ rc = 1;
+ goto return_results;
+ }
+
switch ( method ) {
case LDAP_AUTH_SIMPLE:
- if ( cred->bv_len == 0 ) {
- send_ldap_result( conn, op, LDAP_SUCCESS, NULL, NULL );
- return( 1 );
- } else if ( be_isroot_pw( be, dn, cred ) ) {
+ /* check for root dn/passwd */
+ if ( be_isroot_pw( be, conn, dn, cred ) ) {
/* front end will send result */
- return( 0 );
+ if(edn->bv_val != NULL) free( edn->bv_val );
+ ber_dupbv( edn, be_root_dn( be ) );
+ rc = 0;
+ goto return_results;
}
- if ( (a = attr_find( e->e_attrs, "userpassword" )) == NULL ) {
- if ( be_isroot_pw( be, dn, cred ) ) {
- /* front end will send result */
- return( 0 );
- }
+ if ( ! access_allowed( be, conn, op, e,
+ password, NULL, ACL_AUTH, NULL ) )
+ {
+ send_ldap_result( conn, op, LDAP_INSUFFICIENT_ACCESS,
+ NULL, NULL, NULL, NULL );
+ rc = 1;
+ goto return_results;
+ }
+
+ if ( (a = attr_find( e->e_attrs, password )) == NULL ) {
send_ldap_result( conn, op, LDAP_INAPPROPRIATE_AUTH,
- NULL, NULL );
- cache_return_entry( &li->li_cache, e );
- return( 1 );
+ NULL, NULL, NULL, NULL );
+
+ /* stop front end from sending result */
+ rc = 1;
+ goto return_results;
}
- if ( value_find( a->a_vals, cred, a->a_syntax, 0 ) != 0 ) {
- if ( be_isroot_pw( be, dn, cred ) ) {
- /* front end will send result */
- return( 0 );
- }
+ if ( slap_passwd_check( conn, a, cred ) != 0 ) {
send_ldap_result( conn, op, LDAP_INVALID_CREDENTIALS,
- NULL, NULL );
- cache_return_entry( &li->li_cache, e );
- return( 1 );
+ NULL, NULL, NULL, NULL );
+ /* stop front end from sending result */
+ rc = 1;
+ goto return_results;
}
+
+ rc = 0;
break;
-#ifdef KERBEROS
+#ifdef LDAP_API_FEATURE_X_OPENLDAP_V2_KBIND
case LDAP_AUTH_KRBV41:
if ( krbv4_ldap_auth( be, cred, &ad ) != LDAP_SUCCESS ) {
send_ldap_result( conn, op, LDAP_INVALID_CREDENTIALS,
- NULL, NULL );
- cache_return_entry( &li->li_cache, e );
- return( 1 );
+ NULL, NULL, NULL, NULL );
+ rc = 1;
+ goto return_results;
}
+
+ if ( ! access_allowed( be, conn, op, e,
+ krbattr, NULL, ACL_AUTH, NULL ) )
+ {
+ send_ldap_result( conn, op, LDAP_INSUFFICIENT_ACCESS,
+ NULL, NULL, NULL, NULL );
+ rc = 1;
+ goto return_results;
+ }
+
sprintf( krbname, "%s%s%s@%s", ad.pname, *ad.pinst ? "."
: "", ad.pinst, ad.prealm );
- if ( (a = attr_find( e->e_attrs, "krbname" )) == NULL ) {
+
+ if ( (a = attr_find( e->e_attrs, krbattr )) == NULL ) {
/*
- * no krbName values present: check against DN
+ * no krbname values present: check against DN
*/
- if ( strcasecmp( dn, krbname ) == 0 ) {
+ if ( strcasecmp( dn->bv_val, krbname ) == 0 ) {
+ rc = 0;
break;
}
send_ldap_result( conn, op, LDAP_INAPPROPRIATE_AUTH,
- NULL, NULL );
- cache_return_entry( &li->li_cache, e );
- return( 1 );
- } else { /* look for krbName match */
+ NULL, NULL, NULL, NULL );
+ rc = 1;
+ goto return_results;
+
+ } else { /* look for krbname match */
struct berval krbval;
krbval.bv_val = krbname;
krbval.bv_len = strlen( krbname );
- if ( value_find( a->a_vals, &krbval, a->a_syntax, 3 )
- != 0 ) {
+ if ( value_find( a->a_desc, a->a_vals, &krbval ) != 0 ) {
send_ldap_result( conn, op,
- LDAP_INVALID_CREDENTIALS, NULL, NULL );
- cache_return_entry( &li->li_cache, e );
- return( 1 );
+ LDAP_INVALID_CREDENTIALS,
+ NULL, NULL, NULL, NULL );
+ rc = 1;
+ goto return_results;
}
}
+ rc = 0;
break;
case LDAP_AUTH_KRBV42:
- send_ldap_result( conn, op, LDAP_SUCCESS, NULL, NULL );
- cache_return_entry( &li->li_cache, e );
- return( 1 );
+ send_ldap_result( conn, op, LDAP_UNWILLING_TO_PERFORM,
+ NULL, "Kerberos bind step 2 not supported",
+ NULL, NULL );
+ /* stop front end from sending result */
+ rc = LDAP_UNWILLING_TO_PERFORM;
+ goto return_results;
#endif
default:
send_ldap_result( conn, op, LDAP_STRONG_AUTH_NOT_SUPPORTED,
- NULL, "auth method not supported" );
- cache_return_entry( &li->li_cache, e );
- return( 1 );
+ NULL, "authentication method not supported", NULL, NULL );
+ rc = 1;
+ goto return_results;
}
- cache_return_entry( &li->li_cache, e );
+return_results:;
+ /* free entry and reader lock */
+ cache_return_entry_r( &li->li_cache, e );
+ ldap_pvt_thread_rdwr_runlock(&li->li_giant_rwlock);
- /* success: front end will send result */
- return( 0 );
+ /* front end with send result on success (rc==0) */
+ return( rc );
}
+
ldap_pvt_thread_mutex_unlock( &cache->c_mutex );
#ifdef NEW_LOGGING
- LDAP_LOG(( "cache", LDAP_LEVEL_DETAIL1,
+ LDAP_LOG( CACHE, DETAIL1,
"cache_return_entry_rw: return (%ld):%s, refcnt=%d\n",
- id, rw ? "w" : "r", refcnt ));
+ id, rw ? "w" : "r", refcnt );
#else
Debug( LDAP_DEBUG_TRACE,
"====> cache_return_entry_%s( %ld ): created (%d)\n",
ldap_pvt_thread_mutex_unlock( &cache->c_mutex );
#ifdef NEW_LOGGING
- LDAP_LOG(( "cache", LDAP_LEVEL_DETAIL1,
+ LDAP_LOG( CACHE, DETAIL1,
"cache_return_entry_rw: %ld, delete pending (%d).\n",
- id, refcnt ));
+ id, refcnt, 0 );
#else
Debug( LDAP_DEBUG_TRACE,
"====> cache_return_entry_%s( %ld ): delete pending (%d)\n",
ldap_pvt_thread_mutex_unlock( &cache->c_mutex );
#ifdef NEW_LOGGING
- LDAP_LOG(( "cache", LDAP_LEVEL_DETAIL1,
- "cache_return_entry_rw: (%ld): deleted (%d)\n",
- id, refcnt ));
+ LDAP_LOG( CACHE, DETAIL1,
+ "cache_return_entry_rw: (%ld): deleted (%d)\n", id, refcnt, 0 );
#else
Debug( LDAP_DEBUG_TRACE,
"====> cache_return_entry_%s( %ld ): deleted (%d)\n",
ldap_pvt_thread_mutex_unlock( &cache->c_mutex );
#ifdef NEW_LOGGING
- LDAP_LOG(( "cache", LDAP_LEVEL_DETAIL1,
+ LDAP_LOG( CACHE, DETAIL1,
"cache_return_entry_rw: ID %ld:%s returned (%d)\n",
- id, rw ? "w": "r", refcnt ));
+ id, rw ? "w": "r", refcnt );
#else
Debug( LDAP_DEBUG_TRACE,
"====> cache_return_entry_%s( %ld ): returned (%d)\n",
Entry *ee;
#ifdef NEW_LOGGING
- LDAP_LOG(( "cache", LDAP_LEVEL_ENTRY,
+ LDAP_LOG( CACHE, ENTRY,
"cache_add_entry_rw: add (%s):%s to cache\n",
- e->e_dn, rw ? "w" : "r" ));
+ e->e_dn, rw ? "w" : "r", 0 );
#endif
/* set cache mutex */
ldap_pvt_thread_mutex_lock( &cache->c_mutex );
ldap_pvt_thread_mutex_unlock( &cache->c_mutex );
#ifdef NEW_LOGGING
- LDAP_LOG(( "cache", LDAP_LEVEL_ERR,
+ LDAP_LOG( CACHE, ERR,
"cache_add_entry_rw: add (%s):%ld private init failed!\n",
- e->e_dn, e->e_id ));
+ e->e_dn, e->e_id, 0 );
#else
Debug( LDAP_DEBUG_ANY,
"====> cache_add_entry( %ld ): \"%s\": private init failed!\n",
ldap_pvt_thread_mutex_unlock( &cache->c_mutex );
#ifdef NEW_LOGGING
- LDAP_LOG(( "cache", LDAP_LEVEL_DETAIL1,
- "cache_add_entry: (%s):%ld already in cache.\n",
- e->e_dn, e->e_id ));
+ LDAP_LOG( CACHE, DETAIL1,
+ "cache_add_entry: (%s):%ld already in cache.\n",
+ e->e_dn, e->e_id, 0 );
#else
Debug( LDAP_DEBUG_TRACE,
"====> cache_add_entry( %ld ): \"%s\": already in dn cache\n",
(AVL_CMP) entry_id_cmp, avl_dup_error ) != 0 )
{
#ifdef NEW_LOGGING
- LDAP_LOG(( "cache", LDAP_LEVEL_DETAIL1,
- "cache_add_entry: (%s):%ls already in cache.\n",
- e->e_dn, e->e_id ));
+ LDAP_LOG( CACHE, DETAIL1,
+ "cache_add_entry: (%s):%ls already in cache.\n",
+ e->e_dn, e->e_id, 0 );
#else
Debug( LDAP_DEBUG_ANY,
"====> cache_add_entry( %ld ): \"%s\": already in id cache\n",
(AVL_CMP) entry_dn_cmp ) == NULL )
{
#ifdef NEW_LOGGING
- LDAP_LOG(( "cache", LDAP_LEVEL_INFO,
- "cache_add_entry: can't delete (%s) from cache.\n",
- e->e_dn ));
+ LDAP_LOG( CACHE, INFO,
+ "cache_add_entry: can't delete (%s) from cache.\n",
+ e->e_dn, 0, 0 );
#else
Debug( LDAP_DEBUG_ANY, "====> can't delete from dn cache\n",
0, 0, 0 );
(AVL_CMP) entry_dn_cmp, avl_dup_error ) != 0 )
{
#ifdef NEW_LOGGING
- LDAP_LOG(( "cache", LDAP_LEVEL_DETAIL1,
+ LDAP_LOG( CACHE, DETAIL1,
"cache_update_entry: (%s):%ld already in dn cache\n",
- e->e_dn, e->e_id ));
+ e->e_dn, e->e_id, 0 );
#else
Debug( LDAP_DEBUG_TRACE,
"====> cache_update_entry( %ld ): \"%s\": already in dn cache\n",
(AVL_CMP) entry_id_cmp, avl_dup_error ) != 0 )
{
#ifdef NEW_LOGGING
- LDAP_LOG(( "cache", LDAP_LEVEL_DETAIL1,
+ LDAP_LOG( CACHE, DETAIL1,
"cache_update_entry: (%s)%ld already in id cache\n",
- e->e_dn, e->e_id ));
+ e->e_dn, e->e_id, 0 );
#else
Debug( LDAP_DEBUG_ANY,
"====> cache_update_entry( %ld ): \"%s\": already in id cache\n",
(AVL_CMP) entry_dn_cmp ) == NULL )
{
#ifdef NEW_LOGGING
- LDAP_LOG(( "cache", LDAP_LEVEL_INFO,
- "cache_update_entry: can't delete (%s)%ld from dn cache.\n",
- e->e_dn, e->e_id ));
+ LDAP_LOG( CACHE, INFO,
+ "cache_update_entry: can't delete (%s)%ld from dn cache.\n",
+ e->e_dn, e->e_id, 0 );
#else
Debug( LDAP_DEBUG_ANY, "====> can't delete from dn cache\n",
0, 0, 0 );
ldap_pvt_thread_mutex_unlock( &cache->c_mutex );
#ifdef NEW_LOGGING
- LDAP_LOG(( "cache", LDAP_LEVEL_INFO,
+ LDAP_LOG( CACHE, INFO,
"cache_find_entry_dn2id: (%s) %ld not ready: %d\n",
- ndn->bv_val, id, state ));
+ ndn->bv_val, id, state );
#else
Debug(LDAP_DEBUG_TRACE,
"====> cache_find_entry_dn2id(\"%s\"): %ld (not ready) %d\n",
ldap_pvt_thread_mutex_unlock( &cache->c_mutex );
#ifdef NEW_LOGGING
- LDAP_LOG(( "cache", LDAP_LEVEL_DETAIL1,
+ LDAP_LOG( CACHE, DETAIL1,
"cache_find_entry_dn2id: (%s): %ld %d tries\n",
- ndn->bv_val, id, count ));
+ ndn->bv_val, id, count );
#else
Debug(LDAP_DEBUG_TRACE,
"====> cache_find_entry_dn2id(\"%s\"): %ld (%d tries)\n",
ldap_pvt_thread_mutex_unlock( &cache->c_mutex );
#ifdef NEW_LOGGING
- LDAP_LOG(( "cache", LDAP_LEVEL_INFO,
+ LDAP_LOG( CACHE, INFO,
"cache_find_entry_id: (%ld)->%ld not ready (%d).\n",
- id, ep_id, state ));
+ id, ep_id, state );
#else
Debug(LDAP_DEBUG_TRACE,
ldap_pvt_thread_mutex_unlock( &cache->c_mutex );
#ifdef NEW_LOGGING
- LDAP_LOG(( "cache", LDAP_LEVEL_DETAIL1,
+ LDAP_LOG( CACHE, DETAIL1,
"cache_find_entry_id: %ld -> %s found %d tries.\n",
- ep_id, ep->e_dn, count ));
+ ep_id, ep->e_dn, count );
#else
Debug(LDAP_DEBUG_TRACE,
"====> cache_find_entry_id( %ld ) \"%s\" (found) (%d tries)\n",
assert( e->e_private );
#ifdef NEW_LOGGING
- LDAP_LOG(( "cache", LDAP_LEVEL_ENTRY,
- "cache_delete_entry: delete %ld.\n", e->e_id ));
+ LDAP_LOG( CACHE, ENTRY,
+ "cache_delete_entry: delete %ld.\n", e->e_id, 0, 0 );
#else
Debug( LDAP_DEBUG_TRACE, "====> cache_delete_entry( %ld )\n",
e->e_id, 0, 0 );
ldap_pvt_thread_mutex_lock( &cache->c_mutex );
#ifdef NEW_LOGGING
- LDAP_LOG(( "cache", LDAP_LEVEL_ENTRY,
- "cache_release_all: enter\n" ));
+ LDAP_LOG( CACHE, ENTRY, "cache_release_all: enter\n" , 0, 0, 0);
#else
Debug( LDAP_DEBUG_TRACE, "====> cache_release_all\n", 0, 0, 0 );
#endif
if ( cache->c_cursize ) {
#ifdef NEW_LOGGING
- LDAP_LOG(( "cache", LDAP_LEVEL_INFO,
- "cache_release_all: Entry cache could not be emptied.\n" ));
+ LDAP_LOG( CACHE, INFO,
+ "cache_release_all: Entry cache could not be emptied.\n", 0, 0, 0);
#else
Debug( LDAP_DEBUG_TRACE, "Entry-cache could not be emptied\n", 0, 0, 0 );
#endif
/* close.c - close ldbm backend */
+/* $OpenLDAP$ */
+/*
+ * Copyright 1998-2002 The OpenLDAP Foundation, All Rights Reserved.
+ * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
+ */
+
+#include "portable.h"
#include <stdio.h>
-#include <sys/types.h>
-#include <sys/socket.h>
+
+#include <ac/socket.h>
+
#include "slap.h"
#include "back-ldbm.h"
-ldbm_back_close( Backend *be )
+int
+ldbm_back_db_close( Backend *be )
{
+ struct ldbminfo *li = (struct ldbminfo *) be->be_private;
+ if ( li->li_dbsyncfreq > 0 )
+ {
+ li->li_dbshutdown++;
+ ldap_pvt_thread_join( li->li_dbsynctid, (void *) NULL );
+ }
+#ifdef NEW_LOGGING
+ LDAP_LOG( BACK_LDBM, CRIT,
+ "ldbm_back_db_close: ldbm backend syncing\n", 0, 0, 0 );
+#else
Debug( LDAP_DEBUG_TRACE, "ldbm backend syncing\n", 0, 0, 0 );
+#endif
+
ldbm_cache_flush_all( be );
+#ifdef NEW_LOGGING
+ LDAP_LOG( BACK_LDBM, CRIT,
+ "ldbm_back_db_close: ldbm backend synch'ed\n", 0, 0, 0 );
+#else
Debug( LDAP_DEBUG_TRACE, "ldbm backend done syncing\n", 0, 0, 0 );
+#endif
+
+
+ cache_release_all( &((struct ldbminfo *) be->be_private)->li_cache );
+
+ return 0;
}
/* compare.c - ldbm backend compare routine */
+/* $OpenLDAP$ */
+/*
+ * Copyright 1998-2002 The OpenLDAP Foundation, All Rights Reserved.
+ * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
+ */
+
+#include "portable.h"
#include <stdio.h>
-#include <string.h>
-#include <sys/types.h>
-#include <sys/socket.h>
+
+#include <ac/socket.h>
+#include <ac/string.h>
+
#include "slap.h"
#include "back-ldbm.h"
-
-extern Entry *dn2entry();
-extern Attribute *attr_find();
+#include "proto-back-ldbm.h"
int
ldbm_back_compare(
Backend *be,
Connection *conn,
Operation *op,
- char *dn,
- Ava *ava
+ struct berval *dn,
+ struct berval *ndn,
+ AttributeAssertion *ava
)
{
struct ldbminfo *li = (struct ldbminfo *) be->be_private;
- char *matched;
+ Entry *matched;
Entry *e;
Attribute *a;
- int i;
+ int rc;
+ int manageDSAit = get_manageDSAit( op );
+
+ /* grab giant lock for reading */
+ ldap_pvt_thread_rdwr_rlock(&li->li_giant_rwlock);
+
+ /* get entry with reader lock */
+ if ( (e = dn2entry_r( be, ndn, &matched )) == NULL ) {
+ char *matched_dn = NULL;
+ BerVarray refs = NULL;
+
+ if ( matched != NULL ) {
+ matched_dn = ch_strdup( matched->e_dn );
+ refs = is_entry_referral( matched )
+ ? get_entry_referrals( be, conn, op, matched )
+ : NULL;
+ cache_return_entry_r( &li->li_cache, matched );
+ } else {
+ refs = referral_rewrite( default_referral,
+ NULL, dn, LDAP_SCOPE_DEFAULT );
+ }
+
+ ldap_pvt_thread_rdwr_runlock(&li->li_giant_rwlock);
+
+ send_ldap_result( conn, op, LDAP_REFERRAL,
+ matched_dn, NULL, refs, NULL );
+
+ if ( refs ) ber_bvarray_free( refs );
+ free( matched_dn );
- if ( (e = dn2entry( be, dn, &matched )) == NULL ) {
- send_ldap_result( conn, op, LDAP_NO_SUCH_OBJECT, matched, "" );
return( 1 );
}
- if ( ! access_allowed( be, conn, op, e, ava->ava_type, &ava->ava_value,
- op->o_dn, ACL_COMPARE ) ) {
- send_ldap_result( conn, op, LDAP_INSUFFICIENT_ACCESS, "", "" );
- cache_return_entry( &li->li_cache, e );
- return( 1 );
+ if (!manageDSAit && is_entry_referral( e ) ) {
+ /* entry is a referral, don't allow add */
+ BerVarray refs = get_entry_referrals( be,
+ conn, op, e );
+
+#ifdef NEW_LOGGING
+ LDAP_LOG( BACK_LDBM, INFO,
+ "ldbm_back_compare: entry (%s) is a referral.\n", e->e_dn, 0, 0 );
+#else
+ Debug( LDAP_DEBUG_TRACE, "entry is referral\n", 0,
+ 0, 0 );
+#endif
+
+
+ send_ldap_result( conn, op, LDAP_REFERRAL,
+ e->e_dn, NULL, refs, NULL );
+
+ if (refs ) ber_bvarray_free( refs );
+
+ rc = 1;
+ goto return_results;
}
- if ( (a = attr_find( e->e_attrs, ava->ava_type )) == NULL ) {
- send_ldap_result( conn, op, LDAP_NO_SUCH_ATTRIBUTE, "", "" );
- cache_return_entry( &li->li_cache, e );
- return( 1 );
+ if ( ! access_allowed( be, conn, op, e,
+ ava->aa_desc, &ava->aa_value, ACL_COMPARE, NULL ) )
+ {
+ send_ldap_result( conn, op, LDAP_INSUFFICIENT_ACCESS,
+ NULL, NULL, NULL, NULL );
+ rc = 1;
+ goto return_results;
}
- if ( value_find( a->a_vals, &ava->ava_value, a->a_syntax, 1 ) == 0 ) {
- send_ldap_result( conn, op, LDAP_COMPARE_TRUE, "", "" );
- cache_return_entry( &li->li_cache, e );
- return( 0 );
+ rc = LDAP_NO_SUCH_ATTRIBUTE;
+
+ for(a = attrs_find( e->e_attrs, ava->aa_desc );
+ a != NULL;
+ a = attrs_find( a->a_next, ava->aa_desc ))
+ {
+ rc = LDAP_COMPARE_FALSE;
+
+ if ( value_find( ava->aa_desc, a->a_vals, &ava->aa_value ) == 0 ) {
+ rc = LDAP_COMPARE_TRUE;
+ break;
+ }
}
- send_ldap_result( conn, op, LDAP_COMPARE_FALSE, "", "" );
- cache_return_entry( &li->li_cache, e );
- return( 0 );
+ send_ldap_result( conn, op, rc,
+ NULL, NULL, NULL, NULL );
+
+ if( rc != LDAP_NO_SUCH_ATTRIBUTE ) {
+ rc = 0;
+ }
+
+
+return_results:;
+ cache_return_entry_r( &li->li_cache, e );
+ ldap_pvt_thread_rdwr_runlock(&li->li_giant_rwlock);
+ return( rc );
}
int i;
if ( argc < 2 ) {
#ifdef NEW_LOGGING
- LDAP_LOG (( "config", LDAP_LEVEL_ERR, "ldbm_back_db_config: %s: "
+ LDAP_LOG ( CONFIG, ERR, "ldbm_back_db_config: %s: "
"line %d: missing frequency value in \"dbsync <frequency> "
- "[<wait-times> [wait-interval]]\" line\n", fname, lineno ));
+ "[<wait-times> [wait-interval]]\" line\n", fname, lineno, 0 );
#else
Debug( LDAP_DEBUG_ANY,
"%s: line %d: missing frquency value in \"dbsync <frequency> [<wait-times> [wait-interval]]\" line\n",
if( i < 0 ) {
#ifdef NEW_LOGGING
- LDAP_LOG (( "config", LDAP_LEVEL_ERR, "ldbm_back_db_config: %s: "
+ LDAP_LOG ( CONFIG, ERR,
+ "ldbm_back_db_config: %s: "
"line %d: frequency value (%d) invalid \"dbsync "
"<frequency> [<wait-times> [wait-interval]]\" line\n",
- fname, lineno, i ));
+ fname, lineno, i );
#else
Debug( LDAP_DEBUG_ANY,
"%s: line %d: frquency value (%d) invalid \"dbsync <frequency> [<wait-times> [wait-interval]]\" line\n",
i = atoi( argv[2] );
if ( i < 0 ) {
#ifdef NEW_LOGGING
- LDAP_LOG (( "config",LDAP_LEVEL_ERR, "ldbm_back_db_config: %s: "
+ LDAP_LOG ( CONFIG,ERR, "ldbm_back_db_config: %s: "
"line %d: frequency value (%d) invalid \"dbsync "
"<frequency> [<wait-times> [wait-interval]]\" line\n",
- fname, lineno, i ));
+ fname, lineno, i );
#else
Debug( LDAP_DEBUG_ANY,
"%s: line %d: frquency value (%d) invalid \"dbsync <frequency> [<wait-times> [wait-interval]]\" line\n",
i = atoi( argv[3] );
if ( i <= 0 ) {
#ifdef NEW_LOGGING
- LDAP_LOG (( "config",LDAP_LEVEL_ERR, "ldbm_back_db_config: %s: "
+ LDAP_LOG ( CONFIG,ERR, "ldbm_back_db_config: %s: "
"line %d: frequency value (%d) invalid \"dbsync "
"<frequency> [<wait-times> [wait-interval]]\" line\n",
- fname, lineno, i ));
+ fname, lineno, i );
#else
Debug( LDAP_DEBUG_ANY,
"%s: line %d: frquency value (%d) invalid \"dbsync <frequency> [<wait-times> [wait-interval]]\" line\n",
#else
#ifdef NEW_LOGGING
- LDAP_LOG (( "config", LDAP_LEVEL_ERR, "ldbm_back_db_config: \"dbsync\""
- " policies not supported in non-threaded environments\n" ));
+ LDAP_LOG ( CONFIG, ERR, "ldbm_back_db_config: \"dbsync\""
+ " policies not supported in non-threaded environments\n", 0, 0, 0 );
#else
Debug( LDAP_DEBUG_ANY,
"\"dbsync\" policies not supported in non-threaded environments\n", 0, 0, 0);
}
#ifdef NEW_LOGGING
- LDAP_LOG(( "cache", LDAP_LEVEL_ENTRY,
- "ldbm_cache_open: \"%s\", %d, %o\n", buf, flags, li->li_mode ));
+ LDAP_LOG( CACHE, ENTRY,
+ "ldbm_cache_open: \"%s\", %d, %o\n", buf, flags, li->li_mode );
#else
Debug( LDAP_DEBUG_TRACE, "=> ldbm_cache_open( \"%s\", %d, %o )\n", buf,
flags, li->li_mode );
}
li->li_dbcache[i].dbc_refcnt++;
#ifdef NEW_LOGGING
- LDAP_LOG(( "cache", LDAP_LEVEL_DETAIL1,
- "ldbm_cache_open: cache %d\n", i ));
+ LDAP_LOG( CACHE, DETAIL1,
+ "ldbm_cache_open: cache %d\n", i, 0, 0 );
#else
Debug( LDAP_DEBUG_TRACE,
"<= ldbm_cache_open (cache %d)\n", i, 0, 0 );
li->li_dbcache[i].dbc_name = NULL;
} else {
#ifdef NEW_LOGGING
- LDAP_LOG(( "cache", LDAP_LEVEL_INFO,
- "ldbm_cache_open: no unused db to close - waiting\n" ));
+ LDAP_LOG( CACHE, INFO,
+ "ldbm_cache_open: no unused db to close - waiting\n",
+ 0, 0, 0 );
#else
Debug( LDAP_DEBUG_ANY,
"ldbm_cache_open no unused db to close - waiting\n",
{
int err = errno;
#ifdef NEW_LOGGING
- LDAP_LOG(( "cache", LDAP_LEVEL_ERR,
- "ldbm_cache_open: \"%s\" failed, errono=%d, reason=%s\n",
- buf, err, err > -1 && err < sys_nerr ? sys_errlist[err] :
- "unknown" ));
+ LDAP_LOG( CACHE, ERR,
+ "ldbm_cache_open: \"%s\" failed, errono=%d, reason=%s\n",
+ buf, err, err > -1 && err < sys_nerr ? sys_errlist[err] :
+ "unknown" );
#else
Debug( LDAP_DEBUG_TRACE,
"<= ldbm_cache_open NULL \"%s\" errno=%d reason=\"%s\")\n",
assert( li->li_dbcache[i].dbc_maxindirect < 256 );
#ifdef NEW_LOGGING
- LDAP_LOG(( "cache", LDAP_LEVEL_ARGS,
+ LDAP_LOG( CACHE, ARGS,
"ldbm_cache_open: blksize:%ld maxids:%d maxindirect:%d\n",
li->li_dbcache[i].dbc_blksize, li->li_dbcache[i].dbc_maxids,
- li->li_dbcache[i].dbc_maxindirect ));
+ li->li_dbcache[i].dbc_maxindirect );
#else
Debug( LDAP_DEBUG_ARGS,
"ldbm_cache_open (blksize %ld) (maxids %d) (maxindirect %d)\n",
#endif
#ifdef NEW_LOGGING
- LDAP_LOG(( "cache", LDAP_LEVEL_DETAIL1,
- "<= ldbm_cache_open: (opened %d)\n", i ));
+ LDAP_LOG( CACHE, DETAIL1, "<= ldbm_cache_open: (opened %d)\n", i, 0, 0 );
#else
Debug( LDAP_DEBUG_TRACE, "<= ldbm_cache_open (opened %d)\n", i, 0, 0 );
#endif
for ( i = 0; i < MAXDBCACHE; i++ ) {
if ( li->li_dbcache[i].dbc_name != NULL ) {
#ifdef NEW_LOGGING
- LDAP_LOG(( "cache", LDAP_LEVEL_DETAIL1,
+ LDAP_LOG( CACHE, DETAIL1,
"ldbm_cache_flush_all: flushing db (%s)\n",
- li->li_dbcache[i].dbc_name ));
+ li->li_dbcache[i].dbc_name, 0, 0 );
#else
Debug( LDAP_DEBUG_TRACE, "ldbm flushing db (%s)\n",
li->li_dbcache[i].dbc_name, 0, 0 );
li->li_dbcache[i].dbc_dirty = 0;
if ( li->li_dbcache[i].dbc_refcnt != 0 ) {
#ifdef NEW_LOGGING
- LDAP_LOG(( "cache", LDAP_LEVEL_INFO,
- "ldbm_cache_flush_all: couldn't close db (%s), refcnt=%d\n",
- li->li_dbcache[i].dbc_name, li->li_dbcache[i].dbc_refcnt ));
+ LDAP_LOG( CACHE, INFO,
+ "ldbm_cache_flush_all: couldn't close db (%s), refcnt=%d\n",
+ li->li_dbcache[i].dbc_name, li->li_dbcache[i].dbc_refcnt,0);
#else
Debug( LDAP_DEBUG_TRACE,
"refcnt = %d, couldn't close db (%s)\n",
} else {
#ifdef NEW_LOGGING
- LDAP_LOG(( "cache", LDAP_LEVEL_DETAIL1,
+ LDAP_LOG( CACHE, DETAIL1,
"ldbm_cache_flush_all: ldbm closing db (%s)\n",
- li->li_dbcache[i].dbc_name ));
+ li->li_dbcache[i].dbc_name, 0, 0 );
#else
Debug( LDAP_DEBUG_TRACE,
"ldbm closing db (%s)\n",
for ( i = 0; i < MAXDBCACHE; i++ ) {
if ( li->li_dbcache[i].dbc_name != NULL && li->li_dbcache[i].dbc_dirty ) {
#ifdef NEW_LOGGING
- LDAP_LOG (( "dbcache", LDAP_LEVEL_DETAIL1, "ldbm_cache_sync: "
- "ldbm syncing db (%s)\n", li->li_dbcache[i].dbc_name ));
+ LDAP_LOG ( CACHE, DETAIL1, "ldbm_cache_sync: "
+ "ldbm syncing db (%s)\n", li->li_dbcache[i].dbc_name, 0, 0 );
#else
Debug( LDAP_DEBUG_TRACE, "ldbm syncing db (%s)\n",
li->li_dbcache[i].dbc_name, 0, 0 );
struct ldbminfo *li = (struct ldbminfo *) be->be_private;
#ifdef NEW_LOGGING
- LDAP_LOG (( "dbcache", LDAP_LEVEL_ARGS, "ldbm_cache_sync_daemon:"
- " synchronizer starting for %s\n", li->li_directory ));
+ LDAP_LOG ( CACHE, ARGS, "ldbm_cache_sync_daemon:"
+ " synchronizer starting for %s\n", li->li_directory, 0, 0 );
#else
Debug( LDAP_DEBUG_ANY, "synchronizer starting for %s\n", li->li_directory, 0, 0 );
#endif
while (i && ldap_pvt_thread_pool_backload(&connection_pool) != 0) {
#ifdef NEW_LOGGING
- LDAP_LOG (( "dbcache", LDAP_LEVEL_DETAIL1, "ldbm_cache_sync_daemon:"
- " delay syncing %s\n", li->li_directory ));
+ LDAP_LOG ( CACHE, DETAIL1, "ldbm_cache_sync_daemon:"
+ " delay syncing %s\n", li->li_directory, 0, 0 );
#else
Debug( LDAP_DEBUG_TRACE, "delay syncing %s\n", li->li_directory, 0, 0 );
#endif
if (!li->li_dbshutdown) {
#ifdef NEW_LOGGING
- LDAP_LOG (( "dbcache", LDAP_LEVEL_DETAIL1, "ldbm_cache_sync_daemon:"
- " syncing %s\n", li->li_directory ));
+ LDAP_LOG ( CACHE, DETAIL1, "ldbm_cache_sync_daemon:"
+ " syncing %s\n", li->li_directory, 0, 0 );
#else
Debug( LDAP_DEBUG_TRACE, "syncing %s\n", li->li_directory, 0, 0 );
#endif
}
#ifdef NEW_LOGGING
- LDAP_LOG (( "dbcache", LDAP_LEVEL_DETAIL1, "ldbm_cache_sync_daemon:"
- " synchronizer stopping\n" ));
+ LDAP_LOG ( CACHE, DETAIL1, "ldbm_cache_sync_daemon:"
+ " synchronizer stopping\n", 0, 0, 0);
#else
Debug( LDAP_DEBUG_ANY, "synchronizer stopping\n", 0, 0, 0 );
#endif
/* delete.c - ldbm backend delete routine */
+/* $OpenLDAP$ */
+/*
+ * Copyright 1998-2002 The OpenLDAP Foundation, All Rights Reserved.
+ * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
+ */
+
+#include "portable.h"
#include <stdio.h>
-#include <string.h>
-#include <sys/types.h>
-#include <sys/socket.h>
+
+#include <ac/string.h>
+#include <ac/socket.h>
+
#include "slap.h"
#include "back-ldbm.h"
-
-extern Entry *dn2entry();
-extern Attribute *attr_find();
+#include "proto-back-ldbm.h"
int
ldbm_back_delete(
Backend *be,
Connection *conn,
Operation *op,
- char *dn
+ struct berval *dn,
+ struct berval *ndn
)
{
struct ldbminfo *li = (struct ldbminfo *) be->be_private;
- char *matched = NULL;
- Entry *e;
+ Entry *matched;
+ struct berval pdn;
+ Entry *e, *p = NULL;
+ int rc = -1;
+ int manageDSAit = get_manageDSAit( op );
+ AttributeDescription *children = slap_schema.si_ad_children;
+
+#ifdef NEW_LOGGING
+ LDAP_LOG( BACK_LDBM, ENTRY, "ldbm_back_delete: %s\n", dn->bv_val, 0, 0 );
+#else
+ Debug(LDAP_DEBUG_ARGS, "==> ldbm_back_delete: %s\n", dn->bv_val, 0, 0);
+#endif
+
+ /* grab giant lock for writing */
+ ldap_pvt_thread_rdwr_wlock(&li->li_giant_rwlock);
+
+ /* get entry with writer lock */
+ if ( (e = dn2entry_w( be, ndn, &matched )) == NULL ) {
+ char *matched_dn = NULL;
+ BerVarray refs;
+
+#ifdef NEW_LOGGING
+ LDAP_LOG( BACK_LDBM, INFO,
+ "ldbm_back_delete: no such object %s\n", dn->bv_val, 0, 0 );
+#else
+ Debug(LDAP_DEBUG_ARGS, "<=- ldbm_back_delete: no such object %s\n",
+ dn->bv_val, 0, 0);
+#endif
- if ( (e = dn2entry( be, dn, &matched )) == NULL ) {
- send_ldap_result( conn, op, LDAP_NO_SUCH_OBJECT, matched, "" );
if ( matched != NULL ) {
- free( matched );
+ matched_dn = ch_strdup( matched->e_dn );
+ refs = is_entry_referral( matched )
+ ? get_entry_referrals( be, conn, op, matched )
+ : NULL;
+ cache_return_entry_r( &li->li_cache, matched );
+
+ } else {
+ refs = referral_rewrite( default_referral,
+ NULL, dn, LDAP_SCOPE_DEFAULT );
}
+
+ ldap_pvt_thread_rdwr_wunlock(&li->li_giant_rwlock);
+
+ send_ldap_result( conn, op, LDAP_REFERRAL,
+ matched_dn, NULL, refs, NULL );
+
+ if ( refs ) ber_bvarray_free( refs );
+ free( matched_dn );
+
return( -1 );
}
- if ( has_children( be, e ) ) {
- send_ldap_result( conn, op, LDAP_NOT_ALLOWED_ON_NONLEAF, "",
- "" );
- cache_return_entry( &li->li_cache, e );
- return( -1 );
+ if ( !manageDSAit && is_entry_referral( e ) ) {
+ /* parent is a referral, don't allow add */
+ /* parent is an alias, don't allow add */
+ BerVarray refs = get_entry_referrals( be,
+ conn, op, e );
+
+#ifdef NEW_LOGGING
+ LDAP_LOG( BACK_LDBM, INFO,
+ "ldbm_back_delete: entry (%s) is a referral.\n", e->e_dn, 0, 0 );
+#else
+ Debug( LDAP_DEBUG_TRACE, "entry is referral\n", 0,
+ 0, 0 );
+#endif
+
+ send_ldap_result( conn, op, LDAP_REFERRAL,
+ e->e_dn, NULL, refs, NULL );
+
+ if ( refs ) ber_bvarray_free( refs );
+
+ rc = 1;
+ goto return_results;
}
- if ( ! access_allowed( be, conn, op, e, "entry", NULL, op->o_dn,
- ACL_WRITE ) ) {
- send_ldap_result( conn, op, LDAP_INSUFFICIENT_ACCESS, "", "" );
- cache_return_entry( &li->li_cache, e );
- return( -1 );
+
+ if ( has_children( be, e ) ) {
+#ifdef NEW_LOGGING
+ LDAP_LOG( BACK_LDBM, ERR,
+ "ldbm_back_delete: (%s) is a non-leaf node.\n", dn->bv_val, 0,0);
+#else
+ Debug(LDAP_DEBUG_ARGS, "<=- ldbm_back_delete: non leaf %s\n",
+ dn->bv_val, 0, 0);
+#endif
+
+ send_ldap_result( conn, op, LDAP_NOT_ALLOWED_ON_NONLEAF,
+ NULL, "subtree delete not supported", NULL, NULL );
+ goto return_results;
}
- /* XXX delete from parent's id2children entry XXX */
+ /* delete from parent's id2children entry */
+ if( !be_issuffix( be, &e->e_nname ) && (dnParent( &e->e_nname, &pdn ),
+ pdn.bv_len) ) {
+ if( (p = dn2entry_w( be, &pdn, NULL )) == NULL) {
+#ifdef NEW_LOGGING
+ LDAP_LOG( BACK_LDBM, ERR,
+ "ldbm_back_delete: parent of (%s) does not exist\n", dn, 0, 0 );
+#else
+ Debug( LDAP_DEBUG_TRACE,
+ "<=- ldbm_back_delete: parent does not exist\n",
+ 0, 0, 0);
+#endif
+
+ send_ldap_result( conn, op, LDAP_OTHER,
+ NULL, "could not locate parent of entry", NULL, NULL );
+ goto return_results;
+ }
+
+ /* check parent for "children" acl */
+ if ( ! access_allowed( be, conn, op, p,
+ children, NULL, ACL_WRITE, NULL ) )
+ {
+#ifdef NEW_LOGGING
+ LDAP_LOG( BACK_LDBM, ERR,
+ "ldbm_back_delete: no access to parent of (%s)\n",
+ dn->bv_val, 0, 0 );
+#else
+ Debug( LDAP_DEBUG_TRACE,
+ "<=- ldbm_back_delete: no access to parent\n", 0,
+ 0, 0 );
+#endif
+
+ send_ldap_result( conn, op, LDAP_INSUFFICIENT_ACCESS,
+ NULL, NULL, NULL, NULL );
+ goto return_results;
+ }
+
+ } else {
+ /* no parent, must be root to delete */
+ if( ! be_isroot( be, &op->o_ndn ) ) {
+ if ( be_issuffix( be, (struct berval *)&slap_empty_bv ) || be_isupdate( be, &op->o_ndn ) ) {
+ p = (Entry *)&slap_entry_root;
+
+ rc = access_allowed( be, conn, op, p,
+ children, NULL, ACL_WRITE, NULL );
+ p = NULL;
+
+ /* check parent for "children" acl */
+ if ( ! rc ) {
+#ifdef NEW_LOGGING
+ LDAP_LOG( BACK_LDBM, ERR,
+ "ldbm_back_delete: no access "
+ "to parent of ("")\n", 0, 0, 0 );
+#else
+ Debug( LDAP_DEBUG_TRACE,
+ "<=- ldbm_back_delete: no "
+ "access to parent\n", 0, 0, 0 );
+#endif
+
+ send_ldap_result( conn, op,
+ LDAP_INSUFFICIENT_ACCESS,
+ NULL, NULL, NULL, NULL );
+ goto return_results;
+ }
+
+ } else {
+#ifdef NEW_LOGGING
+ LDAP_LOG( BACK_LDBM, ERR,
+ "ldbm_back_delete: (%s) has no "
+ "parent & not a root.\n", dn, 0, 0 );
+#else
+ Debug( LDAP_DEBUG_TRACE,
+ "<=- ldbm_back_delete: no parent & "
+ "not root\n", 0, 0, 0);
+#endif
+
+ send_ldap_result( conn, op,
+ LDAP_INSUFFICIENT_ACCESS,
+ NULL, NULL, NULL, NULL );
+ goto return_results;
+ }
+ }
+ }
/* delete from dn2id mapping */
- if ( dn2id_delete( be, e->e_dn ) != 0 ) {
- send_ldap_result( conn, op, LDAP_OPERATIONS_ERROR, "", "" );
- cache_return_entry( &li->li_cache, e );
- return( -1 );
+ if ( dn2id_delete( be, &e->e_nname, e->e_id ) != 0 ) {
+#ifdef NEW_LOGGING
+ LDAP_LOG( BACK_LDBM, ERR,
+ "ldbm_back_delete: (%s) operations error\n", dn->bv_val, 0, 0 );
+#else
+ Debug(LDAP_DEBUG_ARGS,
+ "<=- ldbm_back_delete: operations error %s\n",
+ dn->bv_val, 0, 0);
+#endif
+
+ send_ldap_result( conn, op, LDAP_OTHER,
+ NULL, "DN index delete failed", NULL, NULL );
+ goto return_results;
}
/* delete from disk and cache */
if ( id2entry_delete( be, e ) != 0 ) {
- send_ldap_result( conn, op, LDAP_OPERATIONS_ERROR, "", "" );
- cache_return_entry( &li->li_cache, e );
- return( -1 );
+#ifdef NEW_LOGGING
+ LDAP_LOG( BACK_LDBM, ERR,
+ "ldbm_back_delete: (%s) operations error\n", dn->bv_val, 0, 0 );
+#else
+ Debug(LDAP_DEBUG_ARGS,
+ "<=- ldbm_back_delete: operations error %s\n",
+ dn->bv_val, 0, 0);
+#endif
+
+ send_ldap_result( conn, op, LDAP_OTHER,
+ NULL, "entry delete failed", NULL, NULL );
+ goto return_results;
}
- cache_return_entry( &li->li_cache, e );
- send_ldap_result( conn, op, LDAP_SUCCESS, "", "" );
+ /* delete attribute indices */
+ (void) index_entry_del( be, e, e->e_attrs );
+
+ send_ldap_result( conn, op, LDAP_SUCCESS,
+ NULL, NULL, NULL, NULL );
+ rc = 0;
+
+return_results:;
+ if( p != NULL ) {
+ /* free parent and writer lock */
+ cache_return_entry_w( &li->li_cache, p );
+ }
+
+ /* free entry and writer lock */
+ cache_return_entry_w( &li->li_cache, e );
+
+ ldap_pvt_thread_rdwr_wunlock(&li->li_giant_rwlock);
- return( 0 );
+ return rc;
}
/* dn2id.c - routines to deal with the dn2id index */
+/* $OpenLDAP$ */
+/*
+ * Copyright 1998-2002 The OpenLDAP Foundation, All Rights Reserved.
+ * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
+ */
+
+#include "portable.h"
#include <stdio.h>
-#include <string.h>
-#include <sys/types.h>
-#include <sys/socket.h>
+
+#include <ac/string.h>
+#include <ac/socket.h>
+
#include "slap.h"
#include "back-ldbm.h"
-
-extern struct dbcache *ldbm_cache_open();
-extern Entry *cache_find_entry_dn();
-extern Entry *id2entry();
-extern char *dn_parent();
-extern Datum ldbm_cache_fetch();
+#include "proto-back-ldbm.h"
int
dn2id_add(
Backend *be,
- char *dn,
+ struct berval *dn,
ID id
)
{
- int rc;
- struct dbcache *db;
+ int rc, flags;
+ DBCache *db;
Datum key, data;
+ char *buf;
+ struct berval ptr, pdn;
- Debug( LDAP_DEBUG_TRACE, "=> dn2id_add( \"%s\", %ld )\n", dn, id, 0 );
+#ifdef NEW_LOGGING
+ LDAP_LOG( BACK_LDBM, ENTRY, "dn2id_add: (%s):%ld\n", dn->bv_val, id, 0 );
+#else
+ Debug( LDAP_DEBUG_TRACE, "=> dn2id_add( \"%s\", %ld )\n", dn->bv_val, id, 0 );
+#endif
+
+ assert( id != NOID );
if ( (db = ldbm_cache_open( be, "dn2id", LDBM_SUFFIX, LDBM_WRCREAT ))
== NULL ) {
+#ifdef NEW_LOGGING
+ LDAP_LOG( BACK_LDBM, ERR,
+ "dn2id_add: couldn't open/create dn2id%s\n", LDBM_SUFFIX, 0, 0 );
+#else
Debug( LDAP_DEBUG_ANY, "Could not open/create dn2id%s\n",
LDBM_SUFFIX, 0, 0 );
+#endif
+
return( -1 );
}
- dn = strdup( dn );
- dn_normalize_case( dn );
+ ldbm_datum_init( key );
+ key.dsize = dn->bv_len + 2;
+ buf = ch_malloc( key.dsize );
+ key.dptr = buf;
+ buf[0] = DN_BASE_PREFIX;
+ ptr.bv_val = buf + 1;
+ ptr.bv_len = dn->bv_len;
+ strcpy( ptr.bv_val, dn->bv_val );
- key.dptr = dn;
- key.dsize = strlen( dn ) + 1;
+ ldbm_datum_init( data );
data.dptr = (char *) &id;
data.dsize = sizeof(ID);
- rc = ldbm_cache_store( db, key, data, LDBM_INSERT );
+ flags = LDBM_INSERT;
+ rc = ldbm_cache_store( db, key, data, flags );
+
+ if ( rc != -1 && !be_issuffix( be, &ptr )) {
+ buf[0] = DN_SUBTREE_PREFIX;
+ ldap_pvt_thread_mutex_lock( &db->dbc_write_mutex );
+ rc = idl_insert_key( be, db, key, id );
+ ldap_pvt_thread_mutex_unlock( &db->dbc_write_mutex );
+
+ if ( rc != -1 ) {
+ dnParent( &ptr, &pdn );
+
+ pdn.bv_val[-1] = DN_ONE_PREFIX;
+ key.dsize = pdn.bv_len + 2;
+ key.dptr = pdn.bv_val - 1;
+ ptr = pdn;
+ ldap_pvt_thread_mutex_lock( &db->dbc_write_mutex );
+ rc = idl_insert_key( be, db, key, id );
+ ldap_pvt_thread_mutex_unlock( &db->dbc_write_mutex );
+ }
+ }
+
+ while ( rc != -1 && !be_issuffix( be, &ptr )) {
+ ptr.bv_val[-1] = DN_SUBTREE_PREFIX;
+
+ ldap_pvt_thread_mutex_lock( &db->dbc_write_mutex );
+ rc = idl_insert_key( be, db, key, id );
+ ldap_pvt_thread_mutex_unlock( &db->dbc_write_mutex );
- free( dn );
+ if( rc != 0 ) break;
+ dnParent( &ptr, &pdn );
+ key.dsize = pdn.bv_len + 2;
+ key.dptr = pdn.bv_val - 1;
+ ptr = pdn;
+ }
+
+ free( buf );
ldbm_cache_close( be, db );
+#ifdef NEW_LOGGING
+ LDAP_LOG( BACK_LDBM, ENTRY, "dn2id_add: return %d\n", rc, 0, 0 );
+#else
Debug( LDAP_DEBUG_TRACE, "<= dn2id_add %d\n", rc, 0, 0 );
+#endif
+
return( rc );
}
-ID
+int
dn2id(
Backend *be,
- char *dn
+ struct berval *dn,
+ ID *idp
)
{
struct ldbminfo *li = (struct ldbminfo *) be->be_private;
- struct dbcache *db;
- Entry *e;
- ID id;
+ DBCache *db;
Datum key, data;
- Debug( LDAP_DEBUG_TRACE, "=> dn2id( \"%s\" )\n", dn, 0, 0 );
+#ifdef NEW_LOGGING
+ LDAP_LOG( BACK_LDBM, ENTRY, "dn2id: (%s)\n", dn->bv_val, 0, 0 );
+#else
+ Debug( LDAP_DEBUG_TRACE, "=> dn2id( \"%s\" )\n", dn->bv_val, 0, 0 );
+#endif
- dn = strdup( dn );
- dn_normalize_case( dn );
+ assert( idp );
/* first check the cache */
- if ( (e = cache_find_entry_dn( &li->li_cache, dn )) != NULL ) {
- id = e->e_id;
- free( dn );
- Debug( LDAP_DEBUG_TRACE, "<= dn2id %d (in cache)\n", e->e_id,
- 0, 0 );
- cache_return_entry( &li->li_cache, e );
-
- return( id );
+ if ( (*idp = cache_find_entry_ndn2id( be, &li->li_cache, dn )) != NOID ) {
+#ifdef NEW_LOGGING
+ LDAP_LOG( BACK_LDBM, DETAIL1, "dn2id: (%s)%ld in cache.\n", dn, *idp, 0 );
+#else
+ Debug( LDAP_DEBUG_TRACE, "<= dn2id %ld (in cache)\n", *idp,
+ 0, 0 );
+#endif
+
+ return( 0 );
}
if ( (db = ldbm_cache_open( be, "dn2id", LDBM_SUFFIX, LDBM_WRCREAT ))
- == NULL ) {
- free( dn );
+ == NULL ) {
+#ifdef NEW_LOGGING
+ LDAP_LOG( BACK_LDBM, ERR,
+ "dn2id: couldn't open dn2id%s\n", LDBM_SUFFIX, 0, 0 );
+#else
Debug( LDAP_DEBUG_ANY, "<= dn2id could not open dn2id%s\n",
- LDBM_SUFFIX, 0, 0 );
- return( NOID );
+ LDBM_SUFFIX, 0, 0 );
+#endif
+ /*
+ * return code !0 if ldbm cache open failed;
+ * callers should handle this
+ */
+ *idp = NOID;
+ return( -1 );
}
- key.dptr = dn;
- key.dsize = strlen( dn ) + 1;
+ ldbm_datum_init( key );
+
+ key.dsize = dn->bv_len + 2;
+ key.dptr = ch_malloc( key.dsize );
+ sprintf( key.dptr, "%c%s", DN_BASE_PREFIX, dn->bv_val );
data = ldbm_cache_fetch( db, key );
ldbm_cache_close( be, db );
- free( dn );
+
+ free( key.dptr );
if ( data.dptr == NULL ) {
+#ifdef NEW_LOGGING
+ LDAP_LOG( BACK_LDBM, INFO, "dn2id: (%s) NOID\n", dn, 0, 0 );
+#else
Debug( LDAP_DEBUG_TRACE, "<= dn2id NOID\n", 0, 0, 0 );
- return( NOID );
+#endif
+
+ *idp = NOID;
+ return( 0 );
}
- (void) memcpy( (char *) &id, data.dptr, sizeof(ID) );
+ AC_MEMCPY( (char *) idp, data.dptr, sizeof(ID) );
+
+ assert( *idp != NOID );
ldbm_datum_free( db->dbc_db, data );
- Debug( LDAP_DEBUG_TRACE, "<= dn2id %d\n", id, 0, 0 );
- return( id );
+#ifdef NEW_LOGGING
+ LDAP_LOG( BACK_LDBM, ENTRY, "dn2id: %ld\n", *idp, 0, 0 );
+#else
+ Debug( LDAP_DEBUG_TRACE, "<= dn2id %ld\n", *idp, 0, 0 );
+#endif
+
+ return( 0 );
+}
+
+int
+dn2idl(
+ Backend *be,
+ struct berval *dn,
+ int prefix,
+ ID_BLOCK **idlp
+)
+{
+ DBCache *db;
+ Datum key;
+
+#ifdef NEW_LOGGING
+ LDAP_LOG( BACK_LDBM, ENTRY, "dn2idl: \"%c%s\"\n", prefix, dn->bv_val, 0 );
+#else
+ Debug( LDAP_DEBUG_TRACE, "=> dn2idl( \"%c%s\" )\n", prefix, dn->bv_val, 0 );
+#endif
+
+ assert( idlp != NULL );
+ *idlp = NULL;
+
+ if ( prefix == DN_SUBTREE_PREFIX && be_issuffix(be, dn) ) {
+ *idlp = idl_allids( be );
+ return 0;
+ }
+
+ if ( (db = ldbm_cache_open( be, "dn2id", LDBM_SUFFIX, LDBM_WRCREAT ))
+ == NULL ) {
+#ifdef NEW_LOGGING
+ LDAP_LOG( BACK_LDBM, ERR,
+ "dn2idl: could not open dn2id%s\n", LDBM_SUFFIX, 0, 0 );
+#else
+ Debug( LDAP_DEBUG_ANY, "<= dn2idl could not open dn2id%s\n",
+ LDBM_SUFFIX, 0, 0 );
+#endif
+
+ return -1;
+ }
+
+ ldbm_datum_init( key );
+
+ key.dsize = dn->bv_len + 2;
+ key.dptr = ch_malloc( key.dsize );
+ sprintf( key.dptr, "%c%s", prefix, dn->bv_val );
+
+ *idlp = idl_fetch( be, db, key );
+
+ ldbm_cache_close( be, db );
+
+ free( key.dptr );
+
+ return( 0 );
}
+
int
dn2id_delete(
Backend *be,
- char *dn
+ struct berval *dn,
+ ID id
)
{
- struct ldbminfo *li = (struct ldbminfo *) be->be_private;
- struct dbcache *db;
+ DBCache *db;
Datum key;
int rc;
+ char *buf;
+ struct berval ptr, pdn;
- Debug( LDAP_DEBUG_TRACE, "=> dn2id_delete( \"%s\" )\n", dn, 0, 0 );
+#ifdef NEW_LOGGING
+ LDAP_LOG( BACK_LDBM, ENTRY,
+ "dn2id_delete: (%s)%ld\n", dn->bv_val, id, 0 );
+#else
+ Debug( LDAP_DEBUG_TRACE, "=> dn2id_delete( \"%s\", %ld )\n", dn->bv_val, id, 0 );
+#endif
+
+
+ assert( id != NOID );
if ( (db = ldbm_cache_open( be, "dn2id", LDBM_SUFFIX, LDBM_WRCREAT ))
== NULL ) {
+#ifdef NEW_LOGGING
+ LDAP_LOG( BACK_LDBM, ERR,
+ "dn2id_delete: couldn't open db2id%s\n", LDBM_SUFFIX, 0, 0 );
+#else
Debug( LDAP_DEBUG_ANY,
"<= dn2id_delete could not open dn2id%s\n", LDBM_SUFFIX,
0, 0 );
+#endif
+
return( -1 );
}
- dn_normalize_case( dn );
- key.dptr = dn;
- key.dsize = strlen( dn ) + 1;
+ ldbm_datum_init( key );
+ key.dsize = dn->bv_len + 2;
+ buf = ch_malloc( key.dsize );
+ key.dptr = buf;
+ buf[0] = DN_BASE_PREFIX;
+ ptr.bv_val = buf + 1;
+ ptr.bv_len = dn->bv_len;
+ strcpy( ptr.bv_val, dn->bv_val );
rc = ldbm_cache_delete( db, key );
+
+ if( !be_issuffix( be, &ptr )) {
+ buf[0] = DN_SUBTREE_PREFIX;
+ ldap_pvt_thread_mutex_lock( &db->dbc_write_mutex );
+ (void) idl_delete_key( be, db, key, id );
+ ldap_pvt_thread_mutex_unlock( &db->dbc_write_mutex );
+
+ dnParent( &ptr, &pdn );
+
+ pdn.bv_val[-1] = DN_ONE_PREFIX;
+ key.dsize = pdn.bv_len + 2;
+ key.dptr = pdn.bv_val - 1;
+ ptr = pdn;
+
+ ldap_pvt_thread_mutex_lock( &db->dbc_write_mutex );
+ (void) idl_delete_key( be, db, key, id );
+ ldap_pvt_thread_mutex_unlock( &db->dbc_write_mutex );
+ }
+
+ while ( rc != -1 && !be_issuffix( be, &ptr )) {
+ ptr.bv_val[-1] = DN_SUBTREE_PREFIX;
+
+ ldap_pvt_thread_mutex_lock( &db->dbc_write_mutex );
+ (void) idl_delete_key( be, db, key, id );
+ ldap_pvt_thread_mutex_unlock( &db->dbc_write_mutex );
+
+ dnParent( &ptr, &pdn );
+ key.dsize = pdn.bv_len + 2;
+ key.dptr = pdn.bv_val - 1;
+ ptr = pdn;
+ }
+
+ free( buf );
ldbm_cache_close( be, db );
+#ifdef NEW_LOGGING
+ LDAP_LOG( BACK_LDBM, ENTRY, "dn2id_delete: return %d\n", rc, 0, 0 );
+#else
Debug( LDAP_DEBUG_TRACE, "<= dn2id_delete %d\n", rc, 0, 0 );
+#endif
+
return( rc );
}
*/
Entry *
-dn2entry(
+dn2entry_rw(
Backend *be,
- char *dn,
- char **matched
+ struct berval *dn,
+ Entry **matched,
+ int rw
)
{
- struct ldbminfo *li = (struct ldbminfo *) be->be_private;
ID id;
- Entry *e;
- char *pdn;
+ Entry *e = NULL;
+ struct berval pdn;
+
+#ifdef NEW_LOGGING
+ LDAP_LOG( BACK_LDBM, ENTRY,
+ "dn2entry_rw: %s entry %s\n", rw ? "w" : "r", dn->bv_val, 0 );
+#else
+ Debug(LDAP_DEBUG_TRACE, "dn2entry_%s: dn: \"%s\"\n",
+ rw ? "w" : "r", dn->bv_val, 0);
+#endif
- if ( (id = dn2id( be, dn )) != NOID && (e = id2entry( be, id ))
- != NULL ) {
- return( e );
+
+ if( matched != NULL ) {
+ /* caller cares about match */
+ *matched = NULL;
}
- *matched = NULL;
- /* stop when we get to the suffix */
- if ( be_issuffix( be, dn ) ) {
+ if ( dn2id( be, dn, &id ) ) {
+ /* something bad happened to ldbm cache */
return( NULL );
+
+ } else if ( id != NOID ) {
+ /* try to return the entry */
+ if ((e = id2entry_rw( be, id, rw )) != NULL ) {
+ return( e );
+ }
+
+#ifdef NEW_LOGGING
+ LDAP_LOG( BACK_LDBM, ERR,
+ "dn2entry_rw: no entry for valid id (%ld), dn (%s)\n",
+ id, dn->bv_val, 0 );
+#else
+ Debug(LDAP_DEBUG_ANY,
+ "dn2entry_%s: no entry for valid id (%ld), dn \"%s\"\n",
+ rw ? "w" : "r", id, dn->bv_val);
+#endif
+
+ /* must have been deleted from underneath us */
+ /* treat as if NOID was found */
}
+ /* caller doesn't care about match */
+ if( matched == NULL ) return NULL;
+
/* entry does not exist - see how much of the dn does exist */
- if ( (pdn = dn_parent( be, dn )) != NULL ) {
- if ( (e = dn2entry( be, pdn, matched )) != NULL ) {
- *matched = pdn;
- cache_return_entry( &li->li_cache, e );
- } else {
- free( pdn );
+ if ( !be_issuffix( be, dn ) && (dnParent( dn, &pdn ), pdn.bv_len) ) {
+ /* get entry with reader lock */
+ if ( (e = dn2entry_r( be, &pdn, matched )) != NULL ) {
+ *matched = e;
}
}
- return( NULL );
+ return NULL;
}
+
ID_BLOCK *result;
#ifdef NEW_LOGGING
- LDAP_LOG(( "filter", LDAP_LEVEL_ENTRY, "filter_candidates: enter\n"));
+ LDAP_LOG( FILTER, ENTRY, "filter_candidates: enter\n", 0, 0, 0 );
#else
Debug( LDAP_DEBUG_TRACE, "=> filter_candidates\n", 0, 0, 0 );
#endif
switch ( f->f_choice ) {
case SLAPD_FILTER_DN_ONE:
#ifdef NEW_LOGGING
- LDAP_LOG(( "filter", LDAP_LEVEL_DETAIL1,
- "filter_candidates: DN ONE (%s)\n", f->f_dn ));
+ LDAP_LOG( FILTER, DETAIL1,
+ "filter_candidates: DN ONE (%s)\n", f->f_dn, 0, 0 );
#else
Debug( LDAP_DEBUG_FILTER, "\tDN ONE\n", 0, 0, 0 );
#endif
case SLAPD_FILTER_DN_SUBTREE:
#ifdef NEW_LOGGING
- LDAP_LOG(( "filter", LDAP_LEVEL_DETAIL1,
- "filter_candidates: DN SUBTREE (%s)\n", f->f_dn ));
+ LDAP_LOG( FILTER, DETAIL1,
+ "filter_candidates: DN SUBTREE (%s)\n", f->f_dn, 0, 0 );
#else
Debug( LDAP_DEBUG_FILTER, "\tDN SUBTREE\n", 0, 0, 0 );
#endif
case LDAP_FILTER_PRESENT:
#ifdef NEW_LOGGING
- LDAP_LOG(( "filter", LDAP_LEVEL_DETAIL1,
- "filter_candidates: Present (%s)\n", f->f_desc->ad_cname.bv_val ));
+ LDAP_LOG( FILTER, DETAIL1,
+ "filter_candidates: Present (%s)\n",
+ f->f_desc->ad_cname.bv_val, 0, 0 );
#else
Debug( LDAP_DEBUG_FILTER, "\tPRESENT\n", 0, 0, 0 );
#endif
case LDAP_FILTER_EQUALITY:
#ifdef NEW_LOGGING
- LDAP_LOG(( "filter", LDAP_LEVEL_DETAIL1,
+ LDAP_LOG( FILTER, DETAIL1,
"filter_candidates: EQUALITY (%s),(%s)\n",
f->f_ava->aa_desc->ad_cname.bv_val,
- f->f_ava->aa_value.bv_val ));
+ f->f_ava->aa_value.bv_val, 0 );
#else
Debug( LDAP_DEBUG_FILTER, "\tEQUALITY\n", 0, 0, 0 );
#endif
case LDAP_FILTER_APPROX:
#ifdef NEW_LOGGING
- LDAP_LOG(( "filter", LDAP_LEVEL_DETAIL1,
+ LDAP_LOG( FILTER, DETAIL1,
"filter_candidates: APPROX (%s), (%s)\n",
f->f_ava->aa_desc->ad_cname.bv_val,
- f->f_ava->aa_value.bv_val ));
+ f->f_ava->aa_value.bv_val, 0 );
#else
Debug( LDAP_DEBUG_FILTER, "\tAPPROX\n", 0, 0, 0 );
#endif
case LDAP_FILTER_SUBSTRINGS:
#ifdef NEW_LOGGING
- LDAP_LOG(( "filter", LDAP_LEVEL_DETAIL1,
- "filter_candidates: SUBSTRINGS\n"));
+ LDAP_LOG( FILTER, DETAIL1,
+ "filter_candidates: SUBSTRINGS\n", 0, 0, 0 );
#else
Debug( LDAP_DEBUG_FILTER, "\tSUBSTRINGS\n", 0, 0, 0 );
#endif
case LDAP_FILTER_GE:
#ifdef NEW_LOGGING
- LDAP_LOG(( "filter", LDAP_LEVEL_DETAIL1,
- "filter_candidates: GE\n"));
+ LDAP_LOG( FILTER, DETAIL1, "filter_candidates: GE\n", 0, 0, 0 );
#else
Debug( LDAP_DEBUG_FILTER, "\tGE\n", 0, 0, 0 );
#endif
case LDAP_FILTER_LE:
#ifdef NEW_LOGGING
- LDAP_LOG(( "filter", LDAP_LEVEL_DETAIL1,
- "filter_candidates: LE\n" ));
+ LDAP_LOG( FILTER, DETAIL1, "filter_candidates: LE\n", 0, 0, 0 );
#else
Debug( LDAP_DEBUG_FILTER, "\tLE\n", 0, 0, 0 );
#endif
case LDAP_FILTER_AND:
#ifdef NEW_LOGGING
- LDAP_LOG(( "filter", LDAP_LEVEL_DETAIL1,
- "filter_candidates: AND\n" ));
+ LDAP_LOG( FILTER, DETAIL1, "filter_candidates: AND\n", 0, 0, 0 );
#else
Debug( LDAP_DEBUG_FILTER, "\tAND\n", 0, 0, 0 );
#endif
case LDAP_FILTER_OR:
#ifdef NEW_LOGGING
- LDAP_LOG(( "filter", LDAP_LEVEL_DETAIL1,
- "filter_candidates: OR\n" ));
+ LDAP_LOG( FILTER, DETAIL1, "filter_candidates: OR\n", 0, 0, 0 );
#else
Debug( LDAP_DEBUG_FILTER, "\tOR\n", 0, 0, 0 );
#endif
case LDAP_FILTER_NOT:
#ifdef NEW_LOGGING
- LDAP_LOG(( "filter", LDAP_LEVEL_DETAIL1,
- "filter_candidates: NOT\n" ));
+ LDAP_LOG( FILTER, DETAIL1, "filter_candidates: NOT\n", 0, 0, 0 );
#else
Debug( LDAP_DEBUG_FILTER, "\tNOT\n", 0, 0, 0 );
#endif
break;
default:
#ifdef NEW_LOGGING
- LDAP_LOG(( "filter", LDAP_LEVEL_DETAIL1,
- "filter_candidates: UNKNOWN\n" ));
+ LDAP_LOG( FILTER, DETAIL1, "filter_candidates: UNKNOWN\n", 0, 0, 0 );
#else
Debug( LDAP_DEBUG_FILTER, "\tUNKNOWN\n", 0, 0, 0 );
#endif
}
#ifdef NEW_LOGGING
- LDAP_LOG(( "filter", LDAP_LEVEL_ENTRY,
- "filter_candidates: return %ld\n",
- result ? ID_BLOCK_NIDS(result) : 0 ));
+ LDAP_LOG( FILTER, ENTRY,
+ "filter_candidates: return %ld\n",
+ result ? ID_BLOCK_NIDS(result) : 0, 0, 0 );
#else
Debug( LDAP_DEBUG_TRACE, "<= filter_candidates %ld\n",
result ? ID_BLOCK_NIDS(result) : 0, 0, 0 );
struct berval prefix = {0};
#ifdef NEW_LOGGING
- LDAP_LOG(( "filter", LDAP_LEVEL_ENTRY,
- "presence_candidates: enter\n" ));
+ LDAP_LOG( FILTER, ENTRY, "presence_candidates: enter\n", 0, 0, 0 );
#else
Debug( LDAP_DEBUG_TRACE, "=> presence_candidates\n", 0, 0, 0 );
#endif
if( rc != LDAP_SUCCESS ) {
#ifdef NEW_LOGGING
- LDAP_LOG(( "filter", LDAP_LEVEL_INFO,
- "presence_candidates: index_param returned %d\n",
- rc ));
+ LDAP_LOG( FILTER, INFO,
+ "presence_candidates: index_param returned %d\n", rc, 0, 0 );
#else
Debug( LDAP_DEBUG_TRACE,
"<= presence_candidates: index_param returned=%d\n",
if( dbname == NULL ) {
/* not indexed */
#ifdef NEW_LOGGING
- LDAP_LOG(( "filter", LDAP_LEVEL_INFO,
- "presence_candidates: not indexed\n" ));
+ LDAP_LOG( FILTER, INFO, "presence_candidates: not indexed\n", 0, 0, 0 );
#else
Debug( LDAP_DEBUG_TRACE,
"<= presense_candidates: not indexed\n",
if ( db == NULL ) {
#ifdef NEW_LOGGING
- LDAP_LOG(( "filter", LDAP_LEVEL_INFO,
+ LDAP_LOG( FILTER, INFO,
"presence_candidates: db open failed (%s%s)\n",
- dbname, LDBM_SUFFIX ));
+ dbname, LDBM_SUFFIX, 0 );
#else
Debug( LDAP_DEBUG_ANY,
"<= presense_candidates db open failed (%s%s)\n",
if( rc != LDAP_SUCCESS ) {
#ifdef NEW_LOGGING
- LDAP_LOG(( "filter", LDAP_LEVEL_ERR,
- "presence_candidates: key read failed (%d)\n", rc ));
+ LDAP_LOG( FILTER, ERR,
+ "presence_candidates: key read failed (%d)\n", rc, 0, 0 );
#else
Debug( LDAP_DEBUG_TRACE,
"<= presense_candidates key read failed (%d)\n",
} else if( idl == NULL ) {
#ifdef NEW_LOGGING
- LDAP_LOG(( "filter", LDAP_LEVEL_DETAIL1,
- "presence_candidates: NULL\n" ));
+ LDAP_LOG( FILTER, DETAIL1, "presence_candidates: NULL\n", 0, 0, 0 );
#else
Debug( LDAP_DEBUG_TRACE,
"<= presense_candidates NULL\n",
ldbm_cache_close( be, db );
#ifdef NEW_LOGGING
- LDAP_LOG(( "filter", LDAP_LEVEL_ENTRY,
- "presence_candidates: return %ld\n",
- idl ? ID_BLOCK_NIDS(idl) : 0 ));
+ LDAP_LOG( FILTER, ENTRY,
+ "presence_candidates: return %ld\n",
+ idl ? ID_BLOCK_NIDS(idl) : 0, 0, 0 );
#else
Debug( LDAP_DEBUG_TRACE, "<= presence_candidates %ld\n",
idl ? ID_BLOCK_NIDS(idl) : 0, 0, 0 );
MatchingRule *mr;
#ifdef NEW_LOGGING
- LDAP_LOG(( "filter", LDAP_LEVEL_ENTRY,
- "equality_candidates: enter\n" ));
+ LDAP_LOG( FILTER, ENTRY, "equality_candidates: enter\n", 0, 0, 0 );
#else
Debug( LDAP_DEBUG_TRACE, "=> equality_candidates\n", 0, 0, 0 );
#endif
if( rc != LDAP_SUCCESS ) {
#ifdef NEW_LOGGING
- LDAP_LOG(( "filter", LDAP_LEVEL_ERR,
- "equality_candidates: index_param returned %d\n", rc ));
+ LDAP_LOG( FILTER, ERR,
+ "equality_candidates: index_param returned %d\n", rc, 0, 0 );
#else
Debug( LDAP_DEBUG_TRACE,
"<= equality_candidates: index_param returned=%d\n",
if( dbname == NULL ) {
/* not indexed */
#ifdef NEW_LOGGING
- LDAP_LOG(( "filter", LDAP_LEVEL_ERR,
- "equality_candidates: not indexed\n" ));
+ LDAP_LOG( FILTER, ERR, "equality_candidates: not indexed\n", 0, 0, 0 );
#else
Debug( LDAP_DEBUG_TRACE,
"<= equality_candidates: not indexed\n",
if( rc != LDAP_SUCCESS ) {
#ifdef NEW_LOGGING
- LDAP_LOG(( "filter", LDAP_LEVEL_ERR,
+ LDAP_LOG( FILTER, ERR,
"equality_candidates: (%s%s) MR filter failed (%d\n",
- dbname, LDBM_SUFFIX, rc ));
+ dbname, LDBM_SUFFIX, rc );
#else
Debug( LDAP_DEBUG_TRACE,
"<= equality_candidates: (%s%s) MR filter failed (%d)\n",
if( keys == NULL ) {
#ifdef NEW_LOGGING
- LDAP_LOG(( "filter", LDAP_LEVEL_ERR,
- "equality_candidates: no keys (%s%s)\n",
- dbname, LDBM_SUFFIX ));
+ LDAP_LOG( FILTER, ERR,
+ "equality_candidates: no keys (%s%s)\n", dbname, LDBM_SUFFIX, 0 );
#else
Debug( LDAP_DEBUG_TRACE,
"<= equality_candidates: no keys (%s%s)\n",
if ( db == NULL ) {
#ifdef NEW_LOGGING
- LDAP_LOG(( "filter", LDAP_LEVEL_ERR,
- "equality_candidates: db open failed (%s%s)\n",
- dbname, LDBM_SUFFIX ));
+ LDAP_LOG( FILTER, ERR, "equality_candidates: db open failed (%s%s)\n",
+ dbname, LDBM_SUFFIX, 0 );
#else
Debug( LDAP_DEBUG_ANY,
"<= equality_candidates db open failed (%s%s)\n",
idl_free( idl );
idl = NULL;
#ifdef NEW_LOGGING
- LDAP_LOG(( "filter", LDAP_LEVEL_ERR,
- "equality_candidates: key read failed (%d)\n", rc ));
+ LDAP_LOG( FILTER, ERR,
+ "equality_candidates: key read failed (%d)\n", rc, 0, 0 );
#else
Debug( LDAP_DEBUG_TRACE,
"<= equality_candidates key read failed (%d)\n",
idl_free( idl );
idl = NULL;
#ifdef NEW_LOGGING
- LDAP_LOG(( "filter", LDAP_LEVEL_INFO,
- "equality_candidates NULL\n" ));
+ LDAP_LOG( FILTER, INFO, "equality_candidates NULL\n", 0, 0, 0 );
#else
Debug( LDAP_DEBUG_TRACE,
"<= equality_candidates NULL\n",
#ifdef NEW_LOGGING
- LDAP_LOG(( "filter", LDAP_LEVEL_ENTRY,
- "equality_candidates: return %ld\n",
- idl ? ID_BLOCK_NIDS(idl) : 0 ));
+ LDAP_LOG( FILTER, ENTRY,
+ "equality_candidates: return %ld\n",
+ idl ? ID_BLOCK_NIDS(idl) : 0, 0, 0 );
#else
Debug( LDAP_DEBUG_TRACE, "<= equality_candidates %ld\n",
idl ? ID_BLOCK_NIDS(idl) : 0, 0, 0 );
MatchingRule *mr;
#ifdef NEW_LOGGING
- LDAP_LOG(( "filter", LDAP_LEVEL_ENTRY,
- "approx_candidates: enter\n" ));
+ LDAP_LOG( FILTER, ENTRY, "approx_candidates: enter\n", 0, 0, 0 );
#else
Debug( LDAP_DEBUG_TRACE, "=> approx_candidates\n", 0, 0, 0 );
#endif
if( rc != LDAP_SUCCESS ) {
#ifdef NEW_LOGGING
- LDAP_LOG(( "filter", LDAP_LEVEL_ERR,
- "approx_candidates: index_param returned %d\n", rc ));
+ LDAP_LOG( FILTER, ERR,
+ "approx_candidates: index_param returned %d\n", rc, 0, 0 );
#else
Debug( LDAP_DEBUG_TRACE,
"<= approx_candidates: index_param returned=%d\n",
if( dbname == NULL ) {
/* not indexed */
#ifdef NEW_LOGGING
- LDAP_LOG(( "filter", LDAP_LEVEL_ERR,
- "approx_candidates: not indexed\n" ));
+ LDAP_LOG( FILTER, ERR, "approx_candidates: not indexed\n", 0, 0, 0 );
#else
Debug( LDAP_DEBUG_ANY,
"<= approx_candidates: not indexed\n",
if( rc != LDAP_SUCCESS ) {
#ifdef NEW_LOGGING
- LDAP_LOG(( "filter", LDAP_LEVEL_ERR,
+ LDAP_LOG( FILTER, ERR,
"approx_candidates: (%s%s) MR filter failed (%d)\n",
- dbname, LDBM_SUFFIX, rc ));
+ dbname, LDBM_SUFFIX, rc );
#else
Debug( LDAP_DEBUG_TRACE,
"<= approx_candidates: (%s%s) MR filter failed (%d)\n",
if( keys == NULL ) {
#ifdef NEW_LOGGING
- LDAP_LOG(( "filter", LDAP_LEVEL_INFO,
+ LDAP_LOG( FILTER, INFO,
"approx_candidates: no keys (%s%s)\n",
- dbname, LDBM_SUFFIX ));
+ dbname, LDBM_SUFFIX, 0 );
#else
Debug( LDAP_DEBUG_TRACE,
"<= approx_candidates: no keys (%s%s)\n",
if ( db == NULL ) {
#ifdef NEW_LOGGING
- LDAP_LOG(( "filter", LDAP_LEVEL_ERR,
- "approx_candidates db open failed (%s%s)\n",
- dbname, LDBM_SUFFIX ));
+ LDAP_LOG( FILTER, ERR,
+ "approx_candidates db open failed (%s%s)\n",
+ dbname, LDBM_SUFFIX, 0 );
#else
Debug( LDAP_DEBUG_ANY,
"<= approx_candidates db open failed (%s%s)\n",
idl_free( idl );
idl = NULL;
#ifdef NEW_LOGGING
- LDAP_LOG(( "filter", LDAP_LEVEL_ERR,
- "approx_candidates: key read failed (%d)\n", rc ));
+ LDAP_LOG( FILTER, ERR,
+ "approx_candidates: key read failed (%d)\n", rc, 0, 0 );
#else
Debug( LDAP_DEBUG_TRACE, "<= approx_candidates key read failed (%d)\n",
rc, 0, 0 );
idl_free( idl );
idl = NULL;
#ifdef NEW_LOGGING
- LDAP_LOG(( "filter", LDAP_LEVEL_INFO,
- "approx_candidates: NULL\n" ));
+ LDAP_LOG( FILTER, INFO, "approx_candidates: NULL\n", 0, 0, 0 );
#else
Debug( LDAP_DEBUG_TRACE, "<= approx_candidates NULL\n",
0, 0, 0 );
ldbm_cache_close( be, db );
#ifdef NEW_LOGGING
- LDAP_LOG(( "filter", LDAP_LEVEL_ENTRY,
- "approx_candidates: return %ld\n",
- idl ? ID_BLOCK_NIDS(idl) : 0 ));
+ LDAP_LOG( FILTER, ENTRY,
+ "approx_candidates: return %ld\n",
+ idl ? ID_BLOCK_NIDS(idl) : 0, 0, 0 );
#else
Debug( LDAP_DEBUG_TRACE, "<= approx_candidates %ld\n",
idl ? ID_BLOCK_NIDS(idl) : 0, 0, 0 );
Filter *f;
#ifdef NEW_LOGGING
- LDAP_LOG(( "filter", LDAP_LEVEL_ENTRY,
- "list_candidates: 0x%x\n", ftype ));
+ LDAP_LOG( FILTER, ENTRY, "list_candidates: 0x%x\n", ftype, 0, 0 );
#else
Debug( LDAP_DEBUG_TRACE, "=> list_candidates 0x%x\n", ftype, 0, 0 );
#endif
if ( (tmp = filter_candidates( be, f )) == NULL &&
ftype == LDAP_FILTER_AND ) {
#ifdef NEW_LOGGING
- LDAP_LOG(( "filter", LDAP_LEVEL_INFO,
- "list_candidates: NULL\n" ));
+ LDAP_LOG( FILTER, INFO, "list_candidates: NULL\n", 0, 0, 0 );
#else
Debug( LDAP_DEBUG_TRACE,
"<= list_candidates NULL\n", 0, 0, 0 );
}
#ifdef NEW_LOGGING
- LDAP_LOG(( "filter", LDAP_LEVEL_ENTRY,
- "list_candidates: return %ld\n",
- idl ? ID_BLOCK_NIDS(idl) : 0 ));
+ LDAP_LOG( FILTER, ENTRY, "list_candidates: return %ld\n",
+ idl ? ID_BLOCK_NIDS(idl) : 0, 0, 0 );
#else
Debug( LDAP_DEBUG_TRACE, "<= list_candidates %ld\n",
idl ? ID_BLOCK_NIDS(idl) : 0, 0, 0 );
MatchingRule *mr;
#ifdef NEW_LOGGING
- LDAP_LOG(( "filter", LDAP_LEVEL_ENTRY,
- "substrings_candidates: enter\n" ));
+ LDAP_LOG( FILTER, ENTRY, "substrings_candidates: enter\n", 0, 0, 0 );
#else
Debug( LDAP_DEBUG_TRACE, "=> substrings_candidates\n", 0, 0, 0 );
#endif
if( rc != LDAP_SUCCESS ) {
#ifdef NEW_LOGGING
- LDAP_LOG(( "filter", LDAP_LEVEL_ERR,
- "substrings_candidates: index_param returned %d\n", rc ));
+ LDAP_LOG( FILTER, ERR,
+ "substrings_candidates: index_param returned %d\n", rc, 0, 0 );
#else
Debug( LDAP_DEBUG_TRACE,
"<= substrings_candidates: index_param returned=%d\n",
if( dbname == NULL ) {
/* not indexed */
#ifdef NEW_LOGGING
- LDAP_LOG(( "filter", LDAP_LEVEL_ERR,
- "substrings_candidates: not indexed\n" ));
+ LDAP_LOG( FILTER, ERR, "substrings_candidates: not indexed\n", 0, 0, 0);
#else
Debug( LDAP_DEBUG_ANY,
"<= substrings_candidates: not indexed\n",
if( rc != LDAP_SUCCESS ) {
#ifdef NEW_LOGGING
- LDAP_LOG(( "filter", LDAP_LEVEL_ERR,
+ LDAP_LOG( FILTER, ERR,
"substrings_candidates: (%s%s) MR filter failed (%d)\n",
- dbname, LDBM_SUFFIX, rc ));
+ dbname, LDBM_SUFFIX, rc );
#else
Debug( LDAP_DEBUG_TRACE,
"<= substrings_candidates: (%s%s) MR filter failed (%d)\n",
if( keys == NULL ) {
#ifdef NEW_LOGGING
- LDAP_LOG(( "filter", LDAP_LEVEL_ERR,
+ LDAP_LOG( FILTER, ERR,
"substrings_candidates: (0x%04lx) no keys (%s%s)\n",
- mask, dbname, LDBM_SUFFIX ));
+ mask, dbname, LDBM_SUFFIX );
#else
Debug( LDAP_DEBUG_TRACE,
"<= substrings_candidates: (0x%04lx) no keys (%s%s)\n",
if ( db == NULL ) {
#ifdef NEW_LOGGING
- LDAP_LOG(( "filter", LDAP_LEVEL_ERR,
+ LDAP_LOG( FILTER, ERR,
"substrings_candidates: db open failed (%s%s)\n",
- dbname, LDBM_SUFFIX ));
+ dbname, LDBM_SUFFIX, 0 );
#else
Debug( LDAP_DEBUG_ANY,
"<= substrings_candidates db open failed (%s%s)\n",
idl_free( idl );
idl = NULL;
#ifdef NEW_LOGGING
- LDAP_LOG(( "filter", LDAP_LEVEL_ERR,
- "substrings_candidates: key read failed (%d)\n",
- rc ));
+ LDAP_LOG( FILTER, ERR,
+ "substrings_candidates: key read failed (%d)\n", rc, 0, 0 );
#else
Debug( LDAP_DEBUG_TRACE, "<= substrings_candidates key read failed (%d)\n",
rc, 0, 0 );
idl_free( idl );
idl = NULL;
#ifdef NEW_LOGGING
- LDAP_LOG(( "filter", LDAP_LEVEL_INFO,
- "substrings_candidates: NULL\n" ));
+ LDAP_LOG( FILTER, INFO, "substrings_candidates: NULL\n", 0, 0, 0 );
#else
Debug( LDAP_DEBUG_TRACE, "<= substrings_candidates NULL\n",
0, 0, 0 );
ldbm_cache_close( be, db );
#ifdef NEW_LOGGING
- LDAP_LOG(( "filter", LDAP_LEVEL_ENTRY,
+ LDAP_LOG( FILTER, ENTRY,
"substrings_candidates: return %ld\n",
- idl ? ID_BLOCK_NIDS(idl) : 0 ));
+ idl ? ID_BLOCK_NIDS(idl) : 0, 0, 0 );
#else
Debug( LDAP_DEBUG_TRACE, "<= substrings_candidates %ld\n",
idl ? ID_BLOCK_NIDS(idl) : 0, 0, 0 );
--- /dev/null
+/* group.c - ldbm backend acl group routine */
+/* $OpenLDAP$ */
+/*
+ * Copyright 1998-2002 The OpenLDAP Foundation, All Rights Reserved.
+ * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
+ */
+
+#include "portable.h"
+
+#include <stdio.h>
+
+#include <ac/socket.h>
+#include <ac/string.h>
+
+#include "slap.h"
+#include "back-ldbm.h"
+#include "proto-back-ldbm.h"
+
+
+/* return 0 IFF op_dn is a value in member attribute
+ * of entry with gr_dn AND that entry has an objectClass
+ * value of groupOfNames
+ */
+int
+ldbm_back_group(
+ Backend *be,
+ Connection *conn,
+ Operation *op,
+ Entry *target,
+ struct berval *gr_ndn,
+ struct berval *op_ndn,
+ ObjectClass *group_oc,
+ AttributeDescription *group_at
+)
+{
+ struct ldbminfo *li = (struct ldbminfo *) be->be_private;
+ Entry *e;
+ int rc = 1;
+ Attribute *attr;
+
+ const char *group_oc_name = NULL;
+ const char *group_at_name = group_at->ad_cname.bv_val;
+
+ if( group_oc->soc_names && group_oc->soc_names[0] ) {
+ group_oc_name = group_oc->soc_names[0];
+ } else {
+ group_oc_name = group_oc->soc_oid;
+ }
+
+#ifdef NEW_LOGGING
+ LDAP_LOG( BACK_LDBM, ENTRY,
+ "ldbm_back_group: check (%s) member of (%s), oc %s\n",
+ op_ndn->bv_val, gr_ndn->bv_val, group_oc_name );
+#else
+ Debug( LDAP_DEBUG_ARGS,
+ "=> ldbm_back_group: gr dn: \"%s\"\n",
+ gr_ndn->bv_val, 0, 0 );
+
+ Debug( LDAP_DEBUG_ARGS,
+ "=> ldbm_back_group: op dn: \"%s\"\n",
+ op_ndn->bv_val, 0, 0 );
+ Debug( LDAP_DEBUG_ARGS,
+ "=> ldbm_back_group: oc: \"%s\" at: \"%s\"\n",
+ group_oc_name, group_at_name, 0 );
+
+ Debug( LDAP_DEBUG_ARGS,
+ "=> ldbm_back_group: tr dn: \"%s\"\n",
+ target->e_ndn, 0, 0 );
+#endif
+
+ if (dn_match(&target->e_nname, gr_ndn)) {
+ /* we already have a LOCKED copy of the entry */
+ e = target;
+#ifdef NEW_LOGGING
+ LDAP_LOG( BACK_LDBM, DETAIL1,
+ "ldbm_back_group: target is group (%s)\n", gr_ndn->bv_val, 0, 0 );
+#else
+ Debug( LDAP_DEBUG_ARGS,
+ "=> ldbm_back_group: target is group: \"%s\"\n",
+ gr_ndn->bv_val, 0, 0 );
+#endif
+
+
+ } else {
+ /* can we find group entry with reader lock */
+ if ((e = dn2entry_r(be, gr_ndn, NULL )) == NULL) {
+#ifdef NEW_LOGGING
+ LDAP_LOG( BACK_LDBM, DETAIL1,
+ "ldbm_back_group: cannot find group (%s)\n",
+ gr_ndn->bv_val, 0, 0 );
+#else
+ Debug( LDAP_DEBUG_ACL,
+ "=> ldbm_back_group: cannot find group: \"%s\"\n",
+ gr_ndn->bv_val, 0, 0 );
+#endif
+
+ return( 1 );
+ }
+
+#ifdef NEW_LOGGING
+ LDAP_LOG( BACK_LDBM, DETAIL1,
+ "ldbm_back_group: found group (%s)\n", gr_ndn->bv_val, 0, 0 );
+#else
+ Debug( LDAP_DEBUG_ACL,
+ "=> ldbm_back_group: found group: \"%s\"\n",
+ gr_ndn->bv_val, 0, 0 );
+#endif
+
+ }
+
+ /* find it's objectClass and member attribute values
+ * make sure this is a group entry
+ * finally test if we can find op_dn in the member attribute value list *
+ */
+
+ rc = 1;
+
+
+ if( is_entry_alias( e ) ) {
+#ifdef NEW_LOGGING
+ LDAP_LOG( BACK_LDBM, INFO,
+ "ldbm_back_group: group (%s) is an alias\n", gr_ndn->bv_val, 0, 0 );
+#else
+ Debug( LDAP_DEBUG_ACL,
+ "<= ldbm_back_group: group is an alias\n", 0, 0, 0 );
+#endif
+
+ goto return_results;
+ }
+
+ if( is_entry_referral( e ) ) {
+#ifdef NEW_LOGGING
+ LDAP_LOG( BACK_LDBM, INFO,
+ "ldbm_back_group: group (%s) is a referral.\n", gr_ndn->bv_val,0,0);
+#else
+ Debug( LDAP_DEBUG_ACL,
+ "<= ldbm_back_group: group is an referral\n", 0, 0, 0 );
+#endif
+
+ goto return_results;
+ }
+
+ if( !is_entry_objectclass( e, group_oc, 0 ) ) {
+#ifdef NEW_LOGGING
+ LDAP_LOG( BACK_LDBM, ERR,
+ "ldbm_back_group: failed to find %s in objectClass.\n",
+ group_oc_name, 0, 0 );
+#else
+ Debug( LDAP_DEBUG_ACL,
+ "<= ldbm_back_group: failed to find %s in objectClass\n",
+ group_oc_name, 0, 0 );
+#endif
+
+ goto return_results;
+ }
+
+ if ((attr = attr_find(e->e_attrs, group_at)) == NULL) {
+#ifdef NEW_LOGGING
+ LDAP_LOG( BACK_LDBM, INFO,
+ "ldbm_back_group: failed to find %s\n", group_at_name, 0, 0 );
+#else
+ Debug( LDAP_DEBUG_ACL,
+ "<= ldbm_back_group: failed to find %s\n",
+ group_at_name, 0, 0 );
+#endif
+
+ goto return_results;
+ }
+
+#ifdef NEW_LOGGING
+ LDAP_LOG( BACK_LDBM, ENTRY,
+ "ldbm_back_group: found objectClass %s and %s\n",
+ group_oc_name, group_at_name, 0 );
+#else
+ Debug( LDAP_DEBUG_ACL,
+ "<= ldbm_back_group: found objectClass %s and %s\n",
+ group_oc_name, group_at_name, 0 );
+#endif
+
+
+ if( value_find( group_at, attr->a_vals, op_ndn ) != LDAP_SUCCESS ) {
+#ifdef NEW_LOGGING
+ LDAP_LOG( BACK_LDBM, DETAIL1,
+ "ldbm_back_group: \"%s\" not in \"%s\": %s\n",
+ op_ndn->bv_val, gr_ndn->bv_val, group_at_name );
+#else
+ Debug( LDAP_DEBUG_ACL,
+ "<= ldbm_back_group: \"%s\" not in \"%s\": %s\n",
+ op_ndn->bv_val, gr_ndn->bv_val, group_at_name );
+#endif
+
+ goto return_results;
+ }
+
+
+#ifdef NEW_LOGGING
+ LDAP_LOG( BACK_LDBM, DETAIL1,
+ "ldbm_back_group: %s is in %s: %s\n",
+ op_ndn->bv_val, gr_ndn->bv_val, group_at_name );
+#else
+ Debug( LDAP_DEBUG_ACL,
+ "<= ldbm_back_group: \"%s\" is in \"%s\": %s\n",
+ op_ndn->bv_val, gr_ndn->bv_val, group_at_name );
+#endif
+
+
+ rc = 0;
+
+return_results:
+ if( target != e ) {
+ /* free entry and reader lock */
+ cache_return_entry_r( &li->li_cache, e );
+ }
+
+#ifdef NEW_LOGGING
+ LDAP_LOG( BACK_LDBM, ENTRY, "ldbm_back_group: rc=%d\n", rc, 0, 0 );
+#else
+ Debug( LDAP_DEBUG_TRACE, "ldbm_back_group: rc=%d\n", rc, 0, 0 );
+#endif
+
+ return(rc);
+}
+
#include "slap.h"
#include "back-ldbm.h"
-
int
has_children(
Backend *be,
ldbm_datum_init( key );
#ifdef NEW_LOGGING
- LDAP_LOG(( "id2children", LDAP_LEVEL_ENTRY,
- "has_children: enter %ld\n", p->e_id ));
+ LDAP_LOG( INDEX, ENTRY, "has_children: enter %ld\n", p->e_id, 0, 0 );
#else
Debug( LDAP_DEBUG_TRACE, "=> has_children( %ld )\n", p->e_id , 0, 0 );
#endif
if ( (db = ldbm_cache_open( be, "dn2id", LDBM_SUFFIX,
LDBM_WRCREAT )) == NULL ) {
#ifdef NEW_LOGGING
- LDAP_LOG(( "id2children", LDAP_LEVEL_ERR,
- "has_children: could not open \"dn2id%s\"\n",
- LDBM_SUFFIX ));
+ LDAP_LOG( INDEX, ERR,
+ "has_children: could not open \"dn2id%s\"\n", LDBM_SUFFIX, 0, 0 );
#else
Debug( LDAP_DEBUG_ANY,
"<= has_children -1 could not open \"dn2id%s\"\n",
}
#ifdef NEW_LOGGING
- LDAP_LOG(( "id2children", LDAP_LEVEL_ENTRY,
+ LDAP_LOG( INDEX, ENTRY,
"has_children: id (%ld) %s children.\n",
- p->e_id, rc ? "has" : "doesn't have" ));
+ p->e_id, rc ? "has" : "doesn't have", 0 );
#else
Debug( LDAP_DEBUG_TRACE, "<= has_children( %ld ): %s\n",
p->e_id, rc ? "yes" : "no", 0 );
ldbm_datum_init( data );
#ifdef NEW_LOGGING
- LDAP_LOG(( "id2entry", LDAP_LEVEL_ENTRY,
- "id2entry_add: (%s)%ld\n", e->e_dn, e->e_id ));
+ LDAP_LOG( INDEX, ENTRY, "id2entry_add: (%s)%ld\n", e->e_dn, e->e_id, 0 );
#else
Debug( LDAP_DEBUG_TRACE, "=> id2entry_add( %ld, \"%s\" )\n", e->e_id,
e->e_dn, 0 );
if ( (db = ldbm_cache_open( be, "id2entry", LDBM_SUFFIX, LDBM_WRCREAT ))
== NULL ) {
#ifdef NEW_LOGGING
- LDAP_LOG(( "id2entry", LDAP_LEVEL_ERR,
- "id2entry_add: could not open/create id2entry%s\n",
- LDBM_SUFFIX ));
+ LDAP_LOG( INDEX, ERR,
+ "id2entry_add: could not open/create id2entry%s\n",
+ LDBM_SUFFIX, 0,0 );
#else
Debug( LDAP_DEBUG_ANY, "Could not open/create id2entry%s\n",
LDBM_SUFFIX, 0, 0 );
ldbm_cache_close( be, db );
#ifdef NEW_LOGGING
- LDAP_LOG(( "id2entry", LDAP_LEVEL_ENTRY,
- "id2entry_add: return %d\n", rc ));
+ LDAP_LOG( INDEX, ENTRY, "id2entry_add: return %d\n", rc, 0, 0 );
#else
Debug( LDAP_DEBUG_TRACE, "<= id2entry_add %d\n", rc, 0, 0 );
#endif
#endif
#ifdef NEW_LOGGING
- LDAP_LOG(( "id2entry", LDAP_LEVEL_ENTRY,
- "id2entry_delete: (%s)%ld\n", e->e_dn, e->e_id ));
+ LDAP_LOG( INDEX, ENTRY, "id2entry_delete: (%s)%ld\n", e->e_dn, e->e_id, 0 );
#else
Debug(LDAP_DEBUG_TRACE, "=> id2entry_delete( %ld, \"%s\" )\n", e->e_id,
e->e_dn, 0 );
if ( (db = ldbm_cache_open( be, "id2entry", LDBM_SUFFIX, LDBM_WRCREAT ))
== NULL ) {
#ifdef NEW_LOGGING
- LDAP_LOG(( "id2entry", LDAP_LEVEL_ERR,
+ LDAP_LOG( INDEX, ERR,
"id2entry_delete: could not open/create id2entry%s\n",
- LDBM_SUFFIX ));
+ LDBM_SUFFIX, 0, 0 );
#else
Debug( LDAP_DEBUG_ANY, "Could not open/create id2entry%s\n",
LDBM_SUFFIX, 0, 0 );
if ( cache_delete_entry( &li->li_cache, e ) != 0 ) {
#ifdef NEW_LOGGING
- LDAP_LOG(( "id2entry", LDAP_LEVEL_ERR,
+ LDAP_LOG( INDEX, ERR,
"id2entry_delete: Could not delete (%s)%ld from cache\n",
- e->e_dn, e->e_id ));
+ e->e_dn, e->e_id, 0 );
#else
Debug(LDAP_DEBUG_ANY, "could not delete %ld (%s) from cache\n",
e->e_id, e->e_dn, 0 );
ldbm_cache_close( be, db );
#ifdef NEW_LOGGING
- LDAP_LOG(( "id2entry", LDAP_LEVEL_ENTRY,
- "id2entry_delete: return %d\n", rc ));
+ LDAP_LOG( INDEX, ENTRY, "id2entry_delete: return %d\n", rc, 0, 0 );
#else
Debug( LDAP_DEBUG_TRACE, "<= id2entry_delete %d\n", rc, 0, 0 );
#endif
ldbm_datum_init( data );
#ifdef NEW_LOGGING
- LDAP_LOG(( "id2entry", LDAP_LEVEL_ENTRY,
- "id2entry_rw: %s (%ld)\n",
- rw ? "write" : "read", id ));
+ LDAP_LOG( INDEX, ENTRY,
+ "id2entry_rw: %s (%ld)\n", rw ? "write" : "read", id, 0 );
#else
Debug( LDAP_DEBUG_TRACE, "=> id2entry_%s( %ld )\n",
rw ? "w" : "r", id, 0 );
if ( (e = cache_find_entry_id( &li->li_cache, id, rw )) != NULL ) {
#ifdef NEW_LOGGING
- LDAP_LOG(( "id2entry", LDAP_LEVEL_DETAIL1,
+ LDAP_LOG( INDEX, DETAIL1,
"id2entry_rw: %s (%ld) 0x%lx (cache).\n",
- rw ? "write" : "read", id, (unsigned long)e ));
+ rw ? "write" : "read", id, (unsigned long)e );
#else
Debug( LDAP_DEBUG_TRACE, "<= id2entry_%s( %ld ) 0x%lx (cache)\n",
rw ? "w" : "r", id, (unsigned long) e );
if ( (db = ldbm_cache_open( be, "id2entry", LDBM_SUFFIX, LDBM_WRCREAT ))
== NULL ) {
#ifdef NEW_LOGGING
- LDAP_LOG(( "id2entry", LDAP_LEVEL_ERR,
- "id2entry_rw: could not open id2entry%s\n", LDBM_SUFFIX ));
+ LDAP_LOG( INDEX, ERR,
+ "id2entry_rw: could not open id2entry%s\n", LDBM_SUFFIX, 0, 0 );
#else
Debug( LDAP_DEBUG_ANY, "Could not open id2entry%s\n",
LDBM_SUFFIX, 0, 0 );
if ( data.dptr == NULL ) {
#ifdef NEW_LOGGING
- LDAP_LOG(( "id2entry", LDAP_LEVEL_ERR,
- "id2entry_rw: (%ld) not found\n", id ));
+ LDAP_LOG( INDEX, ERR,
+ "id2entry_rw: (%ld) not found\n", id, 0, 0 );
#else
Debug( LDAP_DEBUG_TRACE, "<= id2entry_%s( %ld ) not found\n",
rw ? "w" : "r", id, 0 );
if ( e == NULL ) {
#ifdef NEW_LOGGING
- LDAP_LOG(( "id2entry", LDAP_LEVEL_ERR,
- "id2entry_rw: %s of %ld failed\n",
- rw ? "write" : "read", id ));
+ LDAP_LOG( INDEX, ERR,
+ "id2entry_rw: %s of %ld failed\n", rw ? "write" : "read", id, 0);
#else
Debug( LDAP_DEBUG_TRACE, "<= id2entry_%s( %ld ) (failed)\n",
rw ? "w" : "r", id, 0 );
*/
if ( (e = cache_find_entry_id( &li->li_cache, id, rw )) != NULL ) {
#ifdef NEW_LOGGING
- LDAP_LOG(( "id2entry", LDAP_LEVEL_DETAIL1,
+ LDAP_LOG( INDEX, DETAIL1,
"id2entry_rw: %s of %ld 0x%lx (cache)\n",
- rw ? "write" : "read", id, (unsigned long)e ));
+ rw ? "write" : "read", id, (unsigned long)e );
#else
Debug( LDAP_DEBUG_TRACE, "<= id2entry_%s( %ld ) 0x%lx (cache)\n",
rw ? "w" : "r", id, (unsigned long) e );
}
#ifdef NEW_LOGGING
- LDAP_LOG(( "id2entry", LDAP_LEVEL_ERR,
+ LDAP_LOG( INDEX, ERR,
"id2entry_rw: %s of %ld (cache add failed)\n",
- rw ? "write" : "read", id ));
+ rw ? "write" : "read", id, 0 );
#else
Debug( LDAP_DEBUG_TRACE, "<= id2entry_%s( %ld ) (cache add failed)\n",
rw ? "w" : "r", id, 0 );
}
#ifdef NEW_LOGGING
- LDAP_LOG(( "id2entry", LDAP_LEVEL_ENTRY,
+ LDAP_LOG( INDEX, ENTRY,
"id2entry_rw: %s of %ld 0x%lx (disk)\n",
- rw ? "write" : "read", id, (unsigned long)e ));
+ rw ? "write" : "read", id, (unsigned long)e );
#else
Debug( LDAP_DEBUG_TRACE, "<= id2entry_%s( %ld ) 0x%lx (disk)\n",
rw ? "w" : "r", id, (unsigned long) e );
{
if ( idl == NULL ) {
#ifdef NEW_LOGGING
- LDAP_LOG(( "idl", LDAP_LEVEL_INFO,
- "idl_free: called with NULL pointer\n" ));
+ LDAP_LOG( INDEX, INFO, "idl_free: called with NULL pointer\n" , 0,0,0);
#else
Debug( LDAP_DEBUG_TRACE,
"idl_free: called with NULL pointer\n",
if ( (tmp[i] = idl_fetch_one( be, db, data )) == NULL ) {
#ifdef NEW_LOGGING
- LDAP_LOG(( "idl", LDAP_LEVEL_INFO,
- "idl_fetch: idl_fetch_one returned NULL\n" ));
+ LDAP_LOG( INDEX, INFO,
+ "idl_fetch: idl_fetch_one returned NULL\n", 0,0,0 );
#else
Debug( LDAP_DEBUG_ANY,
"idl_fetch: one returned NULL\n", 0, 0, 0 );
#endif
#ifdef NEW_LOGGING
- LDAP_LOG(( "idl", LDAP_LEVEL_ENTRY,
+ LDAP_LOG( INDEX, ENTRY,
"idl_fetch: %ld ids (%ld max)\n",
- ID_BLOCK_NIDS(idl), ID_BLOCK_NMAXN(idl) ));
+ ID_BLOCK_NIDS(idl), ID_BLOCK_NMAXN(idl), 0 );
#else
Debug( LDAP_DEBUG_TRACE, "<= idl_fetch %ld ids (%ld max)\n",
ID_BLOCK_NIDS(idl), ID_BLOCK_NMAXN(idl), 0 );
/* delete old key block */
if ( (rc = ldbm_cache_delete( db, bkey )) != 0 ) {
#ifdef NEW_LOGGING
- LDAP_LOG(( "idl", LDAP_LEVEL_INFO,
- "idl_change_first: ldbm_cache_delete returned %d\n", rc ));
+ LDAP_LOG( INDEX, INFO,
+ "idl_change_first: ldbm_cache_delete returned %d\n", rc, 0, 0 );
#else
Debug( LDAP_DEBUG_ANY,
"idl_change_first: ldbm_cache_delete returned %d\n",
if ( (rc = idl_store( be, db, bkey, b )) != 0 ) {
#ifdef NEW_LOGGING
- LDAP_LOG(( "idl", LDAP_LEVEL_INFO,
- "idl_change_first: idl_store returned %d\n", rc ));
+ LDAP_LOG( INDEX, INFO,
+ "idl_change_first: idl_store returned %d\n", rc, 0, 0 );
#else
Debug( LDAP_DEBUG_ANY,
"idl_change_first: idl_store returned %d\n", rc, 0, 0 );
ID_BLOCK_ID(h, pos) = ID_BLOCK_ID(b, 0);
if ( (rc = idl_store( be, db, hkey, h )) != 0 ) {
#ifdef NEW_LOGGING
- LDAP_LOG(( "idl", LDAP_LEVEL_INFO,
- "idl_change_first: idl_store returned %s\n", rc ));
+ LDAP_LOG( INDEX, INFO,
+ "idl_change_first: idl_store returned %s\n", rc, 0, 0 );
#else
Debug( LDAP_DEBUG_ANY,
"idl_change_first: idl_store returned %d\n", rc, 0, 0 );
if ( (tmp = idl_fetch_one( be, db, k2 )) == NULL ) {
#ifdef NEW_LOGGING
- LDAP_LOG(( "idl", LDAP_LEVEL_ERR,
- "idl_insert_key: nonexistent continuation block\n" ));
+ LDAP_LOG( INDEX, ERR,
+ "idl_insert_key: nonexistent continuation block\n", 0, 0, 0 );
#else
Debug( LDAP_DEBUG_ANY, "idl_insert_key: nonexistent continuation block\n",
0, 0, 0 );
case 0: /* id inserted ok */
if ( (rc = idl_store( be, db, k2, tmp )) != 0 ) {
#ifdef NEW_LOGGING
- LDAP_LOG(( "idl", LDAP_LEVEL_ERR,
- "ids_insert_key: idl_store returned %d\n", rc ));
+ LDAP_LOG( INDEX, ERR,
+ "ids_insert_key: idl_store returned %d\n", rc, 0, 0 );
#else
Debug( LDAP_DEBUG_ANY,
"idl_insert_key: idl_store returned %d\n", rc, 0, 0 );
cont_id( &k2, ID_BLOCK_ID(idl, i) );
if ( (tmp2 = idl_fetch_one( be, db, k2 )) == NULL ) {
#ifdef NEW_LOGGING
- LDAP_LOG(( "idl", LDAP_LEVEL_ERR,
- "idl_insert_key: idl_fetch_one returned NULL\n"));
+ LDAP_LOG( INDEX, ERR,
+ "idl_insert_key: idl_fetch_one returned NULL\n", 0, 0, 0);
#else
Debug( LDAP_DEBUG_ANY,
"idl_insert_key: idl_fetch_one returned NULL\n",
if ( (rc = idl_store( be, db, k2, tmp )) != 0 ) {
#ifdef NEW_LOGGING
- LDAP_LOG(( "idl", LDAP_LEVEL_ERR,
- "idl_insert_key: idl_store returned %d\n", rc ));
+ LDAP_LOG( INDEX, ERR,
+ "idl_insert_key: idl_store returned %d\n", rc, 0, 0 );
#else
Debug( LDAP_DEBUG_ANY,
"idl_insert_key: idl_store returned %d\n", rc, 0, 0 );
*/
if ( rc == 2 ) {
#ifdef NEW_LOGGING
- LDAP_LOG(( "idl", LDAP_LEVEL_INFO,
+ LDAP_LOG( INDEX, INFO,
"idl_insert_key: id %ld is already in next block\n",
- id ));
+ id, 0, 0 );
#else
Debug( LDAP_DEBUG_ANY,
"idl_insert_key: id %ld already in next block\n",
if ( (tmp = idl_fetch_one( be, db, data )) == NULL ) {
#ifdef NEW_LOGGING
- LDAP_LOG(( "idl", LDAP_LEVEL_INFO,
- "idl_delete_key: idl_fetch_one returned NULL\n" ));
+ LDAP_LOG( INDEX, INFO,
+ "idl_delete_key: idl_fetch_one returned NULL\n", 0, 0, 0 );
#else
Debug( LDAP_DEBUG_ANY,
"idl_delete_key: idl_fetch of returned NULL\n", 0, 0, 0 );
/* index.c - routines for dealing with attribute indexes */
+/* $OpenLDAP$ */
+/*
+ * Copyright 1998-2002 The OpenLDAP Foundation, All Rights Reserved.
+ * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
+ */
-#include <stdio.h>
-#include <string.h>
-#include <sys/types.h>
-#include <sys/socket.h>
-#include "slap.h"
-#include "back-ldbm.h"
+#include "portable.h"
-extern char *first_word();
-extern char *next_word();
-extern char *phonetic();
-extern IDList *idl_fetch();
-extern IDList *idl_allids();
-extern struct dbcache *ldbm_cache_open();
+#include <stdio.h>
-int index_add_values();
+#include <ac/string.h>
+#include <ac/socket.h>
-static int add_value();
-static int index2prefix();
+#include "slap.h"
+#include "back-ldbm.h"
-int
-index_add_entry(
- Backend *be,
- Entry *e
-)
+static slap_mask_t index_mask(
+ Backend *be,
+ AttributeDescription *desc,
+ char **dbname,
+ struct berval *atname )
{
- Attribute *ap;
- char *dnval;
- struct berval bv;
- struct berval *bvals[2];
-
- Debug( LDAP_DEBUG_TRACE, "=> index_add( %ld, \"%s\" )\n", e->e_id,
- e->e_dn, 0 );
-
- /*
- * dn index entry - make it look like an attribute so it works
- * with index_add_values() call
- */
+ AttributeType *at;
+ slap_mask_t mask = 0;
- bv.bv_val = strdup( e->e_dn );
- bv.bv_len = strlen( bv.bv_val );
- (void) dn_normalize_case( bv.bv_val );
- bvals[0] = &bv;
- bvals[1] = NULL;
+ attr_mask( be->be_private, desc, &mask );
- /* add the dn to the indexes */
- index_add_values( be, "dn", bvals, e->e_id );
+ if( mask ) {
+ *atname = desc->ad_cname;
+ *dbname = desc->ad_cname.bv_val;
+ return mask;
+ }
- free( bv.bv_val );
+ /* If there is a language tag, did we ever index the base
+ * type? If so, check for mask, otherwise it's not there.
+ */
+ if( slap_ad_is_lang( desc ) && desc != desc->ad_type->sat_ad ) {
+ /* has language tag */
+ attr_mask( be->be_private, desc->ad_type->sat_ad, &mask );
+
+ if( mask && ( mask ^ SLAP_INDEX_NOLANG ) ) {
+ *atname = desc->ad_type->sat_cname;
+ *dbname = desc->ad_type->sat_cname.bv_val;
+ return mask;
+ }
+ }
- /* add each attribute to the indexes */
- for ( ap = e->e_attrs; ap != NULL; ap = ap->a_next ) {
- index_add_values( be, ap->a_type, ap->a_vals, e->e_id );
+ /* see if supertype defined mask for its subtypes */
+ for( at = desc->ad_type->sat_sup; at != NULL ; at = at->sat_sup ) {
+ /* If no AD, we've never indexed this type */
+ if (!at->sat_ad)
+ continue;
+
+ attr_mask( be->be_private, at->sat_ad, &mask );
+
+ if( mask && ( mask ^ SLAP_INDEX_NOSUBTYPES ) ) {
+ *atname = at->sat_cname;
+ *dbname = at->sat_cname.bv_val;
+ return mask;
+ }
}
- Debug( LDAP_DEBUG_TRACE, "<= index_add( %ld, \"%s\" ) 0\n", e->e_id,
- e->e_dn, 0 );
- return( 0 );
+ return 0;
}
-int
-index_add_mods(
- Backend *be,
- LDAPMod *mods,
- ID id
-)
+int index_is_indexed(
+ Backend *be,
+ AttributeDescription *desc )
{
- int rc;
-
- for ( ; mods != NULL; mods = mods->mod_next ) {
- switch ( mods->mod_op & ~LDAP_MOD_BVALUES ) {
- case LDAP_MOD_ADD:
- case LDAP_MOD_REPLACE:
- rc = index_add_values( be, mods->mod_type,
- mods->mod_bvalues, id );
- break;
-
- case LDAP_MOD_DELETE:
- rc = 0;
- break;
- }
+ slap_mask_t mask;
+ char *dbname;
+ struct berval prefix;
- if ( rc != 0 ) {
- return( rc );
- }
+ mask = index_mask( be, desc, &dbname, &prefix );
+
+ if( mask == 0 ) {
+ return LDAP_INAPPROPRIATE_MATCHING;
}
- return( 0 );
+ return LDAP_SUCCESS;
}
-IDList *
-index_read(
- Backend *be,
- char *type,
- int indextype,
- char *val
-)
+int index_param(
+ Backend *be,
+ AttributeDescription *desc,
+ int ftype,
+ char **dbnamep,
+ slap_mask_t *maskp,
+ struct berval *prefixp )
{
- struct dbcache *db;
- Datum key;
- IDList *idl;
- int indexmask, syntax;
- char prefix;
- char *realval, *tmpval;
- char buf[BUFSIZ];
-
- prefix = index2prefix( indextype );
- Debug( LDAP_DEBUG_TRACE, "=> index_read( \"%s\" \"%c\" \"%s\" )\n",
- type, prefix, val );
-
- attr_masks( be->be_private, type, &indexmask, &syntax );
- if ( ! (indextype & indexmask) ) {
- idl = idl_allids( be );
- Debug( LDAP_DEBUG_TRACE,
- "<= index_read %d candidates (allids - not indexed)\n",
- idl ? idl->b_nids : 0, 0, 0 );
- return( idl );
- }
+ slap_mask_t mask;
+ char *dbname;
- attr_normalize( type );
- if ( (db = ldbm_cache_open( be, type, LDBM_SUFFIX, LDBM_WRCREAT ))
- == NULL ) {
- Debug( LDAP_DEBUG_ANY,
- "<= index_read NULL (could not open %s%s)\n", type,
- LDBM_SUFFIX, 0 );
- return( NULL );
+ mask = index_mask( be, desc, &dbname, prefixp );
+
+ if( mask == 0 ) {
+ return LDAP_INAPPROPRIATE_MATCHING;
}
- realval = val;
- tmpval = NULL;
- if ( prefix != '\0' ) {
- int len;
-
- if ( (len = strlen( val )) < sizeof(buf) ) {
- buf[0] = prefix;
- strcpy( &buf[1], val );
- realval = buf;
- } else {
- /* value + prefix + null */
- tmpval = (char *) ch_malloc( len + 2 );
- tmpval[0] = prefix;
- strcat( &tmpval[1], val );
- realval = tmpval;
+ switch( ftype ) {
+ case LDAP_FILTER_PRESENT:
+ if( IS_SLAP_INDEX( mask, SLAP_INDEX_PRESENT ) ) {
+ goto done;
}
- }
+ break;
+
+ case LDAP_FILTER_APPROX:
+ if( IS_SLAP_INDEX( mask, SLAP_INDEX_APPROX ) ) {
+ goto done;
+ }
+ /* fall thru */
+
+ case LDAP_FILTER_EQUALITY:
+ if( IS_SLAP_INDEX( mask, SLAP_INDEX_EQUALITY ) ) {
+ goto done;
+ }
+ break;
- key.dptr = realval;
- key.dsize = strlen( realval ) + 1;
+ case LDAP_FILTER_SUBSTRINGS:
+ if( IS_SLAP_INDEX( mask, SLAP_INDEX_SUBSTR ) ) {
+ goto done;
+ }
+ break;
- idl = idl_fetch( be, db, key );
+ default:
+ return LDAP_OTHER;
+ }
- ldbm_cache_close( be, db );
+ return LDAP_INAPPROPRIATE_MATCHING;
- Debug( LDAP_DEBUG_TRACE, "<= index_read %d candidates\n",
- idl ? idl->b_nids : 0, 0, 0 );
- return( idl );
+done:
+ *dbnamep = dbname;
+ *maskp = mask;
+ return LDAP_SUCCESS;
}
-static int
-add_value(
- Backend *be,
- struct dbcache *db,
- char *type,
- int indextype,
- char *val,
- ID id
-)
+static int indexer(
+ Backend *be,
+ char *dbname,
+ struct berval *atname,
+ BerVarray vals,
+ ID id,
+ int op,
+ slap_mask_t mask )
{
- int rc;
- Datum key;
- IDList *idl;
- char prefix;
- char *realval, *tmpval, *s;
- char buf[BUFSIZ];
-
- prefix = index2prefix( indextype );
- Debug( LDAP_DEBUG_TRACE, "=> add_value( \"%c%s\" )\n", prefix, val, 0 );
-
- realval = val;
- tmpval = NULL;
- idl = NULL;
- if ( prefix != '\0' ) {
- int len;
-
- if ( (len = strlen( val )) < sizeof(buf) ) {
- buf[0] = prefix;
- strcpy( &buf[1], val );
- realval = buf;
- } else {
- /* value + prefix + null */
- tmpval = (char *) ch_malloc( len + 2 );
- tmpval[0] = prefix;
- strcat( &tmpval[1], val );
- realval = tmpval;
- }
- }
+ int rc, i;
+ const char *text;
+ DBCache *db;
+ AttributeDescription *ad = NULL;
+ struct berval *keys;
- key.dptr = realval;
- key.dsize = strlen( realval ) + 1;
+ assert( mask );
- rc = idl_insert_key( be, db, key, id );
+ rc = slap_bv2ad( atname, &ad, &text );
- if ( tmpval != NULL ) {
- free( tmpval );
- }
- idl_free( idl );
+ if( rc != LDAP_SUCCESS ) return rc;
- pthread_yield();
-
- /* Debug( LDAP_DEBUG_TRACE, "<= add_value %d\n", rc, 0, 0 ); */
- return( rc );
-}
+ db = ldbm_cache_open( be, dbname, LDBM_SUFFIX, LDBM_WRCREAT );
+
+ if ( db == NULL ) {
+#ifdef NEW_LOGGING
+ LDAP_LOG( INDEX, ERR,
+ "index_read: Could not open db %s%s\n", dbname, LDBM_SUFFIX, 0 );
+#else
+ Debug( LDAP_DEBUG_ANY,
+ "<= index_read NULL (could not open %s%s)\n",
+ dbname, LDBM_SUFFIX, 0 );
+#endif
-int
-index_add_values(
- Backend *be,
- char *type,
- struct berval **vals,
- ID id
-)
-{
- char *val, *p, *code, *w;
- int i, j, len;
- int indexmask, syntax;
- char buf[SUBLEN + 1];
- char vbuf[BUFSIZ];
- char *bigbuf;
- struct dbcache *db;
-
- Debug( LDAP_DEBUG_TRACE, "=> index_add_values( \"%s\", %ld )\n", type,
- id, 0 );
-
- attr_masks( be->be_private, type, &indexmask, &syntax );
- if ( indexmask == 0 ) {
- return( 0 );
+ return LDAP_OTHER;
}
- if ( (db = ldbm_cache_open( be, type, LDBM_SUFFIX, LDBM_WRCREAT ))
- == NULL ) {
- Debug( LDAP_DEBUG_ANY,
- "<= index_add_values -1 (could not open/create %s%s)\n",
- type, LDBM_SUFFIX, 0 );
- return( -1 );
+ if( IS_SLAP_INDEX( mask, SLAP_INDEX_PRESENT ) ) {
+ key_change( be, db, atname, id, op );
}
+ if( IS_SLAP_INDEX( mask, SLAP_INDEX_EQUALITY ) ) {
+ rc = ad->ad_type->sat_equality->smr_indexer(
+ LDAP_FILTER_EQUALITY,
+ mask,
+ ad->ad_type->sat_syntax,
+ ad->ad_type->sat_equality,
+ atname, vals, &keys );
+
+ if( rc == LDAP_SUCCESS && keys != NULL ) {
+ for( i=0; keys[i].bv_val != NULL; i++ ) {
+ key_change( be, db, &keys[i], id, op );
+ }
+ ber_bvarray_free( keys );
+ }
+ }
- for ( i = 0; vals[i] != NULL; i++ ) {
- /*
- * presence index entry
- */
- if ( indexmask & INDEX_PRESENCE ) {
- add_value( be, db, type, INDEX_PRESENCE, "*", id );
+ if( IS_SLAP_INDEX( mask, SLAP_INDEX_APPROX ) ) {
+ rc = ad->ad_type->sat_approx->smr_indexer(
+ LDAP_FILTER_APPROX,
+ mask,
+ ad->ad_type->sat_syntax,
+ ad->ad_type->sat_approx,
+ atname, vals, &keys );
+
+ if( rc == LDAP_SUCCESS && keys != NULL ) {
+ for( i=0; keys[i].bv_val != NULL; i++ ) {
+ key_change( be, db, &keys[i], id, op );
+ }
+ ber_bvarray_free( keys );
}
+ }
- Debug( LDAP_DEBUG_TRACE, "*** index_add_values syntax 0x%x syntax bin 0x%x\n",
- syntax, SYNTAX_BIN, 0 );
- if ( syntax & SYNTAX_BIN ) {
- ldbm_cache_close( be, db );
- return( 0 );
+ if( IS_SLAP_INDEX( mask, SLAP_INDEX_SUBSTR ) ) {
+ rc = ad->ad_type->sat_substr->smr_indexer(
+ LDAP_FILTER_SUBSTRINGS,
+ mask,
+ ad->ad_type->sat_syntax,
+ ad->ad_type->sat_substr,
+ atname, vals, &keys );
+
+ if( rc == LDAP_SUCCESS && keys != NULL ) {
+ for( i=0; keys[i].bv_val != NULL; i++ ) {
+ key_change( be, db, &keys[i], id, op );
+ }
+ ber_bvarray_free( keys );
}
+ }
- bigbuf = NULL;
- len = vals[i]->bv_len;
+ ldbm_cache_close( be, db );
+ return LDAP_SUCCESS;
+}
- /* value + null */
- if ( len + 2 > sizeof(vbuf) ) {
- bigbuf = (char *) ch_malloc( len + 1 );
- val = bigbuf;
- } else {
- val = vbuf;
- }
- (void) memcpy( val, vals[i]->bv_val, len );
- val[len] = '\0';
+static int index_at_values(
+ Backend *be,
+ AttributeType *type,
+ struct berval *lang,
+ BerVarray vals,
+ ID id,
+ int op )
+{
+ slap_mask_t mask = 0;
- value_normalize( val, syntax );
+ if( type->sat_sup ) {
+ /* recurse */
+ (void) index_at_values( be,
+ type->sat_sup, lang,
+ vals, id, op );
+ }
- /*
- * equality index entry
- */
- if ( indexmask & INDEX_EQUALITY ) {
- add_value( be, db, type, INDEX_EQUALITY, val, id );
- }
+ /* If this type has no AD, we've never used it before */
+ if( type->sat_ad ) {
+ attr_mask( be->be_private, type->sat_ad, &mask );
+ }
- /*
- * approximate index entry
- */
- if ( indexmask & INDEX_APPROX ) {
- for ( w = first_word( val ); w != NULL;
- w = next_word( w ) ) {
- if ( (code = phonetic( w )) != NULL ) {
- add_value( be, db, type, INDEX_APPROX,
- code, id );
- free( code );
- }
- }
- }
+ if( mask ) {
+ indexer( be, type->sat_cname.bv_val,
+ &type->sat_cname,
+ vals, id, op,
+ mask );
+ }
- /*
- * substrings index entry
- */
- if ( indexmask & INDEX_SUB ) {
- /* leading and trailing */
- if ( len > SUBLEN - 2 ) {
- buf[0] = '^';
- for ( j = 0; j < SUBLEN - 1; j++ ) {
- buf[j + 1] = val[j];
- }
- buf[SUBLEN] = '\0';
-
- add_value( be, db, type, INDEX_SUB, buf, id );
-
- p = val + len - SUBLEN + 1;
- for ( j = 0; j < SUBLEN - 1; j++ ) {
- buf[j] = p[j];
- }
- buf[SUBLEN - 1] = '$';
- buf[SUBLEN] = '\0';
-
- add_value( be, db, type, INDEX_SUB, buf, id );
- }
+ if( lang->bv_len ) {
+ AttributeDescription *desc;
- /* any */
- for ( p = val; p < (val + len - SUBLEN + 1); p++ ) {
- for ( j = 0; j < SUBLEN; j++ ) {
- buf[j] = p[j];
- }
- buf[SUBLEN] = '\0';
+ mask = 0;
- add_value( be, db, type, INDEX_SUB, buf, id );
- }
+ desc = ad_find_lang(type, lang);
+ if( desc ) {
+ attr_mask( be->be_private, desc, &mask );
}
- if ( bigbuf != NULL ) {
- free( bigbuf );
+ if( mask ) {
+ indexer( be, desc->ad_cname.bv_val, &desc->ad_cname,
+ vals, id, op,
+ mask );
}
}
- ldbm_cache_close( be, db );
- return( 0 );
+ return LDAP_SUCCESS;
}
-static int
-index2prefix( int indextype )
+int index_values(
+ Backend *be,
+ AttributeDescription *desc,
+ BerVarray vals,
+ ID id,
+ int op )
{
- int prefix;
+ (void) index_at_values( be,
+ desc->ad_type, &desc->ad_lang,
+ vals, id, op );
- switch ( indextype ) {
- case INDEX_EQUALITY:
- prefix = EQ_PREFIX;
- break;
- case INDEX_APPROX:
- prefix = APPROX_PREFIX;
- break;
- case INDEX_SUB:
- prefix = SUB_PREFIX;
- break;
- default:
- prefix = '\0';
- break;
+ return LDAP_SUCCESS;
+}
+
+int
+index_entry(
+ Backend *be,
+ int op,
+ Entry *e,
+ Attribute *ap )
+{
+#ifdef NEW_LOGGING
+ LDAP_LOG( INDEX, ENTRY,
+ "index_entry: %s (%s)%ld\n", op == SLAP_INDEX_ADD_OP ? "add" : "del",
+ e->e_dn, e->e_id );
+#else
+ Debug( LDAP_DEBUG_TRACE, "=> index_entry_%s( %ld, \"%s\" )\n",
+ op == SLAP_INDEX_ADD_OP ? "add" : "del",
+ e->e_id, e->e_dn );
+#endif
+
+ /* add each attribute to the indexes */
+ for ( ; ap != NULL; ap = ap->a_next ) {
+ index_values( be, ap->a_desc, ap->a_vals, e->e_id, op );
}
- return( prefix );
+#ifdef NEW_LOGGING
+ LDAP_LOG( INDEX, ENTRY, "index_entry: success\n", 0, 0, 0 );
+#else
+ Debug( LDAP_DEBUG_TRACE, "<= index_entry_%s( %ld, \"%s\" ) success\n",
+ op == SLAP_INDEX_ADD_OP ? "add" : "del",
+ e->e_id, e->e_dn );
+#endif
+
+ return LDAP_SUCCESS;
}
+
if ( rc != 0 )
{
#ifdef NEW_LOGGING
- LDAP_LOG (( "init", LDAP_LEVEL_ERR, "ldbm_back_db_open: sync "
- "ldap_pvt_thread_create failed (%d)\n", rc ));
+ LDAP_LOG ( BACK_LDBM, ERR, "ldbm_back_db_open: sync "
+ "ldap_pvt_thread_create failed (%d)\n", rc, 0, 0 );
#else
Debug( LDAP_DEBUG_ANY,
"sync ldap_pvt_thread_create failed (%d)\n", rc, 0, 0 );
--- /dev/null
+/* index.c - routines for dealing with attribute indexes */
+/* $OpenLDAP$ */
+/*
+ * Copyright 1998-2002 The OpenLDAP Foundation, All Rights Reserved.
+ * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
+ */
+
+#include "portable.h"
+
+#include <stdio.h>
+
+#include <ac/string.h>
+#include <ac/socket.h>
+
+#include "slap.h"
+#include "back-ldbm.h"
+
+/* read a key */
+int
+key_read(
+ Backend *be,
+ DBCache *db,
+ struct berval *k,
+ ID_BLOCK **idout
+)
+{
+ Datum key;
+ ID_BLOCK *idl;
+
+#ifdef NEW_LOGGING
+ LDAP_LOG( INDEX, ENTRY, "key_read: enter\n", 0, 0, 0 );
+#else
+ Debug( LDAP_DEBUG_TRACE, "=> key_read\n", 0, 0, 0 );
+#endif
+
+
+ ldbm_datum_init( key );
+ key.dptr = k->bv_val;
+ key.dsize = k->bv_len;
+
+ idl = idl_fetch( be, db, key );
+
+#ifdef NEW_LOGGING
+ LDAP_LOG( INDEX, ENTRY,
+ "key_read: %ld candidates\n", idl ? ID_BLOCK_NIDS(idl) : 0, 0, 0 );
+#else
+ Debug( LDAP_DEBUG_TRACE, "<= index_read %ld candidates\n",
+ idl ? ID_BLOCK_NIDS(idl) : 0, 0, 0 );
+#endif
+
+
+ *idout = idl;
+ return LDAP_SUCCESS;
+}
+
+/* Add or remove stuff from index files */
+int
+key_change(
+ Backend *be,
+ DBCache *db,
+ struct berval *k,
+ ID id,
+ int op
+)
+{
+ int rc;
+ Datum key;
+
+#ifdef NEW_LOGGING
+ LDAP_LOG( INDEX, ENTRY, "key_change: %s ID %lx\n",
+ op == SLAP_INDEX_ADD_OP ? "Add" : "Delete", (long)id, 0 );
+#else
+ Debug( LDAP_DEBUG_TRACE, "=> key_change(%s,%lx)\n",
+ op == SLAP_INDEX_ADD_OP ? "ADD":"DELETE", (long) id, 0 );
+#endif
+
+
+ ldbm_datum_init( key );
+ key.dptr = k->bv_val;
+ key.dsize = k->bv_len;
+
+ ldap_pvt_thread_mutex_lock( &db->dbc_write_mutex );
+ if (op == SLAP_INDEX_ADD_OP) {
+ /* Add values */
+ rc = idl_insert_key( be, db, key, id );
+
+ } else {
+ /* Delete values */
+ rc = idl_delete_key( be, db, key, id );
+ }
+ ldap_pvt_thread_mutex_unlock( &db->dbc_write_mutex );
+
+
+#ifdef NEW_LOGGING
+ LDAP_LOG( INDEX, ENTRY, "key_change: return %d\n", rc, 0, 0 );
+#else
+ Debug( LDAP_DEBUG_TRACE, "<= key_change %d\n", rc, 0, 0 );
+#endif
+
+
+ ldap_pvt_thread_yield();
+
+ return rc;
+}
Attribute *ap;
#ifdef NEW_LOGGING
- LDAP_LOG(( "backend", LDAP_LEVEL_ENTRY,
- "ldbm_modify_internal: %s\n", dn ));
+ LDAP_LOG( BACK_LDBM, ENTRY, "ldbm_modify_internal: %s\n", dn, 0, 0 );
#else
Debug(LDAP_DEBUG_TRACE, "ldbm_modify_internal: %s\n", dn, 0, 0);
#endif
switch ( mod->sm_op ) {
case LDAP_MOD_ADD:
#ifdef NEW_LOGGING
- LDAP_LOG(( "backend", LDAP_LEVEL_DETAIL1,
- "ldbm_modify_internal: add\n" ));
+ LDAP_LOG( BACK_LDBM, DETAIL1, "ldbm_modify_internal: add\n", 0, 0, 0);
#else
Debug(LDAP_DEBUG_ARGS, "ldbm_modify_internal: add\n", 0, 0, 0);
#endif
rc = modify_add_values( e, mod, text, textbuf, textlen );
if( rc != LDAP_SUCCESS ) {
#ifdef NEW_LOGGING
- LDAP_LOG(( "backend", LDAP_LEVEL_INFO,
- "ldbm_modify_internal: failed %d (%s)\n",
- rc, *text ));
+ LDAP_LOG( BACK_LDBM, INFO,
+ "ldbm_modify_internal: failed %d (%s)\n", rc, *text, 0 );
#else
Debug(LDAP_DEBUG_ARGS, "ldbm_modify_internal: %d %s\n",
rc, *text, 0);
case LDAP_MOD_DELETE:
#ifdef NEW_LOGGING
- LDAP_LOG(( "backend", LDAP_LEVEL_DETAIL1,
- "ldbm_modify_internal: delete\n" ));
+ LDAP_LOG( BACK_LDBM, DETAIL1, "ldbm_modify_internal: delete\n", 0,0,0);
#else
Debug(LDAP_DEBUG_ARGS, "ldbm_modify_internal: delete\n", 0, 0, 0);
#endif
assert( rc != LDAP_TYPE_OR_VALUE_EXISTS );
if( rc != LDAP_SUCCESS ) {
#ifdef NEW_LOGGING
- LDAP_LOG(( "backend", LDAP_LEVEL_INFO,
- "ldbm_modify_internal: failed %d (%s)\n", rc, *text ));
+ LDAP_LOG( BACK_LDBM, INFO,
+ "ldbm_modify_internal: failed %d (%s)\n", rc, *text, 0 );
#else
Debug(LDAP_DEBUG_ARGS, "ldbm_modify_internal: %d %s\n",
rc, *text, 0);
case LDAP_MOD_REPLACE:
#ifdef NEW_LOGGING
- LDAP_LOG(( "backend", LDAP_LEVEL_DETAIL1,
- "ldbm_modify_internal: replace\n" ));
+ LDAP_LOG( BACK_LDBM, DETAIL1, "ldbm_modify_internal: replace\n",0,0,0);
#else
Debug(LDAP_DEBUG_ARGS, "ldbm_modify_internal: replace\n", 0, 0, 0);
#endif
rc = modify_replace_values( e, mod, text, textbuf, textlen );
if( rc != LDAP_SUCCESS ) {
#ifdef NEW_LOGGING
- LDAP_LOG(( "backend", LDAP_LEVEL_INFO,
- "ldbm_modify_internal: failed %d (%s)\n", rc, *text ));
+ LDAP_LOG( BACK_LDBM, INFO,
+ "ldbm_modify_internal: failed %d (%s)\n", rc, *text, 0 );
#else
Debug(LDAP_DEBUG_ARGS, "ldbm_modify_internal: %d %s\n",
rc, *text, 0);
case SLAP_MOD_SOFTADD:
#ifdef NEW_LOGGING
- LDAP_LOG(( "backend", LDAP_LEVEL_DETAIL1,
- "ldbm_modify_internal: softadd\n" ));
+ LDAP_LOG( BACK_LDBM, DETAIL1,
+ "ldbm_modify_internal: softadd\n", 0, 0, 0 );
#else
Debug(LDAP_DEBUG_ARGS, "ldbm_modify_internal: softadd\n", 0, 0, 0);
#endif
if( rc != LDAP_SUCCESS ) {
#ifdef NEW_LOGGING
- LDAP_LOG(( "backend", LDAP_LEVEL_INFO,
- "ldbm_modify_internal: failed %d (%s)\n", rc, *text ));
+ LDAP_LOG( BACK_LDBM, INFO,
+ "ldbm_modify_internal: failed %d (%s)\n", rc, *text, 0 );
#else
Debug(LDAP_DEBUG_ARGS, "ldbm_modify_internal: %d %s\n",
rc, *text, 0);
default:
#ifdef NEW_LOGGING
- LDAP_LOG(( "backend", LDAP_LEVEL_ERR,
- "ldbm_modify_internal: invalid op %d\n", mod->sm_op ));
+ LDAP_LOG( BACK_LDBM, ERR,
+ "ldbm_modify_internal: invalid op %d\n", mod->sm_op, 0, 0 );
#else
Debug(LDAP_DEBUG_ANY, "ldbm_modify_internal: invalid op %d\n",
mod->sm_op, 0, 0);
rc = LDAP_OTHER;
*text = "Invalid modify operation";
#ifdef NEW_LOGGING
- LDAP_LOG(( "backend", LDAP_LEVEL_INFO,
- "ldbm_modify_internal: %d (%s)\n", rc, *text ));
+ LDAP_LOG( BACK_LDBM, INFO,
+ "ldbm_modify_internal: %d (%s)\n", rc, *text, 0 );
#else
Debug(LDAP_DEBUG_ARGS, "ldbm_modify_internal: %d %s\n",
rc, *text, 0);
rc = entry_schema_check( be, e, save_attrs, text, textbuf, textlen );
if ( rc != LDAP_SUCCESS ) {
#ifdef NEW_LOGGING
- LDAP_LOG(( "backend", LDAP_LEVEL_ERR,
- "ldbm_modify_internal: entry failed schema check: %s\n",
- *text ));
+ LDAP_LOG( BACK_LDBM, ERR,
+ "ldbm_modify_internal: entry failed schema check: %s\n",
+ *text, 0, 0 );
#else
Debug( LDAP_DEBUG_ANY, "entry failed schema check: %s\n",
*text, 0, 0 );
SLAP_INDEX_DELETE_OP );
if ( rc != LDAP_SUCCESS ) {
#ifdef NEW_LOGGING
- LDAP_LOG(( "backend", LDAP_LEVEL_ERR,
- "ldbm_modify_internal: Attribute index delete failure\n" ));
+ LDAP_LOG( BACK_LDBM, ERR,
+ "ldbm_modify_internal: Attribute index delete failure\n",
+ 0, 0, 0 );
#else
Debug( LDAP_DEBUG_ANY,
"Attribute index delete failure",
SLAP_INDEX_ADD_OP );
if ( rc != LDAP_SUCCESS ) {
#ifdef NEW_LOGGING
- LDAP_LOG(( "backend", LDAP_LEVEL_ERR,
- "ldbm_modify_internal: Attribute index add failure\n" ));
+ LDAP_LOG( BACK_LDBM, ERR,
+ "ldbm_modify_internal: Attribute index add failure\n",
+ 0, 0, 0 );
#else
Debug( LDAP_DEBUG_ANY,
"Attribute index add failure",
size_t textlen = sizeof textbuf;
#ifdef NEW_LOGGING
- LDAP_LOG(( "backend", LDAP_LEVEL_ENTRY,
- "ldbm_back_modify: enter\n" ));
+ LDAP_LOG( BACK_LDBM, ENTRY, "ldbm_back_modify: enter\n", 0, 0, 0);
#else
Debug(LDAP_DEBUG_ARGS, "ldbm_back_modify:\n", 0, 0, 0);
#endif
conn, op, e );
#ifdef NEW_LOGGING
- LDAP_LOG(( "backend", LDAP_LEVEL_INFO,
- "ldbm_back_modify: entry (%s) is referral\n", ndn->bv_val ));
+ LDAP_LOG( BACK_LDBM, INFO,
+ "ldbm_back_modify: entry (%s) is referral\n", ndn->bv_val, 0, 0 );
#else
Debug( LDAP_DEBUG_TRACE, "entry is referral\n", 0,
0, 0 );
int manageDSAit = get_manageDSAit( op );
#ifdef NEW_LOGGING
- LDAP_LOG(( "backend", LDAP_LEVEL_ENTRY,
+ LDAP_LOG( BACK_LDBM, ENTRY,
"ldbm_back_modrdn: dn: %s newSuperior=%s\n",
dn->bv_len ? dn->bv_val : "NULL",
- ( newSuperior && newSuperior->bv_len )
- ? newSuperior->bv_val : "NULL" ));
+ ( newSuperior && newSuperior->bv_len ) ? newSuperior->bv_val : "NULL",0 );
#else
Debug( LDAP_DEBUG_TRACE,
"==>ldbm_back_modrdn: dn: %s newSuperior=%s\n",
conn, op, e );
#ifdef NEW_LOGGING
- LDAP_LOG(( "backend", LDAP_LEVEL_INFO,
- "ldbm_back_modrdn: entry %s is a referral\n", e->e_dn ));
+ LDAP_LOG( BACK_LDBM, INFO,
+ "ldbm_back_modrdn: entry %s is a referral\n", e->e_dn, 0, 0 );
#else
Debug( LDAP_DEBUG_TRACE, "entry %s is referral\n", e->e_dn,
0, 0 );
if ( has_children( be, e ) ) {
#ifdef NEW_LOGGING
- LDAP_LOG(( "backend", LDAP_LEVEL_INFO,
- "ldbm_back_modrdn: entry %s has children\n", e->e_dn ));
+ LDAP_LOG( BACK_LDBM, INFO,
+ "ldbm_back_modrdn: entry %s has children\n", e->e_dn, 0, 0 );
#else
Debug( LDAP_DEBUG_TRACE, "entry %s has children\n", e->e_dn,
0, 0 );
if( (p = dn2entry_w( be, &p_ndn, NULL )) == NULL) {
#ifdef NEW_LOGGING
- LDAP_LOG(( "backend", LDAP_LEVEL_INFO,
- "ldbm_back_modrdn: parent of %s does not exist\n", e->e_ndn ));
+ LDAP_LOG( BACK_LDBM, INFO,
+ "ldbm_back_modrdn: parent of %s does not exist\n",
+ e->e_ndn, 0, 0 );
#else
Debug( LDAP_DEBUG_TRACE, "parent does not exist\n",
0, 0, 0);
children, NULL, ACL_WRITE, NULL ) )
{
#ifdef NEW_LOGGING
- LDAP_LOG(( "backend", LDAP_LEVEL_INFO,
- "ldbm_back_modrdn: no access to parent of (%s)\n", e->e_dn ));
+ LDAP_LOG( BACK_LDBM, INFO,
+ "ldbm_back_modrdn: no access to parent of (%s)\n",
+ e->e_dn, 0, 0 );
#else
Debug( LDAP_DEBUG_TRACE, "no access to parent\n", 0,
0, 0 );
}
#ifdef NEW_LOGGING
- LDAP_LOG(( "backend", LDAP_LEVEL_DETAIL1,
- "ldbm_back_modrdn: wr to children of entry %s OK\n",
- p_ndn.bv_val ));
+ LDAP_LOG( BACK_LDBM, DETAIL1,
+ "ldbm_back_modrdn: wr to children of entry %s OK\n",
+ p_ndn.bv_val, 0, 0 );
#else
Debug( LDAP_DEBUG_TRACE,
"ldbm_back_modrdn: wr to children of entry %s OK\n",
}
#ifdef NEW_LOGGING
- LDAP_LOG(( "backend", LDAP_LEVEL_DETAIL1,
- "ldbm_back_modrdn: parent dn=%s\n", p_dn.bv_val ));
+ LDAP_LOG( BACK_LDBM, DETAIL1,
+ "ldbm_back_modrdn: parent dn=%s\n", p_dn.bv_val, 0, 0 );
#else
Debug( LDAP_DEBUG_TRACE, "ldbm_back_modrdn: parent dn=%s\n",
p_dn.bv_val, 0, 0 );
/* check parent for "children" acl */
if ( ! rc ) {
#ifdef NEW_LOGGING
- LDAP_LOG(( "backend", LDAP_LEVEL_ERR,
- "ldbm_back_modrdn: no access "
- "to parent \"\"\n" ));
+ LDAP_LOG( BACK_LDBM, ERR,
+ "ldbm_back_modrdn: no access to parent \"\"\n", 0,0,0 );
#else
Debug( LDAP_DEBUG_TRACE,
"<=- ldbm_back_modrdn: no "
} else {
#ifdef NEW_LOGGING
- LDAP_LOG(( "backend", LDAP_LEVEL_ERR,
- "ldbm_back_modrdn: (%s) has no "
- "parent & not a root.\n", dn ));
+ LDAP_LOG( BACK_LDBM, ERR,
+ "ldbm_back_modrdn: (%s) has no parent & not a root.\n",
+ dn, 0, 0 );
#else
Debug( LDAP_DEBUG_TRACE,
"<=- ldbm_back_modrdn: no parent & "
}
#ifdef NEW_LOGGING
- LDAP_LOG(( "backend", LDAP_LEVEL_INFO,
- "ldbm_back_modrdn: (%s) no parent, locked root.\n", e->e_dn ));
+ LDAP_LOG( BACK_LDBM, INFO,
+ "ldbm_back_modrdn: (%s) no parent, locked root.\n", e->e_dn, 0, 0 );
#else
Debug( LDAP_DEBUG_TRACE,
"ldbm_back_modrdn: no parent, locked root\n",
if ( newSuperior != NULL ) {
#ifdef NEW_LOGGING
- LDAP_LOG(( "backend", LDAP_LEVEL_DETAIL1,
+ LDAP_LOG( BACK_LDBM, DETAIL1,
"ldbm_back_modrdn: new parent \"%s\" requested\n",
- newSuperior->bv_val ));
+ newSuperior->bv_val, 0, 0 );
#else
Debug( LDAP_DEBUG_TRACE,
"ldbm_back_modrdn: new parent \"%s\" requested...\n",
/* newSuperior == oldParent? */
if ( dn_match( &p_ndn, np_ndn ) ) {
#ifdef NEW_LOGGING
- LDAP_LOG(( "backend", LDAP_LEVEL_INFO, "ldbm_back_modrdn: "
+ LDAP_LOG( BACK_LDBM, INFO, "ldbm_back_modrdn: "
"new parent\"%s\" seems to be the same as the "
- "old parent \"%s\"\n",
- newSuperior->bv_val, p_dn.bv_val ));
+ "old parent \"%s\"\n", newSuperior->bv_val, p_dn.bv_val, 0 );
#else
Debug( LDAP_DEBUG_TRACE, "ldbm_back_modrdn: "
"new parent\"%s\" seems to be the same as the "
if ( nnewSuperior->bv_len ) {
if( (np = dn2entry_w( be, np_ndn, NULL )) == NULL) {
#ifdef NEW_LOGGING
- LDAP_LOG(( "backend", LDAP_LEVEL_ERR,
- "ldbm_back_modrdn: newSup(ndn=%s) not found.\n", np_ndn->bv_val ));
+ LDAP_LOG( BACK_LDBM, ERR,
+ "ldbm_back_modrdn: newSup(ndn=%s) not found.\n",
+ np_ndn->bv_val, 0, 0 );
#else
Debug( LDAP_DEBUG_TRACE,
"ldbm_back_modrdn: newSup(ndn=%s) not here!\n",
}
#ifdef NEW_LOGGING
- LDAP_LOG(( "backend", LDAP_LEVEL_DETAIL1,
+ LDAP_LOG( BACK_LDBM, DETAIL1,
"ldbm_back_modrdn: wr to new parent OK np=%p, id=%ld\n",
- np, np->e_id ));
+ np, np->e_id, 0 );
#else
Debug( LDAP_DEBUG_TRACE,
"ldbm_back_modrdn: wr to new parent OK np=%p, id=%ld\n",
ACL_WRITE, NULL ) )
{
#ifdef NEW_LOGGING
- LDAP_LOG(( "backend", LDAP_LEVEL_INFO,
- "ldbm_back_modrdn: no wr to newSup children.\n" ));
+ LDAP_LOG( BACK_LDBM, INFO,
+ "ldbm_back_modrdn: no wr to newSup children.\n", 0, 0, 0 );
#else
Debug( LDAP_DEBUG_TRACE,
"ldbm_back_modrdn: no wr to newSup children\n",
if ( is_entry_alias( np ) ) {
/* parent is an alias, don't allow add */
#ifdef NEW_LOGGING
- LDAP_LOG(( "backend", LDAP_LEVEL_INFO,
- "ldbm_back_modrdn: entry (%s) is an alias.\n", np->e_dn ));
+ LDAP_LOG( BACK_LDBM, INFO,
+ "ldbm_back_modrdn: entry (%s) is an alias.\n", np->e_dn,0,0);
#else
Debug( LDAP_DEBUG_TRACE, "entry is alias\n", 0, 0, 0 );
#endif
if ( is_entry_referral( np ) ) {
/* parent is a referral, don't allow add */
#ifdef NEW_LOGGING
- LDAP_LOG(( "backend", LDAP_LEVEL_INFO,
+ LDAP_LOG( BACK_LDBM, INFO,
"ldbm_back_modrdn: entry (%s) is a referral\n",
- np->e_dn ));
+ np->e_dn, 0, 0 );
#else
Debug( LDAP_DEBUG_TRACE, "entry (%s) is referral\n",
np->e_dn, 0, 0 );
/* check parent for "children" acl */
if ( ! rc ) {
#ifdef NEW_LOGGING
- LDAP_LOG(( "backend", LDAP_LEVEL_ERR,
+ LDAP_LOG( BACK_LDBM, ERR,
"ldbm_back_modrdn: no access "
- "to new superior \"\"\n" ));
+ "to new superior \"\"\n", 0, 0, 0 );
#else
Debug( LDAP_DEBUG_TRACE,
"<=- ldbm_back_modrdn: no "
} else {
#ifdef NEW_LOGGING
- LDAP_LOG(( "backend", LDAP_LEVEL_ERR,
- "ldbm_back_modrdn: \"\" "
- "not allowed as new superior\n" ));
+ LDAP_LOG( BACK_LDBM, ERR,
+ "ldbm_back_modrdn: \"\" not allowed as new superior\n",
+ 0, 0, 0 );
#else
Debug( LDAP_DEBUG_TRACE,
"<=- ldbm_back_modrdn: \"\" "
}
#ifdef NEW_LOGGING
- LDAP_LOG(( "backend", LDAP_LEVEL_DETAIL1,
- "ldbm_back_modrdn: wr to new parent's children OK.\n" ));
+ LDAP_LOG( BACK_LDBM, DETAIL1,
+ "ldbm_back_modrdn: wr to new parent's children OK.\n", 0, 0, 0 );
#else
Debug( LDAP_DEBUG_TRACE,
"ldbm_back_modrdn: wr to new parent's children OK\n",
dnNormalize2( NULL, &new_dn, &new_ndn );
#ifdef NEW_LOGGING
- LDAP_LOG(( "backend", LDAP_LEVEL_DETAIL1,
- "ldbm_back_modrdn: new ndn=%s\n", new_ndn.bv_val ));
+ LDAP_LOG( BACK_LDBM, DETAIL1, "ldbm_back_modrdn: new ndn=%s\n",
+ new_ndn.bv_val, 0, 0 );
#else
Debug( LDAP_DEBUG_TRACE, "ldbm_back_modrdn: new ndn=%s\n",
new_ndn.bv_val, 0, 0 );
}
#ifdef NEW_LOGGING
- LDAP_LOG(( "backend", LDAP_LEVEL_INFO,
- "ldbm_back_modrdn: new ndn (%s) does not exist\n", new_ndn.bv_val ));
+ LDAP_LOG( BACK_LDBM, INFO, "ldbm_back_modrdn: new ndn (%s) does not exist\n",
+ new_ndn.bv_val, 0, 0 );
#else
Debug( LDAP_DEBUG_TRACE,
"ldbm_back_modrdn: new ndn=%s does not exist\n",
LDAP_DN_FORMAT_LDAP ) )
{
#ifdef NEW_LOGGING
- LDAP_LOG(( "backend", LDAP_LEVEL_INFO,
- "ldbm_back_modrdn: can't figure out type(s)/value(s) of newrdn\n" ));
+ LDAP_LOG( BACK_LDBM, INFO,
+ "ldbm_back_modrdn: can't figure out type(s)/value(s) of newrdn\n",
+ 0, 0, 0 );
#else
Debug( LDAP_DEBUG_TRACE,
"ldbm_back_modrdn: can't figure out type(s)/value(s) of newrdn\n",
}
#ifdef NEW_LOGGING
- LDAP_LOG(( "backend", LDAP_LEVEL_DETAIL1,
- "ldbm_back_modrdn: new_rdn_type=\"%s\", new_rdn_val=\"%s\"\n",
- new_rdn[0][0]->la_attr.bv_val, new_rdn[0][0]->la_value.bv_val ));
+ LDAP_LOG( BACK_LDBM, DETAIL1,
+ "ldbm_back_modrdn: new_rdn_type=\"%s\", new_rdn_val=\"%s\"\n",
+ new_rdn[0][0]->la_attr.bv_val, new_rdn[0][0]->la_value.bv_val, 0 );
#else
Debug( LDAP_DEBUG_TRACE,
"ldbm_back_modrdn: new_rdn_type=\"%s\", new_rdn_val=\"%s\"\n",
LDAP_DN_FORMAT_LDAP ) )
{
#ifdef NEW_LOGGING
- LDAP_LOG(( "backend", LDAP_LEVEL_INFO,
- "ldbm_back_modrdn: can't figure out the old_rdn type(s)/value(s).\n" ));
+ LDAP_LOG( BACK_LDBM, INFO,
+ "ldbm_back_modrdn: can't figure out the old_rdn "
+ "type(s)/value(s).\n", 0, 0, 0 );
#else
Debug( LDAP_DEBUG_TRACE,
"ldbm_back_modrdn: can't figure out the old_rdn type(s)/value(s)\n",
{
/* Not a big deal but we may say something */
#ifdef NEW_LOGGING
- LDAP_LOG(( "backend", LDAP_LEVEL_INFO,
+ LDAP_LOG( BACK_LDBM, INFO,
"ldbm_back_modrdn: old_rdn_type=%s new_rdn_type=%s\n",
- old_rdn_types[0], new_rdn_types[0] ));
+ old_rdn_types[0], new_rdn_types[0], 0 );
#else
Debug( LDAP_DEBUG_TRACE,
"ldbm_back_modrdn: old_rdn_type=%s, new_rdn_type=%s!\n",
#endif
#ifdef NEW_LOGGING
- LDAP_LOG(( "backend", LDAP_LEVEL_DETAIL1,
- "ldbm_back_modrdn: DN_X500\n" ));
+ LDAP_LOG( BACK_LDBM, DETAIL1, "ldbm_back_modrdn: DN_X500\n", 0, 0, 0 );
#else
Debug( LDAP_DEBUG_TRACE, "ldbm_back_modrdn: DN_X500\n",
0, 0, 0 );
if ( rc != LDAP_SUCCESS ) {
#ifdef NEW_LOGGING
- LDAP_LOG(( "backend", LDAP_LEVEL_INFO,
- "ldbm_back_modrdn: slap_bv2ad error: %s (%s)\n",
- text, new_rdn[0][a_cnt]->la_attr.bv_val ));
+ LDAP_LOG( BACK_LDBM, INFO,
+ "ldbm_back_modrdn: slap_bv2ad error: %s (%s)\n",
+ text, new_rdn[0][a_cnt]->la_attr.bv_val, 0 );
#else
Debug( LDAP_DEBUG_TRACE,
"ldbm_back_modrdn: %s: %s (new)\n",
if ( ! access_allowed( be, conn, op, e,
desc, &new_rdn[0][a_cnt]->la_value, ACL_WRITE, NULL ) ) {
#ifdef NEW_LOGGING
- LDAP_LOG(( "backend", LDAP_LEVEL_INFO,
- "ldbm_back_modrdn: access "
- "not allowed to attr \"%s\"\n",
- new_rdn[0][a_cnt]->la_attr.bv_val ));
+ LDAP_LOG( BACK_LDBM, INFO,
+ "ldbm_back_modrdn: access not allowed to attr \"%s\"\n",
+ new_rdn[0][a_cnt]->la_attr.bv_val, 0, 0 );
#else
Debug( LDAP_DEBUG_TRACE,
"ldbm_back_modrdn: access not allowed "
/* Get value of old rdn */
if ( old_rdn == NULL ) {
#ifdef NEW_LOGGING
- LDAP_LOG(( "backend", LDAP_LEVEL_INFO,
- "ldbm_back_modrdn: can't figure out old RDN value(s) from old RDN\n" ));
+ LDAP_LOG( BACK_LDBM, INFO,
+ "ldbm_back_modrdn: can't figure out old RDN value(s) "
+ "from old RDN\n", 0, 0, 0 );
#else
Debug( LDAP_DEBUG_TRACE,
"ldbm_back_modrdn: can't figure out oldRDN value(s) from old RDN\n",
if ( rc != LDAP_SUCCESS ) {
#ifdef NEW_LOGGING
- LDAP_LOG(( "backend", LDAP_LEVEL_INFO,
- "ldbm_back_modrdn: %s: %s (old)\n",
- text, old_rdn[0][d_cnt]->la_attr.bv_val ));
+ LDAP_LOG( BACK_LDBM, INFO,
+ "ldbm_back_modrdn: %s: %s (old)\n",
+ text, old_rdn[0][d_cnt]->la_attr.bv_val, 0 );
#else
Debug( LDAP_DEBUG_TRACE,
"ldbm_back_modrdn: %s: %s (old)\n",
if ( ! access_allowed( be, conn, op, e,
desc, &old_rdn[0][d_cnt]->la_value, ACL_WRITE, NULL ) ) {
#ifdef NEW_LOGGING
- LDAP_LOG(( "backend", LDAP_LEVEL_INFO,
- "ldbm_back_modrdn: access "
- "not allowed to attr \"%s\"\n",
- old_rdn[0][d_cnt]->la_attr.bv_val ));
+ LDAP_LOG( BACK_LDBM, INFO,
+ "ldbm_back_modrdn: access not allowed to attr \"%s\"\n",
+ old_rdn[0][d_cnt]->la_attr.bv_val, 0, 0 );
#else
Debug( LDAP_DEBUG_TRACE,
"ldbm_back_modrdn: access not allowed "
mod = mod_tmp;
#ifdef NEW_LOGGING
- LDAP_LOG(( "backend", LDAP_LEVEL_DETAIL1,
- "ldbm_back_modrdn: removing old_rdn_val=%s\n", old_rdn[0][d_cnt]->la_value.bv_val ));
+ LDAP_LOG( BACK_LDBM, DETAIL1,
+ "ldbm_back_modrdn: removing old_rdn_val=%s\n",
+ old_rdn[0][d_cnt]->la_value.bv_val, 0, 0 );
#else
Debug( LDAP_DEBUG_TRACE,
"ldbm_back_modrdn: removing old_rdn_val=%s\n",
-/* id.c - keep track of the next id to be given out */
+/* nextid.c - keep track of the next id to be given out */
+/* $OpenLDAP$ */
+/*
+ * Copyright 1998-2002 The OpenLDAP Foundation, All Rights Reserved.
+ * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
+ */
+
+#include "portable.h"
#include <stdio.h>
-#include <sys/types.h>
-#include <sys/socket.h>
-#include <sys/param.h>
+
+#include <ac/string.h>
+#include <ac/socket.h>
+#include <ac/param.h>
+
#include "slap.h"
#include "back-ldbm.h"
-ID
-next_id( Backend *be )
+static int
+next_id_read( Backend *be, ID *idp )
{
- struct ldbminfo *li = (struct ldbminfo *) be->be_private;
- char buf[MAXPATHLEN];
- char buf2[20];
- FILE *fp;
- ID id;
-
- sprintf( buf, "%s/NEXTID", li->li_directory );
-
- pthread_mutex_lock( &li->li_nextid_mutex );
- /* first time in here since startup - try to read the nexid */
- if ( li->li_nextid == -1 ) {
- if ( (fp = fopen( buf, "r" )) == NULL ) {
- Debug( LDAP_DEBUG_ANY,
- "next_id %d: could not open \"%s\"\n",
- li->li_nextid, buf, 0 );
- li->li_nextid = 1;
- } else {
- if ( fgets( buf2, sizeof(buf2), fp ) != NULL ) {
- li->li_nextid = atol( buf2 );
- } else {
- Debug( LDAP_DEBUG_ANY,
- "next_id %d: could not fgets nextid from \"%s\"\n",
- li->li_nextid, buf2, 0 );
- li->li_nextid = 1;
- }
- fclose( fp );
- }
+ Datum key, data;
+ DBCache *db;
+
+ *idp = NOID;
+
+ if ( (db = ldbm_cache_open( be, "nextid", LDBM_SUFFIX, LDBM_WRCREAT ))
+ == NULL ) {
+#ifdef NEW_LOGGING
+ LDAP_LOG( BACK_LDBM, CRIT,
+ "next_id_read: could not open/create nextid%s\n", LDBM_SUFFIX, 0, 0 );
+#else
+ Debug( LDAP_DEBUG_ANY, "Could not open/create nextid" LDBM_SUFFIX "\n",
+ 0, 0, 0 );
+#endif
+
+ return( -1 );
}
- li->li_nextid++;
- if ( (fp = fopen( buf, "w" )) == NULL ) {
- Debug( LDAP_DEBUG_ANY, "next_id %d: could not open \"%s\"\n",
- li->li_nextid, buf, 0 );
+ ldbm_datum_init( key );
+ key.dptr = (char *) idp;
+ key.dsize = sizeof(ID);
+
+ data = ldbm_cache_fetch( db, key );
+
+ if( data.dptr != NULL ) {
+ AC_MEMCPY( idp, data.dptr, sizeof( ID ) );
+ ldbm_datum_free( db->dbc_db, data );
+
} else {
- if ( fprintf( fp, "%ld\n", li->li_nextid ) == EOF ) {
- Debug( LDAP_DEBUG_ANY, "next_id %d: cannot fprintf\n",
- li->li_nextid, 0, 0 );
- }
- if( fclose( fp ) != 0 ) {
- Debug( LDAP_DEBUG_ANY, "next_id %d: cannot fclose\n",
- li->li_nextid, 0, 0 );
- }
+ *idp = 1;
}
- id = li->li_nextid - 1;
- pthread_mutex_unlock( &li->li_nextid_mutex );
- return( id );
+ ldbm_cache_close( be, db );
+ return( 0 );
}
-void
-next_id_return( Backend *be, ID id )
+int
+next_id_write( Backend *be, ID id )
{
- struct ldbminfo *li = (struct ldbminfo *) be->be_private;
- char buf[MAXPATHLEN];
- FILE *fp;
+ Datum key, data;
+ DBCache *db;
+ ID noid = NOID;
+ int flags, rc = 0;
- pthread_mutex_lock( &li->li_nextid_mutex );
- if ( id != li->li_nextid - 1 ) {
- pthread_mutex_unlock( &li->li_nextid_mutex );
- return;
+ if ( (db = ldbm_cache_open( be, "nextid", LDBM_SUFFIX, LDBM_WRCREAT ))
+ == NULL ) {
+#ifdef NEW_LOGGING
+ LDAP_LOG( BACK_LDBM, CRIT,
+ "next_id_write: Could not open/create nextid%s\n", LDBM_SUFFIX, 0, 0 );
+#else
+ Debug( LDAP_DEBUG_ANY, "Could not open/create nextid" LDBM_SUFFIX "\n",
+ 0, 0, 0 );
+#endif
+
+ return( -1 );
}
- sprintf( buf, "%s/NEXTID", li->li_directory );
+ ldbm_datum_init( key );
+ ldbm_datum_init( data );
- li->li_nextid--;
- if ( (fp = fopen( buf, "w" )) == NULL ) {
- Debug( LDAP_DEBUG_ANY,
- "next_id_return of %d: could not open \"%s\" next id %d\n",
- id, buf, li->li_nextid );
- } else {
- if ( fprintf( fp, "%ld\n", li->li_nextid ) == EOF ) {
- Debug( LDAP_DEBUG_ANY,
- "next_id_return of %d: cannot fprintf \"%s\" next id %d\n",
- id, buf, li->li_nextid );
- }
- if( fclose( fp ) != 0 ) {
- Debug( LDAP_DEBUG_ANY,
- "next_id_return of %d: cannot fclose \"%s\" next id %d\n",
- id, buf, li->li_nextid );
+ key.dptr = (char *) &noid;
+ key.dsize = sizeof(ID);
+
+ data.dptr = (char *) &id;
+ data.dsize = sizeof(ID);
+
+ flags = LDBM_REPLACE;
+ if ( ldbm_cache_store( db, key, data, flags ) != 0 ) {
+ rc = -1;
+ }
+
+ ldbm_cache_close( be, db );
+ return( rc );
+}
+
+int
+next_id_get( Backend *be, ID *idp )
+{
+ struct ldbminfo *li = (struct ldbminfo *) be->be_private;
+ int rc = 0;
+
+ *idp = NOID;
+
+ if ( li->li_nextid == NOID ) {
+ if ( ( rc = next_id_read( be, idp ) ) ) {
+ return( rc );
}
+ li->li_nextid = *idp;
}
- pthread_mutex_unlock( &li->li_nextid_mutex );
+
+ *idp = li->li_nextid;
+
+ return( rc );
}
-ID
-next_id_get( Backend *be )
+int
+next_id( Backend *be, ID *idp )
{
struct ldbminfo *li = (struct ldbminfo *) be->be_private;
- char buf[MAXPATHLEN];
- char buf2[20];
- FILE *fp;
- ID id;
-
- sprintf( buf, "%s/NEXTID", li->li_directory );
-
- pthread_mutex_lock( &li->li_nextid_mutex );
- /* first time in here since startup - try to read the nexid */
- if ( li->li_nextid == -1 ) {
- if ( (fp = fopen( buf, "r" )) == NULL ) {
- Debug( LDAP_DEBUG_ANY,
- "next_id %d: could not open \"%s\"\n",
- li->li_nextid, buf, 0 );
- li->li_nextid = 1;
- } else {
- if ( fgets( buf2, sizeof(buf2), fp ) != NULL ) {
- li->li_nextid = atol( buf2 );
- } else {
- Debug( LDAP_DEBUG_ANY,
- "next_id %d: cannot fgets nextid from \"%s\"\n",
- li->li_nextid, buf2, 0 );
- li->li_nextid = 1;
- }
- fclose( fp );
+ int rc = 0;
+
+ if ( li->li_nextid == NOID ) {
+ if ( ( rc = next_id_read( be, idp ) ) ) {
+ return( rc );
}
+ li->li_nextid = *idp;
+ }
+
+ *idp = li->li_nextid++;
+ if ( next_id_write( be, li->li_nextid ) ) {
+ rc = -1;
}
- id = li->li_nextid;
- pthread_mutex_unlock( &li->li_nextid_mutex );
- return( id );
+ return( rc );
}
&id, NULL, &new, text );
#ifdef NEW_LOGGING
- LDAP_LOG(( "backend", LDAP_LEVEL_ENTRY,
- "ldbm_back_exop_passwd: \"%s\"\n",
- id.bv_val ? id.bv_val : "" ));
+ LDAP_LOG( BACK_LDBM, ENTRY,
+ "ldbm_back_exop_passwd: \"%s\"\n", id.bv_val ? id.bv_val : "", 0,0 );
#else
Debug( LDAP_DEBUG_ARGS, "==> ldbm_back_exop_passwd: \"%s\"\n",
id.bv_val ? id.bv_val : "", 0, 0 );
}
#ifdef NEW_LOGGING
- LDAP_LOG(( "backend", LDAP_LEVEL_DETAIL1,
+ LDAP_LOG( BACK_LDBM, DETAIL1,
"ldbm_back_exop_passwd: \"%s\"%s\n",
- dn.bv_val, id.bv_len ? " (proxy)" : "" ));
+ dn.bv_val, id.bv_len ? " (proxy)" : "", 0 );
#else
Debug( LDAP_DEBUG_TRACE, "passwd: \"%s\"%s\n",
dn.bv_val, id.bv_len ? " (proxy)" : "", 0 );
--- /dev/null
+/* referral.c - LDBM backend referral handler */
+/* $OpenLDAP$ */
+/*
+ * Copyright 2000-2002 The OpenLDAP Foundation, All Rights Reserved.
+ * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
+ */
+
+#include "portable.h"
+
+#include <stdio.h>
+
+#include <ac/string.h>
+#include <ac/socket.h>
+
+#include "slap.h"
+#include "back-ldbm.h"
+
+int
+ldbm_back_referrals(
+ Backend *be,
+ Connection *conn,
+ Operation *op,
+ struct berval *dn,
+ struct berval *ndn,
+ const char **text )
+{
+ struct ldbminfo *li = (struct ldbminfo *) be->be_private;
+ int rc = LDAP_SUCCESS;
+ Entry *e, *matched;
+
+ if( op->o_tag == LDAP_REQ_SEARCH ) {
+ /* let search take care of itself */
+ return rc;
+ }
+
+ if( get_manageDSAit( op ) ) {
+ /* let op take care of DSA management */
+ return rc;
+ }
+
+ /* grab giant lock for reading */
+ ldap_pvt_thread_rdwr_rlock(&li->li_giant_rwlock);
+
+ /* get entry with reader lock */
+ e = dn2entry_r( be, ndn, &matched );
+ if ( e == NULL ) {
+ char *matched_dn = NULL;
+ BerVarray refs = NULL;
+
+ if ( matched != NULL ) {
+ matched_dn = ch_strdup( matched->e_dn );
+
+#ifdef NEW_LOGGING
+ LDAP_LOG( BACK_LDBM, DETAIL1,
+ "ldbm_back_referrals: op=%ld target=\"%s\" matched=\"%s\"\n",
+ op->o_tag, dn->bv_val, matched_dn );
+#else
+ Debug( LDAP_DEBUG_TRACE,
+ "ldbm_referrals: op=%ld target=\"%s\" matched=\"%s\"\n",
+ op->o_tag, dn->bv_val, matched_dn );
+#endif
+
+ if( is_entry_referral( matched ) ) {
+ rc = LDAP_OTHER;
+ refs = get_entry_referrals( be, conn, op, matched );
+ }
+
+ cache_return_entry_r( &li->li_cache, matched );
+
+ } else if ( default_referral != NULL ) {
+ rc = LDAP_OTHER;
+ refs = referral_rewrite( default_referral,
+ NULL, dn, LDAP_SCOPE_DEFAULT );
+ }
+
+ ldap_pvt_thread_rdwr_runlock(&li->li_giant_rwlock);
+
+ if( refs != NULL ) {
+ /* send referrals */
+ send_ldap_result( conn, op, rc = LDAP_REFERRAL,
+ matched_dn, NULL, refs, NULL );
+ ber_bvarray_free( refs );
+
+ } else if ( rc != LDAP_SUCCESS ) {
+ send_ldap_result( conn, op, rc, matched_dn,
+ matched_dn ? "bad referral object" : "bad default referral",
+ NULL, NULL );
+ }
+
+ if ( matched_dn ) free( matched_dn );
+ return rc;
+ }
+
+ if ( is_entry_referral( e ) ) {
+ /* entry is a referral */
+ BerVarray refs = get_entry_referrals( be, conn, op, e );
+ BerVarray rrefs = referral_rewrite(
+ refs, &e->e_name, dn, LDAP_SCOPE_DEFAULT );
+
+#ifdef NEW_LOGGING
+ LDAP_LOG( BACK_LDBM, DETAIL1,
+ "ldbm_referrals: op=%ld target=\"%s\" matched=\"%s\"\n",
+ op->o_tag, dn->bv_val, e->e_dn );
+#else
+ Debug( LDAP_DEBUG_TRACE,
+ "ldbm_referrals: op=%ld target=\"%s\" matched=\"%s\"\n",
+ op->o_tag, dn->bv_val, e->e_dn );
+#endif
+
+ if( rrefs != NULL ) {
+ send_ldap_result( conn, op, rc = LDAP_REFERRAL,
+ e->e_dn, NULL, rrefs, NULL );
+
+ ber_bvarray_free( rrefs );
+
+ } else {
+ send_ldap_result( conn, op, rc = LDAP_OTHER, e->e_dn,
+ "bad referral object", NULL, NULL );
+ }
+
+ if( refs != NULL ) ber_bvarray_free( refs );
+ }
+
+ cache_return_entry_r( &li->li_cache, e );
+ ldap_pvt_thread_rdwr_runlock(&li->li_giant_rwlock);
+
+ return rc;
+}
int isroot = 0;
#ifdef NEW_LOGGING
- LDAP_LOG(( "backend", LDAP_LEVEL_ENTRY,
- "ldbm_back_search: enter\n" ));
+ LDAP_LOG( BACK_LDBM, ENTRY, "ldbm_back_search: enter\n", 0, 0, 0 );
#else
Debug(LDAP_DEBUG_TRACE, "=> ldbm_back_search\n", 0, 0, 0);
#endif
ldap_pvt_thread_rdwr_runlock(&li->li_giant_rwlock);
#ifdef NEW_LOGGING
- LDAP_LOG(( "backend", LDAP_LEVEL_INFO,
+ LDAP_LOG( BACK_LDBM, INFO,
"ldbm_search: entry (%s) is a referral.\n",
- e->e_dn ));
+ e->e_dn, 0, 0 );
#else
Debug( LDAP_DEBUG_TRACE,
"ldbm_search: entry is referral\n",
if ( candidates == NULL ) {
/* no candidates */
#ifdef NEW_LOGGING
- LDAP_LOG(( "backend", LDAP_LEVEL_INFO,
- "ldbm_search: no candidates\n" ));
+ LDAP_LOG( BACK_LDBM, INFO,
+ "ldbm_search: no candidates\n" , 0, 0, 0);
#else
Debug( LDAP_DEBUG_TRACE, "ldbm_search: no candidates\n",
0, 0, 0 );
if ( e == NULL ) {
#ifdef NEW_LOGGING
- LDAP_LOG(( "backend", LDAP_LEVEL_INFO,
- "ldbm_search: candidate %ld not found.\n", id ));
+ LDAP_LOG( BACK_LDBM, INFO,
+ "ldbm_search: candidate %ld not found.\n", id, 0, 0 );
#else
Debug( LDAP_DEBUG_TRACE,
"ldbm_search: candidate %ld not found\n",
} else if ( dnIsSuffix( &e->e_nname, &realbase ) ) {
/* alias is within scope */
#ifdef NEW_LOGGING
- LDAP_LOG(( "backend", LDAP_LEVEL_DETAIL1,
- "ldbm_search: alias \"%s\" in subtree\n", e->e_dn ));
+ LDAP_LOG( BACK_LDBM, DETAIL1,
+ "ldbm_search: alias \"%s\" in subtree\n", e->e_dn, 0, 0 );
#else
Debug( LDAP_DEBUG_TRACE,
"ldbm_search: alias \"%s\" in subtree\n",
} else {
#ifdef NEW_LOGGING
- LDAP_LOG(( "backend", LDAP_LEVEL_DETAIL2,
+ LDAP_LOG( BACK_LDBM, DETAIL2,
"ldbm_search: candidate referral %ld scope not okay\n",
- id ));
+ id, 0, 0 );
#else
Debug( LDAP_DEBUG_TRACE,
"ldbm_search: candidate referral %ld scope not okay\n",
}
} else {
#ifdef NEW_LOGGING
- LDAP_LOG(( "backend", LDAP_LEVEL_DETAIL2,
- "ldbm_search: candidate entry %ld scope not okay\n", id ));
+ LDAP_LOG( BACK_LDBM, DETAIL2,
+ "ldbm_search: candidate entry %ld scope not okay\n",
+ id, 0, 0 );
#else
Debug( LDAP_DEBUG_TRACE,
"ldbm_search: candidate entry %ld scope not okay\n",
} else {
#ifdef NEW_LOGGING
- LDAP_LOG(( "backend", LDAP_LEVEL_DETAIL2,
- "ldbm_search: candidate entry %ld does not match filter\n", id ));
+ LDAP_LOG( BACK_LDBM, DETAIL2,
+ "ldbm_search: candidate entry %ld does not match filter\n",
+ id, 0, 0 );
#else
Debug( LDAP_DEBUG_TRACE,
"ldbm_search: candidate entry %ld does not match filter\n",
ID_BLOCK *idl;
#ifdef NEW_LOGGING
- LDAP_LOG(( "backend", LDAP_LEVEL_ENTRY,
- "base_candidate: base (%s)\n", e->e_dn ));
+ LDAP_LOG( BACK_LDBM, ENTRY, "base_candidate: base (%s)\n", e->e_dn, 0, 0 );
#else
Debug(LDAP_DEBUG_TRACE, "base_candidates: base: \"%s\"\n",
e->e_dn, 0, 0);
struct berval bv_alias = { sizeof("ALIAS")-1, "ALIAS" };
#ifdef NEW_LOGGING
- LDAP_LOG(( "backend", LDAP_LEVEL_DETAIL1,
+ LDAP_LOG( BACK_LDBM, DETAIL1,
"search_candidates: base (%s) scope %d deref %d\n",
- e->e_ndn, scope, deref ));
+ e->e_ndn, scope, deref );
#else
Debug(LDAP_DEBUG_TRACE,
"search_candidates: base=\"%s\" s=%d d=%d\n",
--- /dev/null
+/* tools.c - tools for slap tools */
+/* $OpenLDAP$ */
+/*
+ * Copyright 1998-2002 The OpenLDAP Foundation, All Rights Reserved.
+ * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
+ */
+
+#include "portable.h"
+
+#include <stdio.h>
+
+#include <ac/string.h>
+#include <ac/socket.h>
+
+#include "slap.h"
+#include "back-ldbm.h"
+
+static LDBMCursor *cursorp = NULL;
+static DBCache *id2entry = NULL;
+
+int ldbm_tool_entry_open(
+ BackendDB *be, int mode )
+{
+ struct ldbminfo *li = (struct ldbminfo *) be->be_private;
+ int flags;
+
+ assert( slapMode & SLAP_TOOL_MODE );
+ assert( id2entry == NULL );
+
+ switch( mode ) {
+ case 1:
+ flags = LDBM_WRCREAT;
+ break;
+ case 2:
+#ifdef TRUNCATE_MODE
+ flags = LDBM_NEWDB;
+#else
+ flags = LDBM_WRCREAT;
+#endif
+ break;
+ default:
+ flags = LDBM_READER;
+ }
+
+ li->li_dbwritesync = 0;
+
+ if ( (id2entry = ldbm_cache_open( be, "id2entry", LDBM_SUFFIX, flags ))
+ == NULL ) {
+#ifdef NEW_LOGGING
+ LDAP_LOG( BACK_LDBM, CRIT,
+ "Could not open/create id2entry%s\n", LDBM_SUFFIX, 0, 0 );
+#else
+ Debug( LDAP_DEBUG_ANY, "Could not open/create id2entry" LDBM_SUFFIX "\n",
+ 0, 0, 0 );
+#endif
+
+ return( -1 );
+ }
+
+ return 0;
+}
+
+int ldbm_tool_entry_close(
+ BackendDB *be )
+{
+ struct ldbminfo *li = (struct ldbminfo *) be->be_private;
+
+ assert( slapMode & SLAP_TOOL_MODE );
+ assert( id2entry != NULL );
+
+ ldbm_cache_close( be, id2entry );
+ li->li_dbwritesync = 1;
+ id2entry = NULL;
+
+ return 0;
+}
+
+ID ldbm_tool_entry_first(
+ BackendDB *be )
+{
+ Datum key;
+ ID id;
+
+ assert( slapMode & SLAP_TOOL_MODE );
+ assert( id2entry != NULL );
+
+ key = ldbm_firstkey( id2entry->dbc_db, &cursorp );
+
+ if( key.dptr == NULL ) {
+ return NOID;
+ }
+
+ AC_MEMCPY( &id, key.dptr, key.dsize );
+#ifndef WORDS_BIGENDIAN
+ id = ntohl( id );
+#endif
+
+ ldbm_datum_free( id2entry->dbc_db, key );
+
+ return id;
+}
+
+ID ldbm_tool_entry_next(
+ BackendDB *be )
+{
+ Datum key;
+ ID id;
+
+ assert( slapMode & SLAP_TOOL_MODE );
+ assert( id2entry != NULL );
+
+ /* allow for NEXTID */
+ ldbm_datum_init( key );
+
+ key = ldbm_nextkey( id2entry->dbc_db, key, cursorp );
+
+ if( key.dptr == NULL ) {
+ return NOID;
+ }
+
+ AC_MEMCPY( &id, key.dptr, key.dsize );
+#ifndef WORDS_BIGENDIAN
+ id = ntohl( id );
+#endif
+
+ ldbm_datum_free( id2entry->dbc_db, key );
+
+ return id;
+}
+
+Entry* ldbm_tool_entry_get( BackendDB *be, ID id )
+{
+ Entry *e;
+ Datum key, data;
+#ifndef WORDS_BIGENDIAN
+ ID id2;
+#endif
+ assert( slapMode & SLAP_TOOL_MODE );
+ assert( id2entry != NULL );
+
+ ldbm_datum_init( key );
+
+#ifndef WORDS_BIGENDIAN
+ id2 = htonl( id );
+ key.dptr = (char *) &id2;
+#else
+ key.dptr = (char *) &id;
+#endif
+ key.dsize = sizeof(ID);
+
+ data = ldbm_cache_fetch( id2entry, key );
+
+ if ( data.dptr == NULL ) {
+ return NULL;
+ }
+
+ e = str2entry( data.dptr );
+ ldbm_datum_free( id2entry->dbc_db, data );
+
+ if( e != NULL ) {
+ e->e_id = id;
+ }
+
+ return e;
+}
+
+ID ldbm_tool_entry_put(
+ BackendDB *be,
+ Entry *e,
+ struct berval *text )
+{
+ struct ldbminfo *li = (struct ldbminfo *) be->be_private;
+ Datum key, data;
+ int rc, len;
+ ID id;
+
+ assert( slapMode & SLAP_TOOL_MODE );
+ assert( id2entry != NULL );
+
+ assert( text );
+ assert( text->bv_val );
+ assert( text->bv_val[0] == '\0' );
+
+ if ( next_id_get( be, &id ) || id == NOID ) {
+ strncpy( text->bv_val, "unable to get nextid", text->bv_len );
+ return NOID;
+ }
+
+ e->e_id = li->li_nextid++;
+
+#ifdef NEW_LOGGING
+ LDAP_LOG( BACK_LDBM, ENTRY,
+ "ldbm_tool_entry_put: (%s)%ld\n", e->e_dn, e->e_id ,0 );
+#else
+ Debug( LDAP_DEBUG_TRACE, "=> ldbm_tool_entry_put( %ld, \"%s\" )\n",
+ e->e_id, e->e_dn, 0 );
+#endif
+
+ if ( dn2id( be, &e->e_nname, &id ) ) {
+ /* something bad happened to ldbm cache */
+ strncpy( text->bv_val, "ldbm cache corrupted", text->bv_len );
+ return NOID;
+ }
+
+ if( id != NOID ) {
+#ifdef NEW_LOGGING
+ LDAP_LOG( BACK_LDBM, ENTRY,
+ "ldbm_tool_entry_put: \"%s\" already exists (id=%ld)\n",
+ e->e_dn, id, 0 );
+#else
+ Debug( LDAP_DEBUG_TRACE,
+ "<= ldbm_tool_entry_put: \"%s\" already exists (id=%ld)\n",
+ e->e_ndn, id, 0 );
+#endif
+ strncpy( text->bv_val, "already exists", text->bv_len );
+ return NOID;
+ }
+
+ rc = index_entry_add( be, e, e->e_attrs );
+ if( rc != 0 ) {
+ strncpy( text->bv_val, "index add failed", text->bv_len );
+ return NOID;
+ }
+
+ rc = dn2id_add( be, &e->e_nname, e->e_id );
+ if( rc != 0 ) {
+ strncpy( text->bv_val, "dn2id add failed", text->bv_len );
+ return NOID;
+ }
+
+ ldbm_datum_init( key );
+ ldbm_datum_init( data );
+
+#ifndef WORDS_BIGENDIAN
+ id = htonl( e->e_id );
+ key.dptr = (char *) &id;
+#else
+ key.dptr = (char *) &e->e_id;
+#endif
+ key.dsize = sizeof(ID);
+
+ data.dptr = entry2str( e, &len );
+ data.dsize = len + 1;
+
+ /* store it */
+ rc = ldbm_cache_store( id2entry, key, data, LDBM_REPLACE );
+
+ if( rc != 0 ) {
+ (void) dn2id_delete( be, &e->e_nname, e->e_id );
+ strncpy( text->bv_val, "cache store failed", text->bv_len );
+ return NOID;
+ }
+
+ return e->e_id;
+}
+
+int ldbm_tool_entry_reindex(
+ BackendDB *be,
+ ID id )
+{
+ int rc;
+ Entry *e;
+
+#ifdef NEW_LOGGING
+ LDAP_LOG( BACK_LDBM, ENTRY, "ldbm_tool_entry_reindex: ID=%ld\n",
+ (long)id, 0, 0 );
+#else
+ Debug( LDAP_DEBUG_ARGS, "=> ldbm_tool_entry_reindex( %ld )\n",
+ (long) id, 0, 0 );
+#endif
+
+
+ e = ldbm_tool_entry_get( be, id );
+
+ if( e == NULL ) {
+#ifdef NEW_LOGGING
+ LDAP_LOG( BACK_LDBM, INFO,
+ "ldbm_tool_entry_reindex: could not locate id %ld\n",
+ (long)id, 0, 0 );
+#else
+ Debug( LDAP_DEBUG_ANY,
+ "ldbm_tool_entry_reindex:: could not locate id=%ld\n",
+ (long) id, 0, 0 );
+#endif
+
+ return -1;
+ }
+
+ /*
+ * just (re)add them for now
+ * assume that some other routine (not yet implemented)
+ * will zap index databases
+ *
+ */
+
+#ifdef NEW_LOGGING
+ LDAP_LOG( BACK_LDBM, ENTRY,
+ "ldbm_tool_entry_reindex: (%s) %ld\n", e->e_dn, id, 0 );
+#else
+ Debug( LDAP_DEBUG_TRACE, "=> ldbm_tool_entry_reindex( %ld, \"%s\" )\n",
+ id, e->e_dn, 0 );
+#endif
+
+ dn2id_add( be, &e->e_nname, e->e_id );
+ rc = index_entry_add( be, e, e->e_attrs );
+
+ entry_free( e );
+
+ return rc;
+}
+
+int ldbm_tool_sync( BackendDB *be )
+{
+ struct ldbminfo *li = (struct ldbminfo *) be->be_private;
+
+ assert( slapMode & SLAP_TOOL_MODE );
+
+ if ( li->li_nextid != NOID ) {
+ if ( next_id_write( be, li->li_nextid ) ) {
+ return( -1 );
+ }
+ }
+
+ return 0;
+}
--- /dev/null
+/*
+ * Copyright 1998-2002 The OpenLDAP Foundation, All Rights Reserved.
+ * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
+ *
+ * Copyright 2001, Pierangelo Masarati, All rights reserved. <ando@sys-net.it>
+ *
+ * This work has been developed to fulfill the requirements
+ * of SysNet s.n.c. <http:www.sys-net.it> and it has been donated
+ * to the OpenLDAP Foundation in the hope that it may be useful
+ * to the Open Source community, but WITHOUT ANY WARRANTY.
+ *
+ * Permission is granted to anyone to use this software for any purpose
+ * on any computer system, and to alter it and redistribute it, subject
+ * to the following restrictions:
+ *
+ * 1. The author and SysNet s.n.c. are not responsible for the consequences
+ * of use of this software, no matter how awful, even if they arise from
+ * flaws in it.
+ *
+ * 2. The origin of this software must not be misrepresented, either by
+ * explicit claim or by omission. Since few users ever read sources,
+ * credits should appear in the documentation.
+ *
+ * 3. Altered versions must be plainly marked as such, and must not be
+ * misrepresented as being the original software. Since few users
+ * ever read sources, credits should appear in the documentation.
+ * SysNet s.n.c. cannot be responsible for the consequences of the
+ * alterations.
+ *
+ * 4. This notice may not be removed or altered.
+ *
+ *
+ * This software is based on the backend back-ldap, implemented
+ * by Howard Chu <hyc@highlandsun.com>, and modified by Mark Valence
+ * <kurash@sassafras.com>, Pierangelo Masarati <ando@sys-net.it> and other
+ * contributors. The contribution of the original software to the present
+ * implementation is acknowledged in this copyright statement.
+ *
+ * A special acknowledgement goes to Howard for the overall architecture
+ * (and for borrowing large pieces of code), and to Mark, who implemented
+ * from scratch the attribute/objectclass mapping.
+ *
+ * The original copyright statement follows.
+ *
+ * Copyright 1999, Howard Chu, All rights reserved. <hyc@highlandsun.com>
+ *
+ * Permission is granted to anyone to use this software for any purpose
+ * on any computer system, and to alter it and redistribute it, subject
+ * to the following restrictions:
+ *
+ * 1. The author is not responsible for the consequences of use of this
+ * software, no matter how awful, even if they arise from flaws in it.
+ *
+ * 2. The origin of this software must not be misrepresented, either by
+ * explicit claim or by omission. Since few users ever read sources,
+ * credits should appear in the documentation.
+ *
+ * 3. Altered versions must be plainly marked as such, and must not be
+ * misrepresented as being the original software. Since few users
+ * ever read sources, credits should appear in the
+ * documentation.
+ *
+ * 4. This notice may not be removed or altered.
+ *
+ */
+
+
+#include "portable.h"
+
+#include <stdio.h>
+
+#include <ac/string.h>
+#include <ac/socket.h>
+
+#include "slap.h"
+#include "../back-ldap/back-ldap.h"
+#include "back-meta.h"
+
+int
+meta_back_add(
+ Backend *be,
+ Connection *conn,
+ Operation *op,
+ Entry *e
+)
+{
+ struct metainfo *li = ( struct metainfo * )be->be_private;
+ struct metaconn *lc;
+ int i, candidate = -1;
+ Attribute *a;
+ LDAPMod **attrs;
+ struct berval mdn = { 0, NULL }, mapped;
+
+#ifdef NEW_LOGGING
+ LDAP_LOG( BACK_META, ENTRY, "meta_back_add: %s\n", e->e_dn, 0, 0 );
+#else /* !NEW_LOGGING */
+ Debug(LDAP_DEBUG_ARGS, "==> meta_back_add: %s\n%s%s", e->e_dn, "", "");
+#endif /* !NEW_LOGGING */
+
+ /*
+ * get the current connection
+ */
+ lc = meta_back_getconn( li, conn, op, META_OP_REQUIRE_SINGLE,
+ &e->e_nname, &candidate );
+ if ( !lc || !meta_back_dobind( lc, op ) || !meta_back_is_valid( lc, candidate ) ) {
+ send_ldap_result( conn, op, LDAP_OPERATIONS_ERROR,
+ NULL, NULL, NULL, NULL );
+ return -1;
+ }
+
+ /*
+ * Rewrite the add dn, if needed
+ */
+ switch ( rewrite_session( li->targets[ candidate ]->rwinfo,
+ "addDn", e->e_dn, conn, &mdn.bv_val )) {
+ case REWRITE_REGEXEC_OK:
+ if ( mdn.bv_val != NULL && mdn.bv_val[ 0 ] != '\0' ) {
+ mdn.bv_len = strlen( mdn.bv_val );
+ } else {
+ mdn = e->e_name;
+ }
+
+#ifdef NEW_LOGGING
+ LDAP_LOG( BACK_META, DETAIL1,
+ "[rw] addDn: \"%s\" -> \"%s\"\n", e->e_dn, mdn.bv_val, 0 );
+#else /* !NEW_LOGGING */
+ Debug( LDAP_DEBUG_ARGS, "rw> addDn: \"%s\" -> \"%s\"\n%s",
+ e->e_dn, mdn.bv_val, "" );
+#endif /* !NEW_LOGGING */
+ break;
+
+ case REWRITE_REGEXEC_UNWILLING:
+ send_ldap_result( conn, op, LDAP_UNWILLING_TO_PERFORM,
+ NULL, NULL, NULL, NULL );
+ return -1;
+
+ case REWRITE_REGEXEC_ERR:
+ send_ldap_result( conn, op, LDAP_OPERATIONS_ERROR,
+ NULL, NULL, NULL, NULL );
+ return -1;
+ }
+
+ /* Count number of attributes in entry */
+ for ( i = 1, a = e->e_attrs; a; i++, a = a->a_next );
+
+ /* Create array of LDAPMods for ldap_add() */
+ attrs = ch_malloc( sizeof( LDAPMod * )*i );
+
+ for ( i = 0, a = e->e_attrs; a; a = a->a_next ) {
+ int j;
+ /*
+ * lastmod should always be <off>, so that
+ * creation/modification operational attrs
+ * of the target directory are used, if available
+ */
+#if 0
+ if ( !strcasecmp( a->a_desc->ad_cname.bv_val,
+ slap_schema.si_ad_creatorsName->ad_cname.bv_val )
+ || !strcasecmp( a->a_desc->ad_cname.bv_val,
+ slap_schema.si_ad_createTimestamp->ad_cname.bv_val )
+ || !strcasecmp( a->a_desc->ad_cname.bv_val,
+ slap_schema.si_ad_modifiersName->ad_cname.bv_val )
+ || !strcasecmp( a->a_desc->ad_cname.bv_val,
+ slap_schema.si_ad_modifyTimestamp->ad_cname.bv_val )
+ ) {
+ continue;
+ }
+#endif
+
+ ldap_back_map( &li->targets[ candidate ]->at_map,
+ &a->a_desc->ad_cname, &mapped, 0);
+ if ( mapped.bv_val == NULL ) {
+ continue;
+ }
+
+ attrs[ i ] = ch_malloc( sizeof( LDAPMod ) );
+ if ( attrs[ i ] == NULL ) {
+ continue;
+ }
+ attrs[ i ]->mod_op = LDAP_MOD_BVALUES;
+ attrs[ i ]->mod_type = mapped.bv_val;
+
+ /*
+ * FIXME: dn-valued attrs should be rewritten
+ * to allow their use in ACLs at the back-ldap
+ * level.
+ */
+ if ( strcmp( a->a_desc->ad_type->sat_syntax->ssyn_oid,
+ SLAPD_DN_SYNTAX ) == 0 ) {
+ ldap_dnattr_rewrite( li->targets[ candidate ]->rwinfo,
+ a->a_vals, conn );
+ }
+
+ for (j=0; a->a_vals[ j ].bv_val; j++);
+ attrs[ i ]->mod_vals.modv_bvals = ch_malloc((j+1)*sizeof(struct berval *));
+ for (j=0; a->a_vals[ j ].bv_val; j++)
+ attrs[ i ]->mod_vals.modv_bvals[ j ] = &a->a_vals[ j ];
+ attrs[ i ]->mod_vals.modv_bvals[ j ] = NULL;
+ i++;
+ }
+ attrs[ i ] = NULL;
+
+ ldap_add_s( lc->conns[ candidate ]->ld, mdn.bv_val, attrs );
+ for ( --i; i >= 0; --i ) {
+ free( attrs[ i ]->mod_vals.modv_bvals );
+ free( attrs[ i ] );
+ }
+ free( attrs );
+ if ( mdn.bv_val != e->e_dn ) {
+ free( mdn.bv_val );
+ }
+ return meta_back_op_result( lc, op );
+}
+
int realmethod = method;
#ifdef NEW_LOGGING
- LDAP_LOG(( "backend", LDAP_LEVEL_ENTRY,
- "meta_back_bind: dn: %s.\n", dn->bv_val ));
+ LDAP_LOG( BACK_META, ENTRY,
+ "meta_back_bind: dn: %s.\n", dn->bv_val, 0, 0 );
#else /* !NEW_LOGGING */
Debug( LDAP_DEBUG_ARGS, "meta_back_bind: dn: %s.\n%s%s", dn->bv_val, "", "" );
#endif /* !NEW_LOGGING */
lc = meta_back_getconn( li, conn, op, op_type, ndn, NULL );
if ( !lc ) {
#ifdef NEW_LOGGING
- LDAP_LOG(( "backend", LDAP_LEVEL_NOTICE,
- "meta_back_bind: no target for dn %s.\n",
- dn->bv_val ));
+ LDAP_LOG( BACK_META, NOTICE,
+ "meta_back_bind: no target for dn %s.\n", dn->bv_val, 0, 0 );
#else /* !NEW_LOGGING */
Debug( LDAP_DEBUG_ANY,
"meta_back_bind: no target for dn %s.\n%s%s",
* ONE CANDIDATE ONLY!
*/
#ifdef NEW_LOGGING
- LDAP_LOG(( "backend", LDAP_LEVEL_WARNING,
+ LDAP_LOG( BACK_META, WARNING,
"==>meta_back_bind: more than one"
" candidate is attempting to bind"
- " ...\n" ));
+ " ...\n" , 0, 0, 0 );
#else /* !NEW_LOGGING */
Debug( LDAP_DEBUG_ANY,
"==>meta_back_bind: more than one"
mdn = *dn;
}
#ifdef NEW_LOGGING
- LDAP_LOG(( "backend", LDAP_LEVEL_DETAIL1,
- "[rw] bindDn: \"%s\" -> \"%s\"\n", dn->bv_val, mdn.bv_val ));
+ LDAP_LOG( BACK_META, DETAIL1,
+ "[rw] bindDn: \"%s\" -> \"%s\"\n", dn->bv_val, mdn.bv_val, 0 );
#else /* !NEW_LOGGING */
Debug( LDAP_DEBUG_ARGS,
"rw> bindDn: \"%s\" -> \"%s\"\n%s",
if ( rc != LDAP_SUCCESS ) {
#ifdef NEW_LOGGING
- LDAP_LOG(( "backend", LDAP_LEVEL_WARNING,
+ LDAP_LOG( BACK_META, WARNING,
"meta_back_dobind: (anonymous)"
" bind as \"%s\" failed"
" with error \"%s\"\n",
lsc[ 0 ]->bound_dn.bv_val,
- ldap_err2string( rc ) ));
+ ldap_err2string( rc ), 0 );
#else /* !NEW_LOGGING */
Debug( LDAP_DEBUG_ANY,
"==>meta_back_dobind: (anonymous)"
err = ldap_back_map_result( err );
#ifdef NEW_LOGGING
- LDAP_LOG(( "backend", LDAP_LEVEL_RESULTS,
+ LDAP_LOG( BACK_META, RESULTS,
"meta_back_op_result: target"
" <%d> sending msg \"%s\""
" (matched \"%s\")\n",
i, ( msg ? msg : "" ),
- ( match ? match : "" ) ));
+ ( match ? match : "" ) );
#else /* !NEW_LOGGING */
Debug(LDAP_DEBUG_ANY,
"==> meta_back_op_result: target"
--- /dev/null
+/*
+ * Copyright 1998-2002 The OpenLDAP Foundation, All Rights Reserved.
+ * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
+ *
+ * Copyright 2001, Pierangelo Masarati, All rights reserved. <ando@sys-net.it>
+ *
+ * This work has been developed to fulfill the requirements
+ * of SysNet s.n.c. <http:www.sys-net.it> and it has been donated
+ * to the OpenLDAP Foundation in the hope that it may be useful
+ * to the Open Source community, but WITHOUT ANY WARRANTY.
+ *
+ * Permission is granted to anyone to use this software for any purpose
+ * on any computer system, and to alter it and redistribute it, subject
+ * to the following restrictions:
+ *
+ * 1. The author and SysNet s.n.c. are not responsible for the consequences
+ * of use of this software, no matter how awful, even if they arise from
+ * flaws in it.
+ *
+ * 2. The origin of this software must not be misrepresented, either by
+ * explicit claim or by omission. Since few users ever read sources,
+ * credits should appear in the documentation.
+ *
+ * 3. Altered versions must be plainly marked as such, and must not be
+ * misrepresented as being the original software. Since few users
+ * ever read sources, credits should appear in the documentation.
+ * SysNet s.n.c. cannot be responsible for the consequences of the
+ * alterations.
+ *
+ * 4. This notice may not be removed or altered.
+ *
+ *
+ * This software is based on the backend back-ldap, implemented
+ * by Howard Chu <hyc@highlandsun.com>, and modified by Mark Valence
+ * <kurash@sassafras.com>, Pierangelo Masarati <ando@sys-net.it> and other
+ * contributors. The contribution of the original software to the present
+ * implementation is acknowledged in this copyright statement.
+ *
+ * A special acknowledgement goes to Howard for the overall architecture
+ * (and for borrowing large pieces of code), and to Mark, who implemented
+ * from scratch the attribute/objectclass mapping.
+ *
+ * The original copyright statement follows.
+ *
+ * Copyright 1999, Howard Chu, All rights reserved. <hyc@highlandsun.com>
+ *
+ * Permission is granted to anyone to use this software for any purpose
+ * on any computer system, and to alter it and redistribute it, subject
+ * to the following restrictions:
+ *
+ * 1. The author is not responsible for the consequences of use of this
+ * software, no matter how awful, even if they arise from flaws in it.
+ *
+ * 2. The origin of this software must not be misrepresented, either by
+ * explicit claim or by omission. Since few users ever read sources,
+ * credits should appear in the documentation.
+ *
+ * 3. Altered versions must be plainly marked as such, and must not be
+ * misrepresented as being the original software. Since few users
+ * ever read sources, credits should appear in the
+ * documentation.
+ *
+ * 4. This notice may not be removed or altered.
+ *
+ */
+
+#include "portable.h"
+
+#include <stdio.h>
+
+#include <ac/string.h>
+#include <ac/socket.h>
+
+#include "slap.h"
+#include "../back-ldap/back-ldap.h"
+#include "back-meta.h"
+
+int
+meta_back_compare(
+ Backend *be,
+ Connection *conn,
+ Operation *op,
+ struct berval *dn,
+ struct berval *ndn,
+ AttributeAssertion *ava
+)
+{
+ struct metainfo *li = ( struct metainfo * )be->be_private;
+ struct metaconn *lc;
+ struct metasingleconn **lsc;
+ char *match = NULL, *err = NULL, *mmatch = NULL;
+ int candidates = 0, last = 0, i, count, rc;
+ int cres = LDAP_SUCCESS, rres = LDAP_SUCCESS;
+ int *msgid;
+
+ lc = meta_back_getconn( li, conn, op, META_OP_ALLOW_MULTIPLE,
+ ndn, NULL );
+ if ( !lc || !meta_back_dobind( lc, op ) ) {
+ return -1;
+ }
+
+ msgid = ch_calloc( sizeof( int ), li->ntargets );
+ if ( msgid == NULL ) {
+ return -1;
+ }
+
+ /*
+ * start an asynchronous compare for each candidate target
+ */
+ for ( i = 0, lsc = lc->conns; lsc[ 0 ] != NULL; ++i, ++lsc ) {
+ char *mdn = NULL;
+ struct berval mapped_attr = ava->aa_desc->ad_cname;
+ struct berval mapped_value = ava->aa_value;
+
+ if ( lsc[ 0 ]->candidate != META_CANDIDATE ) {
+ continue;
+ }
+
+ /*
+ * Rewrite the compare dn, if needed
+ */
+ switch ( rewrite_session( li->targets[ i ]->rwinfo,
+ "compareDn",
+ dn->bv_val, conn, &mdn ) ) {
+ case REWRITE_REGEXEC_OK:
+ if ( mdn == NULL ) {
+ mdn = ( char * )dn->bv_val;
+ }
+#ifdef NEW_LOGGING
+ LDAP_LOG( BACK_META, DETAIL1,
+ "[rw] compareDn: \"%s\" -> \"%s\"\n", dn->bv_val, mdn, 0 );
+#else /* !NEW_LOGGING */
+ Debug( LDAP_DEBUG_ARGS,
+ "rw> compareDn: \"%s\" -> \"%s\"\n%s",
+ dn->bv_val, 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;
+ }
+
+ /*
+ * if attr is objectClass, try to remap the value
+ */
+ if ( ava->aa_desc->ad_type->sat_oid
+ == slap_schema.si_ad_objectClass->ad_type->sat_oid ) {
+ ldap_back_map( &li->targets[ i ]->oc_map,
+ &ava->aa_value, &mapped_value, 0 );
+
+ if ( mapped_value.bv_val == NULL ) {
+ lsc[ 0 ]->candidate = META_NOT_CANDIDATE;
+ continue;
+ }
+ /*
+ * else try to remap the attribute
+ */
+ } else {
+ ldap_back_map( &li->targets[ i ]->at_map,
+ &ava->aa_desc->ad_cname, &mapped_attr, 0 );
+ if ( mapped_attr.bv_val == NULL ) {
+ lsc[ 0 ]->candidate = META_NOT_CANDIDATE;
+ continue;
+ }
+ }
+
+ /*
+ * the compare op is spawned across the targets and the first
+ * that returns determines the result; a constraint on unicity
+ * of the result ought to be enforced
+ */
+ msgid[ i ] = ldap_compare( lc->conns[ i ]->ld, mdn,
+ mapped_attr.bv_val, mapped_value.bv_val );
+ if ( msgid[ i ] == -1 ) {
+ lsc[ 0 ]->candidate = META_NOT_CANDIDATE;
+ continue;
+ }
+
+ if ( mdn != dn->bv_val ) {
+ free( mdn );
+ }
+ if ( mapped_attr.bv_val != ava->aa_desc->ad_cname.bv_val ) {
+ free( mapped_attr.bv_val );
+ }
+ if ( mapped_value.bv_val != ava->aa_value.bv_val ) {
+ free( mapped_value.bv_val );
+ }
+
+ ++candidates;
+ }
+
+ /*
+ * wait for replies
+ */
+ for ( rc = 0, count = 0; candidates > 0; ) {
+
+ /*
+ * FIXME: should we check for abandon?
+ */
+ for ( i = 0, lsc = lc->conns; lsc[ 0 ] != NULL; lsc++, i++ ) {
+ int lrc;
+ LDAPMessage *res = NULL;
+
+ if ( lsc[ 0 ]->candidate != META_CANDIDATE ) {
+ continue;
+ }
+
+ lrc = ldap_result( lsc[ 0 ]->ld, msgid[ i ],
+ 0, NULL, &res );
+
+ if ( lrc == 0 ) {
+ /*
+ * FIXME: should we yield?
+ */
+ if ( res ) {
+ ldap_msgfree( res );
+ }
+ continue;
+ } else if ( lrc == LDAP_RES_COMPARE ) {
+ if ( count > 0 ) {
+ rres = LDAP_OPERATIONS_ERROR;
+ rc = -1;
+ goto finish;
+ }
+
+ cres = ldap_result2error( lsc[ 0 ]->ld,
+ res, 1 );
+ switch ( cres ) {
+ case LDAP_COMPARE_TRUE:
+ case LDAP_COMPARE_FALSE:
+
+ /*
+ * true or flase, got it;
+ * sending to cache ...
+ */
+ if ( li->cache.ttl != META_DNCACHE_DISABLED ) {
+ ( void )meta_dncache_update_entry( &li->cache, ndn, i );
+ }
+
+ count++;
+ rc = 0;
+ break;
+
+ default:
+ rres = ldap_back_map_result( cres );
+
+ if ( err != NULL ) {
+ free( err );
+ }
+ ldap_get_option( lsc[ 0 ]->ld,
+ LDAP_OPT_ERROR_STRING, &err );
+
+ if ( match != NULL ) {
+ free( match );
+ }
+ ldap_get_option( lsc[ 0 ]->ld,
+ LDAP_OPT_MATCHED_DN, &match );
+
+ last = i;
+ break;
+ }
+ lsc[ 0 ]->candidate = META_NOT_CANDIDATE;
+ --candidates;
+ } else {
+ lsc[ 0 ]->candidate = META_NOT_CANDIDATE;
+ --candidates;
+ if ( res ) {
+ ldap_msgfree( res );
+ }
+ break;
+ }
+ }
+ }
+
+finish:;
+
+ /*
+ * Rewrite the matched portion of the search base, if required
+ *
+ * FIXME: only the last one gets caught!
+ */
+ if ( count == 1 ) {
+ if ( match != NULL ) {
+ free( match );
+ match = NULL;
+ }
+
+ /*
+ * the result of the compare is assigned to the res code
+ * that will be returned
+ */
+ rres = cres;
+
+ } else if ( match != NULL ) {
+
+ /*
+ * At least one compare failed with matched portion,
+ * and none was successful
+ */
+ switch ( rewrite_session( li->targets[ last ]->rwinfo,
+ "matchedDn", match, conn, &mmatch ) ) {
+ case REWRITE_REGEXEC_OK:
+ if ( mmatch == NULL ) {
+ mmatch = ( char * )match;
+ }
+#ifdef NEW_LOGGING
+ LDAP_LOG( BACK_META, DETAIL1,
+ "[rw] matchedDn: \"%s\" -> \"%s\"\n", match, mmatch, 0 );
+#else /* !NEW_LOGGING */
+ Debug( LDAP_DEBUG_ARGS, "rw> matchedDn:"
+ " \"%s\" -> \"%s\"\n%s",
+ match, mmatch, "" );
+#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 cleanup;
+
+ case REWRITE_REGEXEC_ERR:
+ send_ldap_result( conn, op, LDAP_OPERATIONS_ERROR,
+ NULL, "Operations error",
+ NULL, NULL );
+ rc = -1;
+ goto cleanup;
+ }
+ }
+
+ send_ldap_result( conn, op, rres, mmatch, err, NULL, NULL );
+
+cleanup:;
+ if ( match != NULL ) {
+ if ( mmatch != match ) {
+ free( mmatch );
+ }
+ free( match );
+ }
+
+ if ( msgid ) {
+ free( msgid );
+ }
+
+ return rc;
+}
+
ber_dupbv( &lsc->bound_dn, &conn->c_dn );
}
#ifdef NEW_LOGGING
- LDAP_LOG(( "backend", LDAP_LEVEL_DETAIL1,
- "[rw] bindDn: \"%s\" -> \"%s\"\n",
- conn->c_dn.bv_val, lsc->bound_dn.bv_val ));
+ LDAP_LOG( BACK_META, DETAIL1,
+ "[rw] bindDn: \"%s\" -> \"%s\"\n",
+ conn->c_dn.bv_val, lsc->bound_dn.bv_val, 0 );
#else /* !NEW_LOGGING */
Debug( LDAP_DEBUG_ARGS,
"rw> bindDn: \"%s\" -> \"%s\"\n",
}
#ifdef NEW_LOGGING
- LDAP_LOG(( "backend", LDAP_LEVEL_INFO,
- "meta_back_getconn: got target %d"
- " for ndn=\"%s\" from cache\n",
- i, ndn->bv_val ));
+ LDAP_LOG( BACK_META, INFO,
+ "meta_back_getconn: got target %d for ndn=\"%s\" from cache\n",
+ i, ndn->bv_val, 0 );
#else /* !NEW_LOGGING */
Debug( LDAP_DEBUG_CACHE,
"==>meta_back_getconn: got target %d for ndn=\"%s\" from cache\n%s",
ldap_pvt_thread_mutex_unlock( &li->conn_mutex );
#ifdef NEW_LOGGING
- LDAP_LOG(( "backend", LDAP_LEVEL_INFO,
- "meta_back_getconn: conn %ld inserted\n",
- lc->conn->c_connid ));
+ LDAP_LOG( BACK_META, INFO,
+ "meta_back_getconn: conn %ld inserted\n", lc->conn->c_connid, 0, 0);
#else /* !NEW_LOGGING */
Debug( LDAP_DEBUG_TRACE,
"=>meta_back_getconn: conn %ld inserted\n%s%s",
}
} else {
#ifdef NEW_LOGGING
- LDAP_LOG(( "backend", LDAP_LEVEL_INFO,
- "meta_back_getconn: conn %ld fetched\n",
- lc->conn->c_connid ));
+ LDAP_LOG( BACK_META, INFO,
+ "meta_back_getconn: conn %ld fetched\n", lc->conn->c_connid, 0, 0 );
#else /* !NEW_LOGGING */
Debug( LDAP_DEBUG_TRACE,
"=>meta_back_getconn: conn %ld fetched\n%s%s",
--- /dev/null
+/*
+ * Copyright 1998-2002 The OpenLDAP Foundation, All Rights Reserved.
+ * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
+ *
+ * Copyright 2001, Pierangelo Masarati, All rights reserved. <ando@sys-net.it>
+ *
+ * This work has been developed to fulfill the requirements
+ * of SysNet s.n.c. <http:www.sys-net.it> and it has been donated
+ * to the OpenLDAP Foundation in the hope that it may be useful
+ * to the Open Source community, but WITHOUT ANY WARRANTY.
+ *
+ * Permission is granted to anyone to use this software for any purpose
+ * on any computer system, and to alter it and redistribute it, subject
+ * to the following restrictions:
+ *
+ * 1. The author and SysNet s.n.c. are not responsible for the consequences
+ * of use of this software, no matter how awful, even if they arise from
+ * flaws in it.
+ *
+ * 2. The origin of this software must not be misrepresented, either by
+ * explicit claim or by omission. Since few users ever read sources,
+ * credits should appear in the documentation.
+ *
+ * 3. Altered versions must be plainly marked as such, and must not be
+ * misrepresented as being the original software. Since few users
+ * ever read sources, credits should appear in the documentation.
+ * SysNet s.n.c. cannot be responsible for the consequences of the
+ * alterations.
+ *
+ * 4. This notice may not be removed or altered.
+ *
+ *
+ * This software is based on the backend back-ldap, implemented
+ * by Howard Chu <hyc@highlandsun.com>, and modified by Mark Valence
+ * <kurash@sassafras.com>, Pierangelo Masarati <ando@sys-net.it> and other
+ * contributors. The contribution of the original software to the present
+ * implementation is acknowledged in this copyright statement.
+ *
+ * A special acknowledgement goes to Howard for the overall architecture
+ * (and for borrowing large pieces of code), and to Mark, who implemented
+ * from scratch the attribute/objectclass mapping.
+ *
+ * The original copyright statement follows.
+ *
+ * Copyright 1999, Howard Chu, All rights reserved. <hyc@highlandsun.com>
+ *
+ * Permission is granted to anyone to use this software for any purpose
+ * on any computer system, and to alter it and redistribute it, subject
+ * to the following restrictions:
+ *
+ * 1. The author is not responsible for the consequences of use of this
+ * software, no matter how awful, even if they arise from flaws in it.
+ *
+ * 2. The origin of this software must not be misrepresented, either by
+ * explicit claim or by omission. Since few users ever read sources,
+ * credits should appear in the documentation.
+ *
+ * 3. Altered versions must be plainly marked as such, and must not be
+ * misrepresented as being the original software. Since few users
+ * ever read sources, credits should appear in the
+ * documentation.
+ *
+ * 4. This notice may not be removed or altered.
+ *
+ */
+
+#include "portable.h"
+
+#include <stdio.h>
+
+#include <ac/string.h>
+#include <ac/socket.h>
+
+#include "slap.h"
+#include "../back-ldap/back-ldap.h"
+#include "back-meta.h"
+
+int
+meta_back_delete(
+ Backend *be,
+ Connection *conn,
+ Operation *op,
+ struct berval *dn,
+ struct berval *ndn
+)
+{
+ struct metainfo *li = ( struct metainfo * )be->be_private;
+ struct metaconn *lc;
+ int candidate = -1;
+
+ char *mdn = NULL;
+
+ lc = meta_back_getconn( li, conn, op, META_OP_REQUIRE_SINGLE,
+ ndn, &candidate );
+ if ( !lc || !meta_back_dobind( lc, op ) || !meta_back_is_valid( lc, candidate ) ) {
+ send_ldap_result( conn, op, LDAP_OPERATIONS_ERROR,
+ NULL, NULL, NULL, NULL );
+ return -1;
+ }
+
+ /*
+ * Rewrite the compare dn, if needed
+ */
+ switch ( rewrite_session( li->targets[ candidate ]->rwinfo,
+ "deleteDn", dn->bv_val, conn, &mdn ) ) {
+ case REWRITE_REGEXEC_OK:
+ if ( mdn == NULL ) {
+ mdn = ( char * )dn->bv_val;
+ }
+#ifdef NEW_LOGGING
+ LDAP_LOG( BACK_META, DETAIL1,
+ "[rw] deleteDn: \"%s\" -> \"%s\"\n", dn->bv_val, mdn, 0 );
+#else /* !NEW_LOGGING */
+ Debug( LDAP_DEBUG_ARGS, "rw> deleteDn: \"%s\" -> \"%s\"\n%s",
+ dn->bv_val, mdn, "" );
+#endif /* !NEW_LOGGING */
+ break;
+
+ case REWRITE_REGEXEC_UNWILLING:
+ send_ldap_result( conn, op, LDAP_UNWILLING_TO_PERFORM,
+ NULL, NULL, NULL, NULL );
+ return -1;
+
+ case REWRITE_REGEXEC_ERR:
+ send_ldap_result( conn, op, LDAP_OPERATIONS_ERROR,
+ NULL, NULL, NULL, NULL );
+ return -1;
+ }
+
+ ldap_delete_s( lc->conns[ candidate ]->ld, mdn );
+
+ if ( mdn != dn->bv_val ) {
+ free( mdn );
+ }
+
+ return meta_back_op_result( lc, op );
+}
+
#include "../back-ldap/back-ldap.h"
#include "back-meta.h"
-
/* return 0 IFF op_dn is a value in group_at (member) attribute
* of entry with gr_dn AND that entry has an objectClass
* value of group_oc (groupOfNames)
mop_ndn = *op_ndn;
}
#ifdef NEW_LOGGING
- LDAP_LOG(( "backend", LDAP_LEVEL_DETAIL1,
- "[rw] bindDn (op ndn in group):"
- " \"%s\" -> \"%s\"\n",
- op_ndn->bv_val, mop_ndn.bv_val));
+ LDAP_LOG( BACK_META, DETAIL1,
+ "[rw] bindDn (op ndn in group): \"%s\" -> \"%s\"\n",
+ op_ndn->bv_val, mop_ndn.bv_val, 0 );
#else /* !NEW_LOGGING */
Debug( LDAP_DEBUG_ARGS,
"rw> bindDn (op ndn in group):"
mgr_ndn = *gr_ndn;
}
#ifdef NEW_LOGGING
- LDAP_LOG(( "backend", LDAP_LEVEL_DETAIL1,
- "[rw] searchBase (gr ndn in group):"
- " \"%s\" -> \"%s\"\n",
- gr_ndn->bv_val, mgr_ndn.bv_val ));
+ LDAP_LOG( BACK_META, DETAIL1,
+ "[rw] searchBase (gr ndn in group): \"%s\" -> \"%s\"\n",
+ gr_ndn->bv_val, mgr_ndn.bv_val, 0 );
#else /* !NEW_LOGGING */
Debug( LDAP_DEBUG_ARGS,
"rw> searchBase (gr ndn in group):"
goto cleanup;
}
- ptr = slap_strcopy( filter, "(&(objectclass=" );
- ptr = slap_strcopy( ptr , group_oc_name.bv_val );
- ptr = slap_strcopy( ptr , ")(" );
- ptr = slap_strcopy( ptr , group_at_name.bv_val );
- ptr = slap_strcopy( ptr , "=" );
- ptr = slap_strcopy( ptr , mop_ndn.bv_val );
+ ptr = lutil_strcopy( filter, "(&(objectclass=" );
+ ptr = lutil_strcopy( ptr , group_oc_name.bv_val );
+ ptr = lutil_strcopy( ptr , ")(" );
+ ptr = lutil_strcopy( ptr , group_at_name.bv_val );
+ ptr = lutil_strcopy( ptr , "=" );
+ ptr = lutil_strcopy( ptr , mop_ndn.bv_val );
strcpy( ptr , "))" );
gattr[ 0 ] = "objectclass";
--- /dev/null
+/*
+ * Copyright 1998-2002 The OpenLDAP Foundation, All Rights Reserved.
+ * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
+ *
+ * Copyright 2001, Pierangelo Masarati, All rights reserved. <ando@sys-net.it>
+ *
+ * This work has been developed to fulfill the requirements
+ * of SysNet s.n.c. <http:www.sys-net.it> and it has been donated
+ * to the OpenLDAP Foundation in the hope that it may be useful
+ * to the Open Source community, but WITHOUT ANY WARRANTY.
+ *
+ * Permission is granted to anyone to use this software for any purpose
+ * on any computer system, and to alter it and redistribute it, subject
+ * to the following restrictions:
+ *
+ * 1. The author and SysNet s.n.c. are not responsible for the consequences
+ * of use of this software, no matter how awful, even if they arise from
+ * flaws in it.
+ *
+ * 2. The origin of this software must not be misrepresented, either by
+ * explicit claim or by omission. Since few users ever read sources,
+ * credits should appear in the documentation.
+ *
+ * 3. Altered versions must be plainly marked as such, and must not be
+ * misrepresented as being the original software. Since few users
+ * ever read sources, credits should appear in the documentation.
+ * SysNet s.n.c. cannot be responsible for the consequences of the
+ * alterations.
+ *
+ * 4. This notice may not be removed or altered.
+ *
+ *
+ * This software is based on the backend back-ldap, implemented
+ * by Howard Chu <hyc@highlandsun.com>, and modified by Mark Valence
+ * <kurash@sassafras.com>, Pierangelo Masarati <ando@sys-net.it> and other
+ * contributors. The contribution of the original software to the present
+ * implementation is acknowledged in this copyright statement.
+ *
+ * A special acknowledgement goes to Howard for the overall architecture
+ * (and for borrowing large pieces of code), and to Mark, who implemented
+ * from scratch the attribute/objectclass mapping.
+ *
+ * The original copyright statement follows.
+ *
+ * Copyright 1999, Howard Chu, All rights reserved. <hyc@highlandsun.com>
+ *
+ * Permission is granted to anyone to use this software for any purpose
+ * on any computer system, and to alter it and redistribute it, subject
+ * to the following restrictions:
+ *
+ * 1. The author is not responsible for the consequences of use of this
+ * software, no matter how awful, even if they arise from flaws in it.
+ *
+ * 2. The origin of this software must not be misrepresented, either by
+ * explicit claim or by omission. Since few users ever read sources,
+ * credits should appear in the documentation.
+ *
+ * 3. Altered versions must be plainly marked as such, and must not be
+ * misrepresented as being the original software. Since few users
+ * ever read sources, credits should appear in the
+ * documentation.
+ *
+ * 4. This notice may not be removed or altered.
+ *
+ */
+
+#include "portable.h"
+
+#include <stdio.h>
+
+#include <ac/string.h>
+#include <ac/socket.h>
+
+#include "slap.h"
+#include "../back-ldap/back-ldap.h"
+#include "back-meta.h"
+
+int
+meta_back_modify(
+ Backend *be,
+ Connection *conn,
+ Operation *op,
+ struct berval *dn,
+ struct berval *ndn,
+ Modifications *modlist
+)
+{
+ struct metainfo *li = ( struct metainfo * )be->be_private;
+ struct metaconn *lc;
+ LDAPMod **modv;
+ LDAPMod *mods;
+ Modifications *ml;
+ int candidate = -1, i;
+ char *mdn;
+ struct berval mapped;
+
+ lc = meta_back_getconn( li, conn, op, META_OP_REQUIRE_SINGLE,
+ ndn, &candidate );
+ if ( !lc || !meta_back_dobind( lc, op ) || !meta_back_is_valid( lc, candidate ) ) {
+ send_ldap_result( conn, op, LDAP_OPERATIONS_ERROR,
+ NULL, NULL, NULL, NULL );
+ return -1;
+ }
+
+ /*
+ * Rewrite the modify dn, if needed
+ */
+ switch ( rewrite_session( li->targets[ candidate ]->rwinfo,
+ "modifyDn", dn->bv_val, conn, &mdn ) ) {
+ case REWRITE_REGEXEC_OK:
+ if ( mdn == NULL ) {
+ mdn = ( char * )dn->bv_val;
+ }
+#ifdef NEW_LOGGING
+ LDAP_LOG( BACK_META, DETAIL1,
+ "[rw] modifyDn: \"%s\" -> \"%s\"\n", dn->bv_val, mdn, 0 );
+#else /* !NEW_LOGGING */
+ Debug( LDAP_DEBUG_ARGS, "rw> modifyDn: \"%s\" -> \"%s\"\n%s",
+ dn->bv_val, mdn, "" );
+#endif /* !NEW_LOGGING */
+ break;
+
+ case REWRITE_REGEXEC_UNWILLING:
+ send_ldap_result( conn, op, LDAP_UNWILLING_TO_PERFORM,
+ NULL, NULL, NULL, NULL );
+ return -1;
+
+ case REWRITE_REGEXEC_ERR:
+ send_ldap_result( conn, op, LDAP_OPERATIONS_ERROR,
+ NULL, NULL, NULL, NULL );
+ return -1;
+ }
+
+ for ( i = 0, ml = modlist; ml; i++ ,ml = ml->sml_next )
+ ;
+
+ mods = ch_malloc( sizeof( LDAPMod )*i );
+ if ( mods == NULL ) {
+ if ( mdn != dn->bv_val ) {
+ free( mdn );
+ }
+ return -1;
+ }
+ modv = ( LDAPMod ** )ch_malloc( ( i + 1 )*sizeof( LDAPMod * ) );
+ if ( modv == NULL ) {
+ free( mods );
+ if ( mdn != dn->bv_val ) {
+ free( mdn );
+ }
+ return -1;
+ }
+
+ for ( i = 0, ml = modlist; ml; ml = ml->sml_next ) {
+ int j;
+ /*
+ * lastmod should always be <off>
+ */
+#if 0
+ if ( !strcasecmp( a->a_desc->ad_cname.bv_val,
+ slap_schema.si_ad_creatorsName->ad_cname.bv_val )
+ || !strcasecmp( a->a_desc->ad_cname.bv_val,
+ slap_schema.si_ad_createTimestamp->ad_cname.bv_val )
+ || !strcasecmp( a->a_desc->ad_cname.bv_val,
+ slap_schema.si_ad_modifiersName->ad_cname.bv_val )
+ || !strcasecmp( a->a_desc->ad_cname.bv_val,
+ slap_schema.si_ad_modifyTimestamp->ad_cname.bv_val ) ) {
+ continue;
+ }
+#endif
+
+ ldap_back_map( &li->targets[ candidate ]->at_map,
+ &ml->sml_desc->ad_cname, &mapped, 0 );
+ if ( mapped.bv_val == NULL ) {
+ continue;
+ }
+
+ modv[ i ] = &mods[ i ];
+ mods[ i ].mod_op = ml->sml_op | LDAP_MOD_BVALUES;
+ mods[ i ].mod_type = mapped.bv_val;
+
+ /*
+ * FIXME: dn-valued attrs should be rewritten
+ * to allow their use in ACLs at the back-ldap
+ * level.
+ */
+ if ( strcmp( ml->sml_desc->ad_type->sat_syntax->ssyn_oid,
+ SLAPD_DN_SYNTAX ) == 0 ) {
+ ldap_dnattr_rewrite(
+ li->targets[ candidate ]->rwinfo,
+ ml->sml_bvalues, conn );
+ }
+
+ for (j = 0; ml->sml_bvalues[ j ].bv_val; j++);
+ mods[ i ].mod_bvalues = (struct berval **)ch_malloc((j+1) *
+ sizeof(struct berval *));
+ for (j = 0; ml->sml_bvalues[ j ].bv_val; j++)
+ mods[ i ].mod_bvalues[ j ] = &ml->sml_bvalues[j];
+ mods[ i ].mod_bvalues[ j ] = NULL;
+ i++;
+ }
+ modv[ i ] = 0;
+
+ ldap_modify_s( lc->conns[ candidate ]->ld, mdn, modv );
+
+ if ( mdn != dn->bv_val ) {
+ free( mdn );
+ }
+ for ( i=0; modv[ i ]; i++)
+ free( modv[ i ]->mod_bvalues );
+ free( mods );
+ free( modv );
+ return meta_back_op_result( lc, op );
+}
+
--- /dev/null
+/*
+ * Copyright 1998-2002 The OpenLDAP Foundation, All Rights Reserved.
+ * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
+ *
+ * Copyright 2001, Pierangelo Masarati, All rights reserved. <ando@sys-net.it>
+ *
+ * This work has been developed to fulfill the requirements
+ * of SysNet s.n.c. <http:www.sys-net.it> and it has been donated
+ * to the OpenLDAP Foundation in the hope that it may be useful
+ * to the Open Source community, but WITHOUT ANY WARRANTY.
+ *
+ * Permission is granted to anyone to use this software for any purpose
+ * on any computer system, and to alter it and redistribute it, subject
+ * to the following restrictions:
+ *
+ * 1. The author and SysNet s.n.c. are not responsible for the consequences
+ * of use of this software, no matter how awful, even if they arise from
+ * flaws in it.
+ *
+ * 2. The origin of this software must not be misrepresented, either by
+ * explicit claim or by omission. Since few users ever read sources,
+ * credits should appear in the documentation.
+ *
+ * 3. Altered versions must be plainly marked as such, and must not be
+ * misrepresented as being the original software. Since few users
+ * ever read sources, credits should appear in the documentation.
+ * SysNet s.n.c. cannot be responsible for the consequences of the
+ * alterations.
+ *
+ * 4. This notice may not be removed or altered.
+ *
+ *
+ * This software is based on the backend back-ldap, implemented
+ * by Howard Chu <hyc@highlandsun.com>, and modified by Mark Valence
+ * <kurash@sassafras.com>, Pierangelo Masarati <ando@sys-net.it> and other
+ * contributors. The contribution of the original software to the present
+ * implementation is acknowledged in this copyright statement.
+ *
+ * A special acknowledgement goes to Howard for the overall architecture
+ * (and for borrowing large pieces of code), and to Mark, who implemented
+ * from scratch the attribute/objectclass mapping.
+ *
+ * The original copyright statement follows.
+ *
+ * Copyright 1999, Howard Chu, All rights reserved. <hyc@highlandsun.com>
+ *
+ * Permission is granted to anyone to use this software for any purpose
+ * on any computer system, and to alter it and redistribute it, subject
+ * to the following restrictions:
+ *
+ * 1. The author is not responsible for the consequences of use of this
+ * software, no matter how awful, even if they arise from flaws in it.
+ *
+ * 2. The origin of this software must not be misrepresented, either by
+ * explicit claim or by omission. Since few users ever read sources,
+ * credits should appear in the documentation.
+ *
+ * 3. Altered versions must be plainly marked as such, and must not be
+ * misrepresented as being the original software. Since few users
+ * ever read sources, credits should appear in the
+ * documentation.
+ *
+ * 4. This notice may not be removed or altered.
+ *
+ */
+
+#include "portable.h"
+
+#include <stdio.h>
+
+#include <ac/socket.h>
+#include <ac/string.h>
+
+#include "slap.h"
+#include "../back-ldap/back-ldap.h"
+#include "back-meta.h"
+
+int
+meta_back_modrdn(
+ Backend *be,
+ Connection *conn,
+ Operation *op,
+ struct berval *dn,
+ struct berval *ndn,
+ struct berval *newrdn,
+ struct berval *nnewrdn,
+ int deleteoldrdn,
+ struct berval *newSuperior,
+ struct berval *nnewSuperior
+)
+{
+ struct metainfo *li = ( struct metainfo * )be->be_private;
+ struct metaconn *lc;
+ int candidate = -1;
+
+ char *mdn = NULL, *mnewSuperior = NULL;
+
+ lc = meta_back_getconn( li, conn, op, META_OP_REQUIRE_SINGLE,
+ ndn, &candidate );
+ if ( !lc || !meta_back_dobind( lc, op ) || !meta_back_is_valid( lc, candidate ) ) {
+ send_ldap_result( conn, op, LDAP_OPERATIONS_ERROR,
+ NULL, NULL, NULL, NULL );
+ return -1;
+ }
+
+ if ( newSuperior ) {
+ int nsCandidate, version = LDAP_VERSION3;
+
+ nsCandidate = meta_back_select_unique_candidate( li,
+ newSuperior );
+
+ if ( nsCandidate != candidate ) {
+ /*
+ * FIXME: one possibility is to delete the entry
+ * from one target and add it to the other;
+ * unfortunately we'd need write access to both,
+ * which is nearly impossible; for administration
+ * needs, the rootdn of the metadirectory could
+ * be mapped to an administrative account on each
+ * target (the binddn?); we'll see.
+ */
+ /*
+ * FIXME: is this the correct return code?
+ */
+ send_ldap_result( conn, op, LDAP_UNWILLING_TO_PERFORM,
+ NULL, NULL, NULL, NULL );
+ return -1;
+ }
+
+ ldap_set_option( lc->conns[ nsCandidate ]->ld,
+ LDAP_OPT_PROTOCOL_VERSION, &version );
+
+ /*
+ * Rewrite the new superior, if defined and required
+ */
+ switch ( rewrite_session( li->targets[ nsCandidate ]->rwinfo,
+ "newSuperiorDn",
+ newSuperior->bv_val,
+ conn,
+ &mnewSuperior ) ) {
+ case REWRITE_REGEXEC_OK:
+ if ( mnewSuperior == NULL ) {
+ mnewSuperior = ( char * )newSuperior;
+ }
+#ifdef NEW_LOGGING
+ LDAP_LOG( BACK_META, DETAIL1,
+ "[rw] newSuperiorDn: \"%s\" -> \"%s\"\n",
+ newSuperior, mnewSuperior, 0 );
+#else /* !NEW_LOGGING */
+ Debug( LDAP_DEBUG_ARGS, "rw> newSuperiorDn:"
+ " \"%s\" -> \"%s\"\n%s",
+ newSuperior->bv_val, mnewSuperior, "" );
+#endif /* !NEW_LOGGING */
+ break;
+
+ case REWRITE_REGEXEC_UNWILLING:
+ send_ldap_result( conn, op, LDAP_UNWILLING_TO_PERFORM,
+ NULL, NULL, NULL, NULL );
+ return -1;
+
+ case REWRITE_REGEXEC_ERR:
+ send_ldap_result( conn, op, LDAP_OPERATIONS_ERROR,
+ NULL, NULL, NULL, NULL );
+ return -1;
+ }
+ }
+
+ /*
+ * Rewrite the modrdn dn, if required
+ */
+ switch ( rewrite_session( li->targets[ candidate ]->rwinfo,
+ "modrDn", dn->bv_val, conn, &mdn ) ) {
+ case REWRITE_REGEXEC_OK:
+ if ( mdn == NULL ) {
+ mdn = ( char * )dn->bv_val;
+ }
+#ifdef NEW_LOGGING
+ LDAP_LOG( BACK_META, DETAIL1,
+ "[rw] modrDn: \"%s\" -> \"%s\"\n", dn->bv_val, mdn, 0 );
+#else /* !NEW_LOGGING */
+ Debug( LDAP_DEBUG_ARGS, "rw> modrDn: \"%s\" -> \"%s\"\n%s",
+ dn->bv_val, mdn, "" );
+#endif /* !NEW_LOGGING */
+ break;
+
+ case REWRITE_REGEXEC_UNWILLING:
+ send_ldap_result( conn, op, LDAP_UNWILLING_TO_PERFORM,
+ NULL, NULL, NULL, NULL );
+ return -1;
+
+ case REWRITE_REGEXEC_ERR:
+ send_ldap_result( conn, op, LDAP_OPERATIONS_ERROR,
+ NULL, NULL, NULL, NULL );
+ return -1;
+ }
+
+ ldap_rename2_s( lc->conns[ candidate ]->ld, mdn, newrdn->bv_val,
+ mnewSuperior, deleteoldrdn );
+
+ if ( mdn != dn->bv_val ) {
+ free( mdn );
+ }
+ if ( mnewSuperior != NULL && mnewSuperior != newSuperior->bv_val ) {
+ free( mnewSuperior );
+ }
+
+ return meta_back_op_result( lc, op );
+}
+
#include "back-meta.h"
#include "ldap_pvt.h"
#undef ldap_debug /* silence a warning in ldap-int.h */
+#include "ldap_log.h"
#include "../../../libraries/libldap/ldap-int.h"
static void
mbase = realbase;
}
#ifdef NEW_LOGGING
- LDAP_LOG(( "backend", LDAP_LEVEL_DETAIL1,
- "[rw] searchBase: \"%s\" -> \"%s\"\n",
- base->bv_val, mbase ));
+ LDAP_LOG( BACK_META, DETAIL1,
+ "[rw] searchBase: \"%s\" -> \"%s\"\n", base->bv_val, mbase, 0 );
#else /* !NEW_LOGGING */
Debug( LDAP_DEBUG_ARGS, "rw> searchBase: \"%s\" -> \"%s\"\n%s",
base->bv_val, mbase, "" );
mfilter = *filterstr;
}
#ifdef NEW_LOGGING
- LDAP_LOG(( "backend", LDAP_LEVEL_DETAIL1,
- "[rw] searchFilter: \"%s\" -> \"%s\"\n",
- filterstr->bv_val, mfilter.bv_val ));
+ LDAP_LOG( BACK_META, DETAIL1,
+ "[rw] searchFilter: \"%s\" -> \"%s\"\n",
+ filterstr->bv_val, mfilter.bv_val, 0 );
#else /* !NEW_LOGGING */
Debug( LDAP_DEBUG_ARGS,
"rw> searchFilter: \"%s\" -> \"%s\"\n%s",
if ( mapped_filter == NULL ) {
mapped_filter = ( char * )mfilter.bv_val;
} else {
- free( mfilter.bv_val );
+ if ( mfilter.bv_val != filterstr->bv_val ) {
+ free( mfilter.bv_val );
+ }
}
mfilter.bv_val = NULL;
mfilter.bv_len = 0;
LDAP_OPT_MATCHED_DN, &match );
#ifdef NEW_LOGGING
- LDAP_LOG(( "backend", LDAP_LEVEL_ERR,
- "meta_back_search [%d]"
- " match=\"%s\" err=\"%s\"\n",
- i, match, err ));
+ LDAP_LOG( BACK_META, ERR,
+ "meta_back_search [%d] match=\"%s\" err=\"%s\"\n",
+ i, match, err );
#else /* !NEW_LOGGING */
Debug( LDAP_DEBUG_ANY,
"=>meta_back_search [%d] match=\"%s\" err=\"%s\"\n",
mmatch = ( char * )match;
}
#ifdef NEW_LOGGING
- LDAP_LOG(( "backend", LDAP_LEVEL_DETAIL1,
- "[rw] matchedDn: \"%s\" -> \"%s\"\n",
- match, mmatch ));
+ LDAP_LOG( BACK_META, DETAIL1,
+ "[rw] matchedDn: \"%s\" -> \"%s\"\n", match, mmatch, 0 );
#else /* !NEW_LOGGING */
Debug( LDAP_DEBUG_ARGS, "rw> matchedDn:"
" \"%s\" -> \"%s\"\n%s",
} else {
#ifdef NEW_LOGGING
- LDAP_LOG(( "backend", LDAP_LEVEL_DETAIL1,
- "[rw] searchResult[%d]:"
- " \"%s\" -> \"%s\"\n",
- target, bdn.bv_val, ent.e_name.bv_val ));
+ LDAP_LOG( BACK_META, DETAIL1,
+ "[rw] searchResult[%d]: \"%s\" -> \"%s\"\n",
+ target, bdn.bv_val, ent.e_name.bv_val );
#else /* !NEW_LOGGING */
Debug( LDAP_DEBUG_ARGS, "rw> searchResult[%d]: \"%s\""
" -> \"%s\"\n", target, bdn.bv_val, ent.e_name.bv_val );
if ( slap_bv2undef_ad( &mapped, &attr->a_desc, &text )
!= LDAP_SUCCESS) {
#ifdef NEW_LOGGING
- LDAP_LOG(( "backend", LDAP_LEVEL_DETAIL1,
- "slap_bv2undef_ad(%s): "
- "%s\n", mapped.bv_val, text ));
+ LDAP_LOG( BACK_META, DETAIL1,
+ "slap_bv2undef_ad(%s): %s\n", mapped.bv_val, text, 0 );
#else /* !NEW_LOGGING */
Debug( LDAP_DEBUG_ANY,
"slap_bv2undef_ad(%s): "
continue;
}
- if ( ber_scanf( &ber, "[W]", &attr->a_vals ) == LBER_ERROR ) {
+ if ( ber_scanf( &ber, "[W]", &attr->a_vals ) == LBER_ERROR
+ || attr->a_vals == NULL ) {
attr->a_vals = &dummy;
+
} else if ( attr->a_desc == slap_schema.si_ad_objectClass
|| attr->a_desc == slap_schema.si_ad_structuralObjectClass ) {
int i, last;
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_val,
- bv->bv_val, newval ));
+ LDAP_LOG( BACK_META, DETAIL1,
+ "[rw] searchResult on attr=%s: \"%s\" -> \"%s\"\n",
+ attr->a_desc->ad_type->sat_cname.bv_val,
+ bv->bv_val, newval );
#else /* !NEW_LOGGING */
Debug( LDAP_DEBUG_ARGS,
"rw> searchResult on attr=%s:"
--- /dev/null
+/*
+ * Copyright 1998-2002 The OpenLDAP Foundation, All Rights Reserved.
+ * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
+ *
+ * Copyright 2001, Pierangelo Masarati, All rights reserved. <ando@sys-net.it>
+ *
+ * This work has been developed to fulfill the requirements
+ * of SysNet s.n.c. <http:www.sys-net.it> and it has been donated
+ * to the OpenLDAP Foundation in the hope that it may be useful
+ * to the Open Source community, but WITHOUT ANY WARRANTY.
+ *
+ * Permission is granted to anyone to use this software for any purpose
+ * on any computer system, and to alter it and redistribute it, subject
+ * to the following restrictions:
+ *
+ * 1. The author and SysNet s.n.c. are not responsible for the consequences
+ * of use of this software, no matter how awful, even if they arise from
+ * flaws in it.
+ *
+ * 2. The origin of this software must not be misrepresented, either by
+ * explicit claim or by omission. Since few users ever read sources,
+ * credits should appear in the documentation.
+ *
+ * 3. Altered versions must be plainly marked as such, and must not be
+ * misrepresented as being the original software. Since few users
+ * ever read sources, credits should appear in the documentation.
+ * SysNet s.n.c. cannot be responsible for the consequences of the
+ * alterations.
+ *
+ * 4. This notice may not be removed or altered.
+ *
+ *
+ * This software is based on the backend back-ldap, implemented
+ * by Howard Chu <hyc@highlandsun.com>, and modified by Mark Valence
+ * <kurash@sassafras.com>, Pierangelo Masarati <ando@sys-net.it> and other
+ * contributors. The contribution of the original software to the present
+ * implementation is acknowledged in this copyright statement.
+ *
+ * A special acknowledgement goes to Howard for the overall architecture
+ * (and for borrowing large pieces of code), and to Mark, who implemented
+ * from scratch the attribute/objectclass mapping.
+ *
+ * The original copyright statement follows.
+ *
+ * Copyright 1999, Howard Chu, All rights reserved. <hyc@highlandsun.com>
+ *
+ * Permission is granted to anyone to use this software for any purpose
+ * on any computer system, and to alter it and redistribute it, subject
+ * to the following restrictions:
+ *
+ * 1. The author is not responsible for the consequences of use of this
+ * software, no matter how awful, even if they arise from flaws in it.
+ *
+ * 2. The origin of this software must not be misrepresented, either by
+ * explicit claim or by omission. Since few users ever read sources,
+ * credits should appear in the documentation.
+ *
+ * 3. Altered versions must be plainly marked as such, and must not be
+ * misrepresented as being the original software. Since few users
+ * ever read sources, credits should appear in the
+ * documentation.
+ *
+ * 4. This notice may not be removed or altered.
+ *
+ */
+
+#include "portable.h"
+
+#include <stdio.h>
+
+#include <ac/socket.h>
+#include <ac/string.h>
+
+#include "slap.h"
+#include "../back-ldap/back-ldap.h"
+#include "back-meta.h"
+
+int
+meta_back_conn_destroy(
+ Backend *be,
+ Connection *conn
+)
+{
+ struct metainfo *li = ( struct metainfo * )be->be_private;
+ struct metaconn *lc, lc_curr;
+
+#ifdef NEW_LOGGING
+ LDAP_LOG( BACK_META, ENTRY,
+ "meta_back_conn_destroy: fetching conn %ld\n", conn->c_connid, 0, 0 );
+#else /* !NEW_LOGGING */
+ Debug( LDAP_DEBUG_TRACE,
+ "=>meta_back_conn_destroy: fetching conn %ld\n%s%s",
+ conn->c_connid, "", "" );
+#endif /* !NEW_LOGGING */
+
+ lc_curr.conn = conn;
+
+ ldap_pvt_thread_mutex_lock( &li->conn_mutex );
+ lc = avl_delete( &li->conntree, ( caddr_t )&lc_curr,
+ meta_back_conn_cmp );
+ ldap_pvt_thread_mutex_unlock( &li->conn_mutex );
+
+ if ( lc ) {
+ int i;
+
+#ifdef NEW_LOGGING
+ LDAP_LOG( BACK_META, INFO,
+ "meta_back_conn_destroy: destroying conn %ld\n",
+ lc->conn->c_connid, 0, 0 );
+#else /* !NEW_LOGGING */
+ Debug( LDAP_DEBUG_TRACE,
+ "=>meta_back_conn_destroy: destroying conn %ld\n%s%s",
+ lc->conn->c_connid, "", "" );
+#endif /* !NEW_LOGGING */
+
+ /*
+ * Cleanup rewrite session
+ */
+ for ( i = 0; i < li->ntargets; ++i ) {
+ if ( lc->conns[ i ]->ld == NULL ) {
+ free( lc->conns[ i ] );
+ continue;
+ }
+
+ rewrite_session_delete( li->targets[ i ]->rwinfo, conn );
+ meta_clear_one_candidate( lc->conns[ i ], 1 );
+ free( lc->conns[ i ] );
+ }
+
+ free( lc->conns );
+ free( lc );
+ }
+
+ /* no response to unbind */
+
+ return 0;
+}
+
if((nBackendInfo != 0) || (backendInfo != NULL)) {
/* already initialized */
#ifdef NEW_LOGGING
- LDAP_LOG(( "backend", LDAP_LEVEL_ERR,
- "backend_init: backend already initialized\n" ));
+ LDAP_LOG( BACKEND, ERR,
+ "backend_init: backend already initialized\n", 0, 0, 0 );
#else
Debug( LDAP_DEBUG_ANY,
"backend_init: already initialized.\n", 0, 0, 0 );
if(rc != 0) {
#ifdef NEW_LOGGING
- LDAP_LOG(( "backend", LDAP_LEVEL_INFO,
+ LDAP_LOG( BACKEND, INFO,
"backend_init: initialized for type \"%s\"\n",
- binfo[nBackendInfo].bi_type ));
+ binfo[nBackendInfo].bi_type, 0, 0 );
#else
Debug( LDAP_DEBUG_ANY,
"backend_init: initialized for type \"%s\"\n",
#else
#ifdef NEW_LOGGING
- LDAP_LOG(( "backend", LDAP_LEVEL_ERR,
- "backend_init: failed\n" ));
+ LDAP_LOG( BACKEND, ERR, "backend_init: failed\n", 0, 0, 0 );
#else
Debug( LDAP_DEBUG_ANY,
"backend_init: failed\n",
if ((rc = aBackendInfo->bi_init(aBackendInfo)) != 0) {
#ifdef NEW_LOGGING
- LDAP_LOG(( "backend", LDAP_LEVEL_ERR,
+ LDAP_LOG( BACKEND, ERR,
"backend_add: initialization for type \"%s\" failed\n",
- aBackendInfo->bi_type ));
+ aBackendInfo->bi_type, 0, 0 );
#else
Debug( LDAP_DEBUG_ANY,
"backend_add: initialization for type \"%s\" failed\n",
if( ! ( nBackendDB > 0 ) ) {
/* no databases */
#ifdef NEW_LOGGING
- LDAP_LOG(( "backend", LDAP_LEVEL_INFO,
- "backend_startup: %d databases to startup. \n",
- nBackendDB ));
+ LDAP_LOG( BACKEND, INFO,
+ "backend_startup: %d databases to startup. \n", nBackendDB, 0, 0 );
#else
Debug( LDAP_DEBUG_ANY,
"backend_startup: %d databases to startup.\n",
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].bv_val ));
+ LDAP_LOG( BACKEND, DETAIL1, "backend_startup: starting \"%s\"\n",
+ be->be_suffix[0].bv_val, 0, 0 );
#else
Debug( LDAP_DEBUG_TRACE,
"backend_startup: starting \"%s\"\n",
if(rc != 0) {
#ifdef NEW_LOGGING
- LDAP_LOG(( "backend", LDAP_LEVEL_CRIT,
- "backend_startup: bi_open failed!\n" ));
+ LDAP_LOG( BACKEND, CRIT, "backend_startup: bi_open failed!\n", 0, 0, 0 );
#else
Debug( LDAP_DEBUG_ANY,
"backend_startup: bi_open failed!\n",
if(rc != 0) {
#ifdef NEW_LOGGING
- LDAP_LOG(( "backend", LDAP_LEVEL_CRIT,
- "backend_startup: bi_db_open failed! (%d)\n", rc ));
+ LDAP_LOG( BACKEND, CRIT,
+ "backend_startup: bi_db_open failed! (%d)\n", rc, 0, 0 );
#else
Debug( LDAP_DEBUG_ANY,
"backend_startup: bi_db_open failed! (%d)\n",
if(rc != 0) {
#ifdef NEW_LOGGING
- LDAP_LOG(( "backend", LDAP_LEVEL_CRIT,
- "backend_startup: bi_open %d failed!\n", i ));
+ LDAP_LOG( BACKEND, CRIT,
+ "backend_startup: bi_open %d failed!\n", i, 0, 0 );
#else
Debug( LDAP_DEBUG_ANY,
"backend_startup: bi_open %d failed!\n",
if(rc != 0) {
#ifdef NEW_LOGGING
- LDAP_LOG(( "backend", LDAP_LEVEL_CRIT,
- "backend_startup: bi_db_open(%d) failed! (%d)\n",
- i, rc ));
+ LDAP_LOG( BACKEND, CRIT,
+ "backend_startup: bi_db_open(%d) failed! (%d)\n", i, rc, 0 );
#else
Debug( LDAP_DEBUG_ANY,
"backend_startup: bi_db_open(%d) failed! (%d)\n",
if(rc != 0) {
#ifdef NEW_LOGGING
- LDAP_LOG(( "backend", LDAP_LEVEL_NOTICE,
- "backend_shutdown: bi_close %s failed!\n",
- backendDB[i].be_type ));
+ LDAP_LOG( BACKEND, NOTICE,
+ "backend_shutdown: bi_close %s failed!\n",
+ backendDB[i].be_type, 0, 0 );
#else
Debug( LDAP_DEBUG_ANY,
"backend_close: bi_close %s failed!\n",
if( op->o_ndn.bv_len == 0 ) {
*text = "modifications require authentication";
- return LDAP_OPERATIONS_ERROR;
+ return LDAP_STRONG_AUTH_REQUIRED;
}
}
}
}
ldap_pvt_thread_mutex_lock( &conn->c_mutex );
+
for (g = conn->c_groups; g; g=g->ga_next) {
if (g->ga_be != be || g->ga_oc != group_oc ||
g->ga_at != group_at || g->ga_len != gr_ndn->bv_len)
if (strcmp( g->ga_ndn, gr_ndn->bv_val ) == 0)
break;
}
+
ldap_pvt_thread_mutex_unlock( &conn->c_mutex );
+
if (g) {
return g->ga_res;
}
target, gr_ndn, op_ndn,
group_oc, group_at );
- if (op->o_tag != LDAP_REQ_BIND) {
+ if ( op->o_tag != LDAP_REQ_BIND && !op->o_do_not_cache ) {
g = ch_malloc(sizeof(GroupAssertion) + gr_ndn->bv_len);
g->ga_be = be;
g->ga_oc = group_oc;
Backend *be;
#ifdef NEW_LOGGING
- LDAP_LOG(( "operation", LDAP_LEVEL_ENTRY,
- "do_bind: conn %d\n", conn->c_connid ));
+ LDAP_LOG( OPERATION, ENTRY, "do_bind: conn %d\n", conn->c_connid, 0, 0 );
#else
Debug( LDAP_DEBUG_TRACE, "do_bind\n", 0, 0, 0 );
#endif
* Force to connection to "anonymous" until bind succeeds.
*/
ldap_pvt_thread_mutex_lock( &conn->c_mutex );
+ if ( conn->c_sasl_bind_in_progress ) be = conn->c_authz_backend;
connection2anonymous( conn );
+ if ( conn->c_sasl_bind_in_progress ) conn->c_authz_backend = be;
ldap_pvt_thread_mutex_unlock( &conn->c_mutex );
if ( op->o_dn.bv_val != NULL ) {
if ( tag == LBER_ERROR ) {
#ifdef NEW_LOGGING
- LDAP_LOG(( "operation", LDAP_LEVEL_ERR,
- "do_bind: conn %d ber_scanf failed\n", conn->c_connid ));
+ LDAP_LOG( OPERATION, ERR,
+ "do_bind: conn %d ber_scanf failed\n", conn->c_connid, 0, 0 );
#else
Debug( LDAP_DEBUG_ANY, "bind: ber_scanf failed\n", 0, 0, 0 );
#endif
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 ));
+ LDAP_LOG( OPERATION, INFO,
+ "do_bind: conn %d get_ctrls failed\n", conn->c_connid, 0, 0 );
#else
Debug( LDAP_DEBUG_ANY, "do_bind: get_ctrls failed\n", 0, 0, 0 );
#endif
rc = dnPrettyNormal( NULL, &dn, &pdn, &ndn );
if ( rc != LDAP_SUCCESS ) {
#ifdef NEW_LOGGING
- LDAP_LOG(( "operation", LDAP_LEVEL_INFO,
- "do_bind: conn %d invalid dn (%s)\n",
- conn->c_connid, dn.bv_val ));
+ LDAP_LOG( OPERATION, INFO,
+ "do_bind: conn %d invalid dn (%s)\n",
+ conn->c_connid, dn.bv_val, 0 );
#else
Debug( LDAP_DEBUG_ANY, "bind: invalid dn (%s)\n",
dn.bv_val, 0, 0 );
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,
- pdn.bv_val, mech.bv_val ));
+ LDAP_LOG( OPERATION, DETAIL1,
+ "do_sasl_bind: conn %d dn (%s) mech %s\n",
+ conn->c_connid, pdn.bv_val, mech.bv_val );
#else
Debug( LDAP_DEBUG_TRACE, "do_sasl_bind: dn (%s) mech %s\n",
pdn.bv_val, mech.bv_val, NULL );
} 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,
- pdn.bv_val, (unsigned long)method ));
+ LDAP_LOG( OPERATION, DETAIL1,
+ "do_bind: version=%ld dn=\"%s\" method=%ld\n",
+ (unsigned long) version, pdn.bv_val, (unsigned long)method );
#else
Debug( LDAP_DEBUG_TRACE,
"do_bind: version=%ld dn=\"%s\" method=%ld\n",
if ( version < LDAP_VERSION_MIN || version > LDAP_VERSION_MAX ) {
#ifdef NEW_LOGGING
- LDAP_LOG(( "operation", LDAP_LEVEL_INFO,
+ LDAP_LOG( OPERATION, INFO,
"do_bind: conn %d unknown version = %ld\n",
- conn->c_connid, (unsigned long)version ));
+ conn->c_connid, (unsigned long)version, 0 );
#else
Debug( LDAP_DEBUG_ANY, "do_bind: unknown version=%ld\n",
(unsigned long) version, 0, 0 );
if ( version < LDAP_VERSION3 ) {
#ifdef NEW_LOGGING
- LDAP_LOG(( "operation", LDAP_LEVEL_INFO,
+ LDAP_LOG( OPERATION, INFO,
"do_bind: conn %d sasl with LDAPv%ld\n",
- conn->c_connid, (unsigned long)version ));
+ conn->c_connid, (unsigned long)version , 0 );
#else
Debug( LDAP_DEBUG_ANY, "do_bind: sasl with LDAPv%ld\n",
(unsigned long) version, 0, 0 );
if( mech.bv_len == 0 ) {
#ifdef NEW_LOGGING
- LDAP_LOG(( "operation", LDAP_LEVEL_INFO,
+ LDAP_LOG( OPERATION, INFO,
"do_bind: conn %d no SASL mechanism provided\n",
- conn->c_connid ));
+ conn->c_connid, 0, 0 );
#else
Debug( LDAP_DEBUG_ANY,
"do_bind: no sasl mechanism provided\n",
send_ldap_result( conn, op, rc,
NULL, text, NULL, NULL );
#ifdef NEW_LOGGING
- LDAP_LOG(( "operation", LDAP_LEVEL_DETAIL1,
+ LDAP_LOG( OPERATION, DETAIL1,
"do_bind: conn %d v%d anonymous bind\n",
- conn->c_connid, version ));
+ conn->c_connid, version , 0 );
#else
Debug( LDAP_DEBUG_TRACE, "do_bind: v%d anonymous bind\n",
version, 0, 0 );
send_ldap_result( conn, op, rc,
NULL, text, NULL, NULL );
#ifdef NEW_LOGGING
- LDAP_LOG(( "operation", LDAP_LEVEL_INFO,
+ LDAP_LOG( OPERATION, INFO,
"do_bind: conn %d v%d simple bind(%s) disallowed\n",
- conn->c_connid, version, ndn.bv_val ));
+ conn->c_connid, version, ndn.bv_val );
#else
Debug( LDAP_DEBUG_TRACE,
"do_bind: v%d simple bind(%s) disallowed\n",
NULL, text, NULL, NULL );
#ifdef NEW_LOGGING
- LDAP_LOG(( "operation", LDAP_LEVEL_INFO, "do_bind: conn %d "
+ LDAP_LOG( OPERATION, INFO, "do_bind: conn %d "
"v%d unprotected simple bind(%s) disallowed\n",
- conn->c_connid, version, ndn.bv_val ));
+ conn->c_connid, version, ndn.bv_val );
#else
Debug( LDAP_DEBUG_TRACE,
"do_bind: v%d unprotected simple bind(%s) disallowed\n",
send_ldap_result( conn, op, rc,
NULL, text, NULL, NULL );
#ifdef NEW_LOGGING
- LDAP_LOG(( "operation", LDAP_LEVEL_DETAIL1,
+ LDAP_LOG( OPERATION, DETAIL1,
"do_bind: conn %d v%d Kerberos V4 bind\n",
- conn->c_connid, version ));
+ conn->c_connid, version , 0 );
#else
Debug( LDAP_DEBUG_TRACE, "do_bind: v%d Kerberos V4 bind\n",
version, 0, 0 );
send_ldap_result( conn, op, rc,
NULL, text, NULL, NULL );
#ifdef NEW_LOGGING
- LDAP_LOG(( "operation", LDAP_LEVEL_INFO,
+ LDAP_LOG( OPERATION, INFO,
"do_bind: conn %ld v%d unknown authentication method (%ld)\n",
- conn->c_connid, version, method ));
+ conn->c_connid, version, method );
#else
Debug( LDAP_DEBUG_TRACE,
"do_bind: v%d unknown authentication method (%ld)\n",
}
#ifdef NEW_LOGGING
- LDAP_LOG(( "operation", LDAP_LEVEL_DETAIL1,
- "do_bind: conn %d v%d bind: \"%s\" to \"%s\" \n",
- conn->c_connid, version, dn.bv_val, conn->c_dn.bv_val ));
+ LDAP_LOG( OPERATION, DETAIL1,
+ "do_bind: v%d bind: \"%s\" to \"%s\" \n",
+ version, conn->c_dn.bv_val, conn->c_dn.bv_val );
#else
Debug( LDAP_DEBUG_TRACE,
"do_bind: v%d bind: \"%s\" to \"%s\"\n",
/* ch_malloc.c - malloc routines that test returns from malloc and friends */
+/* $OpenLDAP$ */
+/*
+ * Copyright 1998-2002 The OpenLDAP Foundation, All Rights Reserved.
+ * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
+ */
+
+#define CH_FREE 1
+
+#include "portable.h"
#include <stdio.h>
-#include <sys/types.h>
-#include <sys/socket.h>
+
+#include <ac/stdlib.h>
+
+#include <ac/string.h>
+#include <ac/socket.h>
+
#include "slap.h"
-char *
+#ifndef CSRIMALLOC
+
+void *
ch_malloc(
- unsigned long size
+ ber_len_t size
)
{
- char *new;
+ void *new;
- if ( (new = (char *) malloc( size )) == NULL ) {
- Debug( LDAP_DEBUG_ANY, "malloc of %d bytes failed\n", size, 0, 0 );
- exit( 1 );
+ if ( (new = (void *) ber_memalloc( size )) == NULL ) {
+#ifdef NEW_LOGGING
+ LDAP_LOG( OPERATION, ERR,
+ "ch_malloc: allocation of %lu bytes failed\n", (long)size, 0,0 );
+#else
+ Debug( LDAP_DEBUG_ANY, "ch_malloc of %lu bytes failed\n",
+ (long) size, 0, 0 );
+#endif
+ assert( 0 );
+ exit( EXIT_FAILURE );
}
return( new );
}
-char *
+void *
ch_realloc(
- char *block,
- unsigned long size
+ void *block,
+ ber_len_t size
)
{
- char *new;
+ void *new;
if ( block == NULL ) {
return( ch_malloc( size ) );
}
- if ( (new = (char *) realloc( block, size )) == NULL ) {
- Debug( LDAP_DEBUG_ANY, "realloc of %d bytes failed\n", size, 0, 0 );
- exit( 1 );
+ if( size == 0 ) {
+ ch_free( block );
+ }
+
+ if ( (new = (void *) ber_memrealloc( block, size )) == NULL ) {
+#ifdef NEW_LOGGING
+ LDAP_LOG( OPERATION, ERR,
+ "ch_realloc: reallocation of %lu bytes failed\n", (long)size, 0,0 );
+#else
+ Debug( LDAP_DEBUG_ANY, "ch_realloc of %lu bytes failed\n",
+ (long) size, 0, 0 );
+#endif
+ assert( 0 );
+ exit( EXIT_FAILURE );
}
return( new );
}
-char *
+void *
ch_calloc(
- unsigned long nelem,
- unsigned long size
+ ber_len_t nelem,
+ ber_len_t size
+)
+{
+ void *new;
+
+ if ( (new = (void *) ber_memcalloc( nelem, size )) == NULL ) {
+#ifdef NEW_LOGGING
+ LDAP_LOG( OPERATION, ERR,
+ "ch_calloc: allocation of %lu elements of %lu bytes faild\n",
+ (long)nelem, (long)size, 0 );
+#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 );
+ }
+
+ return( new );
+}
+
+char *
+ch_strdup(
+ const char *string
)
{
char *new;
- if ( (new = (char *) calloc( nelem, size )) == NULL ) {
- Debug( LDAP_DEBUG_ANY, "calloc of %d elems of %d bytes failed\n",
- nelem, size, 0 );
- exit( 1 );
+ if ( (new = ber_strdup( string )) == NULL ) {
+#ifdef NEW_LOGGING
+ LDAP_LOG( OPERATION, ERR,
+ "chr_strdup: duplication of \"%s\" failed\n", string, 0, 0 );
+#else
+ Debug( LDAP_DEBUG_ANY, "ch_strdup(%s) failed\n", string, 0, 0 );
+#endif
+ assert( 0 );
+ exit( EXIT_FAILURE );
}
return( new );
}
+
+void
+ch_free( void *ptr )
+{
+ ber_memfree( ptr );
+}
+
+#endif
return 0;
}
-
-/* strcopy is like strcpy except it returns a pointer to the trailing NUL of
- * the result string. This allows fast construction of catenated strings
- * without the overhead of strlen/strcat.
- */
-char *
-slap_strcopy(
- char *a,
- const char *b
-)
-{
- if (!a || !b)
- return a;
-
- while ((*a++ = *b++)) ;
- return a-1;
-}
-
-/* strncopy is like strcpy except it returns a pointer to the trailing NUL of
- * the result string. This allows fast construction of catenated strings
- * without the overhead of strlen/strcat.
- */
-char *
-slap_strncopy(
- char *a,
- const char *b,
- size_t n
-)
-{
- if (!a || !b || n == 0)
- return a;
-
- while ((*a++ = *b++) && n-- > 0) ;
- return a-1;
-}
ava.aa_desc = NULL;
#ifdef NEW_LOGGING
- LDAP_LOG(( "operation", LDAP_LEVEL_ENTRY,
- "do_compare: conn %d\n", conn->c_connid ));
+ LDAP_LOG( OPERATION, ENTRY, "do_compare: conn %d\n", conn->c_connid, 0, 0 );
#else
Debug( LDAP_DEBUG_TRACE, "do_compare\n", 0, 0, 0 );
#endif
if ( ber_scanf( op->o_ber, "{m" /*}*/, &dn ) == LBER_ERROR ) {
#ifdef NEW_LOGGING
- LDAP_LOG(( "operation", LDAP_LEVEL_ERR,
- "do_compare: conn %d ber_scanf failed\n", conn->c_connid ));
+ LDAP_LOG( OPERATION, ERR,
+ "do_compare: conn %d ber_scanf failed\n", conn->c_connid, 0, 0 );
#else
Debug( LDAP_DEBUG_ANY, "ber_scanf failed\n", 0, 0, 0 );
#endif
if ( ber_scanf( op->o_ber, "{mm}", &desc, &value ) == LBER_ERROR ) {
#ifdef NEW_LOGGING
- LDAP_LOG(( "operation", LDAP_LEVEL_ERR,
- "do_compare: conn %d get ava failed\n", conn->c_connid ));
+ LDAP_LOG( OPERATION, ERR,
+ "do_compare: conn %d get ava failed\n", conn->c_connid, 0, 0 );
#else
Debug( LDAP_DEBUG_ANY, "do_compare: get ava failed\n", 0, 0, 0 );
#endif
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 ));
+ LDAP_LOG( OPERATION, ERR,
+ "do_compare: conn %d ber_scanf failed\n", conn->c_connid, 0, 0 );
#else
Debug( LDAP_DEBUG_ANY, "ber_scanf failed\n", 0, 0, 0 );
#endif
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 ));
+ LDAP_LOG( OPERATION, INFO,
+ "do_compare: conn %d get_ctrls failed\n", conn->c_connid, 0, 0 );
#else
Debug( LDAP_DEBUG_ANY, "do_compare: get_ctrls failed\n", 0, 0, 0 );
#endif
rc = dnPrettyNormal( NULL, &dn, &pdn, &ndn );
if( rc != LDAP_SUCCESS ) {
#ifdef NEW_LOGGING
- LDAP_LOG(( "operation", LDAP_LEVEL_INFO,
+ LDAP_LOG( OPERATION, INFO,
"do_compare: conn %d invalid dn (%s)\n",
- conn->c_connid, dn.bv_val ));
+ conn->c_connid, dn.bv_val, 0 );
#else
Debug( LDAP_DEBUG_ANY,
"do_compare: invalid dn (%s)\n", dn.bv_val, 0, 0 );
if( strcasecmp( ndn.bv_val, LDAP_ROOT_DSE ) == 0 ) {
#ifdef NEW_LOGGING
- LDAP_LOG(( "operation", LDAP_LEVEL_ARGS,
- "do_compare: conn %d dn (%s) attr(%s) value (%s)\n",
- conn->c_connid, pdn.bv_val,
- ava.aa_desc->ad_cname.bv_val, ava.aa_value.bv_val ));
+ LDAP_LOG( OPERATION, ARGS,
+ "do_compare: dn (%s) attr(%s) value (%s)\n",
+ pdn.bv_val, 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",
pdn.bv_val, ava.aa_desc->ad_cname.bv_val, ava.aa_value.bv_val );
} else if ( strcasecmp( ndn.bv_val, SLAPD_SCHEMA_DN ) == 0 ) {
#ifdef NEW_LOGGING
- LDAP_LOG(( "operation", LDAP_LEVEL_ARGS,
- "do_compare: conn %d dn (%s) attr(%s) value (%s)\n",
- conn->c_connid, pdn.bv_val, ava.aa_desc->ad_cname.bv_val,
- ava.aa_value.bv_val ));
+ LDAP_LOG( OPERATION, ARGS,
+ "do_compare: dn (%s) attr(%s) value (%s)\n",
+ pdn.bv_val, 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",
pdn.bv_val, ava.aa_desc->ad_cname.bv_val, ava.aa_value.bv_val );
}
#ifdef NEW_LOGGING
- LDAP_LOG(( "operation", LDAP_LEVEL_ARGS,
- "do_compare: conn %d dn (%s) attr(%s) value (%s)\n",
- conn->c_connid, pdn.bv_val, ava.aa_desc->ad_cname.bv_val,
- ava.aa_value.bv_val ));
+ LDAP_LOG( OPERATION, ARGS,
+ "do_compare: dn (%s) attr(%s) value (%s)\n",
+ pdn.bv_val, 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",
pdn.bv_val, ava.aa_desc->ad_cname.bv_val, ava.aa_value.bv_val );
if ( (fp = fopen( fname, "r" )) == NULL ) {
ldap_syslog = 1;
#ifdef NEW_LOGGING
- LDAP_LOG(( "config", LDAP_LEVEL_ENTRY, "read_config: "
- "could not open config file \"%s\": %s (%d)\n",
- fname, strerror(errno), errno ));
+ LDAP_LOG( CONFIG, ENTRY,
+ "read_config: " "could not open config file \"%s\": %s (%d)\n",
+ fname, strerror(errno), errno );
#else
Debug( LDAP_DEBUG_ANY,
"could not open config file \"%s\": %s (%d)\n",
}
#ifdef NEW_LOGGING
- LDAP_LOG(( "config", LDAP_LEVEL_ENTRY,
- "read_config: reading config file %s\n", fname ));
+ LDAP_LOG( CONFIG, ENTRY,
+ "read_config: reading config file %s\n", fname, 0, 0 );
#else
Debug( LDAP_DEBUG_CONFIG, "reading config file %s\n", fname, 0, 0 );
#endif
if ( cargc < 1 ) {
#ifdef NEW_LOGGING
- LDAP_LOG(( "config", LDAP_LEVEL_INFO,
- "%s: line %d: bad config line (ignored)\n",
- fname, lineno ));
+ LDAP_LOG( CONFIG, INFO,
+ "%s: line %d: bad config line (ignored)\n", fname, lineno, 0 );
#else
Debug( LDAP_DEBUG_ANY,
"%s: line %d: bad config line (ignored)\n",
if ( strcasecmp( cargv[0], "backend" ) == 0 ) {
if ( cargc < 2 ) {
#ifdef NEW_LOGGING
- LDAP_LOG(( "config", LDAP_LEVEL_CRIT,
+ LDAP_LOG( CONFIG, CRIT,
"%s : line %d: missing type in \"backend\" line.\n",
- fname, lineno ));
+ fname, lineno, 0 );
#else
Debug( LDAP_DEBUG_ANY,
"%s: line %d: missing type in \"backend <type>\" line\n",
if( be != NULL ) {
#ifdef NEW_LOGGING
- LDAP_LOG(( "config", LDAP_LEVEL_CRIT,
+ LDAP_LOG( CONFIG, CRIT,
"%s: line %d: backend line must appear before any "
- "database definition.\n", fname, lineno ));
+ "database definition.\n", fname, lineno , 0 );
#else
Debug( LDAP_DEBUG_ANY,
"%s: line %d: backend line must appear before any database definition\n",
if( bi == NULL ) {
#ifdef NEW_LOGGING
- LDAP_LOG(( "config", LDAP_LEVEL_CRIT,
+ LDAP_LOG( CONFIG, CRIT,
"read_config: backend %s initialization failed.\n",
- cargv[1] ));
+ cargv[1], 0, 0 );
#else
Debug( LDAP_DEBUG_ANY,
"backend %s initialization failed.\n",
} else if ( strcasecmp( cargv[0], "database" ) == 0 ) {
if ( cargc < 2 ) {
#ifdef NEW_LOGGING
- LDAP_LOG(( "config", LDAP_LEVEL_CRIT,
- "%s: line %d: missing type in \"database <type>\" line\n",
- fname, lineno ));
+ LDAP_LOG( CONFIG, CRIT,
+ "%s: line %d: missing type in \"database <type>\" line\n",
+ fname, lineno, 0 );
#else
Debug( LDAP_DEBUG_ANY,
"%s: line %d: missing type in \"database <type>\" line\n",
if( be == NULL ) {
#ifdef NEW_LOGGING
- LDAP_LOG(( "config", LDAP_LEVEL_CRIT,
- "database %s initialization failed.\n",
- cargv[1] ));
+ LDAP_LOG( CONFIG, CRIT,
+ "database %s initialization failed.\n", cargv[1], 0, 0 );
#else
Debug( LDAP_DEBUG_ANY,
"database %s initialization failed.\n",
int c;
if ( cargc < 2 ) {
#ifdef NEW_LOGGING
- LDAP_LOG(( "config", LDAP_LEVEL_CRIT,
- "%s: line %d: missing level in \"concurrency <level\" line\n",
- fname, lineno ));
+ LDAP_LOG( CONFIG, CRIT,
+ "%s: line %d: missing level in \"concurrency <level\" "
+ " line\n", fname, lineno, 0 );
#else
Debug( LDAP_DEBUG_ANY,
"%s: line %d: missing level in \"concurrency <level>\" line\n",
if( c < 1 ) {
#ifdef NEW_LOGGING
- LDAP_LOG(( "config", LDAP_LEVEL_CRIT,
- "%s: line %d: invalid level (%d) in "
- "\"concurrency <level>\" line.\n",
- fname, lineno, c ));
+ LDAP_LOG( CONFIG, CRIT,
+ "%s: line %d: invalid level (%d) in "
+ "\"concurrency <level>\" line.\n", fname, lineno, c );
#else
Debug( LDAP_DEBUG_ANY,
"%s: line %d: invalid level (%d) in \"concurrency <level>\" line\n",
long max;
if ( cargc < 2 ) {
#ifdef NEW_LOGGING
- LDAP_LOG(( "config", LDAP_LEVEL_CRIT,
- "%s: line %d: missing max in \"sockbuf_max_incoming <bytes>\" line\n",
- fname, lineno ));
+ LDAP_LOG( CONFIG, CRIT,
+ "%s: line %d: missing max in \"sockbuf_max_incoming "
+ "<bytes>\" line\n", fname, lineno, 0 );
#else
Debug( LDAP_DEBUG_ANY,
"%s: line %d: missing max in \"sockbuf_max_incoming <bytes>\" line\n",
if( max < 0 ) {
#ifdef NEW_LOGGING
- LDAP_LOG(( "config", LDAP_LEVEL_CRIT,
+ LDAP_LOG( CONFIG, CRIT,
"%s: line %d: invalid max value (%ld) in "
"\"sockbuf_max_incoming <bytes>\" line.\n",
- fname, lineno, max ));
+ fname, lineno, max );
#else
Debug( LDAP_DEBUG_ANY,
"%s: line %d: invalid max value (%ld) in "
long max;
if ( cargc < 2 ) {
#ifdef NEW_LOGGING
- LDAP_LOG(( "config", LDAP_LEVEL_CRIT,
- "%s: line %d: missing max in \"sockbuf_max_incoming_auth <bytes>\" line\n",
- fname, lineno ));
+ LDAP_LOG( CONFIG, CRIT,
+ "%s: line %d: missing max in \"sockbuf_max_incoming_auth "
+ "<bytes>\" line\n", fname, lineno, 0 );
#else
Debug( LDAP_DEBUG_ANY,
"%s: line %d: missing max in \"sockbuf_max_incoming_auth <bytes>\" line\n",
if( max < 0 ) {
#ifdef NEW_LOGGING
- LDAP_LOG(( "config", LDAP_LEVEL_CRIT,
+ LDAP_LOG( CONFIG, CRIT,
"%s: line %d: invalid max value (%ld) in "
"\"sockbuf_max_incoming_auth <bytes>\" line.\n",
- fname, lineno, max ));
+ fname, lineno, max );
#else
Debug( LDAP_DEBUG_ANY,
"%s: line %d: invalid max value (%ld) in "
} else if ( strcasecmp( cargv[0], "defaultSearchBase" ) == 0 ) {
if ( cargc < 2 ) {
#ifdef NEW_LOGGING
- LDAP_LOG(( "config", LDAP_LEVEL_CRIT,
+ LDAP_LOG( CONFIG, CRIT,
"%s: line %d: missing dn in \"defaultSearchBase <dn\" "
- "line\n", fname, lineno ));
+ "line\n", fname, lineno, 0 );
#else
Debug( LDAP_DEBUG_ANY, "%s: line %d: "
"missing dn in \"defaultSearchBase <dn>\" line\n",
} else if ( cargc > 2 ) {
#ifdef NEW_LOGGING
- LDAP_LOG(( "config", LDAP_LEVEL_INFO,
+ LDAP_LOG( CONFIG, INFO,
"%s: line %d: extra cruft after <dn> in "
"\"defaultSearchBase %s\" line (ignored)\n",
- fname, lineno, cargv[1] ));
+ fname, lineno, cargv[1] );
#else
Debug( LDAP_DEBUG_ANY, "%s: line %d: "
"extra cruft after <dn> in \"defaultSearchBase %s\", "
if ( bi != NULL || be != NULL ) {
#ifdef NEW_LOGGING
- LDAP_LOG(( "config", LDAP_LEVEL_CRIT,
+ LDAP_LOG( CONFIG, CRIT,
"%s: line %d: defaultSearchBase line must appear "
"prior to any backend or database definitions\n",
- fname, lineno ));
+ fname, lineno, 0 );
#else
Debug( LDAP_DEBUG_ANY, "%s: line %d: "
"defaultSearchBaase line must appear prior to "
if ( default_search_nbase.bv_len ) {
#ifdef NEW_LOGGING
- LDAP_LOG(( "config", LDAP_LEVEL_INFO, "%s: line %d: "
+ LDAP_LOG( CONFIG, INFO, "%s: line %d: "
"default search base \"%s\" already defined "
"(discarding old)\n", fname, lineno,
- default_search_base.bv_val ));
+ default_search_base.bv_val );
#else
Debug( LDAP_DEBUG_ANY, "%s: line %d: "
"default search base \"%s\" already defined "
if( rc != LDAP_SUCCESS ) {
#ifdef NEW_LOGGING
- LDAP_LOG(( "config", LDAP_LEVEL_CRIT,
+ LDAP_LOG( CONFIG, CRIT,
"%s: line %d: defaultSearchBase DN is invalid.\n",
- fname, lineno ));
+ fname, lineno, 0 );
#else
Debug( LDAP_DEBUG_ANY,
"%s: line %d: defaultSearchBase DN is invalid\n",
int c;
if ( cargc < 2 ) {
#ifdef NEW_LOGGING
- LDAP_LOG(( "config", LDAP_LEVEL_CRIT,
- "%s: line %d: missing count in \"threads <count>\" line\n",
- fname, lineno ));
+ LDAP_LOG( CONFIG, CRIT,
+ "%s: line %d: missing count in \"threads <count>\" line\n",
+ fname, lineno, 0 );
#else
Debug( LDAP_DEBUG_ANY,
"%s: line %d: missing count in \"threads <count>\" line\n",
if( c < 0 ) {
#ifdef NEW_LOGGING
- LDAP_LOG(( "config", LDAP_LEVEL_CRIT,
+ LDAP_LOG( CONFIG, CRIT,
"%s: line %d: invalid level (%d) in \"threads <count>\""
- "line\n",fname, lineno, c ));
+ "line\n", fname, lineno, c );
#else
Debug( LDAP_DEBUG_ANY,
"%s: line %d: invalid level (%d) in \"threads <count>\" line\n",
} else if ( strcasecmp( cargv[0], "pidfile" ) == 0 ) {
if ( cargc < 2 ) {
#ifdef NEW_LOGGING
- LDAP_LOG(( "config", LDAP_LEVEL_CRIT,
- "%s: line %d missing file name in \"pidfile <file>\" line.\n",
- fname, lineno ));
+ LDAP_LOG( CONFIG, CRIT,
+ "%s: line %d missing file name in \"pidfile <file>\" "
+ "line.\n", fname, lineno, 0 );
#else
Debug( LDAP_DEBUG_ANY,
"%s: line %d: missing file name in \"pidfile <file>\" line\n",
} else if ( strcasecmp( cargv[0], "argsfile" ) == 0 ) {
if ( cargc < 2 ) {
#ifdef NEW_LOGGING
- LDAP_LOG(( "config", LDAP_LEVEL_CRIT,
+ LDAP_LOG( CONFIG, CRIT,
"%s: %d: missing file name in "
"\"argsfile <file>\" line.\n",
- fname, lineno ));
+ fname, lineno, 0 );
#else
Debug( LDAP_DEBUG_ANY,
"%s: line %d: missing file name in \"argsfile <file>\" line\n",
} else if ( strcasecmp( cargv[0], "password-hash" ) == 0 ) {
if ( cargc < 2 ) {
#ifdef NEW_LOGGING
- LDAP_LOG(( "config", LDAP_LEVEL_CRIT,
+ LDAP_LOG( CONFIG, CRIT,
"%s: line %d: missing hash in "
"\"password-hash <hash>\" line.\n",
- fname, lineno ));
+ fname, lineno, 0 );
#else
Debug( LDAP_DEBUG_ANY,
"%s: line %d: missing hash in \"password-hash <hash>\" line\n",
}
if ( default_passwd_hash != NULL ) {
#ifdef NEW_LOGGING
- LDAP_LOG(( "config", LDAP_LEVEL_CRIT,
+ LDAP_LOG( CONFIG, CRIT,
"%s: line %d: already set default password_hash!\n",
- fname, lineno ));
+ fname, lineno, 0 );
#else
Debug( LDAP_DEBUG_ANY,
"%s: line %d: already set default password_hash!\n",
if ( lutil_passwd_scheme( cargv[1] ) == 0 ) {
#ifdef NEW_LOGGING
- LDAP_LOG(( "config", LDAP_LEVEL_CRIT,
+ LDAP_LOG( CONFIG, CRIT,
"%s: line %d: password scheme \"%s\" not available\n",
- fname, lineno, cargv[1] ));
+ fname, lineno, cargv[1] );
#else
Debug( LDAP_DEBUG_ANY,
"%s: line %d: password scheme \"%s\" not available\n",
{
if ( cargc < 2 ) {
#ifdef NEW_LOGGING
- LDAP_LOG(( "config", LDAP_LEVEL_CRIT,
+ LDAP_LOG( CONFIG, CRIT,
"%s: line %d: missing format in "
"\"password-crypt-salt-format <format>\" line\n",
- fname, lineno ));
+ fname, lineno, 0 );
#else
Debug( LDAP_DEBUG_ANY, "%s: line %d: missing format in "
"\"password-crypt-salt-format <format>\" line\n",
int err;
if ( cargc < 2 ) {
#ifdef NEW_LOGGING
- LDAP_LOG(( "config", LDAP_LEVEL_CRIT,
+ LDAP_LOG( CONFIG, CRIT,
"%s: line %d: missing path in "
- "\"ucdata-path <path>\" line.\n",
- fname, lineno ));
+ "\"ucdata-path <path>\" line.\n", fname, lineno, 0 );
#else
Debug( LDAP_DEBUG_ANY,
"%s: line %d: missing path in \"ucdata-path <path>\" line\n",
if ( err <= 0 ) {
if ( err == 0 ) {
#ifdef NEW_LOGGING
- LDAP_LOG(( "config", LDAP_LEVEL_CRIT,
+ LDAP_LOG( CONFIG, CRIT,
"%s: line %d: ucdata already loaded, ucdata-path "
"must be set earlier in the file and/or be "
- "specified only once!\n",
- fname, lineno ));
+ "specified only once!\n", fname, lineno, 0 );
#else
Debug( LDAP_DEBUG_ANY,
"%s: line %d: ucdata already loaded, ucdata-path must be set earlier in the file and/or be specified only once!\n",
if ( cargc < 2 ) {
#ifdef NEW_LOGGING
- LDAP_LOG(( "config", LDAP_LEVEL_CRIT,
- "%s: line %d: missing limit in \"sizelimit <limit>\" line.\n",
- fname, lineno ));
+ LDAP_LOG( CONFIG, CRIT,
+ "%s: line %d: missing limit in \"sizelimit <limit>\" "
+ "line.\n", fname, lineno, 0 );
#else
Debug( LDAP_DEBUG_ANY,
"%s: line %d: missing limit in \"sizelimit <limit>\" line\n",
if ( rc ) {
#ifdef NEW_LOGGING
- LDAP_LOG(( "config", LDAP_LEVEL_CRIT,
- "%s: line %d: unable "
- "to parse value \"%s\" "
- "in \"sizelimit "
- "<limit>\" line.\n",
- fname, lineno, cargv[i] ));
+ LDAP_LOG( CONFIG, CRIT,
+ "%s: line %d: unable "
+ "to parse value \"%s\" in \"sizelimit "
+ "<limit>\" line.\n", fname, lineno, cargv[i] );
#else
Debug( LDAP_DEBUG_ANY,
"%s: line %d: unable "
if ( cargc < 2 ) {
#ifdef NEW_LOGGING
- LDAP_LOG(( "config", LDAP_LEVEL_CRIT,
- "%s: line %d missing limit in \"timelimit <limit>\" line.\n",
- fname, lineno ));
+ LDAP_LOG( CONFIG, CRIT,
+ "%s: line %d missing limit in \"timelimit <limit>\" "
+ "line.\n", fname, lineno, 0 );
#else
Debug( LDAP_DEBUG_ANY,
"%s: line %d: missing limit in \"timelimit <limit>\" line\n",
if ( rc ) {
#ifdef NEW_LOGGING
- LDAP_LOG(( "config", LDAP_LEVEL_CRIT,
- "%s: line %d: unable "
- "to parse value \"%s\" "
- "in \"timelimit "
- "<limit>\" line.\n",
- fname, lineno, cargv[i] ));
+ LDAP_LOG( CONFIG, CRIT,
+ "%s: line %d: unable to parse value \"%s\" "
+ "in \"timelimit <limit>\" line.\n",
+ fname, lineno, cargv[i] );
#else
Debug( LDAP_DEBUG_ANY,
"%s: line %d: unable "
} else if ( strcasecmp( cargv[0], "limits" ) == 0 ) {
if ( be == NULL ) {
#ifdef NEW_LOGGING
- LDAP_LOG(( "config", LDAP_LEVEL_WARNING,
- "%s: line %d \"limits\" allowed only in database environment.\n",
- fname, lineno ));
+ LDAP_LOG( CONFIG, WARNING,
+ "%s: line %d \"limits\" allowed only in database "
+ "environment.\n", fname, lineno, 0 );
#else
Debug( LDAP_DEBUG_ANY,
"%s: line %d \"limits\" allowed only in database environment.\n%s",
} else if ( strcasecmp( cargv[0], "subordinate" ) == 0 ) {
if ( be == NULL ) {
#ifdef NEW_LOGGING
- LDAP_LOG(( "config", LDAP_LEVEL_INFO, "%s: line %d: "
+ LDAP_LOG( CONFIG, INFO, "%s: line %d: "
"subordinate keyword must appear inside a database "
- "definition.\n", fname, lineno ));
+ "definition.\n", fname, lineno, 0 );
#else
Debug( LDAP_DEBUG_ANY, "%s: line %d: suffix line "
"must appear inside a database definition.\n",
if ( cargc < 2 ) {
#ifdef NEW_LOGGING
- LDAP_LOG(( "config", LDAP_LEVEL_CRIT,
+ LDAP_LOG( CONFIG, CRIT,
"%s: line %d: missing dn in \"suffix <dn>\" line.\n",
- fname, lineno ));
+ fname, lineno, 0 );
#else
Debug( LDAP_DEBUG_ANY, "%s: line %d: "
"missing dn in \"suffix <dn>\" line\n",
} else if ( cargc > 2 ) {
#ifdef NEW_LOGGING
- LDAP_LOG(( "config", LDAP_LEVEL_INFO,
+ LDAP_LOG( CONFIG, INFO,
"%s: line %d: extra cruft after <dn> in \"suffix %s\""
- " line (ignored).\n", fname, lineno, cargv[1] ));
+ " line (ignored).\n", fname, lineno, cargv[1] );
#else
Debug( LDAP_DEBUG_ANY, "%s: line %d: extra cruft "
"after <dn> in \"suffix %s\" line (ignored)\n",
if ( be == NULL ) {
#ifdef NEW_LOGGING
- LDAP_LOG(( "config", LDAP_LEVEL_INFO,
+ LDAP_LOG( CONFIG, INFO,
"%s: line %d: suffix line must appear inside a database "
- "definition.\n", fname, lineno ));
+ "definition.\n", fname, lineno, 0 );
#else
Debug( LDAP_DEBUG_ANY, "%s: line %d: suffix line "
"must appear inside a database definition\n",
/* "cn=Monitor" is reserved for monitoring slap */
} else if ( strcasecmp( cargv[1], SLAPD_MONITOR_DN ) == 0 ) {
#ifdef NEW_LOGGING
- LDAP_LOG(( "config", LDAP_LEVEL_CRIT, "%s: line %d: \""
+ LDAP_LOG( CONFIG, CRIT, "%s: line %d: \""
SLAPD_MONITOR_DN "\" is reserved for monitoring slapd\n",
- fname, lineno ));
+ fname, lineno, 0 );
#else
Debug( LDAP_DEBUG_ANY, "%s: line %d: \""
SLAPD_MONITOR_DN "\" is reserved for monitoring slapd\n",
rc = dnPrettyNormal( NULL, &dn, &pdn, &ndn );
if( rc != LDAP_SUCCESS ) {
#ifdef NEW_LOGGING
- LDAP_LOG(( "config", LDAP_LEVEL_CRIT,
+ LDAP_LOG( CONFIG, CRIT,
"%s: line %d: suffix DN is invalid.\n",
- fname, lineno ));
+ fname, lineno, 0 );
#else
Debug( LDAP_DEBUG_ANY,
"%s: line %d: suffix DN is invalid\n",
tmp_be = select_backend( &ndn, 0, 0 );
if ( tmp_be == be ) {
#ifdef NEW_LOGGING
- LDAP_LOG(( "config", LDAP_LEVEL_INFO,
+ LDAP_LOG( CONFIG, INFO,
"%s: line %d: suffix already served by this backend "
- "(ignored)\n", fname, lineno ));
+ "(ignored)\n", fname, lineno, 0 );
#else
Debug( LDAP_DEBUG_ANY, "%s: line %d: suffix "
"already served by this backend (ignored)\n",
} else if ( tmp_be != NULL ) {
#ifdef NEW_LOGGING
- LDAP_LOG(( "config", LDAP_LEVEL_INFO,
+ LDAP_LOG( CONFIG, INFO,
"%s: line %d: suffix already served by a preceding "
"backend \"%s\"\n", fname, lineno,
- tmp_be->be_suffix[0].bv_val ));
+ tmp_be->be_suffix[0].bv_val );
#else
Debug( LDAP_DEBUG_ANY, "%s: line %d: suffix "
"already served by a preceeding backend \"%s\"\n",
} else if( pdn.bv_len == 0 && default_search_nbase.bv_len ) {
#ifdef NEW_LOGGING
- LDAP_LOG(( "config", LDAP_LEVEL_INFO,
+ LDAP_LOG( CONFIG, INFO,
"%s: line %d: suffix DN empty and default search "
"base provided \"%s\" (assuming okay).\n",
- fname, lineno, default_search_base.bv_val ));
+ fname, lineno, default_search_base.bv_val );
#else
Debug( LDAP_DEBUG_ANY, "%s: line %d: "
"suffix DN empty and default "
if ( cargc < 2 ) {
#ifdef NEW_LOGGING
- LDAP_LOG(( "config", LDAP_LEVEL_CRIT,
+ LDAP_LOG( CONFIG, CRIT,
"%s: line %d: missing alias and aliased_dn in "
"\"suffixAlias <alias> <aliased_dn>\" line.\n",
- fname, lineno ));
+ fname, lineno, 0 );
#else
Debug( LDAP_DEBUG_ANY,
"%s: line %d: missing alias and aliased_dn in "
return( 1 );
} else if ( cargc < 3 ) {
#ifdef NEW_LOGGING
- LDAP_LOG(( "config", LDAP_LEVEL_CRIT,
+ LDAP_LOG( CONFIG, CRIT,
"%s: line %d: missing aliased_dn in "
"\"suffixAlias <alias> <aliased_dn>\" line\n",
- fname, lineno ));
+ fname, lineno, 0 );
#else
Debug( LDAP_DEBUG_ANY,
"%s: line %d: missing aliased_dn in "
} else if ( cargc > 3 ) {
#ifdef NEW_LOGGING
- LDAP_LOG(( "config", LDAP_LEVEL_CRIT,
+ LDAP_LOG( CONFIG, CRIT,
"%s: line %d: extra cruft in suffixAlias line (ignored)\n",
- fname, lineno ));
+ fname, lineno, 0 );
#else
Debug( LDAP_DEBUG_ANY,
"%s: line %d: extra cruft in suffixAlias line (ignored)\n",
if ( be == NULL ) {
#ifdef NEW_LOGGING
- LDAP_LOG(( "config", LDAP_LEVEL_INFO,
- "%s: line %d: suffixAlias line must appear inside a "
- "database definition.\n", fname, lineno ));
+ LDAP_LOG( CONFIG, INFO,
+ "%s: line %d: suffix line must appear inside a database "
+ "definition.\n", fname, lineno, 0 );
#else
Debug( LDAP_DEBUG_ANY,
"%s: line %d: suffixAlias line"
rc = dnPrettyNormal( NULL, &alias, &palias, &nalias );
if( rc != LDAP_SUCCESS ) {
#ifdef NEW_LOGGING
- LDAP_LOG(( "config", LDAP_LEVEL_CRIT,
- "%s: line %d: alias DN is invalid.\n",
- fname, lineno ));
+ LDAP_LOG( CONFIG, CRIT,
+ "%s: line %d: alias DN is invalid.\n", fname, lineno, 0 );
#else
Debug( LDAP_DEBUG_ANY,
"%s: line %d: alias DN is invalid\n",
free( nalias.bv_val );
if ( tmp_be && tmp_be != be ) {
#ifdef NEW_LOGGING
- LDAP_LOG(( "config", LDAP_LEVEL_INFO,
+ LDAP_LOG( CONFIG, INFO,
"%s: line %d: suffixAlias served by a preceeding "
- "backend \"%s\"\n",
- fname, lineno, tmp_be->be_suffix[0].bv_val ));
+ "backend \"%s\"\n", fname, lineno,
+ tmp_be->be_suffix[0].bv_val );
#else
Debug( LDAP_DEBUG_ANY,
"%s: line %d: suffixAlias served by"
rc = dnPrettyNormal( NULL, &aliased, &paliased, &naliased );
if( rc != LDAP_SUCCESS ) {
#ifdef NEW_LOGGING
- LDAP_LOG(( "config", LDAP_LEVEL_CRIT,
- "%s: line %d: aliased DN is invalid.\n",
- fname, lineno ));
+ LDAP_LOG( CONFIG, CRIT,
+ "%s: line %d: aliased DN is invalid.\n", fname, lineno,0 );
#else
Debug( LDAP_DEBUG_ANY,
"%s: line %d: aliased DN is invalid\n",
free( naliased.bv_val );
if ( tmp_be && tmp_be != be ) {
#ifdef NEW_LOGGING
- LDAP_LOG(( "config", LDAP_LEVEL_INFO,
+ LDAP_LOG( CONFIG, INFO,
"%s: line %d: suffixAlias derefs to a different backend "
"a preceeding backend \"%s\"\n",
- fname, lineno, tmp_be->be_suffix[0].bv_val ));
+ fname, lineno, tmp_be->be_suffix[0].bv_val );
#else
Debug( LDAP_DEBUG_ANY,
"%s: line %d: suffixAlias derefs to differnet backend"
int i;
if ( cargc < 2 ) {
#ifdef NEW_LOGGING
- LDAP_LOG(( "config", LDAP_LEVEL_CRIT,
+ LDAP_LOG( CONFIG, CRIT,
"%s: line %d: missing depth in \"maxDerefDepth <depth>\""
- " line\n", fname, lineno ));
+ " line\n", fname, lineno, 0 );
#else
Debug( LDAP_DEBUG_ANY,
"%s: line %d: missing depth in \"maxDerefDepth <depth>\" line\n",
}
if ( be == NULL ) {
#ifdef NEW_LOGGING
- LDAP_LOG(( "config", LDAP_LEVEL_INFO,
+ LDAP_LOG( CONFIG, INFO,
"%s: line %d: depth line must appear inside a database "
- "definition.\n", fname, lineno ));
+ "definition.\n", fname, lineno ,0 );
#else
Debug( LDAP_DEBUG_ANY,
"%s: line %d: depth line must appear inside a database definition.\n",
} else if ((i = atoi(cargv[1])) < 0) {
#ifdef NEW_LOGGING
- LDAP_LOG(( "config", LDAP_LEVEL_INFO,
+ LDAP_LOG( CONFIG, INFO,
"%s: line %d: depth must be positive.\n",
- fname, lineno ));
+ fname, lineno ,0 );
#else
Debug( LDAP_DEBUG_ANY,
"%s: line %d: depth must be positive.\n",
} else if ( strcasecmp( cargv[0], "rootdn" ) == 0 ) {
if ( cargc < 2 ) {
#ifdef NEW_LOGGING
- LDAP_LOG(( "config", LDAP_LEVEL_INFO,
+ LDAP_LOG( CONFIG, INFO,
"%s: line %d: missing dn in \"rootdn <dn>\" line.\n",
- fname, lineno ));
+ fname, lineno ,0 );
#else
Debug( LDAP_DEBUG_ANY,
"%s: line %d: missing dn in \"rootdn <dn>\" line\n",
if ( be == NULL ) {
#ifdef NEW_LOGGING
- LDAP_LOG(( "config", LDAP_LEVEL_INFO,
+ LDAP_LOG( CONFIG, INFO,
"%s: line %d: rootdn line must appear inside a database "
- "definition.\n", fname, lineno ));
+ "definition.\n", fname, lineno ,0 );
#else
Debug( LDAP_DEBUG_ANY,
"%s: line %d: rootdn line must appear inside a database definition.\n",
if( rc != LDAP_SUCCESS ) {
#ifdef NEW_LOGGING
- LDAP_LOG(( "config", LDAP_LEVEL_CRIT,
- "%s: line %d: rootdn DN is invalid.\n",
- fname, lineno ));
+ LDAP_LOG( CONFIG, CRIT,
+ "%s: line %d: rootdn DN is invalid.\n",
+ fname, lineno ,0 );
#else
Debug( LDAP_DEBUG_ANY,
"%s: line %d: rootdn DN is invalid\n",
} else if ( strcasecmp( cargv[0], "rootpw" ) == 0 ) {
if ( cargc < 2 ) {
#ifdef NEW_LOGGING
- LDAP_LOG(( "config", LDAP_LEVEL_CRIT,
+ LDAP_LOG( CONFIG, CRIT,
"%s: line %d: missing passwd in \"rootpw <passwd>\""
- " line\n", fname, lineno ));
+ " line\n", fname, lineno ,0 );
#else
Debug( LDAP_DEBUG_ANY, "%s: line %d: "
"missing passwd in \"rootpw <passwd>\" line\n",
if ( be == NULL ) {
#ifdef NEW_LOGGING
- LDAP_LOG(( "config", LDAP_LEVEL_INFO, "%s: line %d: "
+ LDAP_LOG( CONFIG, INFO, "%s: line %d: "
"rootpw line must appear inside a database "
- "definition.\n", fname, lineno ));
+ "definition.\n", fname, lineno ,0 );
#else
Debug( LDAP_DEBUG_ANY, "%s: line %d: "
"rootpw line must appear inside a database "
if( tmp_be != be ) {
#ifdef NEW_LOGGING
- LDAP_LOG(( "config", LDAP_LEVEL_INFO,
+ LDAP_LOG( CONFIG, INFO,
"%s: line %d: "
- "rootpw can only be set when rootdn is under suffix\n"
- fname, lineno ));
+ "rootpw can only be set when rootdn is under suffix\n",
+ fname, lineno, "" );
#else
Debug( LDAP_DEBUG_ANY, "%s: line %d: "
"rootpw can only be set when rootdn is under suffix\n",
} else if ( strcasecmp( cargv[0], "readonly" ) == 0 ) {
if ( cargc < 2 ) {
#ifdef NEW_LOGGING
- LDAP_LOG(( "config", LDAP_LEVEL_CRIT,
- "%s: line %d: missing on|off in \"readonly <on|off>\" line.\n",
- fname, lineno ));
+ LDAP_LOG( CONFIG, CRIT,
+ "%s: line %d: missing on|off in \"readonly <on|off>\" "
+ "line.\n", fname, lineno ,0 );
#else
Debug( LDAP_DEBUG_ANY,
"%s: line %d: missing on|off in \"readonly <on|off>\" line\n",
if ( be != NULL ) {
#ifdef NEW_LOGGING
- LDAP_LOG(( "config", LDAP_LEVEL_INFO,
+ LDAP_LOG( CONFIG, INFO,
"%s: line %d: allow line must appear prior to "
- "database definitions.\n", fname, lineno ));
+ "database definitions.\n", fname, lineno ,0 );
#else
Debug( LDAP_DEBUG_ANY,
"%s: line %d: allow line must appear prior to database definitions\n",
if ( cargc < 2 ) {
#ifdef NEW_LOGGING
- LDAP_LOG(( "config", LDAP_LEVEL_CRIT,
+ LDAP_LOG( CONFIG, CRIT,
"%s: line %d: missing feature(s) in \"allow <features>\""
- " line\n", fname, lineno ));
+ " line\n", fname, lineno ,0 );
#else
Debug( LDAP_DEBUG_ANY,
"%s: line %d: missing feature(s) in \"allow <features>\" line\n",
} else if( strcasecmp( cargv[i], "none" ) != 0 ) {
#ifdef NEW_LOGGING
- LDAP_LOG(( "config", LDAP_LEVEL_CRIT,
+ LDAP_LOG( CONFIG, CRIT,
"%s: line %d: unknown feature %s in "
"\"allow <features>\" line.\n",
- fname, lineno, cargv[1] ));
+ fname, lineno, cargv[1] );
#else
Debug( LDAP_DEBUG_ANY,
"%s: line %d: unknown feature %s in \"allow <features>\" line\n",
if ( be != NULL ) {
#ifdef NEW_LOGGING
- LDAP_LOG(( "config", LDAP_LEVEL_INFO,
+ LDAP_LOG( CONFIG, INFO,
"%s: line %d: disallow line must appear prior to "
- "database definitions.\n", fname, lineno ));
+ "database definitions.\n", fname, lineno ,0 );
#else
Debug( LDAP_DEBUG_ANY,
"%s: line %d: disallow line must appear prior to database definitions\n",
if ( cargc < 2 ) {
#ifdef NEW_LOGGING
- LDAP_LOG(( "config", LDAP_LEVEL_CRIT,
- "%s: line %d: missing feature(s) in \"disallow <features>\""
- " line.\n", fname, lineno ));
+ LDAP_LOG( CONFIG, CRIT,
+ "%s: line %d: missing feature(s) in \"disallow <features>\""
+ " line.\n", fname, lineno ,0 );
#else
Debug( LDAP_DEBUG_ANY,
"%s: line %d: missing feature(s) in \"disallow <features>\" line\n",
} else if( strcasecmp( cargv[i], "none" ) != 0 ) {
#ifdef NEW_LOGGING
- LDAP_LOG(( "config", LDAP_LEVEL_CRIT,
+ LDAP_LOG( CONFIG, CRIT,
"%s: line %d: unknown feature %s in "
"\"disallow <features>\" line.\n",
- fname, lineno, cargv[i] ));
+ fname, lineno, cargv[i] );
#else
Debug( LDAP_DEBUG_ANY,
"%s: line %d: unknown feature %s in \"disallow <features>\" line\n",
if ( cargc < 2 ) {
#ifdef NEW_LOGGING
- LDAP_LOG(( "config", LDAP_LEVEL_CRIT,
+ LDAP_LOG( CONFIG, CRIT,
"%s: line %d: missing feature(s) in "
- "\"require <features>\" line.\n", fname, lineno ));
+ "\"require <features>\" line.\n", fname, lineno ,0 );
#else
Debug( LDAP_DEBUG_ANY,
"%s: line %d: missing feature(s) in \"require <features>\" line\n",
} else if( strcasecmp( cargv[i], "none" ) != 0 ) {
#ifdef NEW_LOGGING
- LDAP_LOG(( "config", LDAP_LEVEL_CRIT,
+ LDAP_LOG( CONFIG, CRIT,
"%s: line %d: unknown feature %s in "
- "\"require <features>\" line.\n",
- fname, lineno ));
+ "\"require <features>\" line.\n",
+ fname, lineno , cargv[i] );
#else
Debug( LDAP_DEBUG_ANY,
"%s: line %d: unknown feature %s in \"require <features>\" line\n",
if ( cargc < 2 ) {
#ifdef NEW_LOGGING
- LDAP_LOG(( "config", LDAP_LEVEL_CRIT,
- "%s: line %d: missing factor(s) in \"security <factors>\""
- " line.\n", fname, lineno ));
+ LDAP_LOG( CONFIG, CRIT,
+ "%s: line %d: missing factor(s) in \"security <factors>\""
+ " line.\n", fname, lineno ,0 );
#else
Debug( LDAP_DEBUG_ANY,
"%s: line %d: missing factor(s) in \"security <factors>\" line\n",
} else {
#ifdef NEW_LOGGING
- LDAP_LOG(( "config", LDAP_LEVEL_CRIT,
+ LDAP_LOG( CONFIG, CRIT,
"%s: line %d: unknown factor %S in "
"\"security <factors>\" line.\n",
- fname, lineno, cargv[1] ));
+ fname, lineno, cargv[1] );
#else
Debug( LDAP_DEBUG_ANY,
"%s: line %d: unknown factor %s in \"security <factors>\" line\n",
} else if ( strcasecmp( cargv[0], "referral" ) == 0 ) {
if ( cargc < 2 ) {
#ifdef NEW_LOGGING
- LDAP_LOG(( "config", LDAP_LEVEL_CRIT,
- "%s: line %d: missing URL in \"referral <URL>\""
- " line.\n", fname, lineno ));
+ LDAP_LOG( CONFIG, CRIT,
+ "%s: line %d: missing URL in \"referral <URL>\""
+ " line.\n", fname, lineno , 0 );
#else
Debug( LDAP_DEBUG_ANY,
"%s: line %d: missing URL in \"referral <URL>\" line\n",
if( validate_global_referral( cargv[1] ) ) {
#ifdef NEW_LOGGING
- LDAP_LOG(( "config", LDAP_LEVEL_CRIT, "%s: line %d: "
- "invalid URL (%s) in \"referral\" line.\n",
- fname, lineno, cargv[1] ));
+ LDAP_LOG( CONFIG, CRIT,
+ "%s: line %d: invalid URL (%s) in \"referral\" line.\n",
+ fname, lineno, cargv[1] );
#else
Debug( LDAP_DEBUG_ANY, "%s: line %d: "
"invalid URL (%s) in \"referral\" line.\n",
FILE *logfile;
if ( cargc < 2 ) {
#ifdef NEW_LOGGING
- LDAP_LOG(( "config", LDAP_LEVEL_CRIT,
- "%s: line %d: Error in logfile directive, "
- "\"logfile <filename>\"\n", fname, lineno ));
+ LDAP_LOG( CONFIG, CRIT,
+ "%s: line %d: Error in logfile directive, "
+ "\"logfile <filename>\"\n", fname, lineno , 0 );
#else
Debug( LDAP_DEBUG_ANY,
"%s: line %d: Error in logfile directive, \"logfile filename\"\n",
return( 1 );
}
logfile = fopen( cargv[1], "w" );
- if ( logfile != NULL ) lutil_debug_file( logfile );
+ if ( logfile != NULL ) lutil_debug_file( logfile );
#endif
/* start of a new database definition */
int level;
if ( cargc < 3 ) {
#ifdef NEW_LOGGING
- LDAP_LOG(( "config", LDAP_LEVEL_CRIT,
+ LDAP_LOG( CONFIG, CRIT,
"%s: line %d: Error in debug directive, "
- "\"debug <subsys> <level>\"\n", fname, lineno ));
+ "\"debug <subsys> <level>\"\n", fname, lineno , 0 );
#else
Debug( LDAP_DEBUG_ANY,
"%s: line %d: Error in debug directive, \"debug subsys level\"\n",
} else {
#ifdef NEW_LOGGING
- LDAP_LOG(( "config", LDAP_LEVEL_INFO,
- "%s: line %d: old objectclass format not supported\n",
- fname, lineno ));
+ LDAP_LOG( CONFIG, INFO,
+ "%s: line %d: old objectclass format not supported\n",
+ fname, lineno , 0 );
#else
Debug( LDAP_DEBUG_ANY,
"%s: line %d: old objectclass format not supported.\n",
} else {
#ifdef NEW_LOGGING
- LDAP_LOG(( "config", LDAP_LEVEL_INFO,
- "%s: line %d: old attribute type format not supported.\n",
- fname, lineno ));
+ LDAP_LOG( CONFIG, INFO,
+ "%s: line %d: old attribute type format not supported.\n",
+ fname, lineno , 0 );
#else
Debug( LDAP_DEBUG_ANY,
"%s: line %d: old attribute type format not supported.\n",
} else if ( strcasecmp( cargv[0], "schemacheck" ) == 0 ) {
if ( cargc < 2 ) {
#ifdef NEW_LOGGING
- LDAP_LOG(( "config", LDAP_LEVEL_CRIT,
- "%s: line %d: missing on|off in "
- "\"schemacheck <on|off>\" line.\n",
- fname, lineno ));
+ LDAP_LOG( CONFIG, CRIT,
+ "%s: line %d: missing on|off in \"schemacheck <on|off>\""
+ " line.\n", fname, lineno , 0 );
#else
Debug( LDAP_DEBUG_ANY,
"%s: line %d: missing on|off in \"schemacheck <on|off>\" line\n",
}
if ( strcasecmp( cargv[1], "off" ) == 0 ) {
#ifdef NEW_LOGGING
- LDAP_LOG(( "config", LDAP_LEVEL_CRIT,
- "%s: line %d: schema checking disabled! your mileage may vary!\n",
- fname, lineno ));
+ LDAP_LOG( CONFIG, CRIT,
+ "%s: line %d: schema checking disabled! your mileage may "
+ "vary!\n", fname, lineno , 0 );
#else
Debug( LDAP_DEBUG_ANY,
"%s: line %d: schema checking disabled! your mileage may vary!\n",
} else if ( strcasecmp( cargv[0], "loglevel" ) == 0 ) {
if ( cargc < 2 ) {
#ifdef NEW_LOGGING
- LDAP_LOG(( "config", LDAP_LEVEL_CRIT,
- "%s: line %d: missing level in \"loglevel <level>\""
- " line.\n", fname, lineno ));
+ LDAP_LOG( CONFIG, CRIT,
+ "%s: line %d: missing level in \"loglevel <level>\""
+ " line.\n", fname, lineno , 0 );
#else
Debug( LDAP_DEBUG_ANY,
"%s: line %d: missing level in \"loglevel <level>\" line\n",
} else if ( strcasecmp( cargv[0], "replica" ) == 0 ) {
if ( cargc < 2 ) {
#ifdef NEW_LOGGING
- LDAP_LOG(( "config", LDAP_LEVEL_CRIT,
- "%s: line %d: missing host in \"replica "
- " <host[:port]\" line\n", fname, lineno ));
+ LDAP_LOG( CONFIG, CRIT,
+ "%s: line %d: missing host in \"replica "
+ " <host[:port]\" line\n", fname, lineno , 0 );
#else
Debug( LDAP_DEBUG_ANY,
"%s: line %d: missing host in \"replica <host[:port]>\" line\n",
}
if ( be == NULL ) {
#ifdef NEW_LOGGING
- LDAP_LOG(( "config", LDAP_LEVEL_INFO,
- "%s: line %d: replica line must appear inside "
- "a database definition.\n", fname, lineno ));
+ LDAP_LOG( CONFIG, INFO,
+ "%s: line %d: replica line must appear inside "
+ "a database definition.\n", fname, lineno, 0);
#else
Debug( LDAP_DEBUG_ANY,
"%s: line %d: replica line must appear inside a database definition\n",
}
if ( i == cargc ) {
#ifdef NEW_LOGGING
- LDAP_LOG(( "config", LDAP_LEVEL_INFO,
- "%s: line %d: missing host in \"replica\" line\n",
- fname, lineno ));
+ LDAP_LOG( CONFIG, INFO,
+ "%s: line %d: missing host in \"replica\" line\n",
+ fname, lineno , 0 );
#else
Debug( LDAP_DEBUG_ANY,
"%s: line %d: missing host in \"replica\" line\n",
} else if ( nr == -1 ) {
#ifdef NEW_LOGGING
- LDAP_LOG(( "config", LDAP_LEVEL_INFO,
+ LDAP_LOG( CONFIG, INFO,
"%s: line %d: unable to add"
- " replica \"%s\"\n",
+ " replica \"%s\"\n",
fname, lineno,
- cargv[i] + 5 ));
+ cargv[i] + 5 );
#else
Debug( LDAP_DEBUG_ANY,
"%s: line %d: unable to add replica \"%s\"\n",
switch ( add_replica_suffix( be, nr, cargv[i] + 7 ) ) {
case 1:
#ifdef NEW_LOGGING
- LDAP_LOG(( "config", LDAP_LEVEL_INFO,
- "%s: line %d: suffix \"%s\" in \"replica\" line is not valid for backend (ignored)\n",
- fname, lineno, cargv[i] + 7 ));
+ LDAP_LOG( CONFIG, INFO,
+ "%s: line %d: suffix \"%s\" in \"replica\""
+ " line is not valid for backend(ignored)\n",
+ fname, lineno, cargv[i] + 7 );
#else
Debug( LDAP_DEBUG_ANY,
"%s: line %d: suffix \"%s\" in \"replica\" line is not valid for backend (ignored)\n",
case 2:
#ifdef NEW_LOGGING
- LDAP_LOG(( "config", LDAP_LEVEL_INFO,
- "%s: line %d: unable to normalize suffix in \"replica\" line (ignored)\n",
- fname, lineno ));
+ LDAP_LOG( CONFIG, INFO,
+ "%s: line %d: unable to normalize suffix"
+ " in \"replica\" line (ignored)\n",
+ fname, lineno , 0 );
#else
Debug( LDAP_DEBUG_ANY,
"%s: line %d: unable to normalize suffix in \"replica\" line (ignored)\n",
if ( add_replica_attrs( be, nr, arg + 1, exclude ) ) {
#ifdef NEW_LOGGING
- LDAP_LOG(( "config", LDAP_LEVEL_INFO,
- "%s: line %d: attribute \"%s\" in \"replica\" line is unknown\n",
- fname, lineno, arg + 1 ));
+ LDAP_LOG( CONFIG, INFO,
+ "%s: line %d: attribute \"%s\" in "
+ "\"replica\" line is unknown\n",
+ fname, lineno, arg + 1 );
#else
Debug( LDAP_DEBUG_ANY,
"%s: line %d: attribute \"%s\" in \"replica\" line is unknown\n",
} else if ( strcasecmp( cargv[0], "updatedn" ) == 0 ) {
if ( cargc < 2 ) {
#ifdef NEW_LOGGING
- LDAP_LOG(( "config", LDAP_LEVEL_CRIT,
- "%s: line %d: missing dn in \"updatedn <dn>\""
- " line.\n", fname, lineno ));
+ LDAP_LOG( CONFIG, CRIT,
+ "%s: line %d: missing dn in \"updatedn <dn>\""
+ " line.\n", fname, lineno , 0 );
#else
Debug( LDAP_DEBUG_ANY,
"%s: line %d: missing dn in \"updatedn <dn>\" line\n",
}
if ( be == NULL ) {
#ifdef NEW_LOGGING
- LDAP_LOG(( "config", LDAP_LEVEL_INFO,
- "%s: line %d: updatedn line must appear inside "
- "a database definition\n",
- fname, lineno ));
+ LDAP_LOG( CONFIG, INFO,
+ "%s: line %d: updatedn line must appear inside "
+ "a database definition\n",
+ fname, lineno , 0 );
#else
Debug( LDAP_DEBUG_ANY,
"%s: line %d: updatedn line must appear inside a database definition\n",
rc = dnNormalize2( NULL, &dn, &be->be_update_ndn );
if( rc != LDAP_SUCCESS ) {
#ifdef NEW_LOGGING
- LDAP_LOG(( "config", LDAP_LEVEL_CRIT,
+ LDAP_LOG( CONFIG, CRIT,
"%s: line %d: updatedn DN is invalid.\n",
- fname, lineno ));
+ fname, lineno , 0 );
#else
Debug( LDAP_DEBUG_ANY,
"%s: line %d: updatedn DN is invalid\n",
} else if ( strcasecmp( cargv[0], "updateref" ) == 0 ) {
if ( cargc < 2 ) {
#ifdef NEW_LOGGING
- LDAP_LOG(( "config", LDAP_LEVEL_CRIT, "%s: line %d: "
+ LDAP_LOG( CONFIG, CRIT, "%s: line %d: "
"missing url in \"updateref <ldapurl>\" line.\n",
- fname, lineno ));
+ fname, lineno , 0 );
#else
Debug( LDAP_DEBUG_ANY, "%s: line %d: "
"missing url in \"updateref <ldapurl>\" line\n",
}
if ( be == NULL ) {
#ifdef NEW_LOGGING
- LDAP_LOG(( "config", LDAP_LEVEL_INFO, "%s: line %d: updateref"
+ LDAP_LOG( CONFIG, INFO, "%s: line %d: updateref"
" line must appear inside a database definition\n",
- fname, lineno ));
+ fname, lineno , 0 );
#else
Debug( LDAP_DEBUG_ANY, "%s: line %d: updateref"
" line must appear inside a database definition\n",
} else if ( !be->be_update_ndn.bv_len ) {
#ifdef NEW_LOGGING
- LDAP_LOG(( "config", LDAP_LEVEL_INFO, "%s: line %d: "
+ LDAP_LOG( CONFIG, INFO, "%s: line %d: "
"updateref line must come after updatedn.\n",
- fname, lineno ));
+ fname, lineno , 0 );
#else
Debug( LDAP_DEBUG_ANY, "%s: line %d: "
"updateref line must after updatedn.\n",
if( validate_global_referral( cargv[1] ) ) {
#ifdef NEW_LOGGING
- LDAP_LOG(( "config", LDAP_LEVEL_CRIT, "%s: line %d: "
+ LDAP_LOG( CONFIG, CRIT, "%s: line %d: "
"invalid URL (%s) in \"updateref\" line.\n",
- fname, lineno, cargv[1] ));
+ fname, lineno, cargv[1] );
#else
Debug( LDAP_DEBUG_ANY, "%s: line %d: "
"invalid URL (%s) in \"updateref\" line.\n",
} else if ( strcasecmp( cargv[0], "replogfile" ) == 0 ) {
if ( cargc < 2 ) {
#ifdef NEW_LOGGING
- LDAP_LOG(( "config", LDAP_LEVEL_CRIT,
- "%s: line %d: missing filename in \"replogfile <filename>\""
- " line.\n", fname, lineno ));
+ LDAP_LOG( CONFIG, CRIT,
+ "%s: line %d: missing filename in \"replogfile <filename>\""
+ " line.\n", fname, lineno , 0 );
#else
Debug( LDAP_DEBUG_ANY,
"%s: line %d: missing filename in \"replogfile <filename>\" line\n",
} else if ( strcasecmp( cargv[0], "rootDSE" ) == 0) {
if ( cargc < 2 ) {
#ifdef NEW_LOGGING
- LDAP_LOG(( "config", LDAP_LEVEL_CRIT, "%s: line %d: "
+ LDAP_LOG( CONFIG, CRIT, "%s: line %d: "
"missing filename in \"rootDSE <filename>\" line.\n",
- fname, lineno ));
+ fname, lineno , 0 );
#else
Debug( LDAP_DEBUG_ANY, "%s: line %d: "
"missing filename in \"rootDSE <filename>\" line.\n",
if( read_root_dse_file( cargv[1] ) ) {
#ifdef NEW_LOGGING
- LDAP_LOG(( "config", LDAP_LEVEL_CRIT, "%s: line %d: "
+ LDAP_LOG( CONFIG, CRIT, "%s: line %d: "
"could not read \"rootDSE <filename>\" line.\n",
- fname, lineno ));
+ fname, lineno , 0 );
#else
Debug( LDAP_DEBUG_ANY, "%s: line %d: "
"could not read \"rootDSE <filename>\" line\n",
} else if ( strcasecmp( cargv[0], "lastmod" ) == 0 ) {
if ( cargc < 2 ) {
#ifdef NEW_LOGGING
- LDAP_LOG(( "config", LDAP_LEVEL_CRIT,
+ LDAP_LOG( CONFIG, CRIT,
"%s: line %d: missing on|off in \"lastmod <on|off>\""
- " line.\n", fname, lineno ));
+ " line.\n", fname, lineno , 0 );
#else
Debug( LDAP_DEBUG_ANY,
"%s: line %d: missing on|off in \"lastmod <on|off>\" line\n",
int i;
if ( cargc < 2 ) {
#ifdef NEW_LOGGING
- LDAP_LOG(( "config", LDAP_LEVEL_CRIT,
- "%s: line %d: missing timeout value in "
- "\"idletimeout <seconds>\" line.\n", fname, lineno ));
+ LDAP_LOG( CONFIG, CRIT,
+ "%s: line %d: missing timeout value in "
+ "\"idletimeout <seconds>\" line.\n", fname, lineno , 0 );
#else
Debug( LDAP_DEBUG_ANY,
"%s: line %d: missing timeout value in \"idletimeout <seconds>\" line\n",
if( i < 0 ) {
#ifdef NEW_LOGGING
- LDAP_LOG(( "config", LDAP_LEVEL_CRIT,
- "%s: line %d: timeout value (%d) invalid "
- "\"idletimeout <seconds>\" line.\n",
- fname, lineno, i ));
+ LDAP_LOG( CONFIG, CRIT,
+ "%s: line %d: timeout value (%d) invalid "
+ "\"idletimeout <seconds>\" line.\n", fname, lineno, i );
#else
Debug( LDAP_DEBUG_ANY,
"%s: line %d: timeout value (%d) invalid \"idletimeout <seconds>\" line\n",
} else if ( strcasecmp( cargv[0], "include" ) == 0 ) {
if ( cargc < 2 ) {
#ifdef NEW_LOGGING
- LDAP_LOG(( "config", LDAP_LEVEL_CRIT,
- "%s: line %d: missing filename in \"include "
- "<filename>\" line.\n", fname, lineno ));
+ LDAP_LOG( CONFIG, CRIT,
+ "%s: line %d: missing filename in \"include "
+ "<filename>\" line.\n", fname, lineno , 0 );
#else
Debug( LDAP_DEBUG_ANY,
"%s: line %d: missing filename in \"include <filename>\" line\n",
} else if ( strcasecmp( cargv[0], "srvtab" ) == 0 ) {
if ( cargc < 2 ) {
#ifdef NEW_LOGGING
- LDAP_LOG(( "config", LDAP_LEVEL_CRIT,
- "%s: line %d: missing filename in \"srvtab "
- "<filename>\" line.\n", fname, lineno ));
+ LDAP_LOG( CONFIG, CRIT,
+ "%s: line %d: missing filename in \"srvtab "
+ "<filename>\" line.\n", fname, lineno , 0 );
#else
Debug( LDAP_DEBUG_ANY,
"%s: line %d: missing filename in \"srvtab <filename>\" line\n",
} else if (strcasecmp( cargv[0], "moduleload") == 0 ) {
if ( cargc < 2 ) {
#ifdef NEW_LOGGING
- LDAP_LOG(( "config", LDAP_LEVEL_INFO,
- "%s: line %d: missing filename in \"moduleload "
- "<filename>\" line.\n", fname, lineno ));
+ LDAP_LOG( CONFIG, INFO,
+ "%s: line %d: missing filename in \"moduleload "
+ "<filename>\" line.\n", fname, lineno , 0 );
#else
Debug( LDAP_DEBUG_ANY,
"%s: line %d: missing filename in \"moduleload <filename>\" line\n",
}
if (module_load(cargv[1], cargc - 2, (cargc > 2) ? cargv + 2 : NULL)) {
#ifdef NEW_LOGGING
- LDAP_LOG(( "config", LDAP_LEVEL_CRIT,
- "%s: line %d: failed to load or initialize module %s\n",
- fname, lineno, cargv[1] ));
+ LDAP_LOG( CONFIG, CRIT,
+ "%s: line %d: failed to load or initialize module %s\n",
+ fname, lineno, cargv[1] );
#else
Debug( LDAP_DEBUG_ANY,
"%s: line %d: failed to load or initialize module %s\n",
} else if (strcasecmp( cargv[0], "modulepath") == 0 ) {
if ( cargc != 2 ) {
#ifdef NEW_LOGGING
- LDAP_LOG(( "config", LDAP_LEVEL_INFO,
- "%s: line %d: missing path in \"modulepath <path>\""
- " line\n", fname, lineno ));
+ LDAP_LOG( CONFIG, INFO,
+ "%s: line %d: missing path in \"modulepath <path>\""
+ " line\n", fname, lineno , 0 );
#else
Debug( LDAP_DEBUG_ANY,
"%s: line %d: missing path in \"modulepath <path>\" line\n",
}
if (module_path( cargv[1] )) {
#ifdef NEW_LOGGING
- LDAP_LOG(( "config", LDAP_LEVEL_CRIT,
- "%s: line %d: failed to set module search path to %s.\n",
- fname, lineno, cargv[1] ));
+ LDAP_LOG( CONFIG, CRIT,
+ "%s: line %d: failed to set module search path to %s.\n",
+ fname, lineno, cargv[1] );
#else
Debug( LDAP_DEBUG_ANY,
"%s: line %d: failed to set module search path to %s\n",
#ifdef SLAPD_RLOOKUPS
if ( cargc < 2 ) {
#ifdef NEW_LOGGING
- LDAP_LOG(( "config", LDAP_LEVEL_INFO,
- "%s: line %d: reverse-lookup: "
- "missing \"on\" or \"off\"\n",
- fname, lineno ));
+ LDAP_LOG( CONFIG, INFO,
+ "%s: line %d: reverse-lookup: missing \"on\" or \"off\"\n",
+ fname, lineno , 0 );
#else
Debug( LDAP_DEBUG_ANY,
"%s: line %d: reverse-lookup: missing \"on\" or \"off\"\n",
use_reverse_lookup = 0;
} else {
#ifdef NEW_LOGGING
- LDAP_LOG(( "config", LDAP_LEVEL_INFO,
- "%s: line %d: reverse-lookup: "
- "must be \"on\" (default) "
- "or \"off\"\n",
- fname, lineno ));
+ LDAP_LOG( CONFIG, INFO,
+ "%s: line %d: reverse-lookup: "
+ "must be \"on\" (default) or \"off\"\n", fname, lineno, 0 );
#else
Debug( LDAP_DEBUG_ANY,
"%s: line %d: reverse-lookup: must be \"on\" (default) or \"off\"\n",
#else /* !SLAPD_RLOOKUPS */
#ifdef NEW_LOGGING
- LDAP_LOG(( "config", LDAP_LEVEL_INFO,
- "%s: line %d: reverse lookups "
- "are not configured (ignored).\n",
- fname, lineno ));
+ LDAP_LOG( CONFIG, INFO,
+ "%s: line %d: reverse lookups "
+ "are not configured (ignored).\n", fname, lineno , 0 );
#else
Debug( LDAP_DEBUG_ANY,
"%s: line %d: reverse lookups are not configured (ignored).\n",
if ( bi != NULL ) {
if ( bi->bi_config == 0 ) {
#ifdef NEW_LOGGING
- LDAP_LOG(( "config", LDAP_LEVEL_INFO,
- "%s: line %d: unknown directive \"%s\" inside "
- "backend info definition (ignored).\n",
- fname, lineno, cargv[0] ));
+ LDAP_LOG( CONFIG, INFO,
+ "%s: line %d: unknown directive \"%s\" inside "
+ "backend info definition (ignored).\n",
+ fname, lineno, cargv[0] );
#else
Debug( LDAP_DEBUG_ANY,
"%s: line %d: unknown directive \"%s\" inside backend info definition (ignored)\n",
} else if ( be != NULL ) {
if ( be->be_config == 0 ) {
#ifdef NEW_LOGGING
- LDAP_LOG(( "config", LDAP_LEVEL_INFO,
- "%s: line %d: uknown directive \"%s\" inside "
- "backend database definition (ignored).\n",
- fname, lineno, cargv[0] ));
+ LDAP_LOG( CONFIG, INFO,
+ "%s: line %d: uknown directive \"%s\" inside "
+ "backend database definition (ignored).\n",
+ fname, lineno, cargv[0] );
#else
Debug( LDAP_DEBUG_ANY,
"%s: line %d: unknown directive \"%s\" inside backend database definition (ignored)\n",
}
} else {
#ifdef NEW_LOGGING
- LDAP_LOG(( "config", LDAP_LEVEL_INFO,
- "%s: line %d: unknown directive \"%s\" outside backend "
- "info and database definitions (ignored).\n",
- fname, lineno, cargv[0] ));
+ LDAP_LOG( CONFIG, INFO,
+ "%s: line %d: unknown directive \"%s\" outside backend "
+ "info and database definitions (ignored).\n",
+ fname, lineno, cargv[0] );
#else
Debug( LDAP_DEBUG_ANY,
"%s: line %d: unknown directive \"%s\" outside backend info and database definitions (ignored)\n",
token = strtok_quote( line, " \t" );
logline = line;
- if ( token &&
- (strcasecmp( token, "rootpw" ) == 0 ||
- strcasecmp( token, "replica" ) == 0 || /* contains "credentials" */
- strcasecmp( token, "bindpw" ) == 0 || /* used in back-ldap */
- strcasecmp( token, "pseudorootpw" ) == 0 || /* used in back-meta */
- strcasecmp( token, "dbpasswd" ) == 0 ) ) /* used in back-sql */
- sprintf( logline = logbuf, "%s ***", token );
- if ( strtok_quote_ptr )
+
+ if ( token && ( strcasecmp( token, "rootpw" ) == 0 ||
+ strcasecmp( token, "replica" ) == 0 || /* contains "credentials" */
+ strcasecmp( token, "bindpw" ) == 0 || /* used in back-ldap */
+ strcasecmp( token, "pseudorootpw" ) == 0 || /* used in back-meta */
+ strcasecmp( token, "dbpasswd" ) == 0 ) ) /* used in back-sql */
+ {
+ snprintf( logline = logbuf, sizeof logbuf, "%s ***", token );
+ }
+
+ if ( strtok_quote_ptr ) {
*strtok_quote_ptr = ' ';
+ }
+
#ifdef NEW_LOGGING
- LDAP_LOG(( "config", LDAP_LEVEL_DETAIL1,
- "line %d (%s)\n", lineno, logline ));
+ LDAP_LOG( CONFIG, DETAIL1, "line %d (%s)\n", lineno, logline , 0 );
#else
Debug( LDAP_DEBUG_CONFIG, "line %d (%s)\n", lineno, logline, 0 );
#endif
- if ( strtok_quote_ptr )
+
+ if ( strtok_quote_ptr ) {
*strtok_quote_ptr = '\0';
+ }
for ( ; token != NULL; token = strtok_quote( NULL, " \t" ) ) {
if ( cargc == cargv_size - 1 ) {
sizeof(*cargv) );
if ( tmp == NULL ) {
#ifdef NEW_LOGGING
- LDAP_LOG(( "config", LDAP_LEVEL_ERR,
- "line %d: out of memory\n",
- lineno ));
+ LDAP_LOG( CONFIG, ERR, "line %d: out of memory\n", lineno, 0,0 );
#else
Debug( LDAP_DEBUG_ANY,
"line %d: out of memory\n",
static char buf[BUFSIZ];
static char *line;
-static int lmax, lcur;
-
-#define CATLINE( buf ) { \
- int len; \
- len = strlen( buf ); \
- while ( lcur + len + 1 > lmax ) { \
- lmax += BUFSIZ; \
- line = (char *) ch_realloc( line, lmax ); \
- } \
- strcpy( line + lcur, buf ); \
- lcur += len; \
-}
+static size_t lmax, lcur;
+
+#define CATLINE( buf ) \
+ do { \
+ size_t len = strlen( buf ); \
+ while ( lcur + len + 1 > lmax ) { \
+ lmax += BUFSIZ; \
+ line = (char *) ch_realloc( line, lmax ); \
+ } \
+ strcpy( line + lcur, buf ); \
+ lcur += len; \
+ } while( 0 )
static char *
fp_getline( FILE *fp, int *lineno )
err = ucdata_load( path ? path : SLAPD_DEFAULT_UCDATA, UCDATA_ALL );
if ( err ) {
#ifdef NEW_LOGGING
- LDAP_LOG(( "config", LDAP_LEVEL_CRIT,
- "load_ucdata: Error %d loading ucdata.\n", err ));
+ LDAP_LOG( CONFIG, CRIT,
+ "load_ucdata: Error %d loading ucdata.\n", err, 0,0 );
#else
Debug( LDAP_DEBUG_ANY, "error loading ucdata (error %d)\n",
err, 0, 0 );
if( connections != NULL) {
#ifdef NEW_LOGGING
- LDAP_LOG(( "connection", LDAP_LEVEL_INFO,
- "connections_init: already initialized.\n" ));
+ LDAP_LOG( CONNECTION, INFO,
+ "connections_init: already initialized.\n", 0, 0, 0 );
#else
Debug( LDAP_DEBUG_ANY, "connections_init: already initialized.\n",
0, 0, 0 );
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) ));
+ LDAP_LOG( CONNECTION, ERR,
+ "connections_init: allocation (%d * %ld) of connection "
+ "array failed\n", dtblsize, (long) sizeof(Connection), 0 );
#else
Debug( LDAP_DEBUG_ANY,
"connections_init: allocation (%d*%ld) of connection array failed\n",
if( connections == NULL) {
#ifdef NEW_LOGGING
- LDAP_LOG(( "connection", LDAP_LEVEL_INFO,
- "connections_destroy: nothing to destroy.\n"));
+ LDAP_LOG( CONNECTION, INFO,
+ "connections_destroy: nothing to destroy.\n", 0, 0, 0 );
#else
Debug( LDAP_DEBUG_ANY, "connections_destroy: nothing to destroy.\n",
0, 0, 0 );
Connection *c;
#ifdef NEW_LOGGING
- LDAP_LOG(( "connection", LDAP_LEVEL_ENTRY,
- "connection_get: socket %ld\n", (long)s ));
+ LDAP_LOG( CONNECTION, ENTRY, "connection_get: socket %ld\n", (long)s, 0, 0 );
#else
Debug( LDAP_DEBUG_ARGS,
"connection_get(%ld)\n",
assert( sd == AC_SOCKET_INVALID );
#ifdef NEW_LOGGING
- LDAP_LOG(( "connection", LDAP_LEVEL_ARGS,
- "connection_get: connection %d not used\n", s ));
+ LDAP_LOG( CONNECTION, ARGS,
+ "connection_get: connection %d not used\n", s, 0, 0 );
#else
Debug( LDAP_DEBUG_TRACE,
"connection_get(%d): connection not used\n",
}
#ifdef NEW_LOGGING
- LDAP_LOG(( "connection", LDAP_LEVEL_RESULTS,
- "connection_get: get for %d got connid %lu\n", s, c->c_connid ));
+ LDAP_LOG( CONNECTION, RESULTS,
+ "connection_get: get for %d got connid %lu\n", s, c->c_connid, 0 );
#else
Debug( LDAP_DEBUG_TRACE,
"connection_get(%d): got connid=%lu\n",
if( s == AC_SOCKET_INVALID ) {
#ifdef NEW_LOGGING
- LDAP_LOG(( "connection", LDAP_LEVEL_INFO,
- "connection_init: init of socket %ld invalid.\n", (long)s ));
+ LDAP_LOG( CONNECTION, INFO,
+ "connection_init: init of socket %ld invalid.\n", (long)s, 0, 0 );
#else
Debug( LDAP_DEBUG_ANY,
"connection_init(%ld): invalid.\n",
if( c == NULL ) {
#ifdef NEW_LOGGING
- LDAP_LOG(( "connection", LDAP_LEVEL_INFO,
+ LDAP_LOG( CONNECTION, INFO,
"connection_init: skt %d connection table full (%d/%d)\n",
- s, i, dtblsize ));
+ s, i, dtblsize );
#else
Debug( LDAP_DEBUG_ANY,
"connection_init(%d): connection table full (%d/%d)\n",
c /* non-NULL */ ) < 0 )
{
#ifdef NEW_LOGGING
- LDAP_LOG(( "connection", LDAP_LEVEL_INFO,
+ LDAP_LOG( CONNECTION, INFO,
"connection_init: conn %lu set nonblocking failed\n",
- c->c_connid ));
+ c->c_connid, 0, 0 );
#else
Debug( LDAP_DEBUG_ANY,
"connection_init(%d, %s): set nonblocking failed\n",
ber_sockbuf_ctrl( c->c_sb, LBER_SB_OPT_GET_FD, &sd );
#ifdef NEW_LOGGING
- LDAP_LOG(( "connection", LDAP_LEVEL_DETAIL1,
+ LDAP_LOG( CONNECTION, DETAIL1,
"connection_closing: conn %lu readying socket %d for close.\n",
- c->c_connid, sd ));
+ c->c_connid, sd, 0 );
#else
Debug( LDAP_DEBUG_TRACE,
"connection_closing: readying conn=%lu sd=%d for close\n",
ber_sockbuf_ctrl( c->c_sb, LBER_SB_OPT_GET_FD, &sd );
if( !LDAP_STAILQ_EMPTY(&c->c_ops) ) {
#ifdef NEW_LOGGING
- LDAP_LOG(( "connection", LDAP_LEVEL_DETAIL1,
+ LDAP_LOG( CONNECTION, DETAIL1,
"connection_close: conn %lu deferring sd %d\n",
- c->c_connid, sd ));
+ c->c_connid, sd, 0 );
#else
Debug( LDAP_DEBUG_TRACE,
"connection_close: deferring conn=%lu sd=%d\n",
}
#ifdef NEW_LOGGING
- LDAP_LOG(( "connection", LDAP_LEVEL_RESULTS,
- "connection_close: conn %lu sd %d\n",
- c->c_connid, sd ));
+ LDAP_LOG( CONNECTION, RESULTS,
+ "connection_close: conn %lu sd %d\n", c->c_connid, sd, 0 );
#else
Debug( LDAP_DEBUG_TRACE, "connection_close: conn=%lu sd=%d\n",
c->c_connid, sd, 0 );
if( conn->c_sasl_bind_in_progress && tag != LDAP_REQ_BIND ) {
#ifdef NEW_LOGGING
- LDAP_LOG(( "connection", LDAP_LEVEL_ERR,
- "connection_operation: conn %lu SASL bind in progress (tag=%ld).\n",
- conn->c_connid, (long)tag ));
+ LDAP_LOG( CONNECTION, ERR,
+ "connection_operation: conn %lu SASL bind in progress (tag=%ld).\n",
+ conn->c_connid, (long)tag, 0 );
#else
Debug( LDAP_DEBUG_ANY, "connection_operation: "
"error: SASL bind in progress (tag=%ld).\n",
default:
#ifdef NEW_LOGGING
- LDAP_LOG(( "connection", LDAP_LEVEL_INFO,
+ LDAP_LOG( CONNECTION, INFO,
"connection_operation: conn %lu unknown LDAP request 0x%lx\n",
- conn->c_connid, tag ));
+ conn->c_connid, tag, 0 );
#else
Debug( LDAP_DEBUG_ANY, "unknown LDAP request 0x%lx\n",
tag, 0, 0 );
{
int rc = 0;
Connection *c;
+
assert( connections != NULL );
ldap_pvt_thread_mutex_lock( &connections_mutex );
if( c == NULL ) {
#ifdef NEW_LOGGING
- LDAP_LOG(( "connection", LDAP_LEVEL_INFO,
- "connection_read: sock %ld no connection\n",
- (long)s ));
+ LDAP_LOG( CONNECTION, INFO,
+ "connection_read: sock %ld no connection\n", (long)s, 0, 0 );
#else
Debug( LDAP_DEBUG_ANY,
"connection_read(%ld): no connection!\n",
if( c->c_conn_state == SLAP_C_CLOSING ) {
#ifdef NEW_LOGGING
- LDAP_LOG(( "connection", LDAP_LEVEL_INFO,
- "connection_read: conn %lu connection closing, ignoring input\n",
- c->c_connid));
+ LDAP_LOG( CONNECTION, INFO,
+ "connection_read: conn %lu connection closing, ignoring input\n",
+ c->c_connid, 0, 0 );
#else
Debug( LDAP_DEBUG_TRACE,
"connection_read(%d): closing, ignoring input for id=%lu\n",
}
#ifdef NEW_LOGGING
- LDAP_LOG(( "connection", LDAP_LEVEL_DETAIL1,
- "connection_read: conn %lu checking for input.\n", c->c_connid ));
+ LDAP_LOG( CONNECTION, DETAIL1,
+ "connection_read: conn %lu checking for input.\n",
+ c->c_connid, 0, 0 );
#else
Debug( LDAP_DEBUG_TRACE,
"connection_read(%d): checking for input on id=%lu\n",
#endif
#ifdef NEW_LOGGING
- LDAP_LOG(( "connection", LDAP_LEVEL_ERR,
+ LDAP_LOG( CONNECTION, ERR,
"connection_read: conn %lu TLS accept error, error %d\n",
- c->c_connid, rc ));
+ c->c_connid, rc, 0 );
#else
Debug( LDAP_DEBUG_TRACE,
"connection_read(%d): TLS accept error "
rc = dnX509peerNormalize( ssl, &authid );
if ( rc != LDAP_SUCCESS ) {
#ifdef NEW_LOGGING
- LDAP_LOG(( "connection", LDAP_LEVEL_INFO,
- "connection_read: conn %lu unable to get TLS client DN, error %d\n",
- c->c_connid, rc));
+ LDAP_LOG( CONNECTION, INFO,
+ "connection_read: conn %lu unable to get TLS client DN, "
+ "error %d\n", c->c_connid, rc, 0 );
#else
Debug( LDAP_DEBUG_TRACE,
"connection_read(%d): unable to get TLS client DN "
if( rc != LDAP_SUCCESS ) {
#ifdef NEW_LOGGING
- LDAP_LOG(( "connection", LDAP_LEVEL_ERR,
- "connection_read: conn %lu SASL install error %d, closing\n",
- c->c_connid, rc ));
+ LDAP_LOG( CONNECTION, ERR,
+ "connection_read: conn %lu SASL install error %d, closing\n",
+ c->c_connid, rc, 0 );
#else
Debug( LDAP_DEBUG_TRACE,
"connection_read(%d): SASL install error "
if( rc < 0 ) {
#ifdef NEW_LOGGING
- LDAP_LOG(( "connection", LDAP_LEVEL_ERR,
- "connection_read: conn %lu input error %d, closing.\n",
- c->c_connid, rc ));
+ LDAP_LOG( CONNECTION, ERR,
+ "connection_read: conn %lu input error %d, closing.\n",
+ c->c_connid, rc, 0 );
#else
Debug( LDAP_DEBUG_TRACE,
"connection_read(%d): input error=%d id=%lu, closing.\n",
if ( conn->c_currentber == NULL && (conn->c_currentber = ber_alloc())
== NULL ) {
#ifdef NEW_LOGGING
- LDAP_LOG(( "connection", LDAP_LEVEL_ERR,
- "connection_input: conn %lu ber_alloc failed.\n",
- conn->c_connid ));
+ LDAP_LOG( CONNECTION, ERR,
+ "connection_input: conn %lu ber_alloc failed.\n",
+ conn->c_connid, 0, 0 );
#else
Debug( LDAP_DEBUG_ANY, "ber_alloc failed\n", 0, 0, 0 );
#endif
ber_sockbuf_ctrl( conn->c_sb, LBER_SB_OPT_GET_FD, &sd );
#ifdef NEW_LOGGING
- LDAP_LOG(( "connection", LDAP_LEVEL_ERR,
- "connection_input: conn %lu ber_get_next failed, errno %d (%s).\n",
- conn->c_connid, err, sock_errstr(err) ));
+ LDAP_LOG( CONNECTION, ERR,
+ "connection_input: conn %lu 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",
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 %lu ber_get_int returns 0x%lx.\n",
- conn->c_connid, tag ));
+ LDAP_LOG( CONNECTION, ERR,
+ "connection_input: conn %lu ber_get_int returns 0x%lx.\n",
+ conn->c_connid, tag, 0 );
#else
Debug( LDAP_DEBUG_ANY, "ber_get_int returns 0x%lx\n", tag, 0,
0 );
if ( (tag = ber_peek_tag( ber, &len )) == LBER_ERROR ) {
/* log, close and send error */
#ifdef NEW_LOGGING
- LDAP_LOG(( "connection", LDAP_LEVEL_ERR,
+ LDAP_LOG( CONNECTION, ERR,
"connection_input: conn %lu ber_peek_tag returns 0x%lx.\n",
- conn->c_connid, tag ));
+ conn->c_connid, tag, 0 );
#else
Debug( LDAP_DEBUG_ANY, "ber_peek_tag returns 0x%lx\n", tag, 0,
0 );
}
if (tag != LDAP_REQ_ABANDON && tag != LDAP_REQ_SEARCH) {
#ifdef NEW_LOGGING
- LDAP_LOG(( "connection", LDAP_LEVEL_ERR,
+ LDAP_LOG( CONNECTION, ERR,
"connection_input: conn %lu invalid req for UDP 0x%lx.\n",
- conn->c_connid, tag ));
+ conn->c_connid, tag, 0 );
#else
Debug( LDAP_DEBUG_ANY, "invalid req for UDP 0x%lx\n", tag, 0,
0 );
|| conn->c_conn_state == SLAP_C_CLOSING )
{
#ifdef NEW_LOGGING
- LDAP_LOG(( "connection", LDAP_LEVEL_INFO,
- "connection_input: conn %lu deferring operation\n",
- conn->c_connid ));
+ LDAP_LOG( CONNECTION, INFO,
+ "connection_input: conn %lu deferring operation\n",
+ conn->c_connid, 0, 0 );
#else
Debug( LDAP_DEBUG_ANY, "deferring operation\n", 0, 0, 0 );
#endif
if( rc ) {
#ifdef NEW_LOGGING
- LDAP_LOG(( "connection", LDAP_LEVEL_DETAIL1,
- "connection_resched: conn %lu reaquiring locks.\n",
- conn->c_connid ));
+ LDAP_LOG( CONNECTION, DETAIL1,
+ "connection_resched: conn %lu reaquiring locks.\n",
+ conn->c_connid, 0, 0 );
#else
Debug( LDAP_DEBUG_TRACE,
"connection_resched: reaquiring locks conn=%lu sd=%d\n",
if( conn->c_conn_state != SLAP_C_CLOSING ) {
#ifdef NEW_LOGGING
- LDAP_LOG(( "connection", LDAP_LEVEL_INFO,
- "connection_resched: conn %lu closed by other thread.\n",
- conn->c_connid ));
+ LDAP_LOG( CONNECTION, INFO,
+ "connection_resched: conn %lu closed by other thread.\n",
+ conn->c_connid, 0, 0 );
#else
Debug( LDAP_DEBUG_TRACE, "connection_resched: "
"closed by other thread conn=%lu sd=%d\n",
#endif
} else {
#ifdef NEW_LOGGING
- LDAP_LOG(( "connection", LDAP_LEVEL_DETAIL1,
- "connection_resched: conn %lu attempting closing.\n",
- conn->c_connid ));
+ LDAP_LOG( CONNECTION, DETAIL1,
+ "connection_resched: conn %lu attempting closing.\n",
+ conn->c_connid, 0, 0 );
#else
Debug( LDAP_DEBUG_TRACE, "connection_resched: "
"attempting closing conn=%lu sd=%d\n",
if ( status != 0 ) {
#ifdef NEW_LOGGING
- LDAP_LOG(( "connection", LDAP_LEVEL_ERR,
- "connection_op_activate: conn %lu thread pool submit failed.\n",
- conn->c_connid ));
+ LDAP_LOG( CONNECTION, ERR,
+ "connection_op_activate: conn %lu thread pool submit failed.\n",
+ conn->c_connid, 0, 0 );
#else
Debug( LDAP_DEBUG_ANY,
"ldap_pvt_thread_pool_submit failed (%d)\n", status, 0, 0 );
int connection_write(ber_socket_t s)
{
Connection *c;
+
assert( connections != NULL );
ldap_pvt_thread_mutex_lock( &connections_mutex );
if( c == NULL ) {
#ifdef NEW_LOGGING
- LDAP_LOG(( "connection", LDAP_LEVEL_ERR,
- "connection_write: sock %ld no connection!\n",(long)s));
+ LDAP_LOG( CONNECTION, ERR,
+ "connection_write: sock %ld no connection!\n", (long)s, 0, 0);
#else
Debug( LDAP_DEBUG_ANY,
"connection_write(%ld): no connection!\n",
c->c_n_write++;
#ifdef NEW_LOGGING
- LDAP_LOG(( "connection", LDAP_LEVEL_DETAIL1,
- "connection_write conn %lu waking output.\n",
- c->c_connid ));
+ LDAP_LOG( CONNECTION, DETAIL1,
+ "connection_write conn %lu waking output.\n", c->c_connid, 0, 0 );
#else
Debug( LDAP_DEBUG_TRACE,
"connection_write(%d): waking output for id=%lu\n",
}
#ifdef NEW_LOGGING
- LDAP_LOG(( "operation", LDAP_LEVEL_ENTRY,
- "get_ctrls: conn %lu\n", conn->c_connid ));
+ LDAP_LOG( OPERATION, ENTRY, "get_ctrls: conn %lu\n", conn->c_connid, 0, 0 );
#else
Debug( LDAP_DEBUG_TRACE, "=> get_ctrls\n", 0, 0, 0 );
#endif
if( tag == LBER_ERROR ) {
#ifdef NEW_LOGGING
- LDAP_LOG(( "operation", LDAP_LEVEL_INFO,
- "get_ctrls: conn %lu get OID failed.\n",
- conn->c_connid ));
+ LDAP_LOG( OPERATION, INFO, "get_ctrls: conn %lu get OID failed.\n",
+ conn->c_connid, 0, 0 );
#else
Debug( LDAP_DEBUG_TRACE, "=> get_ctrls: get oid failed.\n",
0, 0, 0 );
if( tag == LBER_ERROR ) {
#ifdef NEW_LOGGING
- LDAP_LOG(( "operation", LDAP_LEVEL_INFO,
- "get_ctrls: conn %lu get crit failed.\n",
- conn->c_connid ));
+ LDAP_LOG( OPERATION, INFO,
+ "get_ctrls: conn %lu get crit failed.\n",
+ conn->c_connid, 0, 0 );
#else
Debug( LDAP_DEBUG_TRACE, "=> get_ctrls: get crit failed.\n",
0, 0, 0 );
if( tag == LBER_ERROR ) {
#ifdef NEW_LOGGING
- LDAP_LOG(( "operation", LDAP_LEVEL_INFO, "get_ctrls: conn %lu: "
+ LDAP_LOG( OPERATION, INFO, "get_ctrls: conn %lu: "
"%s (%scritical): get value failed.\n",
- conn->c_connid,
- c->ldctl_oid ? c->ldctl_oid : "(NULL)",
- c->ldctl_iscritical ? "" : "non" ));
+ conn->c_connid, c->ldctl_oid ? c->ldctl_oid : "(NULL)",
+ c->ldctl_iscritical ? "" : "non" );
#else
Debug( LDAP_DEBUG_TRACE, "=> get_ctrls: conn %lu: "
"%s (%scritical): get value failed.\n",
}
#ifdef NEW_LOGGING
- LDAP_LOG(( "operation", LDAP_LEVEL_INFO,
+ LDAP_LOG( OPERATION, INFO,
"get_ctrls: conn %lu oid=\"%s\" (%scritical)\n",
- conn->c_connid,
- c->ldctl_oid ? c->ldctl_oid : "(NULL)",
- c->ldctl_iscritical ? "" : "non" ));
+ conn->c_connid, c->ldctl_oid ? c->ldctl_oid : "(NULL)",
+ c->ldctl_iscritical ? "" : "non" );
#else
Debug( LDAP_DEBUG_TRACE, "=> get_ctrls: oid=\"%s\" (%scritical)\n",
c->ldctl_oid ? c->ldctl_oid : "(NULL)",
return_results:
#ifdef NEW_LOGGING
- LDAP_LOG(( "operation", LDAP_LEVEL_RESULTS,
- "get_ctrls: conn=%lu n=%d rc=%d err=%s\n",
- conn->c_connid, nctrls, rc, errmsg ? errmsg : "" ));
+ LDAP_LOG( OPERATION, RESULTS,
+ "get_ctrls: n=%d rc=%d err=%s\n", nctrls, rc, errmsg ? errmsg : "" );
#else
Debug( LDAP_DEBUG_TRACE, "<= get_ctrls: n=%d rc=%d err=%s\n",
nctrls, rc, errmsg ? errmsg : "");
}
#ifdef NEW_LOGGING
- LDAP_LOG(( "operation", LDAP_LEVEL_ARGS,
- "parseValuesReturnFilter: conn %d vrFilter: %s\n", conn->c_connid,
- fstr.bv_len ? fstr.bv_val : "empty" ));
+ LDAP_LOG( OPERATION, ARGS,
+ "parseValuesReturnFilter: conn %d vrFilter: %s\n",
+ conn->c_connid, fstr.bv_len ? fstr.bv_val : "empty" , 0 );
#else
Debug( LDAP_DEBUG_ARGS, " vrFilter: %s\n",
fstr.bv_len ? fstr.bv_val : "empty", 0, 0 );
#define LDAPI_MOD_URLEXT "x-mod"
#endif /* LDAP_PF_LOCAL */
+#ifdef LDAP_PF_INET6
int slap_inet4or6 = AF_UNSPEC;
+#else
+int slap_inet4or6 = AF_INET;
+#endif
/* globals */
time_t starttime;
slapd_srvurls[i] = (char *) realloc( slapd_srvurls[i],
strlen( host ) +
sizeof( LDAP_SRVTYPE_PREFIX ) );
- strcpy( slap_strcopy(slapd_srvurls[i],
+ strcpy( lutil_strcopy(slapd_srvurls[i],
LDAP_SRVTYPE_PREFIX ), host );
ch_free( host );
slapd_srvurls[i] = (char *) realloc( slapd_srvurls[i],
strlen( host ) +
sizeof( LDAPS_SRVTYPE_PREFIX ) );
- strcpy( slap_strcopy(slapd_srvurls[i],
+ strcpy( lutil_strcopy(slapd_srvurls[i],
LDAPS_SRVTYPE_PREFIX ), host );
ch_free( host );
FD_SET( s, &slap_daemon.sd_readers );
#ifdef NEW_LOGGING
- LDAP_LOG(( "connection", LDAP_LEVEL_DETAIL1,
- "slapd_add: added %ld%s%s\n",
- (long)s,
- FD_ISSET(s, &slap_daemon.sd_readers) ? "r" : "",
- FD_ISSET(s, &slap_daemon.sd_writers) ? "w" : "" ));
+ LDAP_LOG( CONNECTION, DETAIL1,
+ "slapd_add: added %ld%s%s\n", (long)s,
+ FD_ISSET(s, &slap_daemon.sd_readers) ? "r" : "",
+ FD_ISSET(s, &slap_daemon.sd_writers) ? "w" : "" );
#else
Debug( LDAP_DEBUG_CONNS, "daemon: added %ld%s%s\n",
(long) s,
slap_daemon.sd_nactives--;
#ifdef NEW_LOGGING
- LDAP_LOG(( "connection", LDAP_LEVEL_DETAIL1,
- "slapd_remove: removing %ld%s%s\n",
- (long) s,
- FD_ISSET(s, &slap_daemon.sd_readers) ? "r" : "",
- FD_ISSET(s, &slap_daemon.sd_writers) ? "w" : "" ));
+ LDAP_LOG( CONNECTION, DETAIL1,
+ "slapd_remove: removing %ld%s%s\n", (long) s,
+ FD_ISSET(s, &slap_daemon.sd_readers) ? "r" : "",
+ FD_ISSET(s, &slap_daemon.sd_writers) ? "w" : "" );
#else
Debug( LDAP_DEBUG_CONNS, "daemon: removing %ld%s%s\n",
(long) s,
static void slapd_close(ber_socket_t s) {
#ifdef NEW_LOGGING
- LDAP_LOG(( "connection", LDAP_LEVEL_DETAIL1,
- "slapd_close: closing %ld\n", (long)s ));
+ LDAP_LOG( CONNECTION, DETAIL1, "slapd_close: closing %ld\n", (long)s, 0, 0);
#else
Debug( LDAP_DEBUG_CONNS, "daemon: closing %ld\n",
(long) s, 0, 0 );
if ( strlen(host) >
(sizeof(((struct sockaddr_un *)*sap)->sun_path) - 1) ) {
#ifdef NEW_LOGGING
- LDAP_LOG(( "connection", LDAP_LEVEL_INFO,
- "slap_get_listener_addresses: domain socket path (%s) too long in URL\n",
- host ));
+ LDAP_LOG( CONNECTION, INFO,
+ "slap_get_listener_addresses: domain socket path (%s) "
+ "too long in URL\n", host, 0, 0 );
#else
Debug( LDAP_DEBUG_ANY,
"daemon: domain socket path (%s) too long in URL",
if ( (err = getaddrinfo(host, serv, &hints, &res)) ) {
#ifdef NEW_LOGGING
- LDAP_LOG(( "connection", LDAP_LEVEL_INFO,
+ LDAP_LOG( CONNECTION, INFO,
"slap_get_listener_addresses: getaddrinfo failed: %s\n",
- AC_GAI_STRERROR(err) ));
+ AC_GAI_STRERROR(err), 0, 0 );
#else
Debug( LDAP_DEBUG_ANY, "daemon: getaddrinfo failed: %s\n",
AC_GAI_STRERROR(err), 0, 0);
for ( sai=res; sai; sai=sai->ai_next ) {
if( sai->ai_addr == NULL ) {
#ifdef NEW_LOGGING
- LDAP_LOG(( "connection", LDAP_LEVEL_INFO,
+ LDAP_LOG( CONNECTION, INFO,
"slap_get_listener_addresses: "
- "getaddrinfo ai_addr is NULL?\n" ));
+ "getaddrinfo ai_addr is NULL?\n", 0, 0, 0 );
#else
Debug( LDAP_DEBUG_ANY, "slap_get_listener_addresses: "
"getaddrinfo ai_addr is NULL?\n", 0, 0, 0 );
he = gethostbyname( host );
if( he == NULL ) {
#ifdef NEW_LOGGING
- LDAP_LOG(( "connection", LDAP_LEVEL_INFO,
- "slap_get_listener_addresses: invalid host %s\n",
- host ));
+ LDAP_LOG( CONNECTION, INFO,
+ "slap_get_listener_addresses: invalid host %s\n", host, 0, 0 );
#else
Debug( LDAP_DEBUG_ANY,
"daemon: invalid host %s", host, 0, 0);
int err, addrlen = 0;
struct sockaddr **sal, **psal;
int socktype = SOCK_STREAM; /* default to COTS */
+
#ifdef LDAP_PF_LOCAL
mode_t perms = S_IRWXU;
int crit = 1;
if( rc != LDAP_URL_SUCCESS ) {
#ifdef NEW_LOGGING
- LDAP_LOG(( "connection", LDAP_LEVEL_ERR,
- "slap_open_listener: listen URL \"%s\" parse error %d\n",
- url, rc ));
+ LDAP_LOG( CONNECTION, ERR,
+ "slap_open_listener: listen URL \"%s\" parse error %d\n",
+ url, rc , 0 );
#else
Debug( LDAP_DEBUG_ANY,
"daemon: listen URL \"%s\" parse error=%d\n",
#ifndef HAVE_TLS
if( ldap_pvt_url_scheme2tls( lud->lud_scheme ) ) {
#ifdef NEW_LOGGING
- LDAP_LOG(( "connection", LDAP_LEVEL_INFO,
- "slap_open_listener: TLS is not supported (%s)\n",
- url ));
+ LDAP_LOG( CONNECTION, INFO,
+ "slap_open_listener: TLS is not supported (%s)\n", url, 0, 0 );
#else
Debug( LDAP_DEBUG_ANY,
"daemon: TLS not supported (%s)\n",
#else
#ifdef NEW_LOGGING
- LDAP_LOG(( "connection", LDAP_LEVEL_INFO,
- "slap_open_listener: URL scheme is not supported: %s\n",
- url ));
+ LDAP_LOG( CONNECTION, INFO,
+ "slap_open_listener: URL scheme is not supported: %s\n", url, 0, 0 );
#else
Debug( LDAP_DEBUG_ANY, "daemon: URL scheme not supported: %s",
url, 0, 0);
if ( l.sl_sd == AC_SOCKET_INVALID ) {
int err = sock_errno();
#ifdef NEW_LOGGING
- LDAP_LOG(( "connection", LDAP_LEVEL_ERR,
- "slap_open_listener: socket() failed errno=%d (%s)\n",
- err, sock_errstr(err) ));
+ LDAP_LOG( CONNECTION, ERR,
+ "slap_open_listener: socket() failed errno=%d (%s)\n",
+ err, sock_errstr(err), 0 );
#else
Debug( LDAP_DEBUG_ANY,
"daemon: socket() failed errno=%d (%s)\n", err,
#ifndef HAVE_WINSOCK
if ( l.sl_sd >= dtblsize ) {
#ifdef NEW_LOGGING
- LDAP_LOG(( "connection", LDAP_LEVEL_ERR,
- "slap_open_listener: listener descriptor %ld is too great %ld\n",
- (long)l.sl_sd, (long)dtblsize ));
+ LDAP_LOG( CONNECTION, ERR,
+ "slap_open_listener: listener descriptor %ld is too "
+ "great %ld\n", (long)l.sl_sd, (long)dtblsize, 0 );
#else
Debug( LDAP_DEBUG_ANY,
"daemon: listener descriptor %ld is too great %ld\n",
if ( rc == AC_SOCKET_ERROR ) {
int err = sock_errno();
#ifdef NEW_LOGGING
- LDAP_LOG(( "connection", LDAP_LEVEL_INFO,
- "slap_open_listener: setsockopt( %ld, SO_REUSEADDR ) failed errno %d (%s)\n",
- (long)l.sl_sd, err, sock_errstr(err) ));
+ LDAP_LOG( CONNECTION, INFO,
+ "slap_open_listener: setsockopt( %ld, SO_REUSEADDR ) "
+ "failed errno %d (%s)\n", (long)l.sl_sd, err,
+ sock_errstr(err) );
#else
Debug( LDAP_DEBUG_ANY,
"slapd(%ld): setsockopt(SO_REUSEADDR) failed errno=%d (%s)\n",
if ( rc == AC_SOCKET_ERROR ) {
int err = sock_errno();
#ifdef NEW_LOGGING
- LDAP_LOG(( "connection", LDAP_LEVEL_INFO,
+ LDAP_LOG( CONNECTION, INFO,
"slap_open_listener: setsockopt( %ld, IPV6_V6ONLY ) failed errno %d (%s)\n",
- (long)l.sl_sd, err, sock_errstr(err) ));
+ (long)l.sl_sd, err, sock_errstr(err) );
#else
Debug( LDAP_DEBUG_ANY,
"slapd(%ld): setsockopt(IPV6_V6ONLY) failed errno=%d (%s)\n",
if (bind(l.sl_sd, *sal, addrlen)) {
err = sock_errno();
#ifdef NEW_LOGGING
- LDAP_LOG(( "connection", LDAP_LEVEL_INFO,
- "slap_open_listener: bind(%ld) failed errno=%d (%s)\n",
- (long)l.sl_sd, err, sock_errstr(err) ));
+ LDAP_LOG( CONNECTION, INFO,
+ "slap_open_listener: bind(%ld) failed errno=%d (%s)\n",
+ (long)l.sl_sd, err, sock_errstr(err) );
#else
Debug( LDAP_DEBUG_ANY, "daemon: bind(%ld) failed errno=%d (%s)\n",
(long) l.sl_sd, err, sock_errstr(err) );
if ( chmod( addr, perms ) < 0 && crit ) {
int err = sock_errno();
#ifdef NEW_LOGGING
- LDAP_LOG(( "connection", LDAP_LEVEL_INFO,
- "slap_open_listener: fchmod(%ld) failed errno=%d (%s)\n",
- (long)l.sl_sd, err, sock_errstr(err) ));
+ LDAP_LOG( CONNECTION, INFO,
+ "slap_open_listener: fchmod(%ld) failed errno=%d (%s)\n",
+ (long)l.sl_sd, err, sock_errstr(err) );
#else
Debug( LDAP_DEBUG_ANY, "daemon: fchmod(%ld) failed errno=%d (%s)",
(long) l.sl_sd, err, sock_errstr(err) );
default:
#ifdef NEW_LOGGING
- LDAP_LOG(( "connection", LDAP_LEVEL_INFO,
- "slap_open_listener: unsupported address family (%d)\n",
- (int)(*sal)->sa_family ));
+ LDAP_LOG( CONNECTION, INFO,
+ "slap_open_listener: unsupported address family (%d)\n",
+ (int)(*sal)->sa_family, 0, 0 );
#else
Debug( LDAP_DEBUG_ANY, "daemon: unsupported address family (%d)\n",
(int) (*sal)->sa_family, 0, 0 );
#ifdef NEW_LOGGING
- LDAP_LOG(( "connection", LDAP_LEVEL_RESULTS,
- "slap_open_listener: daemon initialized %s\n", l.sl_url ));
+ LDAP_LOG( CONNECTION, RESULTS,
+ "slap_open_listener: daemon initialzed %s\n", l.sl_url, 0, 0 );
#else
Debug( LDAP_DEBUG_TRACE, "daemon: initialized %s\n",
l.sl_url, 0, 0 );
char **u;
#ifdef NEW_LOGGING
- LDAP_LOG(( "connection", LDAP_LEVEL_ARGS,
- "slapd_daemon_init: %s\n",
- urls ? urls : "<null>" ));
+ LDAP_LOG( CONNECTION, ARGS,
+ "slapd_daemon_init: %s\n", urls ? urls : "<null>", 0, 0 );
#else
Debug( LDAP_DEBUG_ARGS, "daemon_init: %s\n",
urls ? urls : "<null>", 0, 0 );
*/
if( (rc = lutil_pair( wake_sds )) < 0 ) {
#ifdef NEW_LOGGING
- LDAP_LOG(( "connection", LDAP_LEVEL_ERR,
- "slap_daemon_init: lutil_pair() failed rc=%d\n", rc ));
+ LDAP_LOG( CONNECTION, ERR,
+ "slap_daemon_init: lutil_pair() failed rc=%d\n", rc, 0, 0);
#else
Debug( LDAP_DEBUG_ANY,
"daemon: lutil_pair() failed rc=%d\n", rc, 0, 0 );
if( u == NULL || u[0] == NULL ) {
#ifdef NEW_LOGGING
- LDAP_LOG(( "connection", LDAP_LEVEL_ERR,
- "slap_daemon_init: no urls (%s) provided.\n", urls ));
+ LDAP_LOG( CONNECTION, ERR,
+ "slap_daemon_init: no urls (%s) provided.\n", urls, 0, 0 );
#else
Debug( LDAP_DEBUG_ANY, "daemon_init: no urls (%s) provided.\n",
urls, 0, 0 );
for( i=0; u[i] != NULL; i++ ) {
#ifdef NEW_LOGGING
- LDAP_LOG(( "connection", LDAP_LEVEL_DETAIL1,
- "slap_daemon_init: listen on %s\n.", u[i] ));
+ LDAP_LOG( CONNECTION, DETAIL1,
+ "slap_daemon_init: listen on %s\n.", u[i], 0, 0 );
#else
Debug( LDAP_DEBUG_TRACE, "daemon_init: listen on %s\n",
u[i], 0, 0 );
if( i == 0 ) {
#ifdef NEW_LOGGING
- LDAP_LOG(( "connection", LDAP_LEVEL_INFO,
- "slap_daemon_init: no listeners to open (%s)\n", urls ));
+ LDAP_LOG( CONNECTION, INFO,
+ "slap_daemon_init: no listeners to open (%s)\n", urls, 0, 0 );
#else
Debug( LDAP_DEBUG_ANY, "daemon_init: no listeners to open (%s)\n",
urls, 0, 0 );
}
#ifdef NEW_LOGGING
- LDAP_LOG(( "connection", LDAP_LEVEL_INFO,
- "slap_daemon_init: %d listeners to open...\n", i ));
+ LDAP_LOG( CONNECTION, INFO,
+ "slap_daemon_init: %d listeners to open...\n", i, 0, 0 );
#else
Debug( LDAP_DEBUG_TRACE, "daemon_init: %d listeners to open...\n",
i, 0, 0 );
slap_listeners[j] = NULL;
#ifdef NEW_LOGGING
- LDAP_LOG(( "connection", LDAP_LEVEL_DETAIL1,
- "slap_daemon_init: %d listeners opened\n", i ));
+ LDAP_LOG( CONNECTION, DETAIL1,
+ "slap_daemon_init: %d listeners opened\n", i, 0, 0 );
#else
Debug( LDAP_DEBUG_TRACE, "daemon_init: %d listeners opened\n",
i, 0, 0 );
if ( i < l ) {
/* We are already listening to in6addr_any */
#ifdef NEW_LOGGING
- LDAP_LOG(( "connection", LDAP_LEVEL_WARNING,
- "slapd_daemon_task: Attempt to listen to 0.0.0.0 failed, already listening on ::, assuming IPv4 included\n" ));
+ LDAP_LOG(CONNECTION, WARNING,
+ "slapd_daemon_task: Attempt to listen to 0.0.0.0 failed, already listening on ::, assuming IPv4 included\n", 0, 0, 0 );
#else
Debug( LDAP_DEBUG_CONNS,
"daemon: Attempt to listen to 0.0.0.0 failed, already listening on ::, assuming IPv4 included\n",
}
#endif
#ifdef NEW_LOGGING
- LDAP_LOG(( "connection", LDAP_LEVEL_ERR,
- "slapd_daemon_task: listen( %s, 5 ) failed errno=%d (%s)\n",
- slap_listeners[l]->sl_url, err, sock_errstr(err) ));
+ LDAP_LOG( CONNECTION, ERR,
+ "slapd_daemon_task: listen( %s, 5 ) failed errno=%d (%s)\n",
+ slap_listeners[l]->sl_url, err, sock_errstr(err) );
#else
Debug( LDAP_DEBUG_ANY,
"daemon: listen(%s, 5) failed errno=%d (%s)\n",
continue;
#ifdef NEW_LOGGING
- LDAP_LOG(( "connection", LDAP_LEVEL_DETAIL1,
- "slapd_daemon_task: select: listen=%d active_threads=%d tvp=%s\n",
- slap_listeners[l]->sl_sd, at, tvp == NULL ? "NULL" : "zero" ));
+ LDAP_LOG( CONNECTION, DETAIL1,
+ "slapd_daemon_task: select: listen=%d "
+ "active_threads=%d tvp=%s\n",
+ slap_listeners[l]->sl_sd, at, tvp == NULL ? "NULL" : "zero" );
#else
Debug( LDAP_DEBUG_CONNS,
"daemon: select: listen=%d active_threads=%d tvp=%s\n",
if( err != EINTR ) {
#ifdef NEW_LOGGING
- LDAP_LOG(( "connection", LDAP_LEVEL_INFO,
- "slapd_daemon_task: select failed (%d): %s\n",
- err, sock_errstr(err) ));
+ LDAP_LOG( CONNECTION, INFO,
+ "slapd_daemon_task: select failed (%d): %s\n",
+ err, sock_errstr(err), 0 );
#else
Debug( LDAP_DEBUG_CONNS,
"daemon: select failed (%d): %s\n",
case 0: /* timeout - let threads run */
ebadf = 0;
#ifdef NEW_LOGGING
- LDAP_LOG(( "connection", LDAP_LEVEL_DETAIL2,
- "slapd_daemon_task: select timeout - yielding\n" ));
+ LDAP_LOG( CONNECTION, DETAIL2,
+ "slapd_daemon_task: select timeout - yielding\n", 0, 0, 0 );
#else
Debug( LDAP_DEBUG_CONNS, "daemon: select timeout - yielding\n",
0, 0, 0 );
ebadf = 0;
#ifdef NEW_LOGGING
- LDAP_LOG(( "connection", LDAP_LEVEL_DETAIL2,
- "slapd_daemon_task: activity on %d descriptors\n", ns ));
+ LDAP_LOG( CONNECTION, DETAIL2,
+ "slapd_daemon_task: activity on %d descriptors\n", ns, 0, 0 );
#else
Debug( LDAP_DEBUG_CONNS, "daemon: activity on %d descriptors\n",
ns, 0, 0 );
if( emfile < 3 ) {
#ifdef NEW_LOGGING
- LDAP_LOG(( "connection", LDAP_LEVEL_ERR,
+ LDAP_LOG( CONNECTION, ERR,
"slapd_daemon_task: accept(%ld) failed errno=%d (%s)\n",
- (long)slap_listeners[l]->sl_sd, err, sock_errstr(err) ));
+ (long)slap_listeners[l]->sl_sd,
+ err, sock_errstr(err) );
#else
Debug( LDAP_DEBUG_ANY,
"daemon: accept(%ld) failed errno=%d (%s)\n",
/* make sure descriptor number isn't too great */
if ( s >= dtblsize ) {
#ifdef NEW_LOGGING
- LDAP_LOG(( "connection", LDAP_LEVEL_ERR,
+ LDAP_LOG( CONNECTION, ERR,
"slapd_daemon_task: %ld beyond descriptor table size %ld\n",
- (long)s, (long)dtblsize ));
+ (long)s, (long)dtblsize, 0 );
#else
Debug( LDAP_DEBUG_ANY,
"daemon: %ld beyond descriptor table size %ld\n",
if ( rc == AC_SOCKET_ERROR ) {
int err = sock_errno();
#ifdef NEW_LOGGING
- LDAP_LOG(( "connection", LDAP_LEVEL_ERR,
- "slapd_daemon_task: setsockopt( %ld, SO_KEEPALIVE) failed errno=%d (%s)\n",
- (long)s, err, sock_errstr(err) ));
+ LDAP_LOG( CONNECTION, ERR,
+ "slapd_daemon_task: setsockopt( %ld, SO_KEEPALIVE)"
+ " failed errno=%d (%s)\n",
+ (long)s, err, sock_errstr(err) );
#else
Debug( LDAP_DEBUG_ANY,
"slapd(%ld): setsockopt(SO_KEEPALIVE) failed "
if ( rc == AC_SOCKET_ERROR ) {
int err = sock_errno();
#ifdef NEW_LOGGING
- LDAP_LOG(( "connection", LDAP_LEVEL_ERR,
- "slapd_daemon_task: setsockopt( %ld, TCP_NODELAY) failed errno=%d (%s)\n",
- (long)s, err, sock_errstr(err) ));
+ LDAP_LOG( CONNECTION, ERR,
+ "slapd_daemon_task: setsockopt( %ld, "
+ "TCP_NODELAY) failed errno=%d (%s)\n",
+ (long)s, err, sock_errstr(err) );
#else
Debug( LDAP_DEBUG_ANY,
"slapd(%ld): setsockopt(TCP_NODELAY) failed "
#endif
#ifdef NEW_LOGGING
- LDAP_LOG(( "connection", LDAP_LEVEL_DETAIL1,
- "slapd_daemon_task: new connection on %ld\n", (long)s ));
+ LDAP_LOG( CONNECTION, DETAIL1,
+ "slapd_daemon_task: new connection on %ld\n", (long)s, 0, 0 );
#else
Debug( LDAP_DEBUG_CONNS, "daemon: new connection on %ld\n",
(long) s, 0, 0 );
if( id < 0 ) {
#ifdef NEW_LOGGING
- LDAP_LOG(( "connection", LDAP_LEVEL_INFO,
- "slapd_daemon_task: connection_init(%ld, %s, %s) failed.\n",
- (long)s, peername, slap_listeners[l]->sl_name ));
+ LDAP_LOG( CONNECTION, INFO,
+ "slapd_daemon_task: connection_init(%ld, %s, %s) failed.\n",
+ (long)s, peername, slap_listeners[l]->sl_name );
#else
Debug( LDAP_DEBUG_ANY,
"daemon: connection_init(%ld, %s, %s) failed.\n",
#ifdef LDAP_DEBUG
#ifdef NEW_LOGGING
- LDAP_LOG(( "connection", LDAP_LEVEL_DETAIL2,
- "slapd_daemon_task: activity on " ));
+ LDAP_LOG( CONNECTION, DETAIL2,
+ "slapd_daemon_task: activity on ", 0, 0, 0 );
#else
Debug( LDAP_DEBUG_CONNS, "daemon: activity on:", 0, 0, 0 );
#endif
#ifdef HAVE_WINSOCK
for ( i = 0; i < readfds.fd_count; i++ ) {
#ifdef NEW_LOGGING
- LDAP_LOG(( "connection", LDAP_LEVEL_DETAIL2,
- " %d%s", readfds.fd_array[i], "r", 0 ));
+ LDAP_LOG( CONNECTION, DETAIL2,
+ " %d%s", readfds.fd_array[i], "r", 0, 0 );
#else
Debug( LDAP_DEBUG_CONNS, " %d%s",
readfds.fd_array[i], "r", 0 );
}
for ( i = 0; i < writefds.fd_count; i++ ) {
#ifdef NEW_LOGGING
- LDAP_LOG(( "connection", LDAP_LEVEL_DETAIL2,
- " %d%s", writefds.fd_array[i], "w" ));
+ LDAP_LOG( CONNECTION, DETAIL2,
+ " %d%s", writefds.fd_array[i], "w" , 0 );
#else
Debug( LDAP_DEBUG_CONNS, " %d%s",
writefds.fd_array[i], "w", 0 );
w = FD_ISSET( i, &writefds );
if ( r || w ) {
#ifdef NEW_LOGGING
- LDAP_LOG(( "connection", LDAP_LEVEL_DETAIL2,
- " %d%s%s", i,
- r ? "r" : "", w ? "w" : "" ));
+ LDAP_LOG( CONNECTION, DETAIL2,
+ " %d%s%s", i, r ? "r" : "", w ? "w" : "" );
#else
Debug( LDAP_DEBUG_CONNS, " %d%s%s", i,
r ? "r" : "", w ? "w" : "" );
}
#endif
#ifdef NEW_LOGGING
- LDAP_LOG(( "connection", LDAP_LEVEL_DETAIL2, "\n" ));
+ LDAP_LOG( CONNECTION, DETAIL2, "\n", 0, 0, 0 );
#else
Debug( LDAP_DEBUG_CONNS, "\n", 0, 0, 0 );
#endif
continue;
}
#ifdef NEW_LOGGING
- LDAP_LOG(( "connection", LDAP_LEVEL_DETAIL2,
- "slapd_daemon_task: write active on %d\n", wd ));
+ LDAP_LOG( CONNECTION, DETAIL2,
+ "slapd_daemon_task: write active on %d\n", wd, 0, 0 );
#else
Debug( LDAP_DEBUG_CONNS,
"daemon: write active on %d\n",
}
#ifdef NEW_LOGGING
- LDAP_LOG(( "connection", LDAP_LEVEL_DETAIL2,
- "slapd_daemon_task: read activity on %d\n", rd ));
+ LDAP_LOG( CONNECTION, DETAIL2,
+ "slapd_daemon_task: read activity on %d\n", rd, 0, 0 );
#else
Debug ( LDAP_DEBUG_CONNS,
"daemon: read activity on %d\n", rd, 0, 0 );
if( slapd_shutdown == 1 ) {
#ifdef NEW_LOGGING
- LDAP_LOG(( "connection", LDAP_LEVEL_CRIT,
- "slapd_daemon_task: shutdown requested and initiated.\n"));
+ LDAP_LOG( CONNECTION, CRIT,
+ "slapd_daemon_task: shutdown requested and initiated.\n", 0, 0, 0 );
#else
Debug( LDAP_DEBUG_TRACE,
"daemon: shutdown requested and initiated.\n",
} else if ( slapd_shutdown == 2 ) {
#ifdef HAVE_NT_SERVICE_MANAGER
#ifdef NEW_LOGGING
- LDAP_LOG(( "connection", LDAP_LEVEL_CRIT,
- "slapd_daemon_task: shutdown initiated by Service Manager.\n"));
+ LDAP_LOG( CONNECTION, CRIT,
+ "slapd_daemon_task: shutdown initiated by Service Manager.\n",
+ 0, 0, 0);
#else
Debug( LDAP_DEBUG_TRACE,
"daemon: shutdown initiated by Service Manager.\n",
#endif
#else /* !HAVE_NT_SERVICE_MANAGER */
#ifdef NEW_LOGGING
- LDAP_LOG(( "connection", LDAP_LEVEL_CRIT,
- "slapd_daemon_task: abnormal condition, shutdown initiated.\n" ));
+ LDAP_LOG( CONNECTION, CRIT,
+ "slapd_daemon_task: abnormal condition, "
+ "shutdown initiated.\n", 0, 0, 0 );
#else
Debug( LDAP_DEBUG_TRACE,
"daemon: abnormal condition, shutdown initiated.\n",
#endif /* !HAVE_NT_SERVICE_MANAGER */
} else {
#ifdef NEW_LOGGING
- LDAP_LOG(( "connection", LDAP_LEVEL_CRIT,
- "slapd_daemon_task: no active streams, shutdown initiated.\n" ));
+ LDAP_LOG( CONNECTION, CRIT,
+ "slapd_daemon_task: no active streams, shutdown initiated.\n",
+ 0, 0, 0 );
#else
Debug( LDAP_DEBUG_TRACE,
"daemon: no active streams, shutdown initiated.\n",
slap_listeners = NULL;
#ifdef NEW_LOGGING
- LDAP_LOG(( "connection", LDAP_LEVEL_CRIT,
- "slapd_daemon_task: shutdown waiting for %d threads to terminate.\n",
- ldap_pvt_thread_pool_backload(&connection_pool) ));
+ LDAP_LOG( CONNECTION, CRIT,
+ "slapd_daemon_task: shutdown waiting for %d threads to terminate.\n",
+ ldap_pvt_thread_pool_backload(&connection_pool), 0, 0 );
#else
Debug( LDAP_DEBUG_ANY,
"slapd shutdown: waiting for %d threads to terminate\n",
if ( rc != 0 ) {
#ifdef NEW_LOGGING
- LDAP_LOG(( "connection", LDAP_LEVEL_ERR,
- "slapd_daemon: listener ldap_pvt_thread_create failed (%d).\n", rc ));
+ LDAP_LOG( CONNECTION, ERR,
+ "slapd_daemon: listener ldap_pvt_thread_create failed (%d).\n",
+ rc, 0, 0 );
#else
Debug( LDAP_DEBUG_ANY,
"listener ldap_pvt_thread_create failed (%d)\n", rc, 0, 0 );
slap_sig_shutdown( int sig )
{
#ifdef NEW_LOGGING
- LDAP_LOG(( "connection", LDAP_LEVEL_CRIT,
- "slap_sig_shutdown: signal %d\n", sig ));
+ LDAP_LOG( CONNECTION, CRIT,
+ "slap_sig_shutdown: signal %d\n", sig, 0, 0 );
#else
Debug(LDAP_DEBUG_TRACE, "slap_sig_shutdown: signal %d\n", sig, 0, 0);
#endif
#if HAVE_NT_SERVICE_MANAGER && SIGBREAK
if (is_NT_Service && sig == SIGBREAK)
#ifdef NEW_LOGGING
- LDAP_LOG(( "connection", LDAP_LEVEL_CRIT,
- "slap_sig_shutdown: SIGBREAK ignored.\n" ));
+ LDAP_LOG( CONNECTION, CRIT,
+ "slap_sig_shutdown: SIGBREAK ignored.\n", 0, 0, 0 );
#else
Debug(LDAP_DEBUG_TRACE, "slap_sig_shutdown: SIGBREAK ignored.\n",
0, 0, 0);
int manageDSAit;
#ifdef NEW_LOGGING
- LDAP_LOG(( "operation", LDAP_LEVEL_ENTRY,
- "do_delete: conn %d\n", conn->c_connid ));
+ LDAP_LOG( OPERATION, ENTRY,
+ "do_delete: conn %d\n", conn->c_connid, 0, 0 );
#else
Debug( LDAP_DEBUG_TRACE, "do_delete\n", 0, 0, 0 );
#endif
if ( ber_scanf( op->o_ber, "m", &dn ) == LBER_ERROR ) {
#ifdef NEW_LOGGING
- LDAP_LOG(( "operation", LDAP_LEVEL_ERR,
- "do_delete: conn: %d ber_scanf failed\n", conn->c_connid ));
+ LDAP_LOG( OPERATION, ERR,
+ "do_delete: conn: %d ber_scanf failed\n", conn->c_connid, 0, 0 );
#else
Debug( LDAP_DEBUG_ANY, "ber_scanf failed\n", 0, 0, 0 );
#endif
if( ( rc = get_ctrls( conn, op, 1 ) ) != LDAP_SUCCESS ) {
#ifdef NEW_LOGGING
- LDAP_LOG(( "operation", LDAP_LEVEL_ERR,
- "do_delete: conn %d get_ctrls failed\n", conn->c_connid ));
+ LDAP_LOG( OPERATION, ERR,
+ "do_delete: conn %d get_ctrls failed\n", conn->c_connid, 0, 0 );
#else
Debug( LDAP_DEBUG_ANY, "do_delete: get_ctrls failed\n", 0, 0, 0 );
#endif
rc = dnPrettyNormal( NULL, &dn, &pdn, &ndn );
if( rc != LDAP_SUCCESS ) {
#ifdef NEW_LOGGING
- LDAP_LOG(( "operation", LDAP_LEVEL_INFO,
+ LDAP_LOG( OPERATION, INFO,
"do_delete: conn %d invalid dn (%s)\n",
- conn->c_connid, dn.bv_val ));
+ conn->c_connid, dn.bv_val, 0 );
#else
Debug( LDAP_DEBUG_ANY,
"do_delete: invalid dn (%s)\n", dn.bv_val, 0, 0 );
if( ndn.bv_len == 0 ) {
#ifdef NEW_LOGGING
- LDAP_LOG(( "operation", LDAP_LEVEL_INFO, "do_delete: conn %d: "
- "Attempt to delete root DSE.\n", conn->c_connid ));
+ LDAP_LOG( OPERATION, INFO,
+ "do_delete: conn %d: Attempt to delete root DSE.\n",
+ conn->c_connid, 0, 0 );
#else
Debug( LDAP_DEBUG_ANY, "do_delete: root dse!\n", 0, 0, 0 );
#endif
} else if ( strcasecmp( ndn.bv_val, SLAPD_SCHEMA_DN ) == 0 ) {
#ifdef NEW_LOGGING
- LDAP_LOG(( "operation", LDAP_LEVEL_INFO, "do_delete: conn %d: "
- "Attempt to delete subschema subentry.\n", conn->c_connid ));
+ LDAP_LOG( OPERATION, INFO, "do_delete: conn %d: "
+ "Attempt to delete subschema subentry.\n", conn->c_connid, 0, 0 );
#else
Debug( LDAP_DEBUG_ANY, "do_delete: subschema subentry!\n", 0, 0, 0 );
#endif
assert( val );
assert( out );
+#ifdef NEW_LOGGING
+ LDAP_LOG( OPERATION, ARGS, ">>> dnPretty: <%s>\n", val->bv_val, 0, 0 );
+#else
Debug( LDAP_DEBUG_TRACE, ">>> dnPretty: <%s>\n", val->bv_val, 0, 0 );
+#endif
if ( val->bv_len == 0 ) {
ber_dupbv( out, val );
struct berval *pretty,
struct berval *normal)
{
+#ifdef NEW_LOGGING
+ LDAP_LOG ( OPERATION, ENTRY, ">>> dnPrettyNormal: <%s>\n", val->bv_val, 0, 0 );
+#else
Debug( LDAP_DEBUG_TRACE, ">>> dnPrettyNormal: <%s>\n", val->bv_val, 0, 0 );
+#endif
assert( val );
assert( pretty );
}
}
+#ifdef NEW_LOGGING
+ LDAP_LOG (OPERATION, RESULTS, "<<< dnPrettyNormal: <%s>, <%s>\n",
+ pretty->bv_val, normal->bv_val, 0 );
+#else
Debug( LDAP_DEBUG_TRACE, "<<< dnPrettyNormal: <%s>, <%s>\n",
pretty->bv_val, normal->bv_val, 0 );
+#endif
return LDAP_SUCCESS;
}
}
#ifdef NEW_LOGGING
- LDAP_LOG(( "schema", LDAP_LEVEL_ENTRY,
- "dnMatch: %d\n %s\n %s\n", match,
- value->bv_val, asserted->bv_val ));
+ LDAP_LOG( CONFIG, ENTRY, "dnMatch: %d\n %s\n %s\n",
+ match, value->bv_val, asserted->bv_val );
#else
Debug( LDAP_DEBUG_ARGS, "dnMatch %d\n\t\"%s\"\n\t\"%s\"\n",
match, value->bv_val, asserted->bv_val );
new_dn->bv_len = parent_dn->bv_len + newrdn->bv_len + 1;
new_dn->bv_val = (char *) ch_malloc( new_dn->bv_len + 1 );
- ptr = slap_strcopy( new_dn->bv_val, newrdn->bv_val );
+ ptr = lutil_strcopy( new_dn->bv_val, newrdn->bv_val );
*ptr++ = ',';
strcpy( ptr, parent_dn->bv_val );
}
*/
#ifdef NEW_LOGGING
- LDAP_LOG(( "operation", LDAP_LEVEL_DETAIL1,
- "str2entry: \"%s\"\n", s ? s : "NULL" ));
+ LDAP_LOG( OPERATION, DETAIL1, "str2entry: \"%s\"\n", s ? s : "NULL", 0, 0 );
#else
Debug( LDAP_DEBUG_TRACE, "=> str2entry\n",
s ? s : "NULL", 0, 0 );
if( e == NULL ) {
#ifdef NEW_LOGGING
- LDAP_LOG(( "operation", LDAP_LEVEL_ERR,
- "str2entry: entry allocation failed.\n" ));
+ LDAP_LOG( OPERATION, ERR, "str2entry: entry allocation failed.\n", 0, 0, 0 );
#else
Debug( LDAP_DEBUG_ANY,
"<= str2entry NULL (entry allocation failed)\n",
if ( ldif_parse_line( s, &type, &vals[0].bv_val, &vals[0].bv_len ) != 0 ) {
#ifdef NEW_LOGGING
- LDAP_LOG(( "operation", LDAP_LEVEL_DETAIL1,
- "str2entry: NULL (parse_line)\n" ));
+ LDAP_LOG( OPERATION, DETAIL1, "str2entry: NULL (parse_line)\n",0, 0, 0 );
#else
Debug( LDAP_DEBUG_TRACE,
"<= str2entry NULL (parse_line)\n", 0, 0, 0 );
if ( e->e_dn != NULL ) {
#ifdef NEW_LOGGING
- LDAP_LOG(( "operation", LDAP_LEVEL_DETAIL1, "str2entry: "
+ LDAP_LOG( OPERATION, DETAIL1, "str2entry: "
"entry %ld has multiple DNs \"%s\" and \"%s\"\n",
(long) e->e_id, e->e_dn,
- vals[0].bv_val != NULL ? vals[0].bv_val : "" ));
+ vals[0].bv_val != NULL ? vals[0].bv_val : "" );
#else
Debug( LDAP_DEBUG_ANY, "str2entry: "
"entry %ld has multiple DNs \"%s\" and \"%s\"\n",
rc = dnPrettyNormal( NULL, &vals[0], &e->e_name, &e->e_nname );
if( rc != LDAP_SUCCESS ) {
#ifdef NEW_LOGGING
- LDAP_LOG(( "operation", LDAP_LEVEL_DETAIL1, "str2entry: "
- "entry %ld has invalid DN \"%s\"\n",
- (long) e->e_id, vals[0].bv_val ));
+ LDAP_LOG( OPERATION, DETAIL1,
+ "str2entry: entry %ld has invalid DN \"%s\"\n",
+ (long) e->e_id, vals[0].bv_val, 0 );
#else
Debug( LDAP_DEBUG_ANY, "str2entry: "
"entry %ld has invalid DN \"%s\"\n",
if( rc != LDAP_SUCCESS ) {
#ifdef NEW_LOGGING
- LDAP_LOG(( "operation", LDAP_LEVEL_DETAIL1,
- "str2entry: str2ad(%s): %s\n", type, text ));
+ LDAP_LOG( OPERATION, DETAIL1,
+ "str2entry: str2ad(%s): %s\n", type, text, 0 );
#else
Debug( slapMode & SLAP_TOOL_MODE
? LDAP_DEBUG_ANY : LDAP_DEBUG_TRACE,
rc = slap_str2undef_ad( type, &ad, &text );
if( rc != LDAP_SUCCESS ) {
#ifdef NEW_LOGGING
- LDAP_LOG(( "operation", LDAP_LEVEL_DETAIL1,
- "str2entry: str2undef_ad(%s): %s\n", type, text ));
+ LDAP_LOG( OPERATION, DETAIL1,
+ "str2entry: str2undef_ad(%s): %s\n", type, text, 0 );
#else
Debug( LDAP_DEBUG_ANY,
"<= str2entry: str2undef_ad(%s): %s\n",
} else {
#ifdef NEW_LOGGING
- LDAP_LOG(( "operation", LDAP_LEVEL_INFO,
+ LDAP_LOG( OPERATION, INFO,
"str2entry: no validator for syntax %s\n",
- ad->ad_type->sat_syntax->ssyn_oid ));
+ ad->ad_type->sat_syntax->ssyn_oid, 0, 0 );
#else
Debug( LDAP_DEBUG_ANY,
"str2entry: no validator for syntax %s\n",
if( rc != 0 ) {
#ifdef NEW_LOGGING
- LDAP_LOG(( "operation", LDAP_LEVEL_ERR,
+ LDAP_LOG( OPERATION, ERR,
"str2entry: invalid value for syntax %s\n",
- ad->ad_type->sat_syntax->ssyn_oid ));
+ ad->ad_type->sat_syntax->ssyn_oid, 0, 0 );
#else
Debug( LDAP_DEBUG_ANY,
"str2entry: invalid value for syntax %s\n",
rc = attr_merge( e, ad, vals );
if( rc != 0 ) {
#ifdef NEW_LOGGING
- LDAP_LOG(( "operation", LDAP_LEVEL_DETAIL1,
- "str2entry: NULL (attr_merge)\n" ));
+ LDAP_LOG( OPERATION, DETAIL1,
+ "str2entry: NULL (attr_merge)\n" , 0, 0, 0 );
#else
Debug( LDAP_DEBUG_ANY,
"<= str2entry NULL (attr_merge)\n", 0, 0, 0 );
/* check to make sure there was a dn: line */
if ( e->e_dn == NULL ) {
#ifdef NEW_LOGGING
- LDAP_LOG(( "operation", LDAP_LEVEL_INFO,
- "str2entry: entry %ld has no dn.\n",
- (long) e->e_id ));
+ LDAP_LOG( OPERATION, INFO,
+ "str2entry: entry %ld has no dn.\n", (long) e->e_id, 0, 0 );
#else
Debug( LDAP_DEBUG_ANY, "str2entry: entry %ld has no dn\n",
(long) e->e_id, 0, 0 );
}
#ifdef NEW_LOGGING
- LDAP_LOG(( "operation", LDAP_LEVEL_DETAIL2,
- "str2entry(%s) -> 0x%lx\n", e->e_dn, (unsigned long)e ));
+ LDAP_LOG( OPERATION, DETAIL2,
+ "str2entry(%s) -> 0x%lx\n", e->e_dn, (unsigned long)e, 0 );
#else
Debug(LDAP_DEBUG_TRACE, "<= str2entry(%s) -> 0x%lx\n",
e->e_dn, (unsigned long) e, 0 );
unsigned char *ptr;
#ifdef NEW_LOGGING
- LDAP_LOG(( "operation", LDAP_LEVEL_DETAIL1,
- "entry_encode: id: 0x%08lx \"%s\"\n",
- (long) e->e_id, e->e_dn ));
+ LDAP_LOG( OPERATION, DETAIL1, "entry_encode: id: 0x%08lx \"%s\"\n",
+ (long) e->e_id, e->e_dn, 0 );
#else
Debug( LDAP_DEBUG_TRACE, "=> entry_encode(0x%08lx): %s\n",
(long) e->e_id, e->e_dn, 0 );
x->e_nname.bv_len = i;
ptr += i+1;
#ifdef NEW_LOGGING
- LDAP_LOG(( "operation", LDAP_LEVEL_DETAIL2,
- "entry_decode: \"%s\"\n", x->e_dn ));
+ LDAP_LOG( OPERATION, DETAIL2, "entry_decode: \"%s\"\n", x->e_dn, 0, 0 );
#else
Debug( LDAP_DEBUG_TRACE,
"entry_decode: \"%s\"\n",
if( rc != LDAP_SUCCESS ) {
#ifdef NEW_LOGGING
- LDAP_LOG(( "operation", LDAP_LEVEL_INFO,
- "entry_decode: str2ad(%s): %s\n", ptr, text ));
+ LDAP_LOG( OPERATION, INFO,
+ "entry_decode: str2ad(%s): %s\n", ptr, text, 0 );
#else
Debug( LDAP_DEBUG_TRACE,
"<= entry_decode: str2ad(%s): %s\n", ptr, text, 0 );
if( rc != LDAP_SUCCESS ) {
#ifdef NEW_LOGGING
- LDAP_LOG(( "operation", LDAP_LEVEL_INFO,
- "entry_decode: str2undef_ad(%s): %s\n", ptr, text));
+ LDAP_LOG( OPERATION, INFO,
+ "entry_decode: str2undef_ad(%s): %s\n", ptr, text, 0 );
#else
Debug( LDAP_DEBUG_ANY,
"<= entry_decode: str2undef_ad(%s): %s\n",
if (a)
a->a_next = NULL;
#ifdef NEW_LOGGING
- LDAP_LOG(( "operation", LDAP_LEVEL_DETAIL1,
- "entry_decode: %s\n", x->e_dn ));
+ LDAP_LOG( OPERATION, DETAIL1, "entry_decode: %s\n", x->e_dn, 0, 0 );
#else
Debug(LDAP_DEBUG_TRACE, "<= entry_decode(%s)\n",
x->e_dn, 0, 0 );
LDAPControl **rspctrls;
#ifdef NEW_LOGGING
- LDAP_LOG(( "operation", LDAP_LEVEL_ENTRY,
- "do_extended: conn %d\n", conn->c_connid ));
+ LDAP_LOG( OPERATION, ENTRY, "do_extended: conn %d\n", conn->c_connid, 0, 0 );
#else
Debug( LDAP_DEBUG_TRACE, "do_extended\n", 0, 0, 0 );
#endif
if( op->o_protocol < LDAP_VERSION3 ) {
#ifdef NEW_LOGGING
- LDAP_LOG(( "operation", LDAP_LEVEL_ERR,
- "do_extended: protocol version (%d) too low.\n",
- op->o_protocol ));
+ LDAP_LOG( OPERATION, ERR,
+ "do_extended: protocol version (%d) too low.\n", op->o_protocol, 0, 0 );
#else
Debug( LDAP_DEBUG_ANY,
"do_extended: protocol version (%d) too low\n",
if ( ber_scanf( op->o_ber, "{m" /*}*/, &reqoid ) == LBER_ERROR ) {
#ifdef NEW_LOGGING
- LDAP_LOG(( "operation", LDAP_LEVEL_ERR,
- "do_extended: conn %d ber_scanf failed\n", conn->c_connid ));
+ LDAP_LOG( OPERATION, ERR, "do_extended: conn %d ber_scanf failed\n",
+ conn->c_connid, 0, 0 );
#else
Debug( LDAP_DEBUG_ANY, "do_extended: ber_scanf failed\n", 0, 0 ,0 );
#endif
if( !(ext = find_extop(supp_ext_list, &reqoid)) ) {
#ifdef NEW_LOGGING
- LDAP_LOG(( "operation", LDAP_LEVEL_ERR,
+ LDAP_LOG( OPERATION, ERR,
"do_extended: conn %d unsupported operation \"%s\"\n",
- conn->c_connid, reqoid.bv_val ));
+ conn->c_connid, reqoid.bv_val, 0 );
#else
Debug( LDAP_DEBUG_ANY, "do_extended: unsupported operation \"%s\"\n",
reqoid.bv_val, 0 ,0 );
if( ber_peek_tag( op->o_ber, &len ) == LDAP_TAG_EXOP_REQ_VALUE ) {
if( ber_scanf( op->o_ber, "m", &reqdata ) == LBER_ERROR ) {
#ifdef NEW_LOGGING
- LDAP_LOG(( "operation", LDAP_LEVEL_ERR,
- "do_extended: conn %d ber_scanf failed\n", conn->c_connid ));
+ LDAP_LOG( OPERATION, ERR,
+ "do_extended: conn %d ber_scanf failed\n",
+ conn->c_connid, 0, 0 );
#else
Debug( LDAP_DEBUG_ANY, "do_extended: ber_scanf failed\n", 0, 0 ,0 );
#endif
if( (rc = get_ctrls( conn, op, 1 )) != LDAP_SUCCESS ) {
#ifdef NEW_LOGGING
- LDAP_LOG(( "operation", LDAP_LEVEL_ERR,
- "do_extended: conn %d get_ctrls failed\n", conn->c_connid ));
+ LDAP_LOG( OPERATION, ERR,
+ "do_extended: conn %d get_ctrls failed\n", conn->c_connid, 0, 0 );
#else
Debug( LDAP_DEBUG_ANY, "do_extended: get_ctrls failed\n", 0, 0 ,0 );
#endif
}
#ifdef NEW_LOGGING
- LDAP_LOG(( "operation", LDAP_LEVEL_DETAIL1,
- "do_extended: conn %d oid=%d\n.", conn->c_connid, reqoid.bv_val ));
+ LDAP_LOG( OPERATION, DETAIL1,
+ "do_extended: conn %d oid=%d\n.", conn->c_connid, reqoid.bv_val, 0 );
#else
Debug( LDAP_DEBUG_ARGS, "do_extended: oid=%s\n", reqoid.bv_val, 0 ,0 );
#endif
Filter *f;
#ifdef NEW_LOGGING
- LDAP_LOG(( "filter", LDAP_LEVEL_ENTRY, "get_filter: conn %d\n",
- conn->c_connid ));
+ LDAP_LOG( FILTER, ENTRY, "get_filter: conn %d\n", conn->c_connid, 0, 0 );
#else
Debug( LDAP_DEBUG_FILTER, "begin get_filter\n", 0, 0, 0 );
#endif
switch ( f->f_choice ) {
case LDAP_FILTER_EQUALITY:
#ifdef NEW_LOGGING
- LDAP_LOG(( "filter", LDAP_LEVEL_DETAIL2,
- "get_filter: conn %d EQUALITY\n", conn->c_connid ));
+ LDAP_LOG( FILTER, DETAIL2,
+ "get_filter: conn %d EQUALITY\n", conn->c_connid, 0, 0 );
#else
Debug( LDAP_DEBUG_FILTER, "EQUALITY\n", 0, 0, 0 );
#endif
case LDAP_FILTER_SUBSTRINGS:
#ifdef NEW_LOGGING
- LDAP_LOG(( "filter", LDAP_LEVEL_DETAIL1,
- "get_filter: conn %d SUBSTRINGS\n", conn->c_connid ));
+ LDAP_LOG( FILTER, DETAIL1,
+ "get_filter: conn %d SUBSTRINGS\n", conn->c_connid, 0, 0 );
#else
Debug( LDAP_DEBUG_FILTER, "SUBSTRINGS\n", 0, 0, 0 );
#endif
case LDAP_FILTER_GE:
#ifdef NEW_LOGGING
- LDAP_LOG(( "filter", LDAP_LEVEL_DETAIL1,
- "get_filter: conn %d GE\n", conn->c_connid ));
+ LDAP_LOG( FILTER, DETAIL1,
+ "get_filter: conn %d GE\n", conn->c_connid, 0, 0 );
#else
Debug( LDAP_DEBUG_FILTER, "GE\n", 0, 0, 0 );
#endif
case LDAP_FILTER_LE:
#ifdef NEW_LOGGING
- LDAP_LOG(( "filter", LDAP_LEVEL_DETAIL1,
- "get_filter: conn %d LE\n", conn->c_connid ));
+ LDAP_LOG( FILTER, DETAIL1,
+ "get_filter: conn %d LE\n", conn->c_connid, 0, 0 );
#else
Debug( LDAP_DEBUG_FILTER, "LE\n", 0, 0, 0 );
#endif
struct berval type;
#ifdef NEW_LOGGING
- LDAP_LOG(( "filter", LDAP_LEVEL_DETAIL1,
- "get_filter: conn %d PRESENT\n", conn->c_connid ));
+ LDAP_LOG( FILTER, DETAIL1,
+ "get_filter: conn %d PRESENT\n", conn->c_connid, 0, 0 );
#else
Debug( LDAP_DEBUG_FILTER, "PRESENT\n", 0, 0, 0 );
#endif
case LDAP_FILTER_APPROX:
#ifdef NEW_LOGGING
- LDAP_LOG(( "filter", LDAP_LEVEL_DETAIL1,
- "get_filter: conn %d APPROX\n", conn->c_connid ));
+ LDAP_LOG( FILTER, DETAIL1,
+ "get_filter: conn %d APPROX\n", conn->c_connid, 0, 0 );
#else
Debug( LDAP_DEBUG_FILTER, "APPROX\n", 0, 0, 0 );
#endif
case LDAP_FILTER_AND:
#ifdef NEW_LOGGING
- LDAP_LOG(( "filter", LDAP_LEVEL_DETAIL1,
- "get_filter: conn %d AND\n", conn->c_connid ));
+ LDAP_LOG( FILTER, DETAIL1,
+ "get_filter: conn %d AND\n", conn->c_connid, 0, 0 );
#else
Debug( LDAP_DEBUG_FILTER, "AND\n", 0, 0, 0 );
#endif
case LDAP_FILTER_OR:
#ifdef NEW_LOGGING
- LDAP_LOG(( "filter", LDAP_LEVEL_DETAIL1,
- "get_filter: conn %d OR\n", conn->c_connid ));
+ LDAP_LOG( FILTER, DETAIL1,
+ "get_filter: conn %d OR\n", conn->c_connid, 0, 0 );
#else
Debug( LDAP_DEBUG_FILTER, "OR\n", 0, 0, 0 );
#endif
case LDAP_FILTER_NOT:
#ifdef NEW_LOGGING
- LDAP_LOG(( "filter", LDAP_LEVEL_DETAIL1,
- "get_filter: conn %d NOT\n", conn->c_connid ));
+ LDAP_LOG( FILTER, DETAIL1,
+ "get_filter: conn %d NOT\n", conn->c_connid, 0, 0 );
#else
Debug( LDAP_DEBUG_FILTER, "NOT\n", 0, 0, 0 );
#endif
case LDAP_FILTER_EXT:
#ifdef NEW_LOGGING
- LDAP_LOG(( "filter", LDAP_LEVEL_DETAIL1,
- "get_filter: conn %d EXTENSIBLE\n", conn->c_connid ));
+ LDAP_LOG( FILTER, DETAIL1,
+ "get_filter: conn %d EXTENSIBLE\n", conn->c_connid, 0, 0 );
#else
Debug( LDAP_DEBUG_FILTER, "EXTENSIBLE\n", 0, 0, 0 );
#endif
default:
(void) ber_scanf( ber, "x" ); /* skip the element */
#ifdef NEW_LOGGING
- LDAP_LOG(( "filter", LDAP_LEVEL_ERR,
+ LDAP_LOG( FILTER, ERR,
"get_filter: conn %d unknown filter type=%lu\n",
- conn->c_connid, f->f_choice ));
+ conn->c_connid, f->f_choice, 0 );
#else
Debug( LDAP_DEBUG_ANY, "get_filter: unknown filter type=%lu\n",
f->f_choice, 0, 0 );
}
#ifdef NEW_LOGGING
- LDAP_LOG(( "filter", LDAP_LEVEL_DETAIL2,
- "get_filter: conn %d exit\n", conn->c_connid ));
+ LDAP_LOG( FILTER, DETAIL2,
+ "get_filter: conn %d exit\n", conn->c_connid, 0, 0 );
#else
Debug( LDAP_DEBUG_FILTER, "end get_filter %d\n", err, 0, 0 );
#endif
char *last;
#ifdef NEW_LOGGING
- LDAP_LOG(( "filter", LDAP_LEVEL_ENTRY,
- "get_filter_list: conn %d start\n", conn->c_connid ));
+ LDAP_LOG( FILTER, ENTRY,
+ "get_filter_list: conn %d start\n", conn->c_connid, 0, 0 );
#else
Debug( LDAP_DEBUG_FILTER, "begin get_filter_list\n", 0, 0, 0 );
#endif
*new = NULL;
#ifdef NEW_LOGGING
- LDAP_LOG(( "filter", LDAP_LEVEL_ENTRY,
- "get_filter_list: conn %d exit\n", conn->c_connid ));
+ LDAP_LOG( FILTER, ENTRY,
+ "get_filter_list: conn %d exit\n", conn->c_connid, 0, 0 );
#else
Debug( LDAP_DEBUG_FILTER, "end get_filter_list\n", 0, 0, 0 );
#endif
*text = "error decoding filter";
#ifdef NEW_LOGGING
- LDAP_LOG(( "filter", LDAP_LEVEL_ENTRY,
- "get_substring_filter: conn %d begin\n", conn->c_connid ));
+ LDAP_LOG( FILTER, ENTRY,
+ "get_substring_filter: conn %d begin\n", conn->c_connid, 0, 0 );
#else
Debug( LDAP_DEBUG_FILTER, "begin get_substring_filter\n", 0, 0, 0 );
#endif
rc = LDAP_PROTOCOL_ERROR;
#ifdef NEW_LOGGING
- LDAP_LOG(( "filter", LDAP_LEVEL_ERR,
+ LDAP_LOG( FILTER, ERR,
"get_filter_substring: conn %d unknown substring choice=%ld\n",
- conn->c_connid, (long)tag ));
+ conn->c_connid, (long)tag, 0 );
#else
Debug( LDAP_DEBUG_FILTER,
" unknown substring choice=%ld\n",
switch ( tag ) {
case LDAP_SUBSTRING_INITIAL:
#ifdef NEW_LOGGING
- LDAP_LOG(( "filter", LDAP_LEVEL_DETAIL1,
- "get_substring_filter: conn %d INITIAL\n",
- conn->c_connid ));
+ LDAP_LOG( FILTER, DETAIL1,
+ "get_substring_filter: conn %d INITIAL\n", conn->c_connid, 0, 0 );
#else
Debug( LDAP_DEBUG_FILTER, " INITIAL\n", 0, 0, 0 );
#endif
case LDAP_SUBSTRING_ANY:
#ifdef NEW_LOGGING
- LDAP_LOG(( "filter", LDAP_LEVEL_DETAIL1,
- "get_substring_filter: conn %d ANY\n",
- conn->c_connid ));
+ LDAP_LOG( FILTER, DETAIL1,
+ "get_substring_filter: conn %d ANY\n", conn->c_connid, 0, 0 );
#else
Debug( LDAP_DEBUG_FILTER, " ANY\n", 0, 0, 0 );
#endif
case LDAP_SUBSTRING_FINAL:
#ifdef NEW_LOGGING
- LDAP_LOG(( "filter", LDAP_LEVEL_DETAIL1,
- "get_substring_filter: conn %d FINAL\n",
- conn->c_connid ));
+ LDAP_LOG( FILTER, DETAIL1,
+ "get_substring_filter: conn %d FINAL\n", conn->c_connid, 0, 0 );
#else
Debug( LDAP_DEBUG_FILTER, " FINAL\n", 0, 0, 0 );
#endif
default:
#ifdef NEW_LOGGING
- LDAP_LOG(( "filter", LDAP_LEVEL_INFO,
+ LDAP_LOG( FILTER, INFO,
"get_substring_filter: conn %d unknown substring type %ld\n",
- conn->c_connid, (long)tag ));
+ conn->c_connid, (long)tag, 0 );
#else
Debug( LDAP_DEBUG_FILTER,
" unknown substring type=%ld\n",
return_error:
#ifdef NEW_LOGGING
- LDAP_LOG(( "filter", LDAP_LEVEL_INFO,
+ LDAP_LOG( FILTER, INFO,
"get_substring_filter: conn %d error %ld\n",
- conn->c_connid, (long)rc ));
+ conn->c_connid, (long)rc, 0 );
#else
Debug( LDAP_DEBUG_FILTER, " error=%ld\n",
(long) rc, 0, 0 );
}
#ifdef NEW_LOGGING
- LDAP_LOG(( "filter", LDAP_LEVEL_ENTRY,
- "get_substring_filter: conn %d exit\n", conn->c_connid ));
+ LDAP_LOG( FILTER, ENTRY,
+ "get_substring_filter: conn %d exit\n", conn->c_connid, 0, 0 );
#else
Debug( LDAP_DEBUG_FILTER, "end get_substring_filter\n", 0, 0, 0 );
#endif
default:
#ifdef NEW_LOGGING
- LDAP_LOG(( "filter", LDAP_LEVEL_ERR,
- "filter_free: unknown filter type %lu\n", f->f_choice ));
+ LDAP_LOG( FILTER, ERR,
+ "filter_free: unknown filter type %lu\n", f->f_choice, 0, 0 );
#else
Debug( LDAP_DEBUG_ANY, "filter_free: unknown filter type=%lu\n",
f->f_choice, 0, 0 );
ValuesReturnFilter *f;
#ifdef NEW_LOGGING
- LDAP_LOG(( "filter", LDAP_LEVEL_ENTRY, "get_simple_vrFilter: conn %d\n",
- conn->c_connid ));
+ LDAP_LOG( FILTER, ENTRY,
+ "get_simple_vrFilter: conn %d\n", conn->c_connid, 0, 0 );
#else
Debug( LDAP_DEBUG_FILTER, "begin get_simple_vrFilter\n", 0, 0, 0 );
#endif
switch ( f->f_choice ) {
case LDAP_FILTER_EQUALITY:
#ifdef NEW_LOGGING
- LDAP_LOG(( "filter", LDAP_LEVEL_DETAIL2,
- "get_simple_vrFilter: conn %d EQUALITY\n", conn->c_connid ));
+ LDAP_LOG( FILTER, DETAIL2,
+ "get_simple_vrFilter: conn %d EQUALITY\n", conn->c_connid, 0, 0 );
#else
Debug( LDAP_DEBUG_FILTER, "EQUALITY\n", 0, 0, 0 );
#endif
case LDAP_FILTER_SUBSTRINGS:
#ifdef NEW_LOGGING
- LDAP_LOG(( "filter", LDAP_LEVEL_DETAIL1,
- "get_simple_vrFilter: conn %d SUBSTRINGS\n", conn->c_connid ));
+ LDAP_LOG( FILTER, DETAIL1,
+ "get_simple_vrFilter: conn %d SUBSTRINGS\n", conn->c_connid, 0, 0 );
#else
Debug( LDAP_DEBUG_FILTER, "SUBSTRINGS\n", 0, 0, 0 );
#endif
case LDAP_FILTER_GE:
#ifdef NEW_LOGGING
- LDAP_LOG(( "filter", LDAP_LEVEL_DETAIL1,
- "get_simple_vrFilter: conn %d GE\n", conn->c_connid ));
+ LDAP_LOG( FILTER, DETAIL1,
+ "get_simple_vrFilter: conn %d GE\n", conn->c_connid, 0, 0 );
#else
Debug( LDAP_DEBUG_FILTER, "GE\n", 0, 0, 0 );
#endif
case LDAP_FILTER_LE:
#ifdef NEW_LOGGING
- LDAP_LOG(( "filter", LDAP_LEVEL_DETAIL1,
- "get_simple_vrFilter: conn %d LE\n", conn->c_connid ));
+ LDAP_LOG( FILTER, DETAIL1,
+ "get_simple_vrFilter: conn %d LE\n", conn->c_connid, 0, 0 );
#else
Debug( LDAP_DEBUG_FILTER, "LE\n", 0, 0, 0 );
#endif
struct berval type;
#ifdef NEW_LOGGING
- LDAP_LOG(( "filter", LDAP_LEVEL_DETAIL1,
- "get_simple_vrFilter: conn %d PRESENT\n", conn->c_connid ));
+ LDAP_LOG( FILTER, DETAIL1,
+ "get_simple_vrFilter: conn %d PRESENT\n", conn->c_connid, 0, 0 );
#else
Debug( LDAP_DEBUG_FILTER, "PRESENT\n", 0, 0, 0 );
#endif
case LDAP_FILTER_APPROX:
#ifdef NEW_LOGGING
- LDAP_LOG(( "filter", LDAP_LEVEL_DETAIL1,
- "get_simple_vrFilter: conn %d APPROX\n", conn->c_connid ));
+ LDAP_LOG( FILTER, DETAIL1,
+ "get_simple_vrFilter: conn %d APPROX\n", conn->c_connid, 0, 0 );
#else
Debug( LDAP_DEBUG_FILTER, "APPROX\n", 0, 0, 0 );
#endif
case LDAP_FILTER_EXT:
#ifdef NEW_LOGGING
- LDAP_LOG(( "filter", LDAP_LEVEL_DETAIL1,
- "get_simple_vrFilter: conn %d EXTENSIBLE\n", conn->c_connid ));
+ LDAP_LOG( FILTER, DETAIL1,
+ "get_simple_vrFilter: conn %d EXTENSIBLE\n", conn->c_connid, 0, 0 );
#else
Debug( LDAP_DEBUG_FILTER, "EXTENSIBLE\n", 0, 0, 0 );
#endif
default:
(void) ber_scanf( ber, "x" ); /* skip the element */
#ifdef NEW_LOGGING
- LDAP_LOG(( "filter", LDAP_LEVEL_ERR,
+ LDAP_LOG( FILTER, ERR,
"get_simple_vrFilter: conn %d unknown filter type=%lu\n",
- conn->c_connid, f->f_choice ));
+ conn->c_connid, f->f_choice, 0 );
#else
Debug( LDAP_DEBUG_ANY, "get_simple_vrFilter: unknown filter type=%lu\n",
f->f_choice, 0, 0 );
}
#ifdef NEW_LOGGING
- LDAP_LOG(( "filter", LDAP_LEVEL_DETAIL2,
- "get_simple_vrFilter: conn %d exit\n", conn->c_connid ));
+ LDAP_LOG( FILTER, DETAIL2,
+ "get_simple_vrFilter: conn %d exit\n", conn->c_connid, 0, 0 );
#else
Debug( LDAP_DEBUG_FILTER, "end get_simple_vrFilter %d\n", err, 0, 0 );
#endif
char *last;
#ifdef NEW_LOGGING
- LDAP_LOG(( "filter", LDAP_LEVEL_ENTRY,
- "get_vrFilter: conn %d start\n", conn->c_connid ));
+ LDAP_LOG( FILTER, ENTRY,
+ "get_vrFilter: conn %d start\n", conn->c_connid, 0, 0 );
#else
Debug( LDAP_DEBUG_FILTER, "begin get_vrFilter\n", 0, 0, 0 );
#endif
*new = NULL;
#ifdef NEW_LOGGING
- LDAP_LOG(( "filter", LDAP_LEVEL_ENTRY,
- "get_vrFilter: conn %d exit\n", conn->c_connid ));
+ LDAP_LOG( FILTER, ENTRY,
+ "get_vrFilter: conn %d exit\n", conn->c_connid, 0, 0 );
#else
Debug( LDAP_DEBUG_FILTER, "end get_vrFilter\n", 0, 0, 0 );
#endif
default:
#ifdef NEW_LOGGING
- LDAP_LOG(( "filter", LDAP_LEVEL_ERR,
- "filter_free: unknown filter type %lu\n", f->f_choice ));
+ LDAP_LOG( FILTER, ERR,
+ "filter_free: unknown filter type %lu\n", f->f_choice, 0, 0 );
#else
Debug( LDAP_DEBUG_ANY, "filter_free: unknown filter type=%lu\n",
f->f_choice, 0, 0 );
*text = "error decoding filter";
#ifdef NEW_LOGGING
- LDAP_LOG(( "filter", LDAP_LEVEL_ENTRY,
- "get_substring_filter: conn %d begin\n", conn->c_connid ));
+ LDAP_LOG( FILTER, ENTRY,
+ "get_substring_filter: conn %d begin\n", conn->c_connid, 0, 0 );
#else
Debug( LDAP_DEBUG_FILTER, "begin get_substring_filter\n", 0, 0, 0 );
#endif
rc = LDAP_PROTOCOL_ERROR;
#ifdef NEW_LOGGING
- LDAP_LOG(( "filter", LDAP_LEVEL_ERR,
+ LDAP_LOG( FILTER, ERR,
"get_filter_substring: conn %d unknown substring choice=%ld\n",
- conn->c_connid, (long)tag ));
+ conn->c_connid, (long)tag, 0 );
#else
Debug( LDAP_DEBUG_FILTER,
" unknown substring choice=%ld\n",
switch ( tag ) {
case LDAP_SUBSTRING_INITIAL:
#ifdef NEW_LOGGING
- LDAP_LOG(( "filter", LDAP_LEVEL_DETAIL1,
- "get_substring_filter: conn %d INITIAL\n",
- conn->c_connid ));
+ LDAP_LOG( FILTER, DETAIL1,
+ "get_substring_filter: conn %d INITIAL\n",
+ conn->c_connid, 0, 0 );
#else
Debug( LDAP_DEBUG_FILTER, " INITIAL\n", 0, 0, 0 );
#endif
case LDAP_SUBSTRING_ANY:
#ifdef NEW_LOGGING
- LDAP_LOG(( "filter", LDAP_LEVEL_DETAIL1,
- "get_substring_filter: conn %d ANY\n",
- conn->c_connid ));
+ LDAP_LOG( FILTER, DETAIL1,
+ "get_substring_filter: conn %d ANY\n", conn->c_connid, 0, 0 );
#else
Debug( LDAP_DEBUG_FILTER, " ANY\n", 0, 0, 0 );
#endif
case LDAP_SUBSTRING_FINAL:
#ifdef NEW_LOGGING
- LDAP_LOG(( "filter", LDAP_LEVEL_DETAIL1,
- "get_substring_filter: conn %d FINAL\n",
- conn->c_connid ));
+ LDAP_LOG( FILTER, DETAIL1,
+ "get_substring_filter: conn %d FINAL\n", conn->c_connid, 0, 0 );
#else
Debug( LDAP_DEBUG_FILTER, " FINAL\n", 0, 0, 0 );
#endif
default:
#ifdef NEW_LOGGING
- LDAP_LOG(( "filter", LDAP_LEVEL_INFO,
+ LDAP_LOG( FILTER, INFO,
"get_substring_filter: conn %d unknown substring type %ld\n",
- conn->c_connid, (long)tag ));
+ conn->c_connid, (long)tag, 0 );
#else
Debug( LDAP_DEBUG_FILTER,
" unknown substring type=%ld\n",
return_error:
#ifdef NEW_LOGGING
- LDAP_LOG(( "filter", LDAP_LEVEL_INFO,
+ LDAP_LOG( FILTER, INFO,
"get_substring_filter: conn %d error %ld\n",
- conn->c_connid, (long)rc ));
+ conn->c_connid, (long)rc, 0 );
#else
Debug( LDAP_DEBUG_FILTER, " error=%ld\n",
(long) rc, 0, 0 );
}
#ifdef NEW_LOGGING
- LDAP_LOG(( "filter", LDAP_LEVEL_ENTRY,
- "get_substring_filter: conn %d exit\n", conn->c_connid ));
+ LDAP_LOG( FILTER, ENTRY,
+ "get_substring_filter: conn %d exit\n", conn->c_connid, 0, 0 );
#else
Debug( LDAP_DEBUG_FILTER, "end get_substring_filter\n", 0, 0, 0 );
#endif
int rc;
#ifdef NEW_LOGGING
- LDAP_LOG(( "filter", LDAP_LEVEL_ENTRY,
- "test_filter: begin\n" ));
+ LDAP_LOG( FILTER, ENTRY, "test_filter: begin\n", 0, 0, 0 );
#else
Debug( LDAP_DEBUG_FILTER, "=> test_filter\n", 0, 0, 0 );
#endif
switch ( f->f_choice ) {
case SLAPD_FILTER_COMPUTED:
#ifdef NEW_LOGGING
- LDAP_LOG(( "filter", LDAP_LEVEL_DETAIL1,
- "test_filter: COMPUTED %s (%d)\n",
- f->f_result == LDAP_COMPARE_FALSE ? "false" :
- f->f_result == LDAP_COMPARE_TRUE ? "true" :
- f->f_result == SLAPD_COMPARE_UNDEFINED ? "undefined" :
- "error",
- f->f_result ));
+ LDAP_LOG( FILTER, DETAIL1,
+ "test_filter: COMPUTED %s (%d)\n",
+ f->f_result == LDAP_COMPARE_FALSE ? "false" :
+ f->f_result == LDAP_COMPARE_TRUE ? "true" :
+ f->f_result == SLAPD_COMPARE_UNDEFINED ? "undefined" :
+ "error", f->f_result, 0 );
#else
Debug( LDAP_DEBUG_FILTER, " COMPUTED %s (%d)\n",
f->f_result == LDAP_COMPARE_FALSE ? "false" :
case LDAP_FILTER_EQUALITY:
#ifdef NEW_LOGGING
- LDAP_LOG(( "filter", LDAP_LEVEL_DETAIL1,
- "test_filter: EQUALITY\n" ));
+ LDAP_LOG( FILTER, DETAIL1, "test_filter: EQUALITY\n", 0, 0, 0 );
#else
Debug( LDAP_DEBUG_FILTER, " EQUALITY\n", 0, 0, 0 );
#endif
case LDAP_FILTER_SUBSTRINGS:
#ifdef NEW_LOGGING
- LDAP_LOG(( "filter", LDAP_LEVEL_DETAIL1,
- "test_filter SUBSTRINGS\n" ));
+ LDAP_LOG( FILTER, DETAIL1, "test_filter SUBSTRINGS\n", 0, 0, 0 );
#else
Debug( LDAP_DEBUG_FILTER, " SUBSTRINGS\n", 0, 0, 0 );
#endif
case LDAP_FILTER_PRESENT:
#ifdef NEW_LOGGING
- LDAP_LOG(( "filter", LDAP_LEVEL_DETAIL1,
- "test_filter: PRESENT\n" ));
+ LDAP_LOG( FILTER, DETAIL1, "test_filter: PRESENT\n", 0, 0, 0 );
#else
Debug( LDAP_DEBUG_FILTER, " PRESENT\n", 0, 0, 0 );
#endif
case LDAP_FILTER_APPROX:
#ifdef NEW_LOGGING
- LDAP_LOG(( "filter", LDAP_LEVEL_DETAIL1,
- "test_filter: APPROX\n" ));
+ LDAP_LOG( FILTER, DETAIL1, "test_filter: APPROX\n", 0, 0, 0 );
#else
Debug( LDAP_DEBUG_FILTER, " APPROX\n", 0, 0, 0 );
#endif
case LDAP_FILTER_AND:
#ifdef NEW_LOGGING
- LDAP_LOG(( "filter", LDAP_LEVEL_DETAIL1,
- "test_filter: AND\n" ));
+ LDAP_LOG( FILTER, DETAIL1, "test_filter: AND\n", 0, 0, 0 );
#else
Debug( LDAP_DEBUG_FILTER, " AND\n", 0, 0, 0 );
#endif
case LDAP_FILTER_OR:
#ifdef NEW_LOGGING
- LDAP_LOG(( "filter", LDAP_LEVEL_DETAIL1,
- "test_filter: OR\n" ));
+ LDAP_LOG( FILTER, DETAIL1, "test_filter: OR\n", 0, 0, 0 );
#else
Debug( LDAP_DEBUG_FILTER, " OR\n", 0, 0, 0 );
#endif
case LDAP_FILTER_NOT:
#ifdef NEW_LOGGING
- LDAP_LOG(( "filter", LDAP_LEVEL_DETAIL1,
- "test_filter: NOT\n" ));
+ LDAP_LOG( FILTER, DETAIL1, "test_filter: NOT\n", 0, 0, 0 );
#else
Debug( LDAP_DEBUG_FILTER, " NOT\n", 0, 0, 0 );
#endif
case LDAP_FILTER_EXT:
#ifdef NEW_LOGGING
- LDAP_LOG(( "filter", LDAP_LEVEL_DETAIL1,
- "test_filter: EXT\n" ));
+ LDAP_LOG( FILTER, DETAIL1, "test_filter: EXT\n", 0, 0, 0 );
#else
Debug( LDAP_DEBUG_FILTER, " EXT\n", 0, 0, 0 );
#endif
default:
#ifdef NEW_LOGGING
- LDAP_LOG(( "filter", LDAP_LEVEL_INFO,
- "test_filter: unknown filter type %lu\n",
- f->f_choice ));
+ LDAP_LOG( FILTER, INFO,
+ "test_filter: unknown filter type %lu\n", f->f_choice, 0, 0 );
#else
Debug( LDAP_DEBUG_ANY, " unknown filter type %lu\n",
f->f_choice, 0, 0 );
}
#ifdef NEW_LOGGING
- LDAP_LOG(( "filter", LDAP_LEVEL_ENTRY,
- "test_filter: return=%d\n", rc ));
+ LDAP_LOG( FILTER, RESULTS, "test_filter: return=%d\n", rc, 0, 0 );
#else
Debug( LDAP_DEBUG_FILTER, "<= test_filter %d\n", rc, 0, 0 );
#endif
int rtn = LDAP_COMPARE_TRUE; /* True if empty */
#ifdef NEW_LOGGING
- LDAP_LOG(( "filter", LDAP_LEVEL_ENTRY,
- "test_filter_and: begin\n" ));
+ LDAP_LOG( FILTER, ENTRY, "test_filter_and: begin\n", 0, 0, 0 );
#else
Debug( LDAP_DEBUG_FILTER, "=> test_filter_and\n", 0, 0, 0 );
#endif
}
#ifdef NEW_LOGGING
- LDAP_LOG(( "filter", LDAP_LEVEL_ENTRY,
- "test_filter_and: rc=%d\n", rtn ));
+ LDAP_LOG( FILTER, RESULTS, "test_filter_and: rc=%d\n", rtn, 0, 0 );
#else
Debug( LDAP_DEBUG_FILTER, "<= test_filter_and %d\n", rtn, 0, 0 );
#endif
int rtn = LDAP_COMPARE_FALSE; /* False if empty */
#ifdef NEW_LOGGING
- LDAP_LOG(( "filter", LDAP_LEVEL_ENTRY,
- "test_filter_or: begin\n" ));
+ LDAP_LOG( FILTER, ENTRY, "test_filter_or: begin\n", 0, 0, 0 );
#else
Debug( LDAP_DEBUG_FILTER, "=> test_filter_or\n", 0, 0, 0 );
#endif
}
#ifdef NEW_LOGGING
- LDAP_LOG(( "filter", LDAP_LEVEL_ENTRY,
- "test_filter_or: result=%d\n", rtn ));
+ LDAP_LOG( FILTER, ENTRY, "test_filter_or: result=%d\n", rtn, 0, 0 );
#else
Debug( LDAP_DEBUG_FILTER, "<= test_filter_or %d\n", rtn, 0, 0 );
#endif
Attribute *a;
#ifdef NEW_LOGGING
- LDAP_LOG(( "filter", LDAP_LEVEL_ENTRY,
- "test_substrings_filter: begin\n" ));
+ LDAP_LOG( FILTER, ENTRY, "test_substrings_filter: begin\n", 0, 0, 0 );
#else
Debug( LDAP_DEBUG_FILTER, "begin test_substrings_filter\n", 0, 0, 0 );
#endif
}
#ifdef NEW_LOGGING
- LDAP_LOG(( "filter", LDAP_LEVEL_ENTRY,
- "test_substrings_filter: return FALSE\n" ));
+ LDAP_LOG( FILTER, ENTRY, "test_substrings_filter: return FALSE\n", 0, 0, 0 );
#else
Debug( LDAP_DEBUG_FILTER, "end test_substrings_filter 1\n", 0, 0, 0 );
#endif
if( slapMode != SLAP_UNDEFINED_MODE ) {
#ifdef NEW_LOGGING
- LDAP_LOG(( "operation", LDAP_LEVEL_CRIT,
- "init: %s init called twice (old=%d, new=%d)\n",
- name, slapMode, mode ));
+ LDAP_LOG( OPERATION, CRIT,
+ "init: %s init called twice (old=%d, new=%d)\n",
+ name, slapMode, mode );
#else
Debug( LDAP_DEBUG_ANY,
"%s init: init called twice (old=%d, new=%d)\n",
case SLAP_SERVER_MODE:
case SLAP_TOOL_MODE:
#ifdef NEW_LOGGING
- LDAP_LOG(( "operation", LDAP_LEVEL_DETAIL1,
- "init: %s initiation, initiated %s.\n",
- name, (mode & SLAP_MODE) == SLAP_TOOL_MODE ? "tool" : "server" ));
+ LDAP_LOG( OPERATION, DETAIL1,
+ "init: %s initiation, initiated %s.\n",
+ name, (mode & SLAP_MODE) == SLAP_TOOL_MODE ?
+ "tool" : "server", 0 );
#else
Debug( LDAP_DEBUG_TRACE,
"%s init: initiated %s.\n", name,
default:
#ifdef NEW_LOGGING
- LDAP_LOG(( "operation", LDAP_LEVEL_ERR,
- "init: %s init, undefined mode (%d).\n", name, mode ));
+ LDAP_LOG( OPERATION, ERR,
+ "init: %s init, undefined mode (%d).\n", name, mode, 0 );
#else
Debug( LDAP_DEBUG_ANY,
"%s init: undefined mode (%d).\n", name, mode, 0 );
int rc;
#ifdef NEW_LOGGING
- LDAP_LOG(( "operation", LDAP_LEVEL_CRIT,
- "slap_startup: %s started\n", slap_name ));
+ LDAP_LOG( OPERATION, CRIT, "slap_startup: %s started\n", slap_name, 0, 0 );
#else
Debug( LDAP_DEBUG_TRACE,
"%s startup: initiated.\n",
int rc;
#ifdef NEW_LOGGING
- LDAP_LOG(( "operation", LDAP_LEVEL_CRIT,
- "slap_shutdown: %s shutdown initiated.\n", slap_name));
+ LDAP_LOG( OPERATION, CRIT,
+ "slap_shutdown: %s shutdown initiated.\n", slap_name, 0, 0);
#else
Debug( LDAP_DEBUG_TRACE,
"%s shutdown: initiated\n",
int rc;
#ifdef NEW_LOGGING
- LDAP_LOG(( "operation", LDAP_LEVEL_INFO,
- "slap_destroy: %s freeing system resources.\n",
- slap_name ));
+ LDAP_LOG( OPERATION, INFO,
+ "slap_destroy: %s freeing system resources.\n", slap_name, 0, 0);
#else
Debug( LDAP_DEBUG_TRACE,
"%s shutdown: freeing system resources.\n",
if ( argc < 3 ) {
#ifdef NEW_LOGGING
- LDAP_LOG(( "config", LDAP_LEVEL_CRIT,
+ LDAP_LOG( CONFIG, CRIT,
"%s : line %d: missing arg(s) in "
- "\"limits <pattern> <limits>\" line.\n",
- fname, lineno ));
+ "\"limits <pattern> <limits>\" line.\n", fname, lineno, 0 );
#else
Debug( LDAP_DEBUG_ANY,
"%s : line %d: missing arg(s) in "
default:
if ( pattern[0] != '=' ) {
#ifdef NEW_LOGGING
- LDAP_LOG(( "config", LDAP_LEVEL_CRIT,
+ LDAP_LOG( CONFIG, CRIT,
"%s : line %d: missing '=' in "
"\"dn[.{exact|base|one|subtree"
- "|children|regex|anonymous}]"
- "=<pattern>\" in "
- "\"limits <pattern> <limits>\" line.\n",
- fname, lineno ));
+ "|children|regex|anonymous}]" "=<pattern>\" in "
+ "\"limits <pattern> <limits>\" line.\n", fname, lineno, 0 );
#else
Debug( LDAP_DEBUG_ANY,
"%s : line %d: missing '=' in "
if ( parse_limit( argv[i], &limit ) ) {
#ifdef NEW_LOGGING
- LDAP_LOG(( "config", LDAP_LEVEL_CRIT,
+ LDAP_LOG( CONFIG, CRIT,
"%s : line %d: unknown limit type \"%s\" in "
"\"limits <pattern> <limits>\" line.\n",
- fname, lineno, argv[i] ));
+ fname, lineno, argv[i] );
#else
Debug( LDAP_DEBUG_ANY,
"%s : line %d: unknown limit type \"%s\" in "
/* lock.c - routines to open and apply an advisory lock to a file */
+/* $OpenLDAP$ */
+/*
+ * Copyright 1998-2002 The OpenLDAP Foundation, All Rights Reserved.
+ * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
+ */
-#include <stdio.h>
-#include <sys/time.h>
-#include <sys/types.h>
#include "portable.h"
-#ifdef USE_LOCKF
-#include <unistd.h>
-#endif
+
+#include <stdio.h>
+
+#include <ac/string.h>
+#include <ac/socket.h>
+#include <ac/time.h>
+#include <ac/unistd.h>
+
+#ifdef HAVE_SYS_FILE_H
#include <sys/file.h>
-#include <sys/param.h>
-#include <sys/socket.h>
+#endif
+
#include "slap.h"
FILE *
-lock_fopen( char *fname, char *type, FILE **lfp )
+lock_fopen( const char *fname, const char *type, FILE **lfp )
{
FILE *fp;
char buf[MAXPATHLEN];
/* open the lock file */
- strcpy( buf, fname );
- strcat( buf, ".lock" );
+ strcpy(lutil_strcopy( buf, fname ), ".lock" );
if ( (*lfp = fopen( buf, "w" )) == NULL ) {
+#ifdef NEW_LOGGING
+ LDAP_LOG( OPERATION, ERR,
+ "lock_fopen: could not open lock file \"%s\".\n", buf, 0, 0);
+#else
Debug( LDAP_DEBUG_ANY, "could not open \"%s\"\n", buf, 0, 0 );
+#endif
+
return( NULL );
}
/* acquire the lock */
-#ifdef USE_LOCKF
- while ( lockf( fileno( *lfp ), F_LOCK, 0 ) != 0 ) {
-#else
- while ( flock( fileno( *lfp ), LOCK_EX ) != 0 ) {
-#endif
- ; /* NULL */
- }
+ ldap_lockf( fileno(*lfp) );
/* open the log file */
if ( (fp = fopen( fname, type )) == NULL ) {
- Debug( LDAP_DEBUG_ANY, "could not open \"%s\"\n", fname, 0, 0 );
-#ifdef USE_LOCKF
- lockf( fileno( *lfp ), F_ULOCK, 0 );
+#ifdef NEW_LOGGING
+ LDAP_LOG( OPERATION, ERR,
+ "lock_fopen: could not open log file \"%s\".\n", buf, 0, 0);
#else
- flock( fileno( *lfp ), LOCK_UN );
+ Debug( LDAP_DEBUG_ANY, "could not open \"%s\"\n", fname, 0, 0 );
#endif
+
+ ldap_unlockf( fileno(*lfp) );
+ fclose( *lfp );
+ *lfp = NULL;
return( NULL );
}
lock_fclose( FILE *fp, FILE *lfp )
{
/* unlock */
-#ifdef USE_LOCKF
- lockf( fileno( lfp ), F_ULOCK, 0 );
-#else
- flock( fileno( lfp ), LOCK_UN );
-#endif
+ ldap_unlockf( fileno(lfp) );
fclose( lfp );
return( fclose( fp ) );
{
slap_debug = *i;
#ifdef NEW_LOGGING
- LDAP_LOG(( "operation", LDAP_LEVEL_INFO,
- "main: new debug level from registry is: %d\n", slap_debug ));
+ lutil_log_initialize( argc, argv );
+ LDAP_LOG( SLAPD, INFO,
+ "main: new debug level from registry is: %d\n",
+ slap_debug, 0, 0 );
#else
Debug( LDAP_DEBUG_ANY, "new debug level from registry is: %d\n", slap_debug, 0, 0 );
#endif
urls = ch_strdup(newUrls);
#ifdef NEW_LOGGING
- LDAP_LOG(( "operation", LDAP_LEVEL_INFO,
- "main: new urls from registry: %s\n", urls ));
+ LDAP_LOG( SLAPD, INFO,
+ "main: new urls from registry: %s\n", urls, 0, 0 );
#else
Debug(LDAP_DEBUG_ANY, "new urls from registry: %s\n",
urls, 0, 0);
{
configfile = newConfigFile;
#ifdef NEW_LOGGING
- LDAP_LOG(( "operation", LDAP_LEVEL_INFO,
- "main: new config file from registry is: %s\n", configfile ));
+ LDAP_LOG( SLAPD, INFO,
+ "main: new config file from registry is: %s\n", configfile, 0, 0 );
#else
Debug ( LDAP_DEBUG_ANY, "new config file from registry is: %s\n", configfile, 0, 0 );
#endif
#ifdef NEW_LOGGING
lutil_log_initialize( argc, argv );
-#endif
-
+#else
lutil_set_debug_level( "slapd", slap_debug );
ber_set_option(NULL, LBER_OPT_DEBUG_LEVEL, &slap_debug);
ldap_set_option(NULL, LDAP_OPT_DEBUG_LEVEL, &slap_debug);
ldif_debug = slap_debug;
+#endif
#ifdef NEW_LOGGING
- LDAP_LOG(( "operation", LDAP_LEVEL_INFO,
- "%s", Versionstr ));
+ LDAP_LOG( SLAPD, INFO, "%s", Versionstr, 0, 0 );
#else
Debug( LDAP_DEBUG_TRACE, "%s", Versionstr, 0, 0 );
#endif
if ( slap_schema_init( ) != 0 ) {
#ifdef NEW_LOGGING
- LDAP_LOG(( "operation", LDAP_LEVEL_CRIT,
- "main: schema initialization error\n" ));
+ LDAP_LOG( OPERATION, CRIT, "main: schema initialization error\n", 0, 0, 0 );
#else
Debug( LDAP_DEBUG_ANY,
"schema initialization error\n",
if ( glue_sub_init( ) != 0 ) {
#ifdef NEW_LOGGING
- LDAP_LOG(( "operation", LDAP_LEVEL_CRIT,
- "main: subordinate config error\n"));
+ LDAP_LOG( SLAPD, CRIT, "main: subordinate config error\n", 0, 0, 0 );
#else
Debug( LDAP_DEBUG_ANY,
"subordinate config error\n",
if ( slap_schema_check( ) != 0 ) {
#ifdef NEW_LOGGING
- LDAP_LOG(( "operation", LDAP_LEVEL_CRIT,
- "main: schema prep error\n"));
+ LDAP_LOG( SLAPD, CRIT, "main: schema prep error\n", 0, 0, 0 );
#else
Debug( LDAP_DEBUG_ANY,
"schema prep error\n",
rc = ldap_pvt_tls_init();
if( rc != 0) {
#ifdef NEW_LOGGING
- LDAP_LOG(( "operation", LDAP_LEVEL_CRIT,
- "main: tls init failed: %d\n", rc ));
+ LDAP_LOG( SLAPD, CRIT, "main: tls init failed: %d\n", rc, 0, 0 );
#else
Debug( LDAP_DEBUG_ANY,
"main: TLS init failed: %d\n",
rc = ldap_pvt_tls_init_def_ctx();
if( rc != 0) {
#ifdef NEW_LOGGING
- LDAP_LOG(( "operation", LDAP_LEVEL_CRIT,
- "main: tls init def ctx failed: %d\n", rc ));
+ LDAP_LOG( SLAPD, CRIT, "main: tls init def ctx failed: %d\n", rc, 0, 0 );
#else
Debug( LDAP_DEBUG_ANY,
"main: TLS init def ctx failed: %d\n",
FILE *fp;
#ifdef NEW_LOGGING
- LDAP_LOG(( "operation", LDAP_LEVEL_INFO,
- "main: slapd starting.\n" ));
+ LDAP_LOG( SLAPD, INFO, "main: slapd starting.\n", 0, 0, 0 );
#else
Debug( LDAP_DEBUG_ANY, "slapd starting\n", 0, 0, 0 );
#endif
#endif
#ifdef NEW_LOGGING
- LDAP_LOG(( "operation", LDAP_LEVEL_CRIT,
- "main: slapd stopped.\n" ));
+ LDAP_LOG( SLAPD, CRIT, "main: slapd stopped.\n", 0, 0, 0 );
#else
Debug( LDAP_DEBUG_ANY, "slapd stopped.\n", 0, 0, 0 );
#endif
int rc = LDAP_SUCCESS;
#ifdef NEW_LOGGING
- LDAP_LOG(( "filter", LDAP_LEVEL_ENTRY,
- "filter_matched_values: begin\n" ));
+ LDAP_LOG( FILTER, ENTRY, "filter_matched_values: begin\n", 0, 0, 0 );
#else
Debug( LDAP_DEBUG_FILTER, "=> filter_matched_values\n", 0, 0, 0 );
#endif
switch ( f->f_choice ) {
case SLAPD_FILTER_COMPUTED:
#ifdef NEW_LOGGING
- LDAP_LOG(( "filter", LDAP_LEVEL_DETAIL1,
+ LDAP_LOG( FILTER, DETAIL1,
"test_vrFilter: COMPUTED %s (%d)\n",
f->f_result == LDAP_COMPARE_FALSE ? "false" :
f->f_result == LDAP_COMPARE_TRUE ? "true" :
f->f_result == SLAPD_COMPARE_UNDEFINED ? "undefined" :
- "error",
- f->f_result ));
+ "error", f->f_result, 0 );
#else
Debug( LDAP_DEBUG_FILTER, " COMPUTED %s (%d)\n",
f->f_result == LDAP_COMPARE_FALSE ? "false" :
case LDAP_FILTER_EQUALITY:
#ifdef NEW_LOGGING
- LDAP_LOG(( "filter", LDAP_LEVEL_DETAIL1,
- "test_vrFilter: EQUALITY\n" ));
+ LDAP_LOG( FILTER, DETAIL1, "test_vrFilter: EQUALITY\n", 0, 0, 0 );
#else
Debug( LDAP_DEBUG_FILTER, " EQUALITY\n", 0, 0, 0 );
#endif
case LDAP_FILTER_SUBSTRINGS:
#ifdef NEW_LOGGING
- LDAP_LOG(( "filter", LDAP_LEVEL_DETAIL1,
- "test_vrFilter SUBSTRINGS\n" ));
+ LDAP_LOG( FILTER, DETAIL1, "test_vrFilter SUBSTRINGS\n", 0, 0, 0 );
#else
Debug( LDAP_DEBUG_FILTER, " SUBSTRINGS\n", 0, 0, 0 );
#endif
case LDAP_FILTER_PRESENT:
#ifdef NEW_LOGGING
- LDAP_LOG(( "filter", LDAP_LEVEL_DETAIL1,
- "test_vrFilter: PRESENT\n" ));
+ LDAP_LOG( FILTER, DETAIL1, "test_vrFilter: PRESENT\n", 0, 0, 0 );
#else
Debug( LDAP_DEBUG_FILTER, " PRESENT\n", 0, 0, 0 );
#endif
case LDAP_FILTER_EXT:
#ifdef NEW_LOGGING
- LDAP_LOG(( "filter", LDAP_LEVEL_DETAIL1,
- "test_vrFilter: EXT\n" ));
+ LDAP_LOG( FILTER, DETAIL1, "test_vrFilter: EXT\n", 0, 0, 0 );
#else
Debug( LDAP_DEBUG_FILTER, " EXT\n", 0, 0, 0 );
#endif
default:
#ifdef NEW_LOGGING
- LDAP_LOG(( "filter", LDAP_LEVEL_INFO,
- "test_vrFilter: unknown filter type %lu\n",
- f->f_choice ));
+ LDAP_LOG( FILTER, INFO,
+ "test_vrFilter: unknown filter type %lu\n", f->f_choice, 0, 0 );
#else
Debug( LDAP_DEBUG_ANY, " unknown filter type %lu\n",
f->f_choice, 0, 0 );
}
#ifdef NEW_LOGGING
- LDAP_LOG(( "filter", LDAP_LEVEL_ENTRY,
- "filter_matched_values: return=%d\n", rc ));
+ LDAP_LOG( FILTER, ENTRY, "filter_matched_values: return=%d\n", rc, 0, 0 );
#else
Debug( LDAP_DEBUG_FILTER, "<= filter_matched_values %d\n", rc, 0, 0 );
#endif
int manageDSAit;
#ifdef NEW_LOGGING
- LDAP_LOG(( "operation", LDAP_LEVEL_ENTRY,
- "do_modify: enter\n" ));
+ LDAP_LOG( OPERATION, ENTRY, "do_modify: enter\n", 0, 0, 0 );
#else
Debug( LDAP_DEBUG_TRACE, "do_modify\n", 0, 0, 0 );
#endif
if ( ber_scanf( op->o_ber, "{m" /*}*/, &dn ) == LBER_ERROR ) {
#ifdef NEW_LOGGING
- LDAP_LOG(( "operation", LDAP_LEVEL_ERR,
- "do_modify: ber_scanf failed\n" ));
+ LDAP_LOG( OPERATION, ERR, "do_modify: ber_scanf failed\n", 0, 0, 0 );
#else
Debug( LDAP_DEBUG_ANY, "do_modify: ber_scanf failed\n", 0, 0, 0 );
#endif
}
#ifdef NEW_LOGGING
- LDAP_LOG(( "operation", LDAP_LEVEL_ARGS,
- "do_modify: dn (%s)\n", dn.bv_val ));
+ LDAP_LOG( OPERATION, ARGS, "do_modify: dn (%s)\n", dn.bv_val, 0, 0 );
#else
Debug( LDAP_DEBUG_ARGS, "do_modify: dn (%s)\n", dn.bv_val, 0, 0 );
#endif
case LDAP_MOD_ADD:
if ( mod->sml_bvalues == NULL ) {
#ifdef NEW_LOGGING
- LDAP_LOG(( "operation", LDAP_LEVEL_ERR,
+ LDAP_LOG( OPERATION, ERR,
"do_modify: modify/add operation (%ld) requires values\n",
- (long)mop ));
+ (long)mop, 0, 0 );
#else
Debug( LDAP_DEBUG_ANY,
"do_modify: modify/add operation (%ld) requires values\n",
default: {
#ifdef NEW_LOGGING
- LDAP_LOG(( "operation", LDAP_LEVEL_ERR,
- "do_modify: invalid modify operation (%ld)\n",
- (long)mop ));
+ LDAP_LOG( OPERATION, ERR,
+ "do_modify: invalid modify operation (%ld)\n", (long)mop, 0, 0 );
#else
Debug( LDAP_DEBUG_ANY,
"do_modify: invalid modify operation (%ld)\n",
if( (rc = get_ctrls( conn, op, 1 )) != LDAP_SUCCESS ) {
#ifdef NEW_LOGGING
- LDAP_LOG(( "operation", LDAP_LEVEL_ERR,
- "do_modify: get_ctrls failed\n" ));
+ LDAP_LOG( OPERATION, ERR, "do_modify: get_ctrls failed\n", 0, 0, 0 );
#else
Debug( LDAP_DEBUG_ANY, "do_modify: get_ctrls failed\n", 0, 0, 0 );
#endif
rc = dnPrettyNormal( NULL, &dn, &pdn, &ndn );
if( rc != LDAP_SUCCESS ) {
#ifdef NEW_LOGGING
- LDAP_LOG(( "operation", LDAP_LEVEL_INFO,
- "do_modify: conn %d invalid dn (%s)\n",
- conn->c_connid, dn.bv_val ));
+ LDAP_LOG( OPERATION, INFO, "do_modify: conn %d invalid dn (%s)\n",
+ conn->c_connid, dn.bv_val, 0 );
#else
Debug( LDAP_DEBUG_ANY,
"do_modify: invalid dn (%s)\n", dn.bv_val, 0, 0 );
if( ndn.bv_len == 0 ) {
#ifdef NEW_LOGGING
- LDAP_LOG(( "operation", LDAP_LEVEL_ERR,
- "do_modify: attempt to modify root DSE.\n" ));
+ LDAP_LOG( OPERATION, ERR,
+ "do_modify: attempt to modify root DSE.\n",0, 0, 0 );
#else
Debug( LDAP_DEBUG_ANY, "do_modify: root dse!\n", 0, 0, 0 );
#endif
#if defined( SLAPD_SCHEMA_DN )
} else if ( strcasecmp( ndn.bv_val, SLAPD_SCHEMA_DN ) == 0 ) {
#ifdef NEW_LOGGING
- LDAP_LOG(( "operation", LDAP_LEVEL_ERR,
- "do_modify: attempt to modify subschema subentry.\n" ));
+ LDAP_LOG( OPERATION, ERR,
+ "do_modify: attempt to modify subschema subentry.\n" , 0, 0, 0 );
#else
Debug( LDAP_DEBUG_ANY, "do_modify: subschema subentry!\n", 0, 0, 0 );
#endif
#ifdef LDAP_DEBUG
#ifdef NEW_LOGGING
- LDAP_LOG(( "operation", LDAP_LEVEL_DETAIL1,
- "do_modify: modifications:\n" ));
+ LDAP_LOG( OPERATION, DETAIL1, "do_modify: modifications:\n", 0, 0, 0 );
#else
Debug( LDAP_DEBUG_ARGS, "modifications:\n", 0, 0, 0 );
#endif
for ( tmp = modlist; tmp != NULL; tmp = tmp->sml_next ) {
#ifdef NEW_LOGGING
- LDAP_LOG(( "operation", LDAP_LEVEL_DETAIL1,
- "\t%s: %s\n", tmp->sml_op == LDAP_MOD_ADD ?
- "add" : (tmp->sml_op == LDAP_MOD_DELETE ?
- "delete" : "replace"), tmp->sml_type.bv_val ));
+ LDAP_LOG( OPERATION, DETAIL1, "\t%s: %s\n",
+ tmp->sml_op == LDAP_MOD_ADD ?
+ "add" : (tmp->sml_op == LDAP_MOD_DELETE ?
+ "delete" : "replace"), tmp->sml_type.bv_val, 0 );
if ( tmp->sml_bvalues == NULL ) {
- LDAP_LOG(( "operation", LDAP_LEVEL_DETAIL1,
- "\t\tno values" ));
+ LDAP_LOG( OPERATION, DETAIL1, "\t\tno values", 0, 0, 0 );
} else if ( tmp->sml_bvalues[0].bv_val == NULL ) {
- LDAP_LOG(( "operation", LDAP_LEVEL_DETAIL1,
- "\t\tzero values" ));
+ LDAP_LOG( OPERATION, DETAIL1, "\t\tzero values", 0, 0, 0 );
} else if ( tmp->sml_bvalues[1].bv_val == NULL ) {
- LDAP_LOG(( "operation", LDAP_LEVEL_DETAIL1,
- "\t\tone value" ));
+ LDAP_LOG( OPERATION, DETAIL1, "\t\tone value", 0, 0, 0 );
} else {
- LDAP_LOG(( "operation", LDAP_LEVEL_DETAIL1,
- "\t\tmultiple values" ));
+ LDAP_LOG( OPERATION, DETAIL1, "\t\tmultiple values", 0, 0, 0 );
}
#else
ldap_pvt_thread_mutex_lock( &gmtime_mutex );
ltm = gmtime( &now );
- strftime( timebuf, sizeof(timebuf), "%Y%m%d%H%M%SZ", ltm );
+ lutil_gentime( timebuf, sizeof(timebuf), ltm );
csn.bv_len = lutil_csnstr( csnbuf, sizeof( csnbuf ), 0, 0 );
ldap_pvt_thread_mutex_unlock( &gmtime_mutex );
int manageDSAit;
#ifdef NEW_LOGGING
- LDAP_LOG(( "operation", LDAP_LEVEL_ENTRY,
- "do_modrdn: begin\n" ));
+ LDAP_LOG( OPERATION, ENTRY, "do_modrdn: begin\n", 0, 0, 0 );
#else
Debug( LDAP_DEBUG_TRACE, "do_modrdn\n", 0, 0, 0 );
#endif
== LBER_ERROR )
{
#ifdef NEW_LOGGING
- LDAP_LOG(( "operation", LDAP_LEVEL_ERR,
- "do_modrdn: ber_scanf failed\n" ));
+ LDAP_LOG( OPERATION, ERR, "do_modrdn: ber_scanf failed\n", 0, 0, 0 );
#else
Debug( LDAP_DEBUG_ANY, "ber_scanf failed\n", 0, 0, 0 );
#endif
* newSuperior is present: report error.
*/
#ifdef NEW_LOGGING
- LDAP_LOG(( "operation", LDAP_LEVEL_ERR,
- "do_modrdn: (v2) invalid field newSuperior.\n" ));
+ LDAP_LOG( OPERATION, ERR,
+ "do_modrdn: (v2) invalid field newSuperior.\n", 0, 0, 0 );
#else
Debug( LDAP_DEBUG_ANY,
"modrdn(v2): invalid field newSuperior!\n",
== LBER_ERROR ) {
#ifdef NEW_LOGGING
- LDAP_LOG(( "operation", LDAP_LEVEL_ERR,
- "do_modrdn: ber_scanf(\"m\") failed\n" ));
+ LDAP_LOG( OPERATION, ERR,
+ "do_modrdn: ber_scanf(\"m\") failed\n", 0, 0, 0 );
#else
Debug( LDAP_DEBUG_ANY, "ber_scanf(\"m\") failed\n",
0, 0, 0 );
}
#ifdef NEW_LOGGING
- LDAP_LOG(( "operation", LDAP_LEVEL_ARGS,
+ LDAP_LOG( OPERATION, ARGS,
"do_modrdn: dn (%s) newrdn (%s) newsuperior(%s)\n",
dn.bv_val, newrdn.bv_val,
- newSuperior.bv_len ? newSuperior.bv_val : "" ));
+ newSuperior.bv_len ? newSuperior.bv_val : "" );
#else
Debug( LDAP_DEBUG_ARGS,
"do_modrdn: dn (%s) newrdn (%s) newsuperior (%s)\n",
if ( ber_scanf( op->o_ber, /*{*/ "}") == LBER_ERROR ) {
#ifdef NEW_LOGGING
- LDAP_LOG(( "operation", LDAP_LEVEL_ERR,
- "do_modrdn: ber_scanf failed\n" ));
+ LDAP_LOG( OPERATION, ERR, "do_modrdn: ber_scanf failed\n", 0, 0, 0 );
#else
Debug( LDAP_DEBUG_ANY, "do_modrdn: ber_scanf failed\n", 0, 0, 0 );
#endif
if( (rc = get_ctrls( conn, op, 1 )) != LDAP_SUCCESS ) {
#ifdef NEW_LOGGING
- LDAP_LOG(( "operation", LDAP_LEVEL_ERR,
- "do_modrdn: get_ctrls failed\n" ));
+ LDAP_LOG( OPERATION, ERR, "do_modrdn: get_ctrls failed\n", 0, 0, 0 );
#else
Debug( LDAP_DEBUG_ANY, "do_modrdn: get_ctrls failed\n", 0, 0, 0 );
#endif
rc = dnPrettyNormal( NULL, &dn, &pdn, &ndn );
if( rc != LDAP_SUCCESS ) {
#ifdef NEW_LOGGING
- LDAP_LOG(( "operation", LDAP_LEVEL_INFO,
+ LDAP_LOG( OPERATION, INFO,
"do_modrdn: conn %d invalid dn (%s)\n",
- conn->c_connid, dn.bv_val ));
+ conn->c_connid, dn.bv_val, 0 );
#else
Debug( LDAP_DEBUG_ANY,
"do_modrdn: invalid dn (%s)\n", dn.bv_val, 0, 0 );
if( ndn.bv_len == 0 ) {
#ifdef NEW_LOGGING
- LDAP_LOG(( "operation", LDAP_LEVEL_ERR,
- "do_modrdn: attempt to modify root DSE.\n" ));
+ LDAP_LOG( OPERATION, ERR,
+ "do_modrdn: attempt to modify root DSE.\n", 0, 0, 0 );
#else
Debug( LDAP_DEBUG_ANY, "do_modrdn: root dse!\n", 0, 0, 0 );
#endif
#ifdef SLAPD_SCHEMA_DN
} else if ( strcasecmp( ndn.bv_val, SLAPD_SCHEMA_DN ) == 0 ) {
#ifdef NEW_LOGGING
- LDAP_LOG(( "operation", LDAP_LEVEL_ERR,
- "do_modrdn: attempt to modify subschema subentry\n" ));
+ LDAP_LOG( OPERATION, ERR,
+ "do_modrdn: attempt to modify subschema subentry\n", 0, 0, 0 );
#else
Debug( LDAP_DEBUG_ANY, "do_modrdn: subschema subentry!\n", 0, 0, 0 );
#endif
rc = dnPrettyNormal( NULL, &newrdn, &pnewrdn, &nnewrdn );
if( rc != LDAP_SUCCESS ) {
#ifdef NEW_LOGGING
- LDAP_LOG(( "operation", LDAP_LEVEL_INFO,
+ LDAP_LOG( OPERATION, INFO,
"do_modrdn: conn %d invalid newrdn (%s)\n",
- conn->c_connid, newrdn.bv_val ));
+ conn->c_connid, newrdn.bv_val, 0 );
#else
Debug( LDAP_DEBUG_ANY,
"do_modrdn: invalid newrdn (%s)\n", newrdn.bv_val, 0, 0 );
if( rdnValidate( &pnewrdn ) != LDAP_SUCCESS ) {
#ifdef NEW_LOGGING
- LDAP_LOG(( "operation", LDAP_LEVEL_ERR,
- "do_modrdn: invalid rdn (%s).\n", pnewrdn.bv_val ));
+ LDAP_LOG( OPERATION, ERR,
+ "do_modrdn: invalid rdn (%s).\n", pnewrdn.bv_val, 0, 0 );
#else
Debug( LDAP_DEBUG_ANY, "do_modrdn: invalid rdn (%s)\n",
pnewrdn.bv_val, 0, 0 );
&nnewSuperior );
if( rc != LDAP_SUCCESS ) {
#ifdef NEW_LOGGING
- LDAP_LOG(( "operation", LDAP_LEVEL_INFO,
+ LDAP_LOG( OPERATION, INFO,
"do_modrdn: conn %d invalid newSuperior (%s)\n",
- conn->c_connid, newSuperior.bv_val ));
+ conn->c_connid, newSuperior.bv_val, 0 );
#else
Debug( LDAP_DEBUG_ANY,
"do_modrdn: invalid newSuperior (%s)\n",
if (lt_dlinit()) {
const char *error = lt_dlerror();
#ifdef NEW_LOGGING
- LDAP_LOG(( "module", LDAP_LEVEL_CRIT,
- "module_init: lt_ldinit failed: %s\n", error ));
+ LDAP_LOG( SLAPD, CRIT,
+ "module_init: lt_ldinit failed: %s\n", error, 0, 0 );
#else
Debug(LDAP_DEBUG_ANY, "lt_dlinit failed: %s\n", error, 0, 0);
#endif
if (lt_dlexit()) {
const char *error = lt_dlerror();
#ifdef NEW_LOGGING
- LDAP_LOG(( "module", LDAP_LEVEL_CRIT,
- "module_kill: lt_dlexit failed: %s\n", error ));
+ LDAP_LOG( SLAPD, CRIT, "module_kill: lt_dlexit failed: %s\n",
+ error, 0, 0 );
#else
Debug(LDAP_DEBUG_ANY, "lt_dlexit failed: %s\n", error, 0, 0);
#endif
module = (module_loaded_t *)ch_calloc(1, sizeof(module_loaded_t));
if (module == NULL) {
#ifdef NEW_LOGGING
- LDAP_LOG(( "module", LDAP_LEVEL_CRIT,
- "module_load: (%s) out of memory.\n", file_name ));
+ LDAP_LOG( SLAPD, CRIT,
+ "module_load: (%s) out of memory.\n", file_name, 0, 0 );
#else
Debug(LDAP_DEBUG_ANY, "module_load failed: (%s) out of memory\n", file_name,
0, 0);
if ((module->lib = lt_dlopen(file_name)) == NULL) {
error = lt_dlerror();
#ifdef NEW_LOGGING
- LDAP_LOG(( "module", LDAP_LEVEL_CRIT,
- "module_load: lt_dlopen failed: (%s) %s.\n",
- file_name, error ));
+ LDAP_LOG( SLAPD, CRIT,
+ "module_load: lt_dlopen failed: (%s) %s.\n",
+ file_name, error, 0 );
#else
Debug(LDAP_DEBUG_ANY, "lt_dlopen failed: (%s) %s\n", file_name,
error, 0);
}
#ifdef NEW_LOGGING
- LDAP_LOG(( "module", LDAP_LEVEL_INFO,
- "module_load: loaded module %s\n", file_name ));
+ LDAP_LOG( SLAPD, INFO, "module_load: loaded module %s\n", file_name, 0, 0 );
#else
Debug(LDAP_DEBUG_CONFIG, "loaded module %s\n", file_name, 0, 0);
#endif
if ((initialize = lt_dlsym(module->lib, "init_module")) == NULL) {
#ifdef NEW_LOGGING
- LDAP_LOG(( "module", LDAP_LEVEL_ERR,
- "module_load: module %s : no init_module() function found\n",
- file_name ));
+ LDAP_LOG( SLAPD, ERR,
+ "module_load: module %s : no init_module() function found\n",
+ file_name, 0, 0 );
#else
Debug(LDAP_DEBUG_CONFIG, "module %s: no init_module() function found\n",
file_name, 0, 0);
rc = initialize(argc, argv);
if (rc == -1) {
#ifdef NEW_LOGGING
- LDAP_LOG(( "module", LDAP_LEVEL_ERR,
- "module_load: module %s init_module() failed\n", file_name));
+ LDAP_LOG( SLAPD, ERR,
+ "module_load: module %s init_module() failed\n", file_name, 0, 0);
#else
Debug(LDAP_DEBUG_CONFIG, "module %s: init_module() failed\n",
file_name, 0, 0);
|| module_regtable[rc].proc == NULL)
{
#ifdef NEW_LOGGING
- LDAP_LOG(( "module", LDAP_LEVEL_ERR,
- "module_load: module %s: unknown registration type (%d).\n", file_name));
+ LDAP_LOG( SLAPD, ERR,
+ "module_load: module %s: unknown registration type (%d).\n",
+ file_name, 0);
#else
Debug(LDAP_DEBUG_CONFIG, "module %s: unknown registration type (%d)\n",
file_name, rc, 0);
rc = (module_regtable[rc].proc)(module, file_name);
if (rc != 0) {
#ifdef NEW_LOGGING
- LDAP_LOG(( "module", LDAP_LEVEL_ERR,
- "module_load: module %s:%s could not be registered.\n",
- file_name, module_regtable[rc].type ));
+ LDAP_LOG( SLAPD, ERR,
+ "module_load: module %s:%s could not be registered.\n",
+ file_name, module_regtable[rc].type, 0 );
#else
Debug(LDAP_DEBUG_CONFIG, "module %s: %s module could not be registered\n",
file_name, module_regtable[rc].type, 0);
module_list = module;
#ifdef NEW_LOGGING
- LDAP_LOG(( "module", LDAP_LEVEL_INFO,
- "module_load: module %s:%s registered\n", file_name,
- module_regtable[rc].type ));
+ LDAP_LOG( SLAPD, INFO,
+ "module_load: module %s:%s registered\n", file_name,
+ module_regtable[rc].type, 0 );
#else
Debug(LDAP_DEBUG_CONFIG, "module %s: %s module registered\n",
file_name, module_regtable[rc].type, 0);
#include "slap.h"
#include "ldap_pvt.h"
-
struct mindexrec {
struct berval mir_name;
MatchingRule *mir_mr;
if( usage == SLAP_MR_NONE ) {
#ifdef NEW_LOGGING
- LDAP_LOG(( "operation", LDAP_LEVEL_ERR,
- "register_matching_rule: %s not usable\n", desc ));
+ LDAP_LOG( OPERATION, ERR,
+ "register_matching_rule: %s not usable\n", desc, 0, 0 );
#else
Debug( LDAP_DEBUG_ANY, "register_matching_rule: not usable %s\n",
desc, 0, 0 );
if( amr == NULL ) {
#ifdef NEW_LOGGING
- LDAP_LOG(( "operation", LDAP_LEVEL_ERR,
- "register_matching_rule: could not locate associated matching rule %s for %s\n",
- associated, desc ));
+ LDAP_LOG( OPERATION, ERR,
+ "register_matching_rule: could not locate associated "
+ "matching rule %s for %s\n", associated, desc, 0 );
#else
Debug( LDAP_DEBUG_ANY, "register_matching_rule: could not locate "
"associated matching rule %s for %s\n",
mr = ldap_str2matchingrule( desc, &code, &err, LDAP_SCHEMA_ALLOW_ALL);
if ( !mr ) {
#ifdef NEW_LOGGING
- LDAP_LOG(( "operation", LDAP_LEVEL_ERR,
- "register_matching_rule: %s before %s in %s.\n",
- ldap_scherr2str(code), err, desc ));
+ LDAP_LOG( OPERATION, ERR,
+ "register_matching_rule: %s before %s in %s.\n",
+ ldap_scherr2str(code), err, desc );
#else
Debug( LDAP_DEBUG_ANY, "Error in register_matching_rule: %s before %s in %s\n",
ldap_scherr2str(code), err, desc );
if ( code ) {
#ifdef NEW_LOGGING
- LDAP_LOG(( "operation", LDAP_LEVEL_ERR,
- "register_matching_rule: %s for %s in %s.\n",
- scherr2str(code), err, desc ));
+ LDAP_LOG( OPERATION, ERR,
+ "register_matching_rule: %s for %s in %s.\n",
+ scherr2str(code), err, desc );
#else
Debug( LDAP_DEBUG_ANY, "Error in register_matching_rule: %s for %s in %s\n",
scherr2str(code), err, desc );
#include "slap.h"
-
void
mra_free(
MatchingRuleAssertion *mra,
if( rtag == LBER_ERROR ) {
#ifdef NEW_LOGGING
- LDAP_LOG(( "operation", LDAP_LEVEL_ERR,
- "get_mra: ber_scanf (\"{t\") failure\n" ));
+ LDAP_LOG( OPERATION, ERR,
+ "get_mra: ber_scanf (\"{t\") failure\n", 0, 0, 0 );
#else
Debug( LDAP_DEBUG_ANY, " get_mra ber_scanf\n", 0, 0, 0 );
#endif
rtag = ber_scanf( ber, "m", &ma->ma_rule_text );
if ( rtag == LBER_ERROR ) {
#ifdef NEW_LOGGING
- LDAP_LOG(( "operation", LDAP_LEVEL_ERR,
- "get_mra: ber_scanf(\"o\") failure.\n" ));
+ LDAP_LOG( OPERATION, ERR,
+ "get_mra: ber_scanf(\"o\") failure.\n", 0, 0, 0 );
#else
Debug( LDAP_DEBUG_ANY, " get_mra ber_scanf for mr\n", 0, 0, 0 );
#endif
rtag = ber_scanf( ber, "t", &tag );
if( rtag == LBER_ERROR ) {
#ifdef NEW_LOGGING
- LDAP_LOG(( "operation", LDAP_LEVEL_ERR,
- "get_mra: ber_scanf (\"t\") failure\n" ));
+ LDAP_LOG( OPERATION, ERR,
+ "get_mra: ber_scanf (\"t\") failure\n", 0, 0, 0 );
#else
Debug( LDAP_DEBUG_ANY, " get_mra ber_scanf\n", 0, 0, 0 );
#endif
rtag = ber_scanf( ber, "m", &type );
if ( rtag == LBER_ERROR ) {
#ifdef NEW_LOGGING
- LDAP_LOG(( "operation", LDAP_LEVEL_ERR,
- "get_mra: ber_scanf (\"o\") failure.\n" ));
+ LDAP_LOG( OPERATION, ERR,
+ "get_mra: ber_scanf (\"o\") failure.\n", 0, 0, 0 );
#else
Debug( LDAP_DEBUG_ANY, " get_mra ber_scanf for ad\n", 0, 0, 0 );
#endif
rtag = ber_scanf( ber, "t", &tag );
if( rtag == LBER_ERROR ) {
#ifdef NEW_LOGGING
- LDAP_LOG(( "operation", LDAP_LEVEL_ERR,
- "get_mra: ber_scanf (\"t\") failure.\n" ));
+ LDAP_LOG( OPERATION, ERR,
+ "get_mra: ber_scanf (\"t\") failure.\n", 0, 0, 0 );
#else
Debug( LDAP_DEBUG_ANY, " get_mra ber_scanf\n", 0, 0, 0 );
#endif
if ( tag != LDAP_FILTER_EXT_VALUE ) {
#ifdef NEW_LOGGING
- LDAP_LOG(( "operation", LDAP_LEVEL_ERR,
- "get_mra: ber_scanf missing value\n" ));
+ LDAP_LOG( OPERATION, ERR,
+ "get_mra: ber_scanf missing value\n", 0, 0, 0 );
#else
Debug( LDAP_DEBUG_ANY, " get_mra ber_scanf missing value\n", 0, 0, 0 );
#endif
if( rtag == LBER_ERROR ) {
#ifdef NEW_LOGGING
- LDAP_LOG(( "operation", LDAP_LEVEL_ERR,
- "get_mra: ber_scanf (\"o\") failure.\n" ));
+ LDAP_LOG( OPERATION, ERR,
+ "get_mra: ber_scanf (\"o\") failure.\n", 0, 0, 0 );
#else
Debug( LDAP_DEBUG_ANY, " get_mra ber_scanf\n", 0, 0, 0 );
#endif
if( rtag == LBER_ERROR ) {
#ifdef NEW_LOGGING
- LDAP_LOG(( "operation", LDAP_LEVEL_ERR,
- "get_mra: ber_scanf failure\n"));
+ LDAP_LOG( OPERATION, ERR, "get_mra: ber_scanf failure\n", 0, 0, 0);
#else
Debug( LDAP_DEBUG_ANY, " get_mra ber_scanf\n", 0, 0, 0 );
#endif
if( sub == NULL || sup == NULL ) return 0;
#if 1
+#ifdef NEW_LOGGING
+ LDAP_LOG ( OPERATION, ARGS,
+ "is_object_subclass(%s,%s) %d\n",
+ sup->soc_oid, sub->soc_oid, sup == sub );
+#else
Debug( LDAP_DEBUG_TRACE, "is_object_subclass(%s,%s) %d\n",
sup->soc_oid, sub->soc_oid, sup == sub );
+#endif
#endif
if( sup == sub ) {
if( attr == NULL ) {
/* no objectClass attribute */
#ifdef NEW_LOGGING
- LDAP_LOG(( "operation", LDAP_LEVEL_ERR, "is_entry_objectclass: "
- "dn(%s), oid (%s), no objectClass attribute.\n",
- e->e_dn == NULL ? "" : e->e_dn,
- oc->soc_oclass.oc_oid ));
+ LDAP_LOG( OPERATION, ERR,
+ "is_entry_objectclass: dn(%s), oid (%s), no objectClass "
+ "attribute.\n", e->e_dn == NULL ? "" : e->e_dn,
+ oc->soc_oclass.oc_oid, 0 );
#else
Debug( LDAP_DEBUG_ANY, "is_entry_objectclass(\"%s\", \"%s\") "
"no objectClass attribute\n",
if( tag == LDAP_TAG_EXOP_MODIFY_PASSWD_ID ) {
if( id == NULL ) {
#ifdef NEW_LOGGING
- LDAP_LOG(( "operation", LDAP_LEVEL_ERR,
- "slap_passwd_parse: ID not allowed.\n"));
+ LDAP_LOG( OPERATION, ERR,
+ "slap_passwd_parse: ID not allowed.\n", 0, 0, 0 );
#else
Debug( LDAP_DEBUG_TRACE, "slap_passwd_parse: ID not allowed.\n",
0, 0, 0 );
if( tag == LBER_ERROR ) {
#ifdef NEW_LOGGING
- LDAP_LOG(( "operation", LDAP_LEVEL_ERR,
- "slap_passwd_parse: ID parse failed.\n"));
+ LDAP_LOG( OPERATION, ERR,
+ "slap_passwd_parse: ID parse failed.\n", 0, 0, 0 );
#else
Debug( LDAP_DEBUG_TRACE, "slap_passwd_parse: ID parse failed.\n",
0, 0, 0 );
if( tag == LDAP_TAG_EXOP_MODIFY_PASSWD_OLD ) {
if( oldpass == NULL ) {
#ifdef NEW_LOGGING
- LDAP_LOG(( "operation", LDAP_LEVEL_ERR,
- "slap_passwd_parse: OLD not allowed.\n" ));
+ LDAP_LOG( OPERATION, ERR,
+ "slap_passwd_parse: OLD not allowed.\n" , 0, 0, 0 );
#else
Debug( LDAP_DEBUG_TRACE, "slap_passwd_parse: OLD not allowed.\n",
0, 0, 0 );
if( tag == LBER_ERROR ) {
#ifdef NEW_LOGGING
- LDAP_LOG(( "operation", LDAP_LEVEL_ERR,
- "slap_passwd_parse: ID parse failed.\n" ));
+ LDAP_LOG( OPERATION, ERR,
+ "slap_passwd_parse: ID parse failed.\n" , 0, 0, 0 );
#else
Debug( LDAP_DEBUG_TRACE, "slap_passwd_parse: ID parse failed.\n",
0, 0, 0 );
if( tag == LDAP_TAG_EXOP_MODIFY_PASSWD_NEW ) {
if( newpass == NULL ) {
#ifdef NEW_LOGGING
- LDAP_LOG(( "operation", LDAP_LEVEL_ERR,
- "slap_passwd_parse: NEW not allowed.\n" ));
+ LDAP_LOG( OPERATION, ERR,
+ "slap_passwd_parse: NEW not allowed.\n", 0, 0, 0 );
#else
Debug( LDAP_DEBUG_TRACE, "slap_passwd_parse: NEW not allowed.\n",
0, 0, 0 );
if( tag == LBER_ERROR ) {
#ifdef NEW_LOGGING
- LDAP_LOG(( "operation", LDAP_LEVEL_ERR,
- "slap_passwd_parse: OLD parse failed.\n"));
+ LDAP_LOG( OPERATION, ERR,
+ "slap_passwd_parse: OLD parse failed.\n", 0, 0, 0 );
#else
Debug( LDAP_DEBUG_TRACE, "slap_passwd_parse: OLD parse failed.\n",
0, 0, 0 );
if( len != 0 ) {
decoding_error:
#ifdef NEW_LOGGING
- LDAP_LOG(( "operation", LDAP_LEVEL_ERR,
- "slap_passwd_parse: decoding error, len=%ld\n", (long)len ));
+ LDAP_LOG( OPERATION, ERR,
+ "slap_passwd_parse: decoding error, len=%ld\n", (long)len, 0, 0 );
#else
Debug( LDAP_DEBUG_TRACE,
"slap_passwd_parse: decoding error, len=%ld\n",
assert( cred != NULL );
#ifdef NEW_LOGGING
- LDAP_LOG(( "operation", LDAP_LEVEL_ENTRY,
- "slap_passwd_return: %ld\n",(long)cred->bv_len ));
+ LDAP_LOG( OPERATION, ENTRY,
+ "slap_passwd_return: %ld\n",(long)cred->bv_len, 0, 0 );
#else
Debug( LDAP_DEBUG_TRACE, "slap_passwd_return: %ld\n",
(long) cred->bv_len, 0, 0 );
{
struct berval *tmp;
#ifdef NEW_LOGGING
- LDAP_LOG(( "operation", LDAP_LEVEL_ENTRY,
- "slap_passwd_generate: begin\n" ));
+ LDAP_LOG( OPERATION, ENTRY, "slap_passwd_generate: begin\n", 0, 0, 0 );
#else
Debug( LDAP_DEBUG_TRACE, "slap_passwd_generate\n", 0, 0, 0 );
#endif
LDAP_SLAPD_F (int) charray_strcmp LDAP_P(( const char **a1, const char **a2 ));
LDAP_SLAPD_F (int) charray_strcasecmp LDAP_P(( const char **a1, const char **a2 ));
-LDAP_SLAPD_F (char *) slap_strcopy LDAP_P((
- char *dst, const char *src ));
-LDAP_SLAPD_F (char *) slap_strncopy LDAP_P((
- char *dst, const char *src, size_t n ));
-
/*
* controls.c
*/
struct berval *saslname,
struct berval *dn ));
LDAP_SLAPD_F (int) slap_sasl_authorized LDAP_P((
+ Connection *conn,
struct berval *authcid,
struct berval *authzid ));
LDAP_SLAPD_F (int) slap_sasl_regexp_config LDAP_P((
default:
/* other error, bail */
#ifdef NEW_LOGGING
- LDAP_LOG(( "config", LDAP_LEVEL_CRIT,
+ LDAP_LOG( CONFIG, CRIT,
"referral: invalid URL (%s): %s (%d)\n",
- url, "" /* ldap_url_error2str(rc) */, rc ));
+ url, "" /* ldap_url_error2str(rc) */, rc );
#else
Debug( LDAP_DEBUG_ANY,
"referral: invalid URL (%s): %s (%d)\n",
if( lurl->lud_dn && *lurl->lud_dn ) {
#ifdef NEW_LOGGING
- LDAP_LOG(( "config", LDAP_LEVEL_CRIT,
- "referral: URL (%s): contains DN\n",
- url ));
+ LDAP_LOG( CONFIG, CRIT, "referral: URL (%s): contains DN\n", url, 0, 0 );
#else
Debug( LDAP_DEBUG_ANY,
"referral: URL (%s): contains DN\n",
} else if( lurl->lud_attrs ) {
#ifdef NEW_LOGGING
- LDAP_LOG(( "config", LDAP_LEVEL_CRIT,
- "referral: URL (%s): requests attributes\n",
- url ));
+ LDAP_LOG( CONFIG, CRIT,
+ "referral: URL (%s): requests attributes\n", url, 0, 0 );
#else
Debug( LDAP_DEBUG_ANY,
"referral: URL (%s): requests attributes\n",
} else if( lurl->lud_scope != LDAP_SCOPE_DEFAULT ) {
#ifdef NEW_LOGGING
- LDAP_LOG(( "config", LDAP_LEVEL_CRIT,
- "referral: URL (%s): contains explicit scope\n",
- url ));
+ LDAP_LOG( CONFIG, CRIT,
+ "referral: URL (%s): contains explicit scope\n", url, 0, 0 );
#else
Debug( LDAP_DEBUG_ANY,
"referral: URL (%s): contains explicit scope\n",
} else if( lurl->lud_filter ) {
#ifdef NEW_LOGGING
- LDAP_LOG(( "config", LDAP_LEVEL_CRIT,
- "referral: URL (%s): contains explicit filter\n",
- url ));
+ LDAP_LOG( CONFIG, CRIT,
+ "referral: URL (%s): contains explicit filter\n", url, 0, 0 );
#else
Debug( LDAP_DEBUG_ANY,
"referral: URL (%s): contains explicit filter\n",
*/
#ifdef NEW_LOGGING
- LDAP_LOG(( "operation", LDAP_LEVEL_ERR,
- "send_ldap_ber: conn %lu ber_flush failed err=%d (%s)\n",
- conn ? conn->c_connid : 0, err, sock_errstr(err) ));
+ LDAP_LOG( OPERATION, ERR,
+ "send_ldap_ber: conn %lu ber_flush failed err=%d (%s)\n",
+ conn ? conn->c_connid : 0, err, sock_errstr(err) );
#else
Debug( LDAP_DEBUG_CONNS, "ber_flush failed errno=%d reason=\"%s\"\n",
err, sock_errstr(err), 0 );
ber_init_w_nullc( ber, LBER_USE_DER );
#ifdef NEW_LOGGING
- LDAP_LOG(( "operation", LDAP_LEVEL_ENTRY,
- "send_ldap_response: conn %lu msgid=%d tag=%lu err=%d\n",
- conn ? conn->c_connid : 0, msgid, tag, err ));
+ LDAP_LOG( OPERATION, ENTRY,
+ "send_ldap_response: msgid=%d tag=%lu err=%d\n",
+ msgid, tag, err );
#else
Debug( LDAP_DEBUG_TRACE,
"send_ldap_response: msgid=%d tag=%lu err=%d\n",
if( ref ) {
#ifdef NEW_LOGGING
- LDAP_LOG(( "operation", LDAP_LEVEL_ARGS,
- "send_ldap_response: conn %lu ref=\"%s\"\n",
- conn ? conn->c_connid : 0,
- ref[0].bv_val ? ref[0].bv_val : "NULL" ));
+ LDAP_LOG( OPERATION, ARGS,
+ "send_ldap_response: conn %lu ref=\"%s\"\n",
+ conn ? conn->c_connid : 0,
+ ref[0].bv_val ? ref[0].bv_val : "NULL" , 0 );
#else
Debug( LDAP_DEBUG_ARGS, "send_ldap_response: ref=\"%s\"\n",
ref[0].bv_val ? ref[0].bv_val : "NULL",
rc = ber_write(ber, (char *)&op->o_peeraddr, sizeof(struct sockaddr), 0);
if (rc != sizeof(struct sockaddr)) {
#ifdef NEW_LOGGING
- LDAP_LOG(( "operation", LDAP_LEVEL_ERR,
- "send_ldap_response: conn %lu ber_write failed\n",
- conn ? conn->c_connid : 0 ));
+ LDAP_LOG( OPERATION, ERR,
+ "send_ldap_response: conn %lu ber_write failed\n",
+ conn ? conn->c_connid : 0 , 0, 0);
#else
Debug( LDAP_DEBUG_ANY, "ber_write failed\n", 0, 0, 0 );
#endif
if ( rc == -1 ) {
#ifdef NEW_LOGGING
- LDAP_LOG(( "operation", LDAP_LEVEL_ERR,
- "send_ldap_response: conn %lu ber_printf failed\n",
- conn ? conn->c_connid : 0 ));
+ LDAP_LOG( OPERATION, ERR,
+ "send_ldap_response: conn %lu ber_printf failed\n",
+ conn ? conn->c_connid : 0, 0, 0 );
#else
Debug( LDAP_DEBUG_ANY, "ber_printf failed\n", 0, 0, 0 );
#endif
if ( bytes < 0 ) {
#ifdef NEW_LOGGING
- LDAP_LOG(( "operation", LDAP_LEVEL_ERR,
- "send_ldap_response: conn %lu ber write failed\n",
- conn ? conn->c_connid : 0 ));
+ LDAP_LOG( OPERATION, ERR,
+ "send_ldap_response: conn %lu ber write failed\n",
+ conn ? conn->c_connid : 0, 0, 0 );
#else
Debug( LDAP_DEBUG_ANY,
"send_ldap_response: ber write failed\n",
assert( LDAP_UNSOLICITED_ERROR( err ) );
#ifdef NEW_LOGGING
- LDAP_LOG(( "operation", LDAP_LEVEL_ENTRY,
- "send_ldap_disconnect: conn %lu %d:%s\n",
- conn ? conn->c_connid : 0, err, text ? text : "" ));
+ LDAP_LOG( OPERATION, ENTRY,
+ "send_ldap_disconnect: conn %lu %d:%s\n",
+ conn ? conn->c_connid : 0, err, text ? text : "" );
#else
Debug( LDAP_DEBUG_TRACE,
"send_ldap_disconnect %d:%s\n",
assert( !LDAP_API_ERROR( err ) );
#ifdef NEW_LOGGING
- LDAP_LOG(( "operation", LDAP_LEVEL_ENTRY,
- "send_ldap_result : conn %lu op=%lu p=%d\n",
- op->o_connid, op->o_opid, op->o_protocol ));
+ LDAP_LOG( OPERATION, ENTRY,
+ "send_ldap_result : conn %lu op=%lu p=%d\n",
+ op->o_connid, op->o_opid, op->o_protocol );
#else
Debug( LDAP_DEBUG_TRACE,
"send_ldap_result: conn=%lu op=%lu p=%d\n",
#endif
#ifdef NEW_LOGGING
- LDAP_LOG(( "operation", LDAP_LEVEL_ARGS,
- "send_ldap_result: conn=%lu err=%d matched=\"%s\" text=\"%s\"\n",
- op->o_connid, err, matched ? matched : "", text ? text : "" ));
+ LDAP_LOG( OPERATION, ARGS,
+ "send_ldap_result: err=%d matched=\"%s\" text=\"%s\"\n",
+ err, matched ? matched : "", text ? text : "" );
#else
Debug( LDAP_DEBUG_ARGS,
"send_ldap_result: err=%d matched=\"%s\" text=\"%s\"\n",
if( ref ) {
#ifdef NEW_LOGGING
- LDAP_LOG(( "operation", LDAP_LEVEL_ARGS,
+ LDAP_LOG( OPERATION, ARGS,
"send_ldap_result: referral=\"%s\"\n",
- ref[0].bv_val ? ref[0].bv_val : "NULL" ));
+ ref[0].bv_val ? ref[0].bv_val : "NULL", 0, 0 );
#else
Debug( LDAP_DEBUG_ARGS,
"send_ldap_result: referral=\"%s\"\n",
ber_int_t msgid;
#ifdef NEW_LOGGING
- LDAP_LOG(( "operation", LDAP_LEVEL_ENTRY,
- "send_ldap_sasl: conn %lu err=%d len=%lu\n",
- op->o_connid, err, cred ? cred->bv_len : -1 ));
+ LDAP_LOG( OPERATION, ENTRY,
+ "send_ldap_sasl: conn %lu err=%d len=%lu\n",
+ op->o_connid, err, cred ? cred->bv_len : -1 );
#else
Debug( LDAP_DEBUG_TRACE, "send_ldap_sasl: err=%d len=%ld\n",
err, cred ? (long) cred->bv_len : -1, NULL );
ber_int_t msgid;
#ifdef NEW_LOGGING
- LDAP_LOG(( "operation", LDAP_LEVEL_ENTRY,
- "send_ldap_extended: conn %lu err=%d oid=%s len=%ld\n",
- op->o_connid, err, rspoid ? rspoid : "",
- rspdata != NULL ? rspdata->bv_len : 0 ));
+ LDAP_LOG( OPERATION, ENTRY,
+ "send_ldap_extended: err=%d oid=%s len=%ld\n",
+ err, rspoid ? rspoid : "",
+ rspdata != NULL ? rspdata->bv_len : 0 );
#else
Debug( LDAP_DEBUG_TRACE,
"send_ldap_extended err=%d oid=%s len=%ld\n",
}
#ifdef NEW_LOGGING
- LDAP_LOG(( "operation", LDAP_LEVEL_ENTRY,
- "send_search_result: conn %lu err=%d "
- "matched=\"%s\" text=\"%s\"\n",
- op->o_connid, err, matched ? matched : "",
- text ? text : "" ));
+ LDAP_LOG( OPERATION, ENTRY,
+ "send_search_result: err=%d matched=\"%s\" text=\"%s\"\n",
+ err, matched ? matched : "", text ? text : "" );
#else
Debug( LDAP_DEBUG_TRACE,
"send_search_result: err=%d matched=\"%s\" text=\"%s\"\n",
{
char nbuf[64];
- sprintf( nbuf, "%d nentries=%d", err, nentries );
+ snprintf( nbuf, sizeof nbuf, "%d nentries=%d", err, nentries );
Statslog( LDAP_DEBUG_STATS,
"conn=%lu op=%lu SEARCH RESULT tag=%lu err=%s text=%s\n",
}
#ifdef NEW_LOGGING
- LDAP_LOG(( "operation", LDAP_LEVEL_ENTRY,
- "send_search_entry: conn %lu dn=\"%s\"%s\n",
- op->o_connid, e->e_dn,
- attrsonly ? " (attrsOnly)" : "" ));
+ LDAP_LOG( OPERATION, ENTRY,
+ "send_search_entry: conn %lu dn=\"%s\"%s\n",
+ op->o_connid, e->e_dn, attrsonly ? " (attrsOnly)" : "" );
#else
Debug( LDAP_DEBUG_TRACE,
"=> send_search_entry: dn=\"%s\"%s\n",
ad_entry, NULL, ACL_READ, NULL ) )
{
#ifdef NEW_LOGGING
- LDAP_LOG(( "acl", LDAP_LEVEL_INFO,
- "send_search_entry: conn %lu access "
- "to entry (%s) not allowed\n",
- op->o_connid, e->e_dn ));
+ LDAP_LOG( ACL, INFO,
+ "send_search_entry: conn %lu access to entry (%s) not allowed\n",
+ op->o_connid, e->e_dn, 0 );
#else
Debug( LDAP_DEBUG_ACL,
"send_search_entry: access to entry not allowed\n",
rc = ber_write(ber, (char *)&op->o_peeraddr, sizeof(struct sockaddr), 0);
if (rc != sizeof(struct sockaddr)) {
#ifdef NEW_LOGGING
- LDAP_LOG(( "operation", LDAP_LEVEL_ERR,
- "send_search_entry: conn %lu ber_printf failed\n",
- conn ? conn->c_connid : 0 ));
+ LDAP_LOG( OPERATION, ERR,
+ "send_search_entry: conn %lu ber_printf failed\n",
+ conn ? conn->c_connid : 0, 0, 0 );
#else
Debug( LDAP_DEBUG_ANY, "ber_printf failed\n", 0, 0, 0 );
#endif
if ( rc == -1 ) {
#ifdef NEW_LOGGING
- LDAP_LOG(( "operation", LDAP_LEVEL_ERR,
- "send_search_entry: conn %lu ber_printf failed\n",
- op->o_connid ));
+ LDAP_LOG( OPERATION, ERR,
+ "send_search_entry: conn %lu ber_printf failed\n",
+ op->o_connid, 0, 0 );
#else
Debug( LDAP_DEBUG_ANY, "ber_printf failed\n", 0, 0, 0 );
#endif
if ( rc == -1 ) {
#ifdef NEW_LOGGING
- LDAP_LOG(( "operation", LDAP_LEVEL_ERR,
- "send_search_entry: conn %lu "
- "matched values filtering failed\n",
- conn ? conn->c_connid : 0 ));
+ LDAP_LOG( OPERATION, ERR,
+ "send_search_entry: conn %lu matched values filtering failed\n",
+ conn ? conn->c_connid : 0, 0, 0 );
#else
Debug( LDAP_DEBUG_ANY,
"matched values filtering failed\n", 0, 0, 0 );
ACL_READ, &acl_state ) )
{
#ifdef NEW_LOGGING
- LDAP_LOG(( "acl", LDAP_LEVEL_INFO, "send_search_entry: "
- "conn %lu access to attribute %s "
- "not allowed\n",
- op->o_connid, desc->ad_cname.bv_val ));
+ LDAP_LOG( ACL, INFO,
+ "send_search_entry: conn %lu access to attribute %s not "
+ "allowed\n", op->o_connid, desc->ad_cname.bv_val, 0 );
#else
Debug( LDAP_DEBUG_ACL, "acl: "
"access to attribute %s not allowed\n",
if (( rc = ber_printf( ber, "{O[" /*]}*/ , &desc->ad_cname )) == -1 ) {
#ifdef NEW_LOGGING
- LDAP_LOG(( "operation", LDAP_LEVEL_ERR,
- "send_search_entry: "
- "conn %lu ber_printf failed\n",
- op->o_connid ));
+ LDAP_LOG( OPERATION, ERR,
+ "send_search_entry: conn %lu ber_printf failed\n",
+ op->o_connid, 0, 0 );
#else
Debug( LDAP_DEBUG_ANY, "ber_printf failed\n", 0, 0, 0 );
#endif
desc, &a->a_vals[i], ACL_READ, &acl_state ) )
{
#ifdef NEW_LOGGING
- LDAP_LOG(( "acl", LDAP_LEVEL_INFO,
+ LDAP_LOG( ACL, INFO,
"send_search_entry: conn %lu "
- "access to attribute %s, "
- "value %d not allowed\n",
- op->o_connid,
- desc->ad_cname.bv_val, i ));
+ "access to attribute %s, value %d not allowed\n",
+ op->o_connid, desc->ad_cname.bv_val, i );
#else
Debug( LDAP_DEBUG_ACL,
"acl: access to attribute %s, "
if (( rc = ber_printf( ber, "O", &a->a_vals[i] )) == -1 ) {
#ifdef NEW_LOGGING
- LDAP_LOG(( "operation", LDAP_LEVEL_ERR,
+ LDAP_LOG( OPERATION, ERR,
"send_search_entry: conn %lu "
- "ber_printf failed.\n",
- op->o_connid ));
+ "ber_printf failed.\n", op->o_connid, 0, 0 );
#else
Debug( LDAP_DEBUG_ANY,
"ber_printf failed\n", 0, 0, 0 );
if (( rc = ber_printf( ber, /*{[*/ "]N}" )) == -1 ) {
#ifdef NEW_LOGGING
- LDAP_LOG(( "operation", LDAP_LEVEL_ERR,
- "send_search_entry: conn %lu "
- "ber_printf failed\n",
- op->o_connid ));
+ LDAP_LOG( OPERATION, ERR,
+ "send_search_entry: conn %lu ber_printf failed\n",
+ op->o_connid, 0, 0 );
#else
Debug( LDAP_DEBUG_ANY, "ber_printf failed\n", 0, 0, 0 );
#endif
if ( rc == -1 ) {
#ifdef NEW_LOGGING
- LDAP_LOG(( "operation", LDAP_LEVEL_ERR,
+ LDAP_LOG( OPERATION, ERR,
"send_search_entry: conn %lu "
- "matched values filtering failed\n",
- conn ? conn->c_connid : 0 ));
+ "matched values filtering failed\n",
+ conn ? conn->c_connid : 0, 0, 0);
#else
Debug( LDAP_DEBUG_ANY,
"matched values filtering failed\n", 0, 0, 0 );
ACL_READ, &acl_state ) )
{
#ifdef NEW_LOGGING
- LDAP_LOG(( "acl", LDAP_LEVEL_INFO,
+ LDAP_LOG( ACL, INFO,
"send_search_entry: conn %lu "
"access to attribute %s not allowed\n",
- op->o_connid, desc->ad_cname.bv_val ));
+ op->o_connid, desc->ad_cname.bv_val, 0 );
#else
Debug( LDAP_DEBUG_ACL, "acl: access to attribute %s "
"not allowed\n",
rc = ber_printf( ber, "{O[" /*]}*/ , &desc->ad_cname );
if ( rc == -1 ) {
#ifdef NEW_LOGGING
- LDAP_LOG(( "operation", LDAP_LEVEL_ERR,
+ LDAP_LOG( OPERATION, ERR,
"send_search_entry: conn %lu "
- "ber_printf failed\n",
- op->o_connid ));
+ "ber_printf failed\n", op->o_connid, 0, 0 );
#else
Debug( LDAP_DEBUG_ANY, "ber_printf failed\n", 0, 0, 0 );
#endif
desc, &a->a_vals[i], ACL_READ, &acl_state ) )
{
#ifdef NEW_LOGGING
- LDAP_LOG(( "acl", LDAP_LEVEL_INFO,
+ LDAP_LOG( ACL, INFO,
"send_search_entry: conn %lu "
- "access to %s, value %d "
- "not allowed\n",
- op->o_connid,
- desc->ad_cname.bv_val, i ));
+ "access to %s, value %d not allowed\n",
+ op->o_connid, desc->ad_cname.bv_val, i );
#else
Debug( LDAP_DEBUG_ACL,
"acl: access to attribute %s, "
if (( rc = ber_printf( ber, "O", &a->a_vals[i] )) == -1 ) {
#ifdef NEW_LOGGING
- LDAP_LOG(( "operation", LDAP_LEVEL_ERR,
- "send_search_entry: "
- "conn %lu ber_printf "
- "failed\n",
- op->o_connid ));
+ LDAP_LOG( OPERATION, ERR,
+ "send_search_entry: conn %lu ber_printf failed\n",
+ op->o_connid, 0, 0 );
#else
Debug( LDAP_DEBUG_ANY,
"ber_printf failed\n", 0, 0, 0 );
if (( rc = ber_printf( ber, /*{[*/ "]N}" )) == -1 ) {
#ifdef NEW_LOGGING
- LDAP_LOG(( "operation", LDAP_LEVEL_ERR,
- "send_search_entry: conn %lu "
- "ber_printf failed\n",
- op->o_connid ));
+ LDAP_LOG( OPERATION, ERR,
+ "send_search_entry: conn %lu ber_printf failed\n",
+ op->o_connid, 0, 0 );
#else
Debug( LDAP_DEBUG_ANY, "ber_printf failed\n", 0, 0, 0 );
#endif
#endif
if ( rc == -1 ) {
#ifdef NEW_LOGGING
- LDAP_LOG(( "operation", LDAP_LEVEL_ERR,
- "send_search_entry: conn %lu ber_printf failed\n",
- op->o_connid ));
+ LDAP_LOG( OPERATION, ERR,
+ "send_search_entry: conn %lu ber_printf failed\n",
+ op->o_connid, 0, 0 );
#else
Debug( LDAP_DEBUG_ANY, "ber_printf failed\n", 0, 0, 0 );
#endif
if ( bytes < 0 ) {
#ifdef NEW_LOGGING
- LDAP_LOG(( "operation", LDAP_LEVEL_ERR,
- "send_search_entry: conn %lu ber write failed.\n",
- op->o_connid ));
+ LDAP_LOG( OPERATION, ERR,
+ "send_search_entry: conn %lu ber write failed.\n",
+ op->o_connid, 0, 0 );
#else
Debug( LDAP_DEBUG_ANY,
"send_search_entry: ber write failed\n",
conn->c_connid, op->o_opid, e->e_dn, 0, 0 );
#ifdef NEW_LOGGING
- LDAP_LOG(( "operation", LDAP_LEVEL_ENTRY,
- "send_search_entry: conn %lu exit.\n",
- op->o_connid ));
+ LDAP_LOG( OPERATION, ENTRY,
+ "send_search_entry: conn %lu exit.\n", op->o_connid, 0, 0 );
#else
Debug( LDAP_DEBUG_TRACE, "<= send_search_entry\n", 0, 0, 0 );
#endif
AttributeDescription *ad_entry = slap_schema.si_ad_entry;
#ifdef NEW_LOGGING
- LDAP_LOG(( "operation", LDAP_LEVEL_ENTRY,
- "send_search_reference: conn %lu dn=\"%s\"\n",
- op->o_connid, e->e_dn ));
+ LDAP_LOG( OPERATION, ENTRY,
+ "send_search_reference: conn %lu dn=\"%s\"\n",
+ op->o_connid, e->e_dn, 0 );
#else
Debug( LDAP_DEBUG_TRACE,
"=> send_search_reference: dn=\"%s\"\n",
ad_entry, NULL, ACL_READ, NULL ) )
{
#ifdef NEW_LOGGING
- LDAP_LOG(( "acl", LDAP_LEVEL_INFO,
+ LDAP_LOG( ACL, INFO,
"send_search_reference: conn %lu "
- "access to entry %s not allowed\n",
- op->o_connid, e->e_dn ));
+ "access to entry %s not allowed\n", op->o_connid, e->e_dn, 0 );
#else
Debug( LDAP_DEBUG_ACL,
"send_search_reference: access to entry not allowed\n",
ad_ref, NULL, ACL_READ, NULL ) )
{
#ifdef NEW_LOGGING
- LDAP_LOG(( "acl", LDAP_LEVEL_INFO,
+ LDAP_LOG( ACL, INFO,
"send_search_reference: conn %lu access "
- "to reference not allowed.\n",
- op->o_connid ));
+ "to reference not allowed.\n", op->o_connid, 0, 0 );
#else
Debug( LDAP_DEBUG_ACL,
"send_search_reference: access "
if( refs == NULL ) {
#ifdef NEW_LOGGING
- LDAP_LOG(( "operation", LDAP_LEVEL_ERR,
+ LDAP_LOG( OPERATION, ERR,
"send_search_reference: conn %lu null ref in (%s).\n",
- op->o_connid, e->e_dn ));
+ op->o_connid, e->e_dn, 0 );
#else
Debug( LDAP_DEBUG_ANY,
"send_search_reference: null ref in (%s)\n",
if ( rc == -1 ) {
#ifdef NEW_LOGGING
- LDAP_LOG(( "operation", LDAP_LEVEL_ERR,
+ LDAP_LOG( OPERATION, ERR,
"send_search_reference: conn %lu "
- "ber_printf failed.\n",
- op->o_connid ));
+ "ber_printf failed.\n", op->o_connid, 0, 0 );
#else
Debug( LDAP_DEBUG_ANY,
"send_search_reference: ber_printf failed\n", 0, 0, 0 );
conn->c_connid, op->o_opid, e->e_dn, 0, 0 );
#ifdef NEW_LOGGING
- LDAP_LOG(( "operation", LDAP_LEVEL_ENTRY,
- "send_search_reference: conn %lu exit.\n", op->o_connid ));
+ LDAP_LOG( OPERATION, ENTRY,
+ "send_search_reference: conn %lu exit.\n", op->o_connid, 0, 0 );
#else
Debug( LDAP_DEBUG_TRACE, "<= send_search_reference\n", 0, 0, 0 );
#endif
if ( strncasecmp( s, "RESULT", 6 ) != 0 ) {
#ifdef NEW_LOGGING
- LDAP_LOG(( "operation", LDAP_LEVEL_INFO,
- "str2result: (%s), expecting \"RESULT\"\n", s ));
+ LDAP_LOG( OPERATION, INFO,
+ "str2result: (%s), expecting \"RESULT\"\n", s, 0, 0 );
#else
Debug( LDAP_DEBUG_ANY, "str2result (%s) expecting \"RESULT\"\n",
s, 0, 0 );
}
} else {
#ifdef NEW_LOGGING
- LDAP_LOG(( "operation", LDAP_LEVEL_INFO,
- "str2result: (%s) unknown.\n", s ));
+ LDAP_LOG( OPERATION, INFO, "str2result: (%s) unknown.\n", s, 0, 0 );
#else
Debug( LDAP_DEBUG_ANY, "str2result (%s) unknown\n",
s, 0, 0 );
#include "lber_pvt.h"
static struct berval supportedFeatures[] = {
- BER_BVC("1.3.6.1.4.1.4203.1.5.1"), /* all Operational Attributes ("+") */
- BER_BVC("1.3.6.1.4.1.4203.1.5.2"), /* OCs in Attributes List */
- BER_BVC("1.3.6.1.4.1.4203.1.5.3"), /* (&) and (|) search filters */
- BER_BVC("1.3.6.1.4.1.4203.1.5.4"), /* Language Tag Options */
- BER_BVC("1.3.6.1.4.1.4203.1.5.5"), /* Language Range Options */
+ BER_BVC(LDAP_FEATURE_ALL_OPERATIONAL_ATTRS), /* all Operational Attributes ("+") */
+ BER_BVC(LDAP_FEATURE_OBJECTCLASS_ATTRS), /* OCs in Attributes List */
+ BER_BVC(LDAP_FEATURE_ABSOLUTE_FILTERS), /* (&) and (|) search filters */
+ BER_BVC(LDAP_FEATURE_LANGUAGE_TAG_OPTIONS), /* Language Tag Options */
+ BER_BVC(LDAP_FEATURE_LANGUAGE_RANGE_OPTIONS), /* Language Range Options */
{0,NULL}
};
Entry **entry,
const char **text )
{
- char buf[BUFSIZ];
Entry *e;
struct berval vals[2], *bv;
int i, j;
/* supportedLDAPVersion */
for ( i=LDAP_VERSION_MIN; i<=LDAP_VERSION_MAX; i++ ) {
+ char buf[BUFSIZ];
if (!( global_allows & SLAP_ALLOW_BIND_V2 ) &&
( i < LDAP_VERSION3 ) )
{
/* version 2 and lower are disallowed */
continue;
}
- sprintf(buf,"%d",i);
+ snprintf(buf, sizeof buf, "%d", i);
vals[0].bv_val = buf;
vals[0].bv_len = strlen( vals[0].bv_val );
attr_merge( e, ad_supportedLDAPVersion, vals );
if ( strcasecmp( cargv[0], "sasl-authz-policy" ) == 0 ) {
if ( cargc != 2 ) {
#ifdef NEW_LOGGING
- LDAP_LOG(( "config", LDAP_LEVEL_CRIT,
+ LDAP_LOG( CONFIG, CRIT,
"%s: line %d: missing policy in \"sasl-authz-policy <policy>\" line\n",
- fname, lineno ));
+ fname, lineno, 0 );
#else
Debug( LDAP_DEBUG_ANY,
"%s: line %d: missing policy in \"sasl-authz-policy <policy>\" line\n",
}
if ( slap_sasl_setpolicy( cargv[1] ) ) {
#ifdef NEW_LOGGING
- LDAP_LOG(( "config", LDAP_LEVEL_CRIT,
+ LDAP_LOG( CONFIG, CRIT,
"%s: line %d: unable "
"to parse value \"%s\" "
"in \"sasl-authz-policy "
"<policy>\" line.\n",
- fname, lineno, cargv[1] ));
+ fname, lineno, cargv[1] );
#else
Debug( LDAP_DEBUG_ANY,
"%s: line %d: unable "
} else if ( strcasecmp( cargv[0], "sasl-host" ) == 0 ) {
if ( cargc < 2 ) {
#ifdef NEW_LOGGING
- LDAP_LOG(( "config", LDAP_LEVEL_CRIT,
+ LDAP_LOG( CONFIG, CRIT,
"%s: line %d: missing host in \"sasl-host <host>\" line\n",
- fname, lineno ));
+ fname, lineno, 0 );
#else
Debug( LDAP_DEBUG_ANY,
"%s: line %d: missing host in \"sasl-host <host>\" line\n",
if ( global_host != NULL ) {
#ifdef NEW_LOGGING
- LDAP_LOG(( "config", LDAP_LEVEL_CRIT,
+ LDAP_LOG( CONFIG, CRIT,
"%s: line %d: already set sasl-host!\n",
- fname, lineno ));
+ fname, lineno, 0 );
#else
Debug( LDAP_DEBUG_ANY,
"%s: line %d: already set sasl-host!\n",
} else if ( strcasecmp( cargv[0], "sasl-realm" ) == 0 ) {
if ( cargc < 2 ) {
#ifdef NEW_LOGGING
- LDAP_LOG(( "config", LDAP_LEVEL_CRIT,
+ LDAP_LOG( CONFIG, CRIT,
"%s: line %d: missing realm in \"sasl-realm <realm>\" line.\n",
- fname, lineno ));
+ fname, lineno, 0 );
#else
Debug( LDAP_DEBUG_ANY,
"%s: line %d: missing realm in \"sasl-realm <realm>\" line\n",
if ( global_realm != NULL ) {
#ifdef NEW_LOGGING
- LDAP_LOG(( "config", LDAP_LEVEL_CRIT,
+ LDAP_LOG( CONFIG, CRIT,
"%s: line %d: already set sasl-realm!\n",
- fname, lineno ));
+ fname, lineno, 0 );
#else
Debug( LDAP_DEBUG_ANY,
"%s: line %d: already set sasl-realm!\n",
int rc;
if ( cargc != 3 ) {
#ifdef NEW_LOGGING
- LDAP_LOG(( "config", LDAP_LEVEL_CRIT,
+ LDAP_LOG( CONFIG, CRIT,
"%s: line %d: need 2 args in "
"\"saslregexp <match> <replace>\"\n",
- fname, lineno ));
+ fname, lineno, 0 );
#else
Debug( LDAP_DEBUG_ANY,
"%s: line %d: need 2 args in \"saslregexp <match> <replace>\"\n",
if ( cargc < 2 ) {
#ifdef NEW_LOGGING
- LDAP_LOG(( "config", LDAP_LEVEL_CRIT,
+ LDAP_LOG( CONFIG, CRIT,
"%s: line %d: missing flags in "
"\"sasl-secprops <properties>\" line\n",
- fname, lineno ));
+ fname, lineno, 0 );
#else
Debug( LDAP_DEBUG_ANY,
"%s: line %d: missing flags in \"sasl-secprops <properties>\" line\n",
txt = slap_sasl_secprops( cargv[1] );
if ( txt != NULL ) {
#ifdef NEW_LOGGING
- LDAP_LOG(( "config", LDAP_LEVEL_CRIT,
+ LDAP_LOG( CONFIG, CRIT,
"%s: line %d sasl-secprops: %s\n",
- fname, lineno, txt ));
+ fname, lineno, txt );
#else
Debug( LDAP_DEBUG_ANY,
"%s: line %d: sasl-secprops: %s\n",
}
#ifdef NEW_LOGGING
- LDAP_LOG(( "sasl", LDAP_LEVEL_ENTRY,
- "SASL [conn=%ld] %s: %s\n",
- conn ? conn->c_connid : -1,
- label, message ));
+ LDAP_LOG( TRANSPORT, ENTRY,
+ "SASL [conn=%ld] %s: %s\n", conn ? conn->c_connid : -1, label, message);
#else
Debug( level, "SASL [conn=%ld] %s: %s\n",
conn ? conn->c_connid: -1,
struct berval dn2;
#ifdef NEW_LOGGING
- LDAP_LOG(( "sasl", LDAP_LEVEL_ENTRY,
+ LDAP_LOG( TRANSPORT, ENTRY,
"slap_sasl_getdn: conn %d id=%s\n",
- conn ? conn->c_connid : -1,
- id ? (*id ? id : "<empty>") : "NULL" ));
+ conn ? conn->c_connid : -1, id ? (*id ? id : "<empty>") : "NULL", 0 );
#else
Debug( LDAP_DEBUG_ARGS, "slap_sasl_getdn: id=%s\n",
id?(*id?id:"<empty>"):"NULL",0,0 );
/* Build the new dn */
c1 = dn->bv_val;
dn->bv_val = ch_malloc( len+1 );
- p = slap_strcopy( dn->bv_val, "uid=" );
- p = slap_strncopy( p, c1, dn->bv_len );
+ p = lutil_strcopy( dn->bv_val, "uid=" );
+ p = lutil_strncopy( p, c1, dn->bv_len );
if( realm ) {
int rlen = dn->bv_len - ( realm - c1 );
- p = slap_strcopy( p, ",cn=" );
- p = slap_strncopy( p, realm, rlen );
+ p = lutil_strcopy( p, ",cn=" );
+ p = lutil_strncopy( p, realm, rlen );
realm[-1] = '@';
} else if( user_realm && *user_realm ) {
- p = slap_strcopy( p, ",cn=" );
- p = slap_strcopy( p, user_realm );
+ p = lutil_strcopy( p, ",cn=" );
+ p = lutil_strcopy( p, user_realm );
}
if( conn->c_sasl_bind_mech.bv_len ) {
- p = slap_strcopy( p, ",cn=" );
- p = slap_strcopy( p, conn->c_sasl_bind_mech.bv_val );
+ p = lutil_strcopy( p, ",cn=" );
+ p = lutil_strcopy( p, conn->c_sasl_bind_mech.bv_val );
}
- p = slap_strcopy( p, ",cn=auth" );
+ p = lutil_strcopy( p, ",cn=auth" );
dn->bv_len = p - dn->bv_val;
#ifdef NEW_LOGGING
- LDAP_LOG(( "sasl", LDAP_LEVEL_ENTRY,
- "slap_sasl_getdn: u:id converted to %s.\n", dn->bv_val ));
+ LDAP_LOG( TRANSPORT, ENTRY,
+ "slap_sasl_getdn: u:id converted to %s.\n", dn->bv_val, 0, 0 );
#else
Debug( LDAP_DEBUG_TRACE, "getdn: u:id converted to %s\n", dn->bv_val,0,0 );
#endif
ch_free( dn->bv_val );
*dn = dn2;
#ifdef NEW_LOGGING
- LDAP_LOG(( "sasl", LDAP_LEVEL_ENTRY,
- "slap_sasl_getdn: dn:id converted to %s.\n", dn->bv_val ));
+ LDAP_LOG( TRANSPORT, ENTRY,
+ "slap_sasl_getdn: dn:id converted to %s.\n", dn->bv_val, 0, 0 );
#else
Debug( LDAP_DEBUG_TRACE, "getdn: dn:id converted to %s\n",
dn->bv_val, 0, 0 );
rc = slap_str2ad( name, &ad, &text );
if ( rc != LDAP_SUCCESS ) {
#ifdef NEW_LOGGING
- LDAP_LOG(( "sasl", LDAP_LEVEL_DETAIL1,
- "slap_auxprop: str2ad(%s): %s\n", name, text ));
+ LDAP_LOG( TRANSPORT, DETAIL1,
+ "slap_auxprop: str2ad(%s): %s\n", name, text, 0 );
#else
Debug( LDAP_DEBUG_TRACE,
"slap_auxprop: str2ad(%s): %s\n", name, text, 0 );
*out_len = 0;
#ifdef NEW_LOGGING
- LDAP_LOG(( "sasl", LDAP_LEVEL_ENTRY,
+ LDAP_LOG( TRANSPORT, ENTRY,
"slap_sasl_canonicalize: conn %d %s=\"%s\"\n",
- conn ? conn->c_connid : -1,
- (flags & SASL_CU_AUTHID) ? "authcid" : "authzid",
- in ? in : "<empty>" ));
+ conn ? conn->c_connid : -1,
+ (flags & SASL_CU_AUTHID) ? "authcid" : "authzid", in ? in : "<empty>");
#else
Debug( LDAP_DEBUG_ARGS, "SASL Canonicalize [conn=%ld]: "
"%s=\"%s\"\n",
prop_set( props, names[0], (char *)&dn, sizeof( dn ) );
#ifdef NEW_LOGGING
- LDAP_LOG(( "sasl", LDAP_LEVEL_ENTRY,
+ LDAP_LOG( TRANSPORT, ENTRY,
"slap_sasl_canonicalize: conn %d %s=\"%s\"\n",
- conn ? conn->c_connid : -1,
- names[0]+1, dn.bv_val ));
+ conn ? conn->c_connid : -1, names[0]+1, dn.bv_val );
#else
Debug( LDAP_DEBUG_ARGS, "SASL Canonicalize [conn=%ld]: "
"%s=\"%s\"\n",
int rc;
#ifdef NEW_LOGGING
- LDAP_LOG(( "sasl", LDAP_LEVEL_ENTRY,
+ LDAP_LOG( TRANSPORT, ENTRY,
"slap_sasl_authorize: conn %d authcid=\"%s\" authzid=\"%s\"\n",
- conn ? conn->c_connid : -1, auth_identity, requested_user));
+ conn ? conn->c_connid : -1, auth_identity, requested_user);
#else
Debug( LDAP_DEBUG_ARGS, "SASL Authorize [conn=%ld]: "
"authcid=\"%s\" authzid=\"%s\"\n",
AC_MEMCPY( &authzDN, auxvals[1].values[0], sizeof(authzDN) );
- rc = slap_sasl_authorized( &authcDN, &authzDN );
+ rc = slap_sasl_authorized( conn, &authcDN, &authzDN );
ch_free( authcDN.bv_val );
if ( rc != LDAP_SUCCESS ) {
#ifdef NEW_LOGGING
- LDAP_LOG(( "sasl", LDAP_LEVEL_INFO,
- "slap_sasl_authorize: conn %ld authorization disallowed (%d)\n",
- (long)(conn ? conn->c_connid : -1), rc ));
+ LDAP_LOG( TRANSPORT, INFO,
+ "slap_sasl_authorize: conn %ld authorization disallowed (%d)\n",
+ (long)(conn ? conn->c_connid : -1), rc, 0 );
#else
Debug( LDAP_DEBUG_TRACE, "SASL Authorize [conn=%ld]: "
" authorization disallowed (%d)\n",
conn->c_sasl_dn = authzDN;
#ifdef NEW_LOGGING
- LDAP_LOG(( "sasl", LDAP_LEVEL_ENTRY,
- "slap_sasl_authorize: conn %d authorization allowed\n",
- (long)(conn ? conn->c_connid : -1 ) ));
+ LDAP_LOG( TRANSPORT, ENTRY,
+ "slap_sasl_authorize: conn %d authorization allowed\n",
+ (long)(conn ? conn->c_connid : -1), 0, 0 );
#else
Debug( LDAP_DEBUG_TRACE, "SASL Authorize [conn=%ld]: "
" authorization allowed\n",
}
#ifdef NEW_LOGGING
- LDAP_LOG(( "sasl", LDAP_LEVEL_ENTRY,
- "slap_sasl_authorize: conn %d authcid=\"%s\" authzid=\"%s\"\n",
- conn ? conn->c_connid : -1,
- authcid ? authcid : "<empty>",
- authzid ? authzid : "<empty>" ));
+ LDAP_LOG( TRANSPORT, ENTRY,
+ "slap_sasl_authorize: conn %d authcid=\"%s\" authzid=\"%s\"\n",
+ conn ? conn->c_connid : -1, authcid ? authcid : "<empty>",
+ authzid ? authzid : "<empty>" );
#else
Debug( LDAP_DEBUG_ARGS, "SASL Authorize [conn=%ld]: "
"authcid=\"%s\" authzid=\"%s\"\n",
rc = sasl_getprop( conn->c_sasl_context, SASL_REALM, (void **)&realm );
if( rc != SASL_OK && rc != SASL_NOTDONE ) {
#ifdef NEW_LOGGING
- LDAP_LOG(( "sasl", LDAP_LEVEL_ERR,
- "slap_sasl_authorize: getprop(REALM) failed.\n" ));
+ LDAP_LOG( TRANSPORT, ERR,
+ "slap_sasl_authorize: getprop(REALM) failed.\n", 0, 0, 0 );
#else
Debug(LDAP_DEBUG_TRACE,
"authorize: getprop(REALM) failed!\n", 0,0,0);
}
if( ( authzid == NULL ) || !strcmp( authcid,authzid ) ) {
#ifdef NEW_LOGGING
- LDAP_LOG(( "sasl", LDAP_LEVEL_ENTRY,
- "slap_sasl_authorize: conn %d Using authcDN=%s\n",
- conn ? conn->c_connid : -1, authcDN.bv_val ));
+ LDAP_LOG( TRANSPORT, ENTRY,
+ "slap_sasl_authorize: conn %d Using authcDN=%s\n",
+ conn ? conn->c_connid : -1, authcDN.bv_val, 0 );
#else
Debug( LDAP_DEBUG_TRACE, "SASL Authorize [conn=%ld]: "
"Using authcDN=%s\n", (long) (conn ? conn->c_connid : -1), authcDN.bv_val,0 );
return SASL_NOAUTHZ;
}
- rc = slap_sasl_authorized( &authcDN, &authzDN );
+ rc = slap_sasl_authorized(conn, &authcDN, &authzDN );
ch_free( authcDN.bv_val );
if( rc ) {
#ifdef NEW_LOGGING
- LDAP_LOG(( "sasl", LDAP_LEVEL_INFO,
- "slap_sasl_authorize: conn %ld authorization disallowed (%d)\n",
- (long)(conn ? conn->c_connid : -1), rc ));
+ LDAP_LOG( TRANSPORT, INFO,
+ "slap_sasl_authorize: conn %ld authorization disallowed (%d)\n",
+ (long)(conn ? conn->c_connid : -1), rc, 0 );
#else
Debug( LDAP_DEBUG_TRACE, "SASL Authorize [conn=%ld]: "
" authorization disallowed (%d)\n",
}
#ifdef NEW_LOGGING
- LDAP_LOG(( "sasl", LDAP_LEVEL_ENTRY,
- "slap_sasl_authorize: conn %d authorization allowed\n",
- (long)(conn ? conn->c_connid : -1 ) ));
+ LDAP_LOG( TRANSPORT, RESULTS,
+ "slap_sasl_authorize: conn %d authorization allowed\n",
+ (long)(conn ? conn->c_connid : -1 ), 0, 0 );
#else
Debug( LDAP_DEBUG_TRACE, "SASL Authorize [conn=%ld]: "
" authorization allowed\n",
if( rc != SASL_OK ) {
#ifdef NEW_LOGGING
- LDAP_LOG(( "sasl", LDAP_LEVEL_INFO,
- "slap_sasl_init: init failed.\n" ));
+ LDAP_LOG( TRANSPORT, INFO, "slap_sasl_init: init failed.\n", 0, 0, 0 );
#else
Debug( LDAP_DEBUG_ANY, "sasl_server_init failed\n",
0, 0, 0 );
}
#ifdef NEW_LOGGING
- LDAP_LOG(( "sasl", LDAP_LEVEL_INFO,
- "slap_sasl_init: initialized!\n"));
+ LDAP_LOG( TRANSPORT, INFO, "slap_sasl_init: initialized!\n", 0, 0, 0 );
#else
Debug( LDAP_DEBUG_TRACE, "slap_sasl_init: initialized!\n",
0, 0, 0 );
if( sc != SASL_OK ) {
#ifdef NEW_LOGGING
- LDAP_LOG(( "sasl", LDAP_LEVEL_ERR,
- "slap_sasl_open: sasl_server_new failed: %d\n", sc ));
+ LDAP_LOG( TRANSPORT, ERR,
+ "slap_sasl_open: sasl_server_new failed: %d\n", sc, 0, 0 );
#else
Debug( LDAP_DEBUG_ANY, "sasl_server_new failed: %d\n",
sc, 0, 0 );
if( sc != SASL_OK ) {
#ifdef NEW_LOGGING
- LDAP_LOG(( "sasl", LDAP_LEVEL_ERR,
- "slap_sasl_open: sasl_setprop failed: %d \n", sc ));
+ LDAP_LOG( TRANSPORT, ERR,
+ "slap_sasl_open: sasl_setprop failed: %d \n", sc, 0, 0 );
#else
Debug( LDAP_DEBUG_ANY, "sasl_setprop failed: %d\n",
sc, 0, 0 );
if( sc != SASL_OK ) {
#ifdef NEW_LOGGING
- LDAP_LOG(( "sasl", LDAP_LEVEL_ERR,
- "slap_sasl_mechs: sasl_listmech failed: %d\n", sc ));
+ LDAP_LOG( TRANSPORT, ERR,
+ "slap_sasl_mechs: sasl_listmech failed: %d\n", sc, 0, 0 );
#else
Debug( LDAP_DEBUG_ANY, "slap_sasl_listmech failed: %d\n",
sc, 0, 0 );
int sc;
#ifdef NEW_LOGGING
- LDAP_LOG(( "sasl", LDAP_LEVEL_ENTRY,
- "sasl_bind: conn %ld dn=\"%s\" mech=%s datalen=%ld\n",
- conn->c_connid,
+ LDAP_LOG( TRANSPORT, ENTRY,
+ "sasl_bind: dn=\"%s\" mech=%s datalen=%ld\n",
dn->bv_len ? dn->bv_val : "",
- conn->c_sasl_bind_in_progress ? "<continuing>" : conn->c_sasl_bind_mech.bv_val,
- cred ? cred->bv_len : 0 ));
+ conn->c_sasl_bind_in_progress ? "<continuing>" :
+ conn->c_sasl_bind_mech.bv_val,
+ cred ? cred->bv_len : 0 );
#else
Debug(LDAP_DEBUG_ARGS,
"==> sasl_bind: dn=\"%s\" mech=%s datalen=%ld\n",
#endif
#ifdef NEW_LOGGING
- LDAP_LOG(( "sasl", LDAP_LEVEL_ENTRY,
- "slap_sasl_bind: rc=%d\n", rc ));
+ LDAP_LOG( TRANSPORT, RESULTS, "slap_sasl_bind: rc=%d\n", rc, 0, 0 );
#else
Debug(LDAP_DEBUG_TRACE, "<== slap_sasl_bind: rc=%d\n", rc, 0, 0);
#endif
}
#ifdef NEW_LOGGING
- LDAP_LOG(( "backend", LDAP_LEVEL_ENTRY,
+ LDAP_LOG( BACKEND, ENTRY,
"slap_sasl_setpass: \"%s\"\n",
- id.bv_val ? id.bv_val : "" ));
+ id.bv_val ? id.bv_val : "", 0, 0);
#else
- Debug( LDAP_DEBUG_ARGS, "==> ldbm_back_exop_passwd: \"%s\"\n",
+ Debug( LDAP_DEBUG_ARGS, "==> slap_sasl_setpass: \"%s\"\n",
id.bv_val ? id.bv_val : "", 0, 0 );
#endif
id.bv_val, new.bv_val, new.bv_len, 0, text );
#else
rc = sasl_setpass( conn->c_sasl_context, id.bv_val,
- old.bv_val, old.bv_len, new.bv_val, new.bv_len, 0 );
+ new.bv_val, new.bv_len, old.bv_val, old.bv_len, 0 );
if( rc != SASL_OK ) {
*text = sasl_errdetail( conn->c_sasl_context );
}
+/*
+ * Copyright 1998-2002 The OpenLDAP Foundation, All Rights Reserved.
+ * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
+ */
/*
* Copyright (c) 2000, Mark Adamson, Carnegie Mellon. All rights reserved.
* This software is not subject to any license of Carnegie Mellon University.
}
#ifdef NEW_LOGGING
- LDAP_LOG(( "sasl", LDAP_LEVEL_ENTRY,
- "slap_parseURI: parsing %s\n", uri->bv_val ));
+ LDAP_LOG( TRANSPORT, ENTRY,
+ "slap_parseURI: parsing %s\n", uri->bv_val, 0, 0 );
#else
Debug( LDAP_DEBUG_TRACE, "slap_parseURI: parsing %s\n", uri->bv_val, 0, 0 );
#endif
if ( *c == '$' ) {
if ( n == SASLREGEX_REPLACE ) {
#ifdef NEW_LOGGING
- LDAP_LOG(( "sasl", LDAP_LEVEL_ERR,
+ LDAP_LOG( TRANSPORT, ERR,
"slap_sasl_regexp_config: \"%s\" has too many $n "
- "placeholders (max %d)\n",
- rep, SASLREGEX_REPLACE ));
+ "placeholders (max %d)\n", rep, SASLREGEX_REPLACE, 0 );
#else
Debug( LDAP_DEBUG_ANY,
"SASL replace pattern %s has too many $n "
off[n] = -1;
return( LDAP_SUCCESS );
}
-#endif /* HAVE_CYRUS_SASL */
int slap_sasl_regexp_config( const char *match, const char *replace )
{
-#ifdef HAVE_CYRUS_SASL
const char *c;
int rc, n;
SaslRegexp_t *reg;
rc = dnNormalize2( NULL, &bv, &nbv );
if ( rc ) {
#ifdef NEW_LOGGING
- LDAP_LOG(( "sasl", LDAP_LEVEL_ERR,
- "slap_sasl_regexp_config: \"%s\" could not be normalized.\n",
- match ));
+ LDAP_LOG( TRANSPORT, ERR,
+ "slap_sasl_regexp_config: \"%s\" could not be normalized.\n",
+ match, 0, 0 );
#else
Debug( LDAP_DEBUG_ANY,
"SASL match pattern %s could not be normalized.\n",
if ( filter ) filter_free( filter );
if ( rc ) {
#ifdef NEW_LOGGING
- LDAP_LOG(( "sasl", LDAP_LEVEL_ERR,
- "slap_sasl_regexp_config: \"%s\" could not be parsed.\n",
- replace ));
+ LDAP_LOG( TRANSPORT, ERR,
+ "slap_sasl_regexp_config: \"%s\" could not be parsed.\n",
+ replace, 0, 0 );
#else
Debug( LDAP_DEBUG_ANY,
"SASL replace pattern %s could not be parsed.\n",
rc = regcomp( ®->sr_workspace, reg->sr_match, REG_EXTENDED|REG_ICASE );
if ( rc ) {
#ifdef NEW_LOGGING
- LDAP_LOG(( "sasl", LDAP_LEVEL_ERR,
- "slap_sasl_regexp_config: \"%s\" could not be compiled.\n",
- reg->sr_match ));
+ LDAP_LOG( TRANSPORT, ERR,
+ "slap_sasl_regexp_config: \"%s\" could not be compiled.\n",
+ reg->sr_match, 0, 0 );
#else
Debug( LDAP_DEBUG_ANY,
"SASL match pattern %s could not be compiled by regexp engine\n",
}
nSaslRegexp++;
-#endif
return( LDAP_SUCCESS );
}
-#ifdef HAVE_CYRUS_SASL
-
/* Perform replacement on regexp matches */
static void slap_sasl_rx_exp( char *rep, int *off, regmatch_t *str,
char *saslname, struct berval *out )
memset( out, 0, sizeof( *out ) );
#ifdef NEW_LOGGING
- LDAP_LOG(( "sasl", LDAP_LEVEL_ENTRY,
- "slap_sasl_regexp: converting SASL name %s\n", saslname ));
+ LDAP_LOG( TRANSPORT, ENTRY,
+ "slap_sasl_regexp: converting SASL name %s\n", saslname, 0, 0 );
#else
Debug( LDAP_DEBUG_TRACE, "slap_sasl_regexp: converting SASL name %s\n",
saslname, 0, 0 );
out->scope = reg->sr_replace.scope;
#ifdef NEW_LOGGING
- LDAP_LOG(( "sasl", LDAP_LEVEL_ENTRY,
+ LDAP_LOG( TRANSPORT, ENTRY,
"slap_sasl_regexp: converted SASL name to ldap:///%s??%s?%s\n",
out->dn.bv_val, scope[out->scope], out->filter.bv_val ?
- out->filter.bv_val : "" ));
+ out->filter.bv_val : "" );
#else
Debug( LDAP_DEBUG_TRACE,
"slap_sasl_regexp: converted SASL name to ldap:///%s??%s?%s\n",
ndn->bv_val = NULL;
#ifdef NEW_LOGGING
- LDAP_LOG(( "sasl", LDAP_LEVEL_DETAIL1,
- "slap_sasl2dn: search DN returned more than 1 entry\n" ));
+ LDAP_LOG( TRANSPORT, DETAIL1,
+ "slap_sasl2dn: search DN returned more than 1 entry\n", 0, 0, 0 );
#else
Debug( LDAP_DEBUG_TRACE,
"slap_sasl2dn: search DN returned more than 1 entry\n", 0,0,0 );
SaslUri_t uri;
#ifdef NEW_LOGGING
- LDAP_LOG(( "sasl", LDAP_LEVEL_ENTRY,
- "slap_sasl2dn: converting SASL name %s to DN.\n", saslname->bv_val ));
+ LDAP_LOG( TRANSPORT, ENTRY,
+ "slap_sasl2dn: converting SASL name %s to DN.\n", saslname->bv_val, 0, 0 );
#else
Debug( LDAP_DEBUG_TRACE, "==>slap_sasl2dn: "
"converting SASL name %s to a DN\n", saslname->bv_val, 0,0 );
}
#ifdef NEW_LOGGING
- LDAP_LOG(( "sasl", LDAP_LEVEL_DETAIL1,
+ LDAP_LOG( TRANSPORT, DETAIL1,
"slap_sasl2dn: performing internal search (base=%s, scope=%d)\n",
- uri.dn.bv_val, uri.scope ));
+ uri.dn.bv_val, uri.scope, 0 );
#else
Debug( LDAP_DEBUG_TRACE,
"slap_sasl2dn: performing internal search (base=%s, scope=%d)\n",
op.o_ndn = *saslname;
op.o_callback = &cb;
op.o_time = slap_get_time();
+ op.o_do_not_cache = 1;
- (*be->be_search)( be, NULL, &op, NULL, &uri.dn,
+ (*be->be_search)( be, conn, &op, NULL, &uri.dn,
uri.scope, LDAP_DEREF_NEVER, 1, 0,
filter, NULL, NULL, 1 );
+FINISHED:
if( dn->bv_len ) {
conn->c_authz_backend = be;
}
-
-FINISHED:
if( uri.dn.bv_len ) ch_free( uri.dn.bv_val );
if( uri.filter.bv_len ) ch_free( uri.filter.bv_val );
if( filter ) filter_free( filter );
#ifdef NEW_LOGGING
- LDAP_LOG(( "sasl", LDAP_LEVEL_ENTRY,
+ LDAP_LOG( TRANSPORT, ENTRY,
"slap_sasl2dn: Converted SASL name to %s\n",
- dn->bv_len ? dn->bv_val : "<nothing>" ));
+ dn->bv_len ? dn->bv_val : "<nothing>", 0, 0 );
#else
Debug( LDAP_DEBUG_TRACE, "<==slap_sasl2dn: Converted SASL name to %s\n",
dn->bv_len ? dn->bv_val : "<nothing>", 0, 0 );
*/
static
-int slap_sasl_match( struct berval *rule, struct berval *assertDN, struct berval *authc )
+int slap_sasl_match(Connection *conn, struct berval *rule, struct berval *assertDN, struct berval *authc )
{
struct berval searchbase = {0, NULL};
int rc, scope;
Operation op = {0};
#ifdef NEW_LOGGING
- LDAP_LOG(( "sasl", LDAP_LEVEL_ENTRY,
- "slap_sasl_match: comparing DN %s to rule %s\n", assertDN->bv_val, rule->bv_val ));
+ LDAP_LOG( TRANSPORT, ENTRY,
+ "slap_sasl_match: comparing DN %s to rule %s\n",
+ assertDN->bv_val, rule->bv_val,0 );
#else
Debug( LDAP_DEBUG_TRACE,
"===>slap_sasl_match: comparing DN %s to rule %s\n", assertDN->bv_val, rule->bv_val, 0 );
/* Must run an internal search. */
#ifdef NEW_LOGGING
- LDAP_LOG(( "sasl", LDAP_LEVEL_DETAIL1,
+ LDAP_LOG( TRANSPORT, DETAIL1,
"slap_sasl_match: performing internal search (base=%s, scope=%d)\n",
- searchbase.bv_val, scope ));
+ searchbase.bv_val, scope,0 );
#else
Debug( LDAP_DEBUG_TRACE,
"slap_sasl_match: performing internal search (base=%s, scope=%d)\n",
op.o_ndn = *authc;
op.o_callback = &cb;
op.o_time = slap_get_time();
+ op.o_do_not_cache = 1;
- (*be->be_search)( be, /*conn=*/NULL, &op, /*base=*/NULL, &searchbase,
+ (*be->be_search)( be, conn, &op, /*base=*/NULL, &searchbase,
scope, /*deref=*/1, /*sizelimit=*/0, /*time=*/0, filter, /*fstr=*/NULL,
/*attrs=*/NULL, /*attrsonly=*/0 );
if( searchbase.bv_len ) ch_free( searchbase.bv_val );
if( filter ) filter_free( filter );
#ifdef NEW_LOGGING
- LDAP_LOG(( "sasl", LDAP_LEVEL_ENTRY,
- "slap_sasl_match: comparison returned %d\n", rc ));
+ LDAP_LOG( TRANSPORT, ENTRY,
+ "slap_sasl_match: comparison returned %d\n", rc, 0, 0 );
#else
Debug( LDAP_DEBUG_TRACE,
"<===slap_sasl_match: comparison returned %d\n", rc, 0, 0);
* The DNs should not have the dn: prefix
*/
static int
-slap_sasl_check_authz(struct berval *searchDN, struct berval *assertDN, AttributeDescription *ad, struct berval *authc)
+slap_sasl_check_authz( Connection *conn,
+ struct berval *searchDN,
+ struct berval *assertDN,
+ AttributeDescription *ad,
+ struct berval *authc )
{
int i, rc;
BerVarray vals=NULL;
#ifdef NEW_LOGGING
- LDAP_LOG(( "sasl", LDAP_LEVEL_ENTRY,
+ LDAP_LOG( TRANSPORT, ENTRY,
"slap_sasl_check_authz: does %s match %s rule in %s?\n",
- assertDN->bv_val, ad->ad_cname.bv_val, searchDN->bv_val ));
+ assertDN->bv_val, ad->ad_cname.bv_val, searchDN->bv_val);
#else
Debug( LDAP_DEBUG_TRACE,
"==>slap_sasl_check_authz: does %s match %s rule in %s?\n",
/* Check if the *assertDN matches any **vals */
for( i=0; vals[i].bv_val != NULL; i++ ) {
- rc = slap_sasl_match( &vals[i], assertDN, authc );
+ rc = slap_sasl_match( conn, &vals[i], assertDN, authc );
if ( rc == LDAP_SUCCESS )
goto COMPLETE;
}
if( vals ) ber_bvarray_free( vals );
#ifdef NEW_LOGGING
- LDAP_LOG(( "sasl", LDAP_LEVEL_ENTRY,
- "slap_sasl_check_authz: %s check returning %s\n", ad->ad_cname.bv_val, rc ));
+ LDAP_LOG( TRANSPORT, RESULTS,
+ "slap_sasl_check_authz: %s check returning %s\n",
+ ad->ad_cname.bv_val, rc, 0 );
#else
Debug( LDAP_DEBUG_TRACE,
"<==slap_sasl_check_authz: %s check returning %d\n", ad->ad_cname.bv_val, rc, 0);
* The DNs should not have the dn: prefix
*/
-int slap_sasl_authorized( struct berval *authcDN, struct berval *authzDN )
+int slap_sasl_authorized( Connection *conn,
+ struct berval *authcDN, struct berval *authzDN )
{
int rc = LDAP_INAPPROPRIATE_AUTH;
}
#ifdef NEW_LOGGING
- LDAP_LOG(( "sasl", LDAP_LEVEL_ENTRY,
- "slap_sasl_authorized: can %s become %s?\n", authcDN->bv_val, authzDN->bv_val ));
+ LDAP_LOG( TRANSPORT, ENTRY,
+ "slap_sasl_authorized: can %s become %s?\n",
+ authcDN->bv_val, authzDN->bv_val, 0 );
#else
Debug( LDAP_DEBUG_TRACE,
"==>slap_sasl_authorized: can %s become %s?\n", authcDN->bv_val, authzDN->bv_val, 0 );
/* Check source rules */
if( authz_policy & SASL_AUTHZ_TO ) {
- rc = slap_sasl_check_authz( authcDN, authzDN,
+ rc = slap_sasl_check_authz( conn, authcDN, authzDN,
slap_schema.si_ad_saslAuthzTo, authcDN );
if( rc == LDAP_SUCCESS ) {
goto DONE;
/* Check destination rules */
if( authz_policy & SASL_AUTHZ_FROM ) {
- rc = slap_sasl_check_authz( authzDN, authcDN,
+ rc = slap_sasl_check_authz( conn, authzDN, authcDN,
slap_schema.si_ad_saslAuthzFrom, authcDN );
if( rc == LDAP_SUCCESS ) {
goto DONE;
#endif
#ifdef NEW_LOGGING
- LDAP_LOG(( "sasl", LDAP_LEVEL_ENTRY,
- "slap_sasl_authorized: return %d\n", rc ));
+ LDAP_LOG( TRANSPORT, RESULTS, "slap_sasl_authorized: return %d\n", rc,0,0 );
#else
Debug( LDAP_DEBUG_TRACE,
"<== slap_sasl_authorized: return %d\n", rc, 0, 0 );
type );
#ifdef NEW_LOGGING
- LDAP_LOG(( "schema", LDAP_LEVEL_INFO,
- "entry_schema_check: dn=\"%s\" %s\n",
- e->e_dn, textbuf ));
+ LDAP_LOG( OPERATION, INFO,
+ "entry_schema_check: dn=\"%s\" %s\n", e->e_dn, textbuf, 0 );
#else
Debug( LDAP_DEBUG_ANY,
"Entry (%s), %s\n",
asc = attr_find( e->e_attrs, ad_structuralObjectClass );
if ( asc == NULL ) {
#ifdef NEW_LOGGING
- LDAP_LOG(( "schema", LDAP_LEVEL_INFO, "entry_schema_check: "
- "No structuralObjectClass for entry (%s)\n",
- e->e_dn ));
+ LDAP_LOG( OPERATION, INFO,
+ "entry_schema_check: No structuralObjectClass for entry (%s)\n",
+ e->e_dn, 0, 0 );
#else
Debug( LDAP_DEBUG_ANY,
"No structuralObjectClass for entry (%s)\n",
asc->a_vals[0].bv_val );
#ifdef NEW_LOGGING
- LDAP_LOG(( "schema", LDAP_LEVEL_INFO,
- "entry_schema_check: dn (%s), %s\n",
- e->e_dn, textbuf ));
+ LDAP_LOG( OPERATION, INFO,
+ "entry_schema_check: dn (%s), %s\n", e->e_dn, textbuf, 0 );
#else
Debug( LDAP_DEBUG_ANY,
"entry_check_schema(%s): %s\n",
asc->a_vals[0].bv_val );
#ifdef NEW_LOGGING
- LDAP_LOG(( "schema", LDAP_LEVEL_INFO,
- "entry_schema_check: dn (%s), %s\n",
- e->e_dn, textbuf ));
+ LDAP_LOG( OPERATION, INFO,
+ "entry_schema_check: dn (%s), %s\n", e->e_dn, textbuf, 0 );
#else
Debug( LDAP_DEBUG_ANY,
"entry_check_schema(%s): %s\n",
aoc = attr_find( e->e_attrs, ad_objectClass );
if ( aoc == NULL ) {
#ifdef NEW_LOGGING
- LDAP_LOG(( "schema", LDAP_LEVEL_INFO,
- "entry_schema_check: No objectClass for entry (%s).\n",
- e->e_dn ));
+ LDAP_LOG( OPERATION, INFO,
+ "entry_schema_check: No objectClass for entry (%s).\n",
+ e->e_dn, 0, 0 );
#else
Debug( LDAP_DEBUG_ANY, "No objectClass for entry (%s)\n",
e->e_dn, 0, 0 );
aoc->a_vals[i].bv_val );
#ifdef NEW_LOGGING
- LDAP_LOG(( "schema", LDAP_LEVEL_INFO,
- "entry_schema_check: dn (%s), %s\n",
- e->e_dn, textbuf ));
+ LDAP_LOG( OPERATION, INFO,
+ "entry_schema_check: dn (%s), %s\n", e->e_dn, textbuf, 0 );
#else
Debug( LDAP_DEBUG_ANY,
"entry_check_schema(%s): %s\n",
aoc->a_vals[i].bv_val );
#ifdef NEW_LOGGING
- LDAP_LOG(( "schema", LDAP_LEVEL_INFO,
+ LDAP_LOG( OPERATION, INFO,
"entry_schema_check: dn (%s), %s\n",
- e->e_dn, textbuf ));
+ e->e_dn, textbuf, 0 );
#else
Debug( LDAP_DEBUG_ANY,
"entry_check_schema(%s): %s\n",
aoc->a_vals[i].bv_val );
#ifdef NEW_LOGGING
- LDAP_LOG(( "schema", LDAP_LEVEL_INFO,
- "entry_schema_check: dn (%s), %s\n",
- e->e_dn, textbuf ));
+ LDAP_LOG( OPERATION, INFO,
+ "entry_schema_check: dn (%s), %s\n",
+ e->e_dn, textbuf, 0 );
#else
Debug( LDAP_DEBUG_ANY,
"entry_check_schema(%s): %s\n",
aoc->a_vals[i].bv_val, s );
#ifdef NEW_LOGGING
- LDAP_LOG(( "schema", LDAP_LEVEL_INFO,
- "entry_schema_check: dn=\"%s\" %s",
- e->e_dn, textbuf ));
+ LDAP_LOG( OPERATION, INFO,
+ "entry_schema_check: dn=\"%s\" %s", e->e_dn, textbuf, 0 );
#else
Debug( LDAP_DEBUG_ANY,
"Entry (%s): %s\n",
type );
#ifdef NEW_LOGGING
- LDAP_LOG(( "schema", LDAP_LEVEL_INFO,
- "entry_schema_check: dn=\"%s\" %s\n",
- e->e_dn, textbuf ));
+ LDAP_LOG( OPERATION, INFO,
+ "entry_schema_check: dn=\"%s\" %s\n", e->e_dn, textbuf, 0);
#else
Debug( LDAP_DEBUG_ANY,
"Entry (%s), %s\n",
Attribute *a;
#ifdef NEW_LOGGING
- LDAP_LOG(( "schema", LDAP_LEVEL_ENTRY,
- "oc_check_required: dn (%s), objectClass \"%s\"\n",
- e->e_dn, ocname->bv_val ));
+ LDAP_LOG( OPERATION, ENTRY,
+ "oc_check_required: dn (%s), objectClass \"%s\"\n",
+ e->e_dn, ocname->bv_val, 0 );
#else
Debug( LDAP_DEBUG_TRACE,
"oc_check_required entry (%s), objectClass \"%s\"\n",
int i, j;
#ifdef NEW_LOGGING
- LDAP_LOG(( "schema", LDAP_LEVEL_ENTRY,
- "oc_check_allowed: type \"%s\"\n", at->sat_cname.bv_val ));
+ LDAP_LOG( OPERATION, ENTRY,
+ "oc_check_allowed: type \"%s\"\n", at->sat_cname.bv_val, 0, 0 );
#else
Debug( LDAP_DEBUG_TRACE,
"oc_check_allowed type \"%s\"\n",
}
#ifdef NEW_LOGGING
- LDAP_LOG(( "schema", LDAP_LEVEL_ENTRY,
- "objectIdentifierFirstComponentMatch: %d\n %s\n %s\n",
- match, value->bv_val, asserted->bv_val ));
+ LDAP_LOG( CONFIG, ENTRY,
+ "objectIdentifierFirstComponentMatch: %d\n %s\n %s\n",
+ match, value->bv_val, asserted->bv_val );
#else
Debug( LDAP_DEBUG_ARGS, "objectIdentifierFirstComponentMatch "
"%d\n\t\"%s\"\n\t\"%s\"\n",
xcert = d2i_X509(NULL, &p, in->bv_len);
if ( !xcert ) {
#ifdef NEW_LOGGING
- LDAP_LOG(( "schema", LDAP_LEVEL_ENTRY,
- "certificateExactConvert: error parsing cert: %s\n",
- ERR_error_string(ERR_get_error(),NULL)));
+ LDAP_LOG( CONFIG, ENTRY,
+ "certificateExactConvert: error parsing cert: %s\n",
+ ERR_error_string(ERR_get_error(),NULL), 0, 0 );
#else
Debug( LDAP_DEBUG_ARGS, "certificateExactConvert: "
"error parsing cert: %s\n",
*p++ = '\0';
#ifdef NEW_LOGGING
- LDAP_LOG(( "schema", LDAP_LEVEL_ENTRY,
- "certificateExactConvert: \n %s\n",
- out->bv_val));
+ LDAP_LOG( CONFIG, ARGS,
+ "certificateExactConvert: \n %s\n", out->bv_val, 0, 0 );
#else
Debug( LDAP_DEBUG_ARGS, "certificateExactConvert "
"\n\t\"%s\"\n",
xcert = d2i_X509(NULL, &p, value->bv_len);
if ( !xcert ) {
#ifdef NEW_LOGGING
- LDAP_LOG(( "schema", LDAP_LEVEL_ENTRY,
- "certificateExactMatch: error parsing cert: %s\n",
- ERR_error_string(ERR_get_error(),NULL)));
+ LDAP_LOG( CONFIG, ENTRY,
+ "certificateExactMatch: error parsing cert: %s\n",
+ ERR_error_string(ERR_get_error(),NULL), 0, 0 );
#else
Debug( LDAP_DEBUG_ARGS, "certificateExactMatch: "
"error parsing cert: %s\n",
}
#ifdef NEW_LOGGING
- LDAP_LOG(( "schema", LDAP_LEVEL_ENTRY,
- "certificateExactMatch: %d\n %s $ %s\n %s $ %s\n",
- *matchp, serial.bv_val, issuer_dn.bv_val,
- asserted_serial.bv_val, asserted_issuer_dn.bv_val));
+ LDAP_LOG( CONFIG, ARGS, "certificateExactMatch "
+ "%d\n\t\"%s $ %s\"\n",
+ *matchp, serial.bv_val, issuer_dn.bv_val );
+ LDAP_LOG( CONFIG, ARGS, "\t\"%s $ %s\"\n",
+ asserted_serial.bv_val, asserted_issuer_dn.bv_val,
+ 0 );
#else
Debug( LDAP_DEBUG_ARGS, "certificateExactMatch "
"%d\n\t\"%s $ %s\"\n",
xcert = d2i_X509(NULL, &p, values[i].bv_len);
if ( !xcert ) {
#ifdef NEW_LOGGING
- LDAP_LOG(( "schema", LDAP_LEVEL_ENTRY,
- "certificateExactIndexer: error parsing cert: %s\n",
- ERR_error_string(ERR_get_error(),NULL)));
+ LDAP_LOG( CONFIG, ENTRY,
+ "certificateExactIndexer: error parsing cert: %s\n",
+ ERR_error_string(ERR_get_error(),NULL), 0, 0);
#else
Debug( LDAP_DEBUG_ARGS, "certificateExactIndexer: "
"error parsing cert: %s\n",
&keys[i] );
ber_memfree(serial.bv_val);
#ifdef NEW_LOGGING
- LDAP_LOG(( "schema", LDAP_LEVEL_ENTRY,
- "certificateExactIndexer: returning: %s\n",
- keys[i].bv_val));
+ LDAP_LOG( CONFIG, ENTRY,
+ "certificateExactIndexer: returning: %s\n", keys[i].bv_val, 0, 0);
#else
Debug( LDAP_DEBUG_ARGS, "certificateExactIndexer: "
"returning: %s\n",
return LDAP_INVALID_SYNTAX;
}
- } else if ( !ATTR_CHAR( *p ) ) {
+ } else if ( !AD_CHAR( *p ) ) {
return LDAP_INVALID_SYNTAX;
}
}
/* key */
for (; ( p < e ) && ( *p != '=' ); p++ ) {
- if ( !ATTR_CHAR( *p ) ) {
+ if ( !AD_CHAR( *p ) ) {
return LDAP_INVALID_SYNTAX;
}
}
/* server */
for ( p++; ( p < e ) && ( *p != ':' ); p++ ) {
- if ( !ATTR_CHAR( *p ) ) {
+ if ( !AD_CHAR( *p ) ) {
return LDAP_INVALID_SYNTAX;
}
}
/* path */
for ( p++; p < e; p++ ) {
- if ( !ATTR_CHAR( *p ) ) {
+ if ( !SLAP_PRINTABLE( *p ) ) {
return LDAP_INVALID_SYNTAX;
}
}
slap_schema_init( void )
{
int res;
- int i;
+ int i = 0;
/* we should only be called once (from main) */
assert( schema_init_done == 0 );
#if 1
#ifdef NEW_LOGGING
- LDAP_LOG(( "schema", LDAP_LEVEL_ENTRY,
- "> objectClassMatch(%s, %s)\n",
- value->bv_val, a->bv_val ));
+ LDAP_LOG( CONFIG, ENTRY,
+ "> objectClassMatch(%s, %s)\n", value->bv_val, a->bv_val, 0 );
#else
Debug( LDAP_DEBUG_TRACE, "> objectClassMatch(%s,%s)\n",
value->bv_val, a->bv_val, 0 );
#if 1
#ifdef NEW_LOGGING
- LDAP_LOG(( "schema", LDAP_LEVEL_ENTRY,
- "< objectClassMatch(%s, %s) = %d\n",
- value->bv_val, a->bv_val, *matchp ));
+ LDAP_LOG( CONFIG, ENTRY,
+ "< objectClassMatch(%s, %s) = %d\n",
+ value->bv_val, a->bv_val, *matchp );
#else
Debug( LDAP_DEBUG_TRACE, "< objectClassMatch(%s,%s) = %d\n",
value->bv_val, a->bv_val, *matchp );
#if 1
#ifdef NEW_LOGGING
- LDAP_LOG(( "schema", LDAP_LEVEL_ENTRY,
- "> structuralObjectClassMatch(%s, %s)\n",
- value->bv_val, a->bv_val ));
+ LDAP_LOG( CONFIG, ENTRY,
+ "> structuralObjectClassMatch(%s, %s)\n", value->bv_val, a->bv_val, 0 );
#else
Debug( LDAP_DEBUG_TRACE, "> structuralObjectClassMatch(%s,%s)\n",
value->bv_val, a->bv_val, 0 );
#if 1
#ifdef NEW_LOGGING
- LDAP_LOG(( "schema", LDAP_LEVEL_ENTRY,
- "< structuralObjectClassMatch( %s, %s ) = %d\n",
- value->bv_val, a->bv_val, *matchp ));
+ LDAP_LOG( CONFIG, ENTRY,
+ "< structuralObjectClassMatch( %s, %s ) = %d\n",
+ value->bv_val, a->bv_val, *matchp );
#else
Debug( LDAP_DEBUG_TRACE, "< structuralObjectClassMatch(%s,%s) = %d\n",
value->bv_val, a->bv_val, *matchp );
"Success",
"Out of memory",
"ObjectClass not found",
- "ObjectClass inappropriate SUPerior",
- "ObjectClass operational",
+ "user-defined ObjectClass has inappropriate SUPerior",
+ "user-defined ObjectClass includes operational attributes",
"Duplicate objectClass",
"AttributeType not found",
"AttributeType inappropriate USAGE",
int manageDSAit;
#ifdef NEW_LOGGING
- LDAP_LOG(( "operation", LDAP_LEVEL_ENTRY,
- "do_search: conn %d\n", conn->c_connid ));
+ LDAP_LOG( OPERATION, ENTRY, "do_search: conn %d\n", conn->c_connid, 0, 0 );
#else
Debug( LDAP_DEBUG_TRACE, "do_search\n", 0, 0, 0 );
#endif
rc = dnPrettyNormal( NULL, &base, &pbase, &nbase );
if( rc != LDAP_SUCCESS ) {
#ifdef NEW_LOGGING
- LDAP_LOG(( "operation", LDAP_LEVEL_INFO,
+ LDAP_LOG( OPERATION, ERR,
"do_search: conn %d invalid dn (%s)\n",
- conn->c_connid, base.bv_val ));
+ conn->c_connid, base.bv_val, 0 );
#else
Debug( LDAP_DEBUG_ANY,
"do_search: invalid dn (%s)\n", base.bv_val, 0, 0 );
}
#ifdef NEW_LOGGING
- LDAP_LOG(( "operation", LDAP_LEVEL_ARGS,
- "do_search \"%s\" %d %d %d %d %d\n", base.bv_val, scope,
- deref, sizelimit, timelimit, attrsonly ));
+ LDAP_LOG( OPERATION, ARGS, "SRCH \"%s\" %d %d",
+ base.bv_val, scope, deref );
+ LDAP_LOG( OPERATION, ARGS, " %d %d %d\n",
+ sizelimit, timelimit, attrsonly);
#else
Debug( LDAP_DEBUG_ARGS, "SRCH \"%s\" %d %d",
base.bv_val, scope, deref );
}
#ifdef NEW_LOGGING
- LDAP_LOG(( "operation", LDAP_LEVEL_ARGS,
- "do_search: conn %d filter: %s\n", conn->c_connid,
- fstr.bv_len ? fstr.bv_val : "empty" ));
+ LDAP_LOG( OPERATION, ARGS,
+ "do_search: conn %d filter: %s\n",
+ conn->c_connid, fstr.bv_len ? fstr.bv_val : "empty", 0 );
#else
Debug( LDAP_DEBUG_ARGS, " filter: %s\n",
fstr.bv_len ? fstr.bv_val : "empty", 0, 0 );
if( (rc = get_ctrls( conn, op, 1 )) != LDAP_SUCCESS ) {
#ifdef NEW_LOGGING
- LDAP_LOG(( "operation", LDAP_LEVEL_INFO,
+ LDAP_LOG( OPERATION, INFO,
"do_search: conn %d get_ctrls failed (%d)\n",
- conn->c_connid, rc ));
+ conn->c_connid, rc, 0 );
#else
Debug( LDAP_DEBUG_ANY, "do_search: get_ctrls failed\n", 0, 0, 0 );
#endif
}
#ifdef NEW_LOGGING
- LDAP_LOG(( "operation", LDAP_LEVEL_ARGS,
- "do_search: conn %d attrs:", conn->c_connid ));
+ LDAP_LOG( OPERATION, ARGS,
+ "do_search: conn %d attrs:", conn->c_connid, 0, 0 );
#else
Debug( LDAP_DEBUG_ARGS, " attrs:", 0, 0, 0 );
#endif
if ( siz != 0 ) {
for ( i = 0; i<siz; i++ ) {
#ifdef NEW_LOGGING
- LDAP_LOG(( "operation", LDAP_LEVEL_ARGS,
- "do_search: %s", an[i].an_name.bv_val ));
+ LDAP_LOG( OPERATION, ARGS,
+ "do_search: %s", an[i].an_name.bv_val, 0, 0 );
#else
Debug( LDAP_DEBUG_ARGS, " %s", an[i].an_name.bv_val, 0, 0 );
#endif
}
#ifdef NEW_LOGGING
- LDAP_LOG(( "operation", LDAP_LEVEL_ARGS, "\n" ));
+ LDAP_LOG( OPERATION, ARGS, "\n" , 0, 0, 0 );
#else
Debug( LDAP_DEBUG_ARGS, "\n", 0, 0, 0 );
#endif
volatile sig_atomic_t o_abandon; /* abandon flag */
+ char o_do_not_cache; /* don't cache from this op */
+
#define SLAP_NO_CONTROL 0
#define SLAP_NONCRITICAL_CONTROL 1
#define SLAP_CRITICAL_CONTROL 2
const char *text = NULL;
#ifdef NEW_LOGGING
- LDAP_LOG(( "filter", LDAP_LEVEL_ENTRY,
- "str2filter: \"%s\"\n", str ));
+ LDAP_LOG( FILTER, ENTRY, "str2filter: \"%s\"\n", str, 0, 0 );
#else
Debug( LDAP_DEBUG_FILTER, "str2filter \"%s\"\n", str, 0, 0 );
#endif
strncpy( dn->bv_val, oldDN, diff );
strcpy( &dn->bv_val[diff], be->be_suffixAlias[i+1].bv_val );
#ifdef NEW_LOGGING
- LDAP_LOG(( "operation", LDAP_LEVEL_INFO,
- "suffix_alias: converted \"%s\" to \"%s\"\n",
- oldDN, dn->bv_val ));
+ LDAP_LOG( OPERATION, INFO,
+ "suffix_alias: converted \"%s\" to \"%s\"\n",
+ oldDN, dn->bv_val, 0 );
#else
Debug( LDAP_DEBUG_ARGS,
"suffix_alias: converted \"%s\" to \"%s\"\n",
#include "slap.h"
#include "ldap_pvt.h"
-
struct sindexrec {
char *sir_name;
Syntax *sir_syn;
syn = ldap_str2syntax( desc, &code, &err, LDAP_SCHEMA_ALLOW_ALL);
if ( !syn ) {
#ifdef NEW_LOGGING
- LDAP_LOG(( "schema", LDAP_LEVEL_ERR,
- "register_syntax: Error - %s before %s in %s.\n",
- ldap_scherr2str(code), err, desc ));
+ LDAP_LOG( CONFIG, ERR,
+ "register_syntax: Error - %s before %s in %s.\n",
+ ldap_scherr2str(code), err, desc );
#else
Debug( LDAP_DEBUG_ANY, "Error in register_syntax: %s before %s in %s\n",
ldap_scherr2str(code), err, desc );
if ( code ) {
#ifdef NEW_LOGGING
- LDAP_LOG(( "schema", LDAP_LEVEL_ERR,
- "register_syntax: Error - %s %s in %s\n",
- scherr2str(code), err, desc ));
+ LDAP_LOG( CONFIG, ERR,
+ "register_syntax: Error - %s %s in %s\n",
+ scherr2str(code), err, desc );
#else
Debug( LDAP_DEBUG_ANY, "Error in register_syntax: %s %s in %s\n",
scherr2str(code), err, desc );
}
#if 0
#ifdef NEW_LOGGING
- LDAP_LOG(( "schema", LDAP_LEVEL_ENTRY,
+ LDAP_LOG( config, ENTRY,
"syn_schema_info: Merging syn [%ld] %s\n",
- (long)vals[0].bv_len, vals[0].bv_val ));
+ (long)vals[0].bv_len, vals[0].bv_val, 0 );
#else
Debug( LDAP_DEBUG_TRACE, "Merging syn [%ld] %s\n",
(long) vals[0].bv_len, vals[0].bv_val, 0 );
#include "slap.h"
-
int
do_unbind(
Connection *conn,
)
{
#ifdef NEW_LOGGING
- LDAP_LOG(( "operation", LDAP_LEVEL_ENTRY,
- "do_unbind: conn %d\n", conn ? conn->c_connid : -1 ));
+ LDAP_LOG( OPERATION, ENTRY,
+ "do_unbind: conn %d\n", conn ? conn->c_connid : -1, 0, 0 );
#else
Debug( LDAP_DEBUG_TRACE, "do_unbind\n", 0, 0, 0 );
#endif
--- /dev/null
+/* $OpenLDAP$ */
+/*
+ * Copyright 1998-2002 The OpenLDAP Foundation, All Rights Reserved.
+ * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
+ */
+/* user.c - set user id, group id and group access list
+ *
+ * Copyright 1999 by PM Lashley.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms are permitted only
+ * as authorized by the OpenLDAP Public License. A copy of this
+ * license is available at http://www.OpenLDAP.org/license.html or
+ * in file LICENSE in the top-level directory of the distribution.
+*/
+
+#include "portable.h"
+
+#if defined(HAVE_SETUID) && defined(HAVE_SETGID)
+
+#include <stdio.h>
+
+#include <ac/stdlib.h>
+
+#ifdef HAVE_PWD_H
+#include <pwd.h>
+#endif
+#ifdef HAVE_GRP_H
+#include <grp.h>
+#endif
+
+#include <ac/ctype.h>
+#include <ac/unistd.h>
+
+#include "slap.h"
+
+/*
+ * Set real and effective user id and group id, and group access list
+ * The user and group arguments are freed.
+ */
+
+void
+slap_init_user( char *user, char *group )
+{
+ uid_t uid = 0;
+ gid_t gid = 0;
+ int got_uid = 0, got_gid = 0;
+
+ if ( user ) {
+ struct passwd *pwd;
+ if ( isdigit( (unsigned char) *user )) {
+ got_uid = 1;
+ uid = atoi( user );
+#ifdef HAVE_GETPWUID
+ pwd = getpwuid( uid );
+ goto did_getpw;
+#else
+ free( user );
+ user = NULL;
+#endif
+ } else {
+ pwd = getpwnam( user );
+ did_getpw:
+ if ( pwd == NULL ) {
+#ifdef NEW_LOGGING
+ LDAP_LOG( OPERATION, INFO,
+ "slap_init_user: No passwd entry for user %s\n", user, 0, 0 );
+#else
+ Debug( LDAP_DEBUG_ANY, "No passwd entry for user %s\n",
+ user, 0, 0 );
+#endif
+
+ exit( EXIT_FAILURE );
+ }
+ if ( got_uid ) {
+ free( user );
+ user = (pwd != NULL ? ch_strdup( pwd->pw_name ) : NULL);
+ } else {
+ got_uid = 1;
+ uid = pwd->pw_uid;
+ }
+ got_gid = 1;
+ gid = pwd->pw_gid;
+#ifdef HAVE_ENDPWENT
+ endpwent();
+#endif
+ }
+ }
+
+ if ( group ) {
+ struct group *grp;
+ if ( isdigit( (unsigned char) *group )) {
+ gid = atoi( group );
+#ifdef HAVE_GETGRGID
+ grp = getgrgid( gid );
+ goto did_group;
+#endif
+ } else {
+ grp = getgrnam( group );
+ if ( grp != NULL )
+ gid = grp->gr_gid;
+ did_group:
+ if ( grp == NULL ) {
+#ifdef NEW_LOGGING
+ LDAP_LOG( OPERATION, INFO,
+ "slap_init_user: No group entry for group %s\n", group, 0, 0 );
+#else
+ Debug( LDAP_DEBUG_ANY, "No group entry for group %s\n",
+ group, 0, 0 );
+#endif
+
+ exit( EXIT_FAILURE );
+ }
+ }
+ free( group );
+ got_gid = 1;
+ }
+
+ if ( user ) {
+ if ( getuid() == 0 && initgroups( user, gid ) != 0 ) {
+#ifdef NEW_LOGGING
+ LDAP_LOG( OPERATION, INFO,
+ "slap_init_user: Could not set the group access (gid) list.\n",
+ 0, 0, 0 );
+#else
+ Debug( LDAP_DEBUG_ANY,
+ "Could not set the group access (gid) list\n", 0, 0, 0 );
+#endif
+
+ exit( EXIT_FAILURE );
+ }
+ free( user );
+ }
+
+#ifdef HAVE_ENDGRENT
+ endgrent();
+#endif
+
+ if ( got_gid ) {
+ if ( setgid( gid ) != 0 ) {
+#ifdef NEW_LOGGING
+ LDAP_LOG( OPERATION, INFO,
+ "slap_init_user: could not set real group id to %d\n",
+ (int)gid, 0, 0);
+#else
+ Debug( LDAP_DEBUG_ANY, "Could not set real group id to %d\n",
+ (int) gid, 0, 0 );
+#endif
+
+ exit( EXIT_FAILURE );
+ }
+#ifdef HAVE_SETEGID
+ if ( setegid( gid ) != 0 ) {
+#ifdef NEW_LOGGING
+ LDAP_LOG( OPERATION, INFO,
+ "slap_init_user: Could not set effective group id to %d\n",
+ (int)gid, 0, 0);
+#else
+ Debug( LDAP_DEBUG_ANY, "Could not set effective group id to %d\n",
+ (int) gid, 0, 0 );
+#endif
+
+ exit( EXIT_FAILURE );
+ }
+#endif
+ }
+
+ if ( got_uid ) {
+ if ( setuid( uid ) != 0 ) {
+#ifdef NEW_LOGGING
+ LDAP_LOG( OPERATION, INFO,
+ "slap_init_user: Could not set real user id to %d\n",
+ (int)uid, 0, 0 );
+#else
+ Debug( LDAP_DEBUG_ANY, "Could not set real user id to %d\n",
+ (int) uid, 0, 0 );
+#endif
+
+ exit( EXIT_FAILURE );
+ }
+#ifdef HAVE_SETEUID
+ if ( seteuid( uid ) != 0 ) {
+#ifdef NEW_LOGGING
+ LDAP_LOG( OPERATION, INFO,
+ "slap_init_user: Could not set effective user id to %d\n",
+ (int)uid, 0, 0 );
+#else
+ Debug( LDAP_DEBUG_ANY, "Could not set effective user id to %d\n",
+ (int) uid, 0, 0 );
+#endif
+
+ exit( EXIT_FAILURE );
+ }
+#endif
+ }
+}
+
+#endif /* HAVE_PWD_H && HAVE_GRP_H */