Commit ff682be2 authored by Howard Chu's avatar Howard Chu
Browse files

Added acl_destroy, acl_free.

parent 2b0819c4
......@@ -1217,6 +1217,62 @@ acl_append( AccessControl **l, AccessControl *a )
*l = a;
}
static void
access_free( Access *a )
{
if ( a->a_dn_pat )
free ( a->a_dn_pat );
if ( a->a_peername_pat )
free ( a->a_peername_pat );
if ( a->a_sockname_pat )
free ( a->a_sockname_pat );
if ( a->a_domain_pat )
free ( a->a_domain_pat );
if ( a->a_sockurl_pat )
free ( a->a_sockurl_pat );
if ( a->a_set_pat )
free ( a->a_set_pat );
if ( a->a_group_pat )
free ( a->a_group_pat );
free( a );
}
void
acl_free( AccessControl *a )
{
Access *n;
if ( a->acl_filter )
filter_free( a->acl_filter );
if ( a->acl_dn_pat )
free ( a->acl_dn_pat );
if ( a->acl_attrs )
charray_free( a->acl_attrs );
for (; a->acl_access; a->acl_access = n) {
n = a->acl_access->a_next;
access_free( a->acl_access );
}
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 )
{
AccessControl *n;
for (; a && a!= end; a=n) {
n = a->acl_next;
acl_free( a );
}
}
char *
access2str( slap_access_t access )
{
......
......@@ -422,6 +422,7 @@ int backend_destroy(void)
free( backendDB[i].be_root_dn );
free( backendDB[i].be_root_ndn );
free( backendDB[i].be_root_pw.bv_val );
acl_destroy( backendDB[i].be_acl, global_acl );
}
free( backendDB );
......
......@@ -2382,4 +2382,5 @@ config_destroy( )
free ( slapd_args_file );
if ( slapd_pid_file )
free ( slapd_pid_file );
acl_destroy( global_acl, NULL );
}
......@@ -81,6 +81,8 @@ LDAP_SLAPD_F (slap_access_t) str2access LDAP_P(( const char *str ));
#define ACCESSMASK_MAXLEN sizeof("unknown (+wrscan)")
LDAP_SLAPD_F (char *) accessmask2str LDAP_P(( slap_mask_t mask, char* ));
LDAP_SLAPD_F (slap_mask_t) str2accessmask LDAP_P(( const char *str ));
LDAP_SLAPD_F (void) acl_destroy LDAP_P(( AccessControl*, AccessControl* ));
LDAP_SLAPD_F (void) acl_free LDAP_P(( AccessControl *a ));
/*
* at.c
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment