]> git.sur5r.net Git - openldap/commitdiff
ITS#5572 cleanup unneeded code
authorHoward Chu <hyc@openldap.org>
Tue, 11 Nov 2008 21:40:39 +0000 (21:40 +0000)
committerHoward Chu <hyc@openldap.org>
Tue, 11 Nov 2008 21:40:39 +0000 (21:40 +0000)
servers/slapd/aclparse.c
servers/slapd/backend.c
servers/slapd/bconfig.c
servers/slapd/config.c
servers/slapd/proto-slap.h

index 29910379d373121ecf287762f5b65f8e2ba78692..1679f2b0e8f16fbe0deb3ad9077ab602a28908ba 100644 (file)
@@ -2449,19 +2449,12 @@ acl_free( AccessControl *a )
        free( a );
 }
 
-/* Because backend_startup uses acl_append to tack on the global_acl to
- * the end of each backend's acl, we cannot just take one argument and
- * merrily free our way to the end of the list. backend_destroy calls us
- * with the be_acl in arg1, and global_acl in arg2 to give us a stopping
- * point. config_destroy calls us with global_acl in arg1 and NULL in
- * arg2, so we then proceed to polish off the global_acl.
- */
 void
-acl_destroy( AccessControl *a, AccessControl *end )
+acl_destroy( AccessControl *a )
 {
        AccessControl *n;
 
-       for ( ; a && a != end; a = n ) {
+       for ( ; a; a = n ) {
                n = a->acl_next;
                acl_free( a );
        }
index aad928e616e75e7dd6064cfd316110777b228dcc..0a573ca1a19cebddcf63c22da17410c5a7f933e8 100644 (file)
@@ -449,7 +449,7 @@ void backend_destroy_one( BackendDB *bd, int dynamic )
        if ( !BER_BVISNULL( &bd->be_rootpw ) ) {
                free( bd->be_rootpw.bv_val );
        }
-       acl_destroy( bd->be_acl, frontendDB->be_acl );
+       acl_destroy( bd->be_acl );
        limits_destroy( bd->be_limits );
        if ( !BER_BVISNULL( &bd->be_update_ndn ) ) {
                ch_free( bd->be_update_ndn.bv_val );
@@ -500,7 +500,8 @@ int backend_destroy(void)
                if ( !BER_BVISNULL( &bd->be_rootpw ) ) {
                        free( bd->be_rootpw.bv_val );
                }
-               acl_destroy( bd->be_acl, frontendDB->be_acl );
+               acl_destroy( bd->be_acl );
+               frontendDB = NULL;
        }
 
        return 0;
index 5493d9811b6d19f703b15ad9d84dec9d4539a5d4..bf78aabb56b55b8f454035e1b881da36a4ebdbbc 100644 (file)
@@ -979,12 +979,7 @@ config_generic(ConfigArgs *c) {
                        AccessControl *a;
                        char *src, *dst, ibuf[11];
                        struct berval bv, abv;
-                       AccessControl *end;
-                       if ( c->be == frontendDB )
-                               end = NULL;
-                       else
-                               end = frontendDB->be_acl;
-                       for (i=0, a=c->be->be_acl; a && a != end; i++,a=a->acl_next) {
+                       for (i=0, a=c->be->be_acl; a; i++,a=a->acl_next) {
                                abv.bv_len = snprintf( ibuf, sizeof( ibuf ), SLAP_X_ORDERED_FMT, i );
                                if ( abv.bv_len >= sizeof( ibuf ) ) {
                                        ber_bvarray_free_x( c->rvalue_vals, NULL );
@@ -1220,13 +1215,8 @@ config_generic(ConfigArgs *c) {
 
                case CFG_ACL:
                        if ( c->valx < 0 ) {
-                               AccessControl *end;
-                               if ( c->be == frontendDB )
-                                       end = NULL;
-                               else
-                                       end = frontendDB->be_acl;
-                               acl_destroy( c->be->be_acl, end );
-                               c->be->be_acl = end;
+                               acl_destroy( c->be->be_acl );
+                               c->be->be_acl = NULL;
 
                        } else {
                                AccessControl **prev, *a;
@@ -1691,11 +1681,10 @@ sortval_reject:
                case CFG_ACL:
                        /* Don't append to the global ACL if we're on a specific DB */
                        i = c->valx;
-                       if ( c->be != frontendDB && frontendDB->be_acl && c->valx == -1 ) {
+                       if ( c->valx == -1 ) {
                                AccessControl *a;
                                i = 0;
-                               for ( a=c->be->be_acl; a && a != frontendDB->be_acl;
-                                       a = a->acl_next )
+                               for ( a=c->be->be_acl; a; a = a->acl_next )
                                        i++;
                        }
                        if ( parse_acl(c->be, c->fname, c->lineno, c->argc, c->argv, i ) ) {
@@ -5934,7 +5923,7 @@ config_back_db_open( BackendDB *be, ConfigReply *cr )
        /* If we have no explicitly configured ACLs, don't just use
         * the global ACLs. Explicitly deny access to everything.
         */
-       if ( frontendDB->be_acl && be->be_acl == frontendDB->be_acl ) {
+       if ( !be->be_acl ) {
                parse_acl(be, "config_back_db_open", 0, 6, (char **)defacl, 0 );
        }
 
index 368fb9cef62c883dc787c326587b274d98285cb2..a81ab852c9588e332dfc6463f5804af459c419c8 100644 (file)
@@ -1984,7 +1984,7 @@ config_destroy( )
                if ( frontendDB->be_schemadn.bv_val )
                        free( frontendDB->be_schemadn.bv_val );
                if ( frontendDB->be_acl )
-                       acl_destroy( frontendDB->be_acl, NULL );
+                       acl_destroy( frontendDB->be_acl );
        }
        free( line );
        if ( slapd_args_file )
index 1d08b5488ab10147ab7b1e5e25f91ac630d87df3..560ffc3f2d1d785fd71ce9b2b454d731f55c4caf 100644 (file)
@@ -111,7 +111,7 @@ LDAP_SLAPD_F (slap_access_t) str2access LDAP_P(( const char *str ));
 LDAP_SLAPD_F (char *) accessmask2str LDAP_P(( slap_mask_t mask, char*, int debug ));
 LDAP_SLAPD_F (slap_mask_t) str2accessmask LDAP_P(( const char *str ));
 LDAP_SLAPD_F (void) acl_unparse LDAP_P(( AccessControl*, struct berval* ));
-LDAP_SLAPD_F (void) acl_destroy LDAP_P(( AccessControl*, AccessControl* ));
+LDAP_SLAPD_F (void) acl_destroy LDAP_P(( AccessControl* ));
 LDAP_SLAPD_F (void) acl_free LDAP_P(( AccessControl *a ));