More struct berval DNs changes

This commit is contained in:
Kurt Zeilenga 2001-12-26 23:43:28 +00:00
parent e8fa25a215
commit a553a03586
8 changed files with 66 additions and 64 deletions

View file

@ -955,7 +955,7 @@
/* #undef SLAPD_META_DYNAMIC */
/* define to support cn=Monitor backend */
/* #undef SLAPD_MONITOR */
#define SLAPD_MONITOR 1
/* define to support dynamic cn=Monitor backend */
/* #undef SLAPD_MONITOR_DYNAMIC */

View file

@ -214,7 +214,7 @@ sb_sasl_read( Sockbuf_IO_Desc *sbiod, void *buf, ber_len_t len)
sbiod->sbiod_sb->sb_debug );
/* Grow the packet buffer if neccessary */
if ( ( p->sec_buf_in.buf_size < ret ) &&
if ( ( p->sec_buf_in.buf_size < (ber_len_t) ret ) &&
ber_pvt_sb_grow_buffer( &p->sec_buf_in, ret ) < 0 )
{
errno = ENOMEM;

View file

@ -26,7 +26,7 @@ bdb_attribute(
Connection *conn,
Operation *op,
Entry *target,
const char *entry_ndn,
struct berval *entry_ndn,
AttributeDescription *entry_at,
struct berval ***vals )
{
@ -39,7 +39,7 @@ bdb_attribute(
#ifdef NEW_LOGGING
LDAP_LOG(( "backend", LDAP_LEVEL_ARGS,
"bdb_attribute: gr dn: \"%s\"\n", entry_ndn ));
"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,
@ -48,7 +48,7 @@ bdb_attribute(
#else
Debug( LDAP_DEBUG_ARGS,
"=> bdb_attribute: gr dn: \"%s\"\n",
entry_ndn, 0, 0 );
entry_ndn->bv_val, 0, 0 );
Debug( LDAP_DEBUG_ARGS,
"=> bdb_attribute: at: \"%s\"\n",
entry_at_name, 0, 0 );
@ -58,17 +58,17 @@ bdb_attribute(
target ? target->e_ndn : "", 0, 0 );
#endif
if (target != NULL && strcmp(target->e_ndn, entry_ndn) == 0) {
if (target != NULL && strcmp(target->e_ndn, entry_ndn->bv_val) == 0) {
/* 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 ));
entry_ndn->bv_val ));
#else
Debug( LDAP_DEBUG_ARGS,
"=> bdb_attribute: target is entry: \"%s\"\n",
entry_ndn, 0, 0 );
entry_ndn->bv_val, 0, 0 );
#endif
@ -86,22 +86,23 @@ bdb_attribute(
#ifdef NEW_LOGGING
LDAP_LOG(( "backend", LDAP_LEVEL_INFO,
"bdb_attribute: cannot find entry (%s)\n",
entry_ndn ));
entry_ndn->bv_val ));
#else
Debug( LDAP_DEBUG_ACL,
"=> bdb_attribute: cannot find entry: \"%s\"\n",
entry_ndn, 0, 0 );
entry_ndn->bv_val, 0, 0 );
#endif
return LDAP_NO_SUCH_OBJECT;
}
#ifdef NEW_LOGGING
LDAP_LOG(( "backend", LDAP_LEVEL_DETAIL1,
"bdb_attribute: found entry (%s)\n", e_ndn ));
"bdb_attribute: found entry (%s)\n",
entry_ndn->bv_val ));
#else
Debug( LDAP_DEBUG_ACL,
"=> bdb_attribute: found entry: \"%s\"\n",
entry_ndn, 0, 0 );
entry_ndn->bv_val, 0, 0 );
#endif
}

View file

@ -26,7 +26,7 @@ ldbm_back_attribute(
Connection *conn,
Operation *op,
Entry *target,
const char *entry_ndn,
struct berval *entry_ndn,
AttributeDescription *entry_at,
struct berval ***vals )
{
@ -58,23 +58,23 @@ ldbm_back_attribute(
target ? target->e_ndn : "", 0, 0 );
#endif
if (target != NULL && strcmp(target->e_ndn, entry_ndn) == 0) {
if (target != NULL && strcmp(target->e_ndn, entry_ndn->bv_val) == 0) {
/* 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 ));
entry_ndn->bv_val ));
#else
Debug( LDAP_DEBUG_ARGS,
"=> ldbm_back_attribute: target is entry: \"%s\"\n",
entry_ndn, 0, 0 );
entry_ndn->bv_val, 0, 0 );
#endif
} else {
/* can we find entry with reader lock */
if ((e = dn2entry_r(be, entry_ndn, NULL )) == NULL) {
if ((e = dn2entry_r(be, entry_ndn->bv_val, NULL )) == NULL) {
#ifdef NEW_LOGGING
LDAP_LOG(( "backend", LDAP_LEVEL_INFO,
"ldbm_back_attribute: cannot find entry (%s)\n",
@ -90,11 +90,12 @@ ldbm_back_attribute(
#ifdef NEW_LOGGING
LDAP_LOG(( "backend", LDAP_LEVEL_DETAIL1,
"ldbm_back_attribute: found entry (%s)\n", entry_ndn ));
"ldbm_back_attribute: found entry (%s)\n",
entry_ndn->bv_val ));
#else
Debug( LDAP_DEBUG_ACL,
"=> ldbm_back_attribute: found entry: \"%s\"\n",
entry_ndn, 0, 0 );
entry_ndn->bv_val, 0, 0 );
#endif
}
@ -104,7 +105,7 @@ ldbm_back_attribute(
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 ));
"ldbm_back_attribute: entry (%s) is an alias\n", e->e_dn ));
#else
Debug( LDAP_DEBUG_ACL,
"<= ldbm_back_attribute: entry is an alias\n", 0, 0, 0 );
@ -117,7 +118,7 @@ ldbm_back_attribute(
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 ));
"ldbm_back_attribute: entry (%s) is a referral.\n", e->e_dn ));
#else
Debug( LDAP_DEBUG_ACL,
"<= ldbm_back_attribute: entry is an referral\n", 0, 0, 0 );
@ -138,7 +139,7 @@ ldbm_back_attribute(
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 ));
"ldbm_back_attribute: failed to find %s.\n", entry_at_name ));
#else
Debug( LDAP_DEBUG_ACL,
"<= ldbm_back_attribute: failed to find %s\n",

View file

@ -27,8 +27,8 @@ ldbm_back_group(
Connection *conn,
Operation *op,
Entry *target,
const char *gr_ndn,
const char *op_ndn,
struct berval *gr_ndn,
struct berval *op_ndn,
ObjectClass *group_oc,
AttributeDescription *group_at
)
@ -37,7 +37,6 @@ ldbm_back_group(
Entry *e;
int rc = 1;
Attribute *attr;
struct berval bv;
const char *group_oc_name = NULL;
const char *group_at_name = group_at->ad_cname.bv_val;
@ -50,16 +49,16 @@ ldbm_back_group(
#ifdef NEW_LOGGING
LDAP_LOG(( "backend", LDAP_LEVEL_ENTRY,
"ldbm_back_group: check (%s) member of (%s), oc %s\n",
op_ndn, gr_ndn, group_oc_name ));
"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, 0, 0 );
gr_ndn->bv_val, 0, 0 );
Debug( LDAP_DEBUG_ARGS,
"=> ldbm_back_group: op dn: \"%s\"\n",
op_ndn, 0, 0 );
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 );
@ -69,30 +68,31 @@ ldbm_back_group(
target->e_ndn, 0, 0 );
#endif
if (strcmp(target->e_ndn, gr_ndn) == 0) {
if (strcmp(target->e_ndn, gr_ndn->bv_val) == 0) {
/* we already have a LOCKED copy of the entry */
e = target;
#ifdef NEW_LOGGING
LDAP_LOG(( "backend", LDAP_LEVEL_DETAIL1,
"ldbm_back_group: target is group (%s)\n", gr_ndn ));
"ldbm_back_group: target is group (%s)\n",
gr_ndn->bv_val ));
#else
Debug( LDAP_DEBUG_ARGS,
"=> ldbm_back_group: target is group: \"%s\"\n",
gr_ndn, 0, 0 );
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) {
if ((e = dn2entry_r(be, gr_ndn->bv_val, NULL )) == NULL) {
#ifdef NEW_LOGGING
LDAP_LOG(( "backend", LDAP_LEVEL_DETAIL1,
"ldbm_back_group: cannot find group (%s)\n",
gr_ndn ));
"ldbm_back_group: cannot find group (%s)\n",
gr_ndn->bv_val ));
#else
Debug( LDAP_DEBUG_ACL,
"=> ldbm_back_group: cannot find group: \"%s\"\n",
gr_ndn, 0, 0 );
gr_ndn->bv_val, 0, 0 );
#endif
return( 1 );
@ -100,11 +100,11 @@ ldbm_back_group(
#ifdef NEW_LOGGING
LDAP_LOG(( "backend", LDAP_LEVEL_DETAIL1,
"ldbm_back_group: found group (%s)\n", gr_ndn ));
"ldbm_back_group: found group (%s)\n", gr_ndn->bv_val ));
#else
Debug( LDAP_DEBUG_ACL,
"=> ldbm_back_group: found group: \"%s\"\n",
gr_ndn, 0, 0 );
gr_ndn->bv_val, 0, 0 );
#endif
}
@ -120,7 +120,8 @@ ldbm_back_group(
if( is_entry_alias( e ) ) {
#ifdef NEW_LOGGING
LDAP_LOG(( "backend", LDAP_LEVEL_INFO,
"ldbm_back_group: group (%s) is an alias\n", gr_ndn ));
"ldbm_back_group: group (%s) is an alias\n",
gr_ndn->bv_val ));
#else
Debug( LDAP_DEBUG_ACL,
"<= ldbm_back_group: group is an alias\n", 0, 0, 0 );
@ -132,7 +133,8 @@ ldbm_back_group(
if( is_entry_referral( e ) ) {
#ifdef NEW_LOGGING
LDAP_LOG(( "backend", LDAP_LEVEL_INFO,
"ldbm_back_group: group (%s) is a referral.\n", gr_ndn ));
"ldbm_back_group: group (%s) is a referral.\n",
gr_ndn->bv_val ));
#else
Debug( LDAP_DEBUG_ACL,
"<= ldbm_back_group: group is an referral\n", 0, 0, 0 );
@ -144,8 +146,8 @@ ldbm_back_group(
if( !is_entry_objectclass( e, group_oc ) ) {
#ifdef NEW_LOGGING
LDAP_LOG(( "backend", LDAP_LEVEL_ERR,
"ldbm_back_group: failed to find %s in objectClass.\n",
group_oc_name ));
"ldbm_back_group: failed to find %s in objectClass.\n",
group_oc_name ));
#else
Debug( LDAP_DEBUG_ACL,
"<= ldbm_back_group: failed to find %s in objectClass\n",
@ -158,7 +160,7 @@ ldbm_back_group(
if ((attr = attr_find(e->e_attrs, group_at)) == NULL) {
#ifdef NEW_LOGGING
LDAP_LOG(( "backend", LDAP_LEVEL_INFO,
"ldbm_back_group: failed to find %s\n", group_at_name ));
"ldbm_back_group: failed to find %s\n", group_at_name ));
#else
Debug( LDAP_DEBUG_ACL,
"<= ldbm_back_group: failed to find %s\n",
@ -179,33 +181,29 @@ ldbm_back_group(
#endif
bv.bv_val = (char *) op_ndn;
bv.bv_len = strlen( op_ndn );
if( value_find( group_at, attr->a_vals, &bv ) != LDAP_SUCCESS ) {
if( value_find( group_at, attr->a_vals, op_ndn ) != LDAP_SUCCESS ) {
#ifdef NEW_LOGGING
LDAP_LOG(( "backend", LDAP_LEVEL_DETAIL1,
"ldbm_back_group: \"%s\" not in \"%s\": %s\n",
op_ndn, gr_ndn, group_at_name ));
"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, gr_ndn, group_at_name );
op_ndn->bv_val, gr_ndn->bv_val, group_at_name );
#endif
goto return_results;
}
#ifdef NEW_LOGGING
LDAP_LOG(( "backend", LDAP_LEVEL_DETAIL1,
"ldbm_back_group: %s is in %s: %s\n",
op_ndn, gr_ndn, group_at_name ));
"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, gr_ndn, group_at_name );
op_ndn->bv_val, gr_ndn->bv_val, group_at_name );
#endif
@ -219,7 +217,7 @@ return_results:
#ifdef NEW_LOGGING
LDAP_LOG(( "backend", LDAP_LEVEL_ENTRY,
"ldbm_back_group: rc=%d\n", rc ));
"ldbm_back_group: rc=%d\n", rc ));
#else
Debug( LDAP_DEBUG_TRACE, "ldbm_back_group: rc=%d\n", rc, 0, 0 );
#endif

