#include "slap.h"
+static char *
+limits2str( unsigned i )
+{
+ switch ( i ) {
+ case SLAP_LIMITS_UNDEFINED:
+ return "UNDEFINED";
+
+ case SLAP_LIMITS_EXACT:
+ return "EXACT";
+
+ case SLAP_LIMITS_ONE:
+ return "ONELEVEL";
+
+ case SLAP_LIMITS_SUBTREE:
+ return "SUBTREE";
+
+ case SLAP_LIMITS_CHILDREN:
+ return "CHILDREN";
+
+ case SLAP_LIMITS_REGEX:
+ return "REGEX";
+
+ case SLAP_LIMITS_ANONYMOUS:
+ return "ANONYMOUS";
+
+ case SLAP_LIMITS_USERS:
+ return "USERS";
+
+ case SLAP_LIMITS_ANY:
+ return "ANY";
+
+ default:
+ return "UNKNOWN";
+ }
+}
+
int
limits_get(
Operation *op,
assert( op );
assert( limit );
+#ifdef NEW_LOGGING
+ LDAP_LOG( SLAPD, DETAIL1, "==> limits_get: conn=%lu op=%lu dn=\"%s\"\n",
+ op->o_connid, op->o_opid,
+ BER_BVISNULL( ndn ) ? "[anonymous]" : ndn->bv_val );
+
+#else
+ Debug( LDAP_DEBUG_TRACE, "==> limits_get: conn=%lu op=%lu dn=\"%s\"\n",
+ op->o_connid, op->o_opid,
+ BER_BVISNULL( ndn ) ? "[anonymous]" : ndn->bv_val );
+#endif
/*
* default values
*/
lm[0]->lm_group_ad );
if ( rc == 0 ) {
*limit = &lm[0]->lm_limits;
+#ifdef NEW_LOGGING
+ LDAP_LOG( SLAPD, DETAIL1, "<== limits_get: type=GROUP match=EXACT "
+ "dn=\"%s\" oc=\"%s\" ad=\"%s\"\n",
+ lm[0]->lm_pat.bv_val,
+ lm[0]->lm_group_oc->soc_cname.bv_val,
+ lm[0]->lm_group_ad->ad_cname.bv_val );
+#else
+ Debug( LDAP_DEBUG_TRACE, "<== limits_get: type=GROUP match=EXACT "
+ "dn=\"%s\" oc=\"%s\" ad=\"%s\"\n",
+ lm[0]->lm_pat.bv_val,
+ lm[0]->lm_group_oc->soc_cname.bv_val,
+ lm[0]->lm_group_ad->ad_cname.bv_val );
+
+#endif
return( 0 );
}
- }
+ } else {
- if ( dn_match( &lm[0]->lm_pat, ndn ) ) {
- *limit = &lm[0]->lm_limits;
- return( 0 );
+ if ( dn_match( &lm[0]->lm_pat, ndn ) ) {
+ *limit = &lm[0]->lm_limits;
+#ifdef NEW_LOGGING
+ LDAP_LOG( SLAPD, DETAIL1, "<== limits_get: type=DN match=EXACT dn=\"%s\"\n",
+ lm[0]->lm_pat.bv_val, 0, 0 );
+#else
+ Debug( LDAP_DEBUG_TRACE, "<== limits_get: type=DN match=EXACT dn=\"%s\"\n",
+ lm[0]->lm_pat.bv_val, 0, 0 );
+#endif
+ return( 0 );
+ }
}
break;
}
*limit = &lm[0]->lm_limits;
+#ifdef NEW_LOGGING
+ LDAP_LOG( SLAPD, DETAIL1, "<== limits_get: type=DN match=%s dn=\"%s\"\n",
+ limits2str( style ), lm[0]->lm_pat.bv_val, 0 );
+#else
+ Debug( LDAP_DEBUG_TRACE, "<== limits_get: type=DN match=%s dn=\"%s\"\n",
+ limits2str( style ), lm[0]->lm_pat.bv_val, 0 );
+#endif
return( 0 );
}
0, NULL, 0 ) == 0 )
{
*limit = &lm[0]->lm_limits;
+#ifdef NEW_LOGGING
+ LDAP_LOG( SLAPD, DETAIL1, "<== limits_get: type=DN match=%s dn=\"%s\"\n",
+ limits2str( style ), lm[0]->lm_pat.bv_val, 0 );
+#else
+ Debug( LDAP_DEBUG_TRACE, "<== limits_get: type=DN match=%s dn=\"%s\"\n",
+ limits2str( style ), lm[0]->lm_pat.bv_val, 0 );
+#endif
return( 0 );
}
break;
case SLAP_LIMITS_ANONYMOUS:
if ( ndn->bv_len == 0 ) {
+#ifdef NEW_LOGGING
+ LDAP_LOG( SLAPD, DETAIL1, "<== limits_get: type=DN match=%s\n",
+ limits2str( style ), 0, 0 );
+#else
+ Debug( LDAP_DEBUG_TRACE, "<== limits_get: type=DN match=%s\n",
+ limits2str( style ), 0, 0 );
+#endif
*limit = &lm[0]->lm_limits;
return( 0 );
}
case SLAP_LIMITS_USERS:
if ( ndn->bv_len != 0 ) {
*limit = &lm[0]->lm_limits;
+#ifdef NEW_LOGGING
+ LDAP_LOG( SLAPD, DETAIL1, "<== limits_get: type=DN match=%s\n",
+ limits2str( style ), 0, 0 );
+#else
+ Debug( LDAP_DEBUG_TRACE, "<== limits_get: type=DN match=%s\n",
+ limits2str( style ), 0, 0 );
+#endif
return( 0 );
}
break;