]> git.sur5r.net Git - openldap/blobdiff - servers/slapd/acl.c
Hide log schema
[openldap] / servers / slapd / acl.c
index 39857052f8244932f2286658f8f3640c1cfc8031..14cc43894f160a2a3d421b4346d1fd003168dbf0 100644 (file)
@@ -2,7 +2,7 @@
 /* $OpenLDAP$ */
 /* This work is part of OpenLDAP Software <http://www.openldap.org/>.
  *
- * Copyright 1998-2006 The OpenLDAP Foundation.
+ * Copyright 1998-2007 The OpenLDAP Foundation.
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -304,7 +304,7 @@ fe_access_allowed(
        be_orig = op->o_bd;
 
        if ( op->o_bd == NULL ) {
-               op->o_bd = select_backend( &op->o_req_ndn, 0, 0 );
+               op->o_bd = select_backend( &op->o_req_ndn, 0 );
                if ( op->o_bd == NULL )
                        op->o_bd = frontendDB;
        }
@@ -351,7 +351,10 @@ access_allowed_mask(
        assert( attr != NULL );
 
        if ( op ) {
-               if ( op->o_is_auth_check &&
+               if ( op->o_acl_priv != ACL_NONE ) {
+                       access = op->o_acl_priv;
+
+               } else if ( op->o_is_auth_check &&
                        ( access_level == ACL_SEARCH || access_level == ACL_READ ) )
                {
                        access = ACL_AUTH;
@@ -1326,7 +1329,7 @@ slap_acl_mask(
                                                char            buf[] = "FFFF:FFFF:FFFF:FFFF:FFFF:FFFF:FFFF:FFFF";
                                                struct berval   ip;
                                                struct in6_addr addr;
-                                               int             port_number = -1, i;
+                                               int             port_number = -1;
                                                
                                                if ( strncasecmp( op->o_conn->c_peer_name.bv_val, 
                                                                        acl_bv_ipv6_eq.bv_val,
@@ -1359,15 +1362,7 @@ slap_acl_mask(
                                                        continue;
 
                                                /* check mask */
-                                               for ( i = 0; i < 4; i++ ) {
-                                                       if ( ( addr.s6_addr32[i] & b->a_peername_mask6.s6_addr32[i] )
-                                                               != b->a_peername_addr6.s6_addr32[i] )
-                                                       {
-                                                               break;
-                                                       }
-                                               }
-
-                                               if ( i != 4 )
+                                               if ( !slap_addr6_mask( &addr, &b->a_peername_mask6, &b->a_peername_addr6 ) )
                                                        continue;
 #endif /* LDAP_PF_INET6 */
 
@@ -2058,7 +2053,7 @@ acl_set_cb_gather( Operation *op, SlapReply *rs )
                        }
                }
 
-               if ( bvals ) {
+               if ( bvalsp ) {
                        p->bvals = slap_set_join( p->cookie, p->bvals,
                                        ( '|' | SLAP_SET_RREF ), bvalsp );
                }
@@ -2116,7 +2111,7 @@ acl_set_gather( SetCookie *cookie, struct berval *name, AttributeDescription *de
                goto url_done;
        }
 
-       op2.o_bd = select_backend( &op2.o_req_ndn, 0, 1 );
+       op2.o_bd = select_backend( &op2.o_req_ndn, 1 );
        if ( ( op2.o_bd == NULL ) || ( op2.o_bd->be_search == NULL ) ) {
                rc = LDAP_NO_SUCH_OBJECT;
                goto url_done;