X-Git-Url: https://git.sur5r.net/?a=blobdiff_plain;f=servers%2Fslapd%2Facl.c;h=6babdba3390e2b99a823f28f490c83677cf7fec6;hb=4a8d8eb78a610baefde7f5b3e0a371961dafff84;hp=d7cb98d2aee0ebf847f00a000a07f6ba9ef56737;hpb=e891dbcdc47ea22d00050d49dbcef99224a66e00;p=openldap
diff --git a/servers/slapd/acl.c b/servers/slapd/acl.c
index d7cb98d2ae..6babdba339 100644
--- a/servers/slapd/acl.c
+++ b/servers/slapd/acl.c
@@ -2,7 +2,7 @@
/* $OpenLDAP$ */
/* This work is part of OpenLDAP Software .
*
- * Copyright 1998-2004 The OpenLDAP Foundation.
+ * Copyright 1998-2005 The OpenLDAP Foundation.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -253,7 +253,7 @@ access_allowed_mask(
"<= root access granted\n",
0, 0, 0 );
if ( maskp ) {
- mask = ACL_LVL_WRITE;
+ mask = ACL_LVL_MANAGE;
}
goto done;
@@ -394,7 +394,7 @@ vd_access:
"=> access_allowed: %s access %s by %s\n",
access2str( access ),
ACL_GRANT(mask, access) ? "granted" : "denied",
- accessmask2str( mask, accessmaskbuf ) );
+ accessmask2str( mask, accessmaskbuf, 1 ) );
ret = ACL_GRANT(mask, access);
@@ -541,8 +541,11 @@ acl_get(
Debug( LDAP_DEBUG_ACL,
"acl_get: valpat %s\n",
a->acl_attrval.bv_val, 0, 0 );
- if (regexec(&a->acl_attrval_re, val->bv_val, 0, NULL, 0))
+ if ( regexec( &a->acl_attrval_re, val->bv_val, 0, NULL, 0 ) )
+ {
continue;
+ }
+
} else {
int match = 0;
const char *text;
@@ -675,7 +678,7 @@ acl_mask(
"=> acl_mask: to %s by \"%s\", (%s) \n",
val ? "value" : "all values",
op->o_ndn.bv_val ? op->o_ndn.bv_val : "",
- accessmask2str( *mask, accessmaskbuf ) );
+ accessmask2str( *mask, accessmaskbuf, 1) );
if( state && ( state->as_recorded & ACL_STATE_RECORDED_VD )
@@ -1540,8 +1543,8 @@ dn_match_cleanup:;
}
}
Debug(LDAP_DEBUG_ACL, "<= aci_mask grant %s deny %s\n",
- accessmask2str(tgrant,accessmaskbuf),
- accessmask2str(tdeny, accessmaskbuf1), 0);
+ accessmask2str(tgrant,accessmaskbuf, 1),
+ accessmask2str(tdeny, accessmaskbuf1, 1), 0);
}
/* If the entry level aci didn't contain anything valid for the
@@ -1581,8 +1584,8 @@ dn_match_cleanup:;
}
}
Debug(LDAP_DEBUG_ACL, "<= aci_mask grant %s deny %s\n",
- accessmask2str(tgrant,accessmaskbuf),
- accessmask2str(tdeny, accessmaskbuf1), 0);
+ accessmask2str(tgrant,accessmaskbuf, 1),
+ accessmask2str(tdeny, accessmaskbuf1, 1), 0);
}
break;
@@ -1648,7 +1651,7 @@ dn_match_cleanup:;
Debug( LDAP_DEBUG_ACL,
"<= acl_mask: [%d] applying %s (%s)\n",
- i, accessmask2str( modmask, accessmaskbuf ),
+ i, accessmask2str( modmask, accessmaskbuf, 1 ),
b->a_type == ACL_CONTINUE
? "continue"
: b->a_type == ACL_BREAK
@@ -1678,7 +1681,7 @@ dn_match_cleanup:;
Debug( LDAP_DEBUG_ACL,
"<= acl_mask: [%d] mask: %s\n",
- i, accessmask2str(*mask, accessmaskbuf), 0 );
+ i, accessmask2str(*mask, accessmaskbuf, 1), 0 );
if( b->a_type == ACL_CONTINUE ) {
continue;
@@ -1696,7 +1699,7 @@ dn_match_cleanup:;
Debug( LDAP_DEBUG_ACL,
"<= acl_mask: no more clauses, returning %s (stop)\n",
- accessmask2str(*mask, accessmaskbuf), 0, 0 );
+ accessmask2str(*mask, accessmaskbuf, 1), 0, 0 );
return ACL_STOP;
}
@@ -1741,7 +1744,9 @@ acl_check_modlist(
Debug( LDAP_DEBUG_ACL,
"=> access_allowed: backend default %s access %s to \"%s\"\n",
access2str( ACL_WRITE ),
- op->o_bd->be_dfltaccess >= ACL_WRITE ? "granted" : "denied", op->o_dn.bv_val );
+ op->o_bd->be_dfltaccess >= ACL_WRITE
+ ? "granted" : "denied",
+ op->o_dn.bv_val );
ret = (op->o_bd->be_dfltaccess >= ACL_WRITE);
goto done;
}
@@ -2111,8 +2116,9 @@ aci_match_set (
int rc = 0;
AciSetCookie cookie;
- if (setref == 0) {
+ if ( setref == 0 ) {
ber_dupbv_x( &set, subj, op->o_tmpmemctx );
+
} else {
struct berval subjdn, ndn = BER_BVNULL;
struct berval setat;
@@ -2122,7 +2128,7 @@ aci_match_set (
/* format of string is "entry/setAttrName" */
if ( aci_get_part( subj, 0, '/', &subjdn ) < 0 ) {
- return(0);
+ return 0;
}
if ( aci_get_part( subj, 1, '/', &setat ) < 0 ) {
@@ -2674,13 +2680,17 @@ dynacl_aci_parse( const char *fname, int lineno, slap_style_t sty, const char *r
}
static int
-dynacl_aci_print( void *priv )
+dynacl_aci_unparse( void *priv, struct berval *bv )
{
AttributeDescription *ad = ( AttributeDescription * )priv;
+ char *ptr;
assert( ad );
- fprintf( stderr, " aci=%s", ad->ad_cname.bv_val );
+ bv->bv_val = ch_malloc( STRLENOF(" aci=") + ad->ad_cname.bv_len + 1 );
+ ptr = lutil_strcopy( bv->bv_val, " aci=" );
+ ptr = lutil_strcopy( ptr, ad->ad_cname.bv_val );
+ bv->bv_len = ptr - bv->bv_val;
return 0;
}
@@ -2730,8 +2740,8 @@ dynacl_aci_mask(
}
Debug( LDAP_DEBUG_ACL, "<= aci_mask grant %s deny %s\n",
- accessmask2str( tgrant, accessmaskbuf ),
- accessmask2str( tdeny, accessmaskbuf1 ), 0 );
+ accessmask2str( tgrant, accessmaskbuf, 1 ),
+ accessmask2str( tdeny, accessmaskbuf1, 1 ), 0 );
}
/* If the entry level aci didn't contain anything valid for the
@@ -2797,8 +2807,8 @@ dynacl_aci_mask(
}
}
Debug( LDAP_DEBUG_ACL, "<= aci_mask grant %s deny %s\n",
- accessmask2str( tgrant, accessmaskbuf ),
- accessmask2str( tdeny, accessmaskbuf1 ), 0 );
+ accessmask2str( tgrant, accessmaskbuf, 1 ),
+ accessmask2str( tdeny, accessmaskbuf1, 1 ), 0 );
}
break;
@@ -2838,7 +2848,7 @@ dynacl_aci_mask(
static slap_dynacl_t dynacl_aci = {
"aci",
dynacl_aci_parse,
- dynacl_aci_print,
+ dynacl_aci_unparse,
dynacl_aci_mask,
NULL,
NULL,