subversion-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From stef...@apache.org
Subject svn commit: r1770409 - in /subversion/branches/authzperf/subversion: libsvn_repos/authz.c tests/cmdline/svnauthz_tests.py
Date Fri, 18 Nov 2016 16:41:14 GMT
Author: stefan2
Date: Fri Nov 18 16:41:13 2016
New Revision: 1770409

URL: http://svn.apache.org/viewvc?rev=1770409&view=rev
Log:
On the authzperf branch:
Use the new generalized access to config data for authz input as well.

* subversion/libsvn_repos/authz.c
  (authz_read): Call the common access functions instead of the local code.
  (svn_repos_authz_read2): Update code.

* subversion/tests/cmdline/svnauthz_tests.py
  (svnauthz_accessof_is_file_test): Update test expectation.

Modified:
    subversion/branches/authzperf/subversion/libsvn_repos/authz.c
    subversion/branches/authzperf/subversion/tests/cmdline/svnauthz_tests.py

Modified: subversion/branches/authzperf/subversion/libsvn_repos/authz.c
URL: http://svn.apache.org/viewvc/subversion/branches/authzperf/subversion/libsvn_repos/authz.c?rev=1770409&r1=1770408&r2=1770409&view=diff
==============================================================================
--- subversion/branches/authzperf/subversion/libsvn_repos/authz.c (original)
+++ subversion/branches/authzperf/subversion/libsvn_repos/authz.c Fri Nov 18 16:41:13 2016
@@ -41,6 +41,7 @@
 #include "private/svn_subr_private.h"
 #include "repos.h"
 #include "authz.h"
+#include "config_file.h"
 
 
 /*** Access rights. ***/
@@ -1542,8 +1543,8 @@ svn_repos__retrieve_config(svn_config_t
    RESULT_POOL.  If GROUPS_PATH is set, use the global groups parsed from it.
    Use SCRATCH_POOL for temporary allocations.
 
-   PATH and GROUPS_PATH may be a dirent, a registry path or an absolute file
-   url.
+   PATH and GROUPS_PATH may be a dirent or an absolute file url.  REPOS_HINT
+   may be specified to speed up access to in-repo authz file.
 
    If PATH or GROUPS_PATH is not a valid authz rule file, then return
    SVN_AUTHZ_INVALID_CONFIG.  The contents of *AUTHZ_P is then
@@ -1554,34 +1555,38 @@ authz_read(authz_full_t **authz_p,
            const char *path,
            const char *groups_path,
            svn_boolean_t must_exist,
+           svn_repos_t *repos_hint,
            apr_pool_t *result_pool,
            apr_pool_t *scratch_pool)
 {
-  svn_stream_t *rules;
-  svn_stream_t *groups = NULL;
-  svn_error_t* err;
+  svn_error_t* err = NULL;
+  svn_stream_t *rules_stream = NULL;
+  svn_stream_t *groups_stream = NULL;
+  svn_checksum_t *rules_checksum = NULL;
+  svn_checksum_t *groups_checksum = NULL;
+
+  config_access_t *access = svn_repos__create_config_access(repos_hint,
+                                                            scratch_pool);
 
   /* Open the main authz file */
-  SVN_ERR(retrieve_config(&rules, path, must_exist, scratch_pool,
-                          scratch_pool));
+  SVN_ERR(svn_repos__get_config(&rules_stream, &rules_checksum, access,
+                                path, must_exist, scratch_pool));
 
   /* Open the optional groups file */
   if (groups_path)
-    SVN_ERR(retrieve_config(&groups, groups_path, must_exist,
-                            scratch_pool, scratch_pool));
+    SVN_ERR(svn_repos__get_config(&groups_stream, &groups_checksum, access,
+                                  groups_path, must_exist, scratch_pool));
 
   /* Parse the configuration(s) and construct the full authz model from it. */
-  err = svn_authz__parse(authz_p, rules, groups, result_pool,
-                         scratch_pool);
+  err = svn_error_quick_wrapf(svn_authz__parse(authz_p, rules_stream,
+                                               groups_stream,
+                                               result_pool, scratch_pool),
+                              "Error while parsing authz file: '%s':",
+                              path);
 
-  /* Add the URL / file name to the error stack since the parser doesn't
-   * have it. */
-  if (err != SVN_NO_ERROR)
-    return svn_error_createf(err->apr_err, err,
-                             "Error while parsing config file: '%s':",
-                             path);
+  svn_repos__destroy_config_access(access);
 
-  return SVN_NO_ERROR;
+  return err;
 }
 
 
@@ -1597,8 +1602,8 @@ svn_repos_authz_read2(svn_authz_t **auth
   svn_authz_t *authz = apr_pcalloc(pool, sizeof(*authz));
   authz->pool = pool;
 
-  SVN_ERR(authz_read(&authz->full, path, groups_path, must_exist, pool,
-                     scratch_pool));
+  SVN_ERR(authz_read(&authz->full, path, groups_path, must_exist, NULL,
+                     pool, scratch_pool));
 
   svn_pool_destroy(scratch_pool);
 

Modified: subversion/branches/authzperf/subversion/tests/cmdline/svnauthz_tests.py
URL: http://svn.apache.org/viewvc/subversion/branches/authzperf/subversion/tests/cmdline/svnauthz_tests.py?rev=1770409&r1=1770408&r2=1770409&view=diff
==============================================================================
--- subversion/branches/authzperf/subversion/tests/cmdline/svnauthz_tests.py (original)
+++ subversion/branches/authzperf/subversion/tests/cmdline/svnauthz_tests.py Fri Nov 18 16:41:13
2016
@@ -590,7 +590,7 @@ def svnauthz_accessof_is_file_test(sbox)
   svntest.main.file_append(authz_path, "x\n")
   # Check that --is returns 1 when the syntax is invalid with a file..
   expected_out = svntest.verify.RegexOutput(
-      ".*Error while parsing config file:",
+      ".*Error while parsing authz file:",
       match_all=False
   )
   svntest.actions.run_and_verify_svnauthz(None, expected_out, 1, False,



Mime
View raw message