View file

@ -1018,7 +1018,7 @@ backend_group(
if( be->be_group ) {
int res = be->be_group( be, conn, op,
target, gr_ndn->bv_val, op_ndn->bv_val,
target, gr_ndn, op_ndn,
group_oc, group_at );
if (op->o_tag != LDAP_REQ_BIND) {
@ -1066,7 +1066,7 @@ backend_attribute(
}
if( be->be_attribute ) {
return be->be_attribute( be, conn, op, target, edn->bv_val,
return be->be_attribute( be, conn, op, target, edn,
entry_at, vals );
}

View file

@ -548,8 +548,8 @@ glue_back_group (
Connection *conn,
Operation *op,
Entry *target,
const char *ndn,
const char *ondn,
struct berval *ndn,
struct berval *ondn,
ObjectClass *oc,
AttributeDescription * ad
)
@ -557,7 +557,7 @@ glue_back_group (
BackendDB *be;
int rc;
be = glue_back_select (b0, ndn);
be = glue_back_select (b0, ndn->bv_val);
if (be && be->be_group) {
rc = be->be_group (be, conn, op, target, ndn, ondn, oc, ad);
@ -573,7 +573,7 @@ glue_back_attribute (
Connection *conn,
Operation *op,
Entry *target,
const char *ndn,
struct berval *ndn,
AttributeDescription *ad,
struct berval ***vals
)
@ -581,7 +581,7 @@ glue_back_attribute (
BackendDB *be;
int rc;
be = glue_back_select (b0, ndn);
be = glue_back_select (b0, ndn->bv_val);
if (be && be->be_attribute) {
rc = be->be_attribute (be, conn, op, target, ndn, ad, vals);

View file

@ -1095,13 +1095,15 @@ typedef int (BI_chk_referrals) LDAP_P((BackendDB *bd,
typedef int (BI_acl_group) LDAP_P((Backend *bd,
struct slap_conn *c, struct slap_op *o,
Entry *e, const char *bdn, const char *edn,
Entry *e,
struct berval *bdn,
struct berval *edn,
ObjectClass *group_oc,
AttributeDescription *group_at ));
typedef int (BI_acl_attribute) LDAP_P((Backend *bd,
struct slap_conn *c, struct slap_op *o,
Entry *e, const char *edn,
Entry *e, struct berval *edn,
AttributeDescription *entry_at,
struct berval ***vals ));