You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by br...@apache.org on 2014/09/01 10:55:13 UTC
svn commit: r1621707 - in /subversion/branches/authzperf/subversion:
libsvn_repos/authz.h libsvn_repos/authz_parse.c
tests/libsvn_repos/authz-test.c
Author: brane
Date: Mon Sep 1 08:55:13 2014
New Revision: 1621707
URL: http://svn.apache.org/r1621707
Log:
On the authzperf branch: Remove the unused groups hash from the
in-memory authz structure.
* subversion/libsvn_repos/authz.h
(svn_authz_t): Remove member 'groups'.
* subversion/libsvn_repos/authz_parse.c
(ctor_baton_t): Add member 'expanded_groups'.
(add_to_group, array_insert_ace, svn_authz__parse):
Use ctor_baton_t::expanded_groups instead of svn_authz_t::groups.
* subversion/tests/libsvn_repos/authz-test.c
(test_authz_parse): Reconstruct the expanded groups hash for display
from those groups that are mentioned in ACEs.
Modified:
subversion/branches/authzperf/subversion/libsvn_repos/authz.h
subversion/branches/authzperf/subversion/libsvn_repos/authz_parse.c
subversion/branches/authzperf/subversion/tests/libsvn_repos/authz-test.c
Modified: subversion/branches/authzperf/subversion/libsvn_repos/authz.h
URL: http://svn.apache.org/viewvc/subversion/branches/authzperf/subversion/libsvn_repos/authz.h?rev=1621707&r1=1621706&r2=1621707&view=diff
==============================================================================
--- subversion/branches/authzperf/subversion/libsvn_repos/authz.h (original)
+++ subversion/branches/authzperf/subversion/libsvn_repos/authz.h Mon Sep 1 08:55:13 2014
@@ -112,9 +112,6 @@ struct svn_authz_t
an authz_global_rights_t*. */
apr_hash_t *user_rights;
- /* Fully recursively expanded group definitions, indexed by group name. */
- apr_hash_t *groups;
-
/* A cache of rules filtered for a particular user.
These will be generated on-demand. */
authz_user_rules_t *user_rules[AUTHZ_FILTERED_CACHE_SIZE];
Modified: subversion/branches/authzperf/subversion/libsvn_repos/authz_parse.c
URL: http://svn.apache.org/viewvc/subversion/branches/authzperf/subversion/libsvn_repos/authz_parse.c?rev=1621707&r1=1621706&r2=1621707&view=diff
==============================================================================
--- subversion/branches/authzperf/subversion/libsvn_repos/authz_parse.c (original)
+++ subversion/branches/authzperf/subversion/libsvn_repos/authz_parse.c Mon Sep 1 08:55:13 2014
@@ -117,6 +117,9 @@ typedef struct ctor_baton_t
/* Temporary parsed-acl definitions. */
apr_array_header_t *parsed_acls;
+ /* Temporary expanded groups definitions. */
+ apr_hash_t *expanded_groups;
+
/* The temporary ACL we're currently constructing. */
parsed_acl_t *current_acl;
@@ -1004,12 +1007,12 @@ close_section(void *baton, svn_stringbuf
static void
add_to_group(ctor_baton_t *cb, const char *group, const char *user)
{
- apr_hash_t *members = svn_hash_gets(cb->authz->groups, group);
+ apr_hash_t *members = svn_hash_gets(cb->expanded_groups, group);
if (!members)
{
group = intern_string(cb, group, -1);
members = svn_hash__make(cb->authz->pool);
- svn_hash_sets(cb->authz->groups, group, members);
+ svn_hash_sets(cb->expanded_groups, group, members);
}
svn_hash_sets(members, user, interned_empty_string);
}
@@ -1155,7 +1158,7 @@ array_insert_ace(void *baton,
if (*ace->name == '@')
{
SVN_ERR_ASSERT(ace->members == NULL);
- ace->members = svn_hash_gets(iab->cb->authz->groups, ace->name);
+ ace->members = svn_hash_gets(iab->cb->expanded_groups, ace->name);
if (!ace->members)
return svn_error_createf(
SVN_ERR_AUTHZ_INVALID_CONFIG, NULL,
@@ -1341,7 +1344,7 @@ svn_authz__parse(svn_authz_t **authz,
/*
* Pass 2: Expand groups and construct the final svn_authz_t.
*/
- cb->authz->groups = svn_hash__make(cb->authz->pool);
+ cb->expanded_groups = svn_hash__make(cb->parser_pool);
SVN_ERR(svn_iter_apr_hash(NULL, cb->parsed_groups,
expand_group_callback, cb, cb->parser_pool));
Modified: subversion/branches/authzperf/subversion/tests/libsvn_repos/authz-test.c
URL: http://svn.apache.org/viewvc/subversion/branches/authzperf/subversion/tests/libsvn_repos/authz-test.c?rev=1621707&r1=1621706&r2=1621707&view=diff
==============================================================================
--- subversion/branches/authzperf/subversion/tests/libsvn_repos/authz-test.c (original)
+++ subversion/branches/authzperf/subversion/tests/libsvn_repos/authz-test.c Mon Sep 1 08:55:13 2014
@@ -24,6 +24,8 @@
#include "svn_pools.h"
#include "svn_iter.h"
+#include "svn_hash.h"
+#include "private/svn_subr_private.h"
#include "../../libsvn_repos/authz.h"
@@ -187,6 +189,7 @@ test_authz_parse(const svn_test_opts_t *
apr_file_t *groups_file;
svn_stream_t *groups;
svn_authz_t *authz;
+ apr_hash_t *groupdefs = svn_hash__make(pool);
int i;
const char *check_user = "wunga";
@@ -250,12 +253,14 @@ test_authz_parse(const svn_test_opts_t *
printf(" %c%s = %s\n",
(ace->inverted ? '~' : ' '),
ace->name, access_string(ace->access));
+ if (ace->members)
+ svn_hash_sets(groupdefs, ace->name, ace->members);
}
printf("\n\n");
}
printf("[groups]\n");
- SVN_ERR(svn_iter_apr_hash(NULL, authz->groups,
+ SVN_ERR(svn_iter_apr_hash(NULL, groupdefs,
print_group, NULL, pool));
printf("\n\n");