From 33248a02e1983493ed961e6358f3fb33b62e4d81 Mon Sep 17 00:00:00 2001 From: Kurt Zeilenga Date: Tue, 1 Oct 2002 04:07:55 +0000 Subject: [PATCH] Code cleanup (no functional changes) --- servers/slapd/acl.c | 26 +++++++++++++++----------- servers/slapd/back-bdb/group.c | 10 +++++----- 2 files changed, 20 insertions(+), 16 deletions(-) diff --git a/servers/slapd/acl.c b/servers/slapd/acl.c index 3db4fd14e7..281d96e66a 100644 --- a/servers/slapd/acl.c +++ b/servers/slapd/acl.c @@ -919,7 +919,6 @@ dn_match_cleanup:; } if ( b->a_group_pat.bv_len ) { - char buf[ACL_BUF_SIZE]; struct berval bv; struct berval ndn = { 0, NULL }; int rc; @@ -928,29 +927,33 @@ dn_match_cleanup:; continue; } - bv.bv_len = sizeof(buf) - 1; - bv.bv_val = buf; - /* b->a_group is an unexpanded entry name, expanded it should be an * entry with objectclass group* and we test to see if odn is one of * the values in the attribute group */ /* see if asker is listed in dnattr */ if ( b->a_group_style == ACL_STYLE_REGEX ) { - string_expand(&bv, &b->a_group_pat, e->e_ndn, matches); - if ( dnNormalize2(NULL, &bv, &ndn) != LDAP_SUCCESS ) { + char buf[ACL_BUF_SIZE]; + bv.bv_len = sizeof(buf) - 1; + bv.bv_val = buf; + + string_expand( &bv, &b->a_group_pat, e->e_ndn, matches ); + if ( dnNormalize2( NULL, &bv, &ndn ) != LDAP_SUCCESS ) { /* did not expand to a valid dn */ continue; } + bv = ndn; + } else { bv = b->a_group_pat; } - rc = backend_group(be, conn, op, e, &bv, &op->o_ndn, - b->a_group_oc, b->a_group_at); - if ( ndn.bv_val ) - free( ndn.bv_val ); + rc = backend_group( be, conn, op, e, &bv, &op->o_ndn, + b->a_group_oc, b->a_group_at ); + + if ( ndn.bv_val ) free( ndn.bv_val ); + if ( rc != 0 ) { continue; } @@ -1674,7 +1677,8 @@ aci_group_member ( bv.bv_val = (char *)&buf; string_expand(&bv, &subjdn, e->e_ndn, matches); if ( dnNormalize2(NULL, &bv, &ndn) == LDAP_SUCCESS ) { - rc = (backend_group(be, conn, op, e, &ndn, &op->o_ndn, grp_oc, grp_ad) == 0); + rc = (backend_group(be, conn, op, e, &ndn, &op->o_ndn, + grp_oc, grp_ad) == 0); free( ndn.bv_val ); } } diff --git a/servers/slapd/back-bdb/group.c b/servers/slapd/back-bdb/group.c index 20b768bbdb..ad9b979b5b 100644 --- a/servers/slapd/back-bdb/group.c +++ b/servers/slapd/back-bdb/group.c @@ -30,8 +30,7 @@ bdb_group( struct berval *gr_ndn, struct berval *op_ndn, ObjectClass *group_oc, - AttributeDescription *group_at -) + AttributeDescription *group_at ) { struct bdb_info *bdb = (struct bdb_info *) be->be_private; struct bdb_op_info *boi = NULL; @@ -58,18 +57,19 @@ bdb_group( op_ndn->bv_val, gr_ndn->bv_val, group_oc_name ); #else Debug( LDAP_DEBUG_ARGS, - "=> bdb_group: gr dn: \"%s\"\n", + "=> bdb_group: group ndn: \"%s\"\n", gr_ndn->bv_val, 0, 0 ); Debug( LDAP_DEBUG_ARGS, - "=> bdb_group: op dn: \"%s\"\n", + "=> bdb_group: op ndn: \"%s\"\n", op_ndn->bv_val, 0, 0 ); + Debug( LDAP_DEBUG_ARGS, "=> bdb_group: oc: \"%s\" at: \"%s\"\n", group_oc_name, group_at_name, 0 ); Debug( LDAP_DEBUG_ARGS, - "=> bdb_group: tr dn: \"%s\"\n", + "=> bdb_group: tr ndn: \"%s\"\n", target->e_ndn, 0, 0 ); #endif -- 2.39.5