You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by st...@apache.org on 2017/01/01 10:43:41 UTC

svn commit: r1776832 [1/4] - in /subversion/trunk: ./ subversion/include/ subversion/include/private/ subversion/libsvn_fs_x/ subversion/libsvn_repos/ subversion/libsvn_subr/ subversion/mod_authz_svn/ subversion/mod_dav_svn/ subversion/svnserve/ subver...

Author: stefan2
Date: Sun Jan  1 10:43:40 2017
New Revision: 1776832

URL: http://svn.apache.org/viewvc?rev=1776832&view=rev
Log:
Merging branches/authzperf to /trunk and remove BRANCH-README.

Added:
    subversion/trunk/subversion/include/private/svn_config_private.h
      - copied unchanged from r1776831, subversion/branches/authzperf/subversion/include/private/svn_config_private.h
    subversion/trunk/subversion/libsvn_repos/authz.h
      - copied unchanged from r1776831, subversion/branches/authzperf/subversion/libsvn_repos/authz.h
    subversion/trunk/subversion/libsvn_repos/authz_info.c
      - copied unchanged from r1776831, subversion/branches/authzperf/subversion/libsvn_repos/authz_info.c
    subversion/trunk/subversion/libsvn_repos/authz_parse.c
      - copied unchanged from r1776831, subversion/branches/authzperf/subversion/libsvn_repos/authz_parse.c
    subversion/trunk/subversion/libsvn_repos/config_file.c
      - copied unchanged from r1776831, subversion/branches/authzperf/subversion/libsvn_repos/config_file.c
    subversion/trunk/subversion/libsvn_repos/config_file.h
      - copied unchanged from r1776831, subversion/branches/authzperf/subversion/libsvn_repos/config_file.h
    subversion/trunk/subversion/tests/libsvn_repos/authz-test.c
      - copied unchanged from r1776831, subversion/branches/authzperf/subversion/tests/libsvn_repos/authz-test.c
    subversion/trunk/subversion/tests/libsvn_repos/authz.groups
      - copied unchanged from r1776831, subversion/branches/authzperf/subversion/tests/libsvn_repos/authz.groups
    subversion/trunk/subversion/tests/libsvn_repos/authz.rules
      - copied unchanged from r1776831, subversion/branches/authzperf/subversion/tests/libsvn_repos/authz.rules
Removed:
    subversion/trunk/subversion/libsvn_repos/authz_pool.c
Modified:
    subversion/trunk/   (props changed)
    subversion/trunk/build.conf
    subversion/trunk/subversion/include/private/svn_object_pool.h
    subversion/trunk/subversion/include/private/svn_repos_private.h
    subversion/trunk/subversion/include/svn_repos.h
    subversion/trunk/subversion/include/svn_string.h
    subversion/trunk/subversion/libsvn_fs_x/   (props changed)
    subversion/trunk/subversion/libsvn_repos/authz.c
    subversion/trunk/subversion/libsvn_repos/config_pool.c
    subversion/trunk/subversion/libsvn_repos/deprecated.c
    subversion/trunk/subversion/libsvn_repos/repos.h
    subversion/trunk/subversion/libsvn_subr/config.c
    subversion/trunk/subversion/libsvn_subr/config_file.c
    subversion/trunk/subversion/libsvn_subr/config_impl.h
    subversion/trunk/subversion/libsvn_subr/object_pool.c
    subversion/trunk/subversion/libsvn_subr/string.c
    subversion/trunk/subversion/mod_authz_svn/mod_authz_svn.c
    subversion/trunk/subversion/mod_dav_svn/mod_dav_svn.c
    subversion/trunk/subversion/svnserve/serve.c
    subversion/trunk/subversion/svnserve/server.h
    subversion/trunk/subversion/svnserve/svnserve.c
    subversion/trunk/subversion/tests/cmdline/svnauthz_tests.py
    subversion/trunk/subversion/tests/libsvn_repos/repos-test.c
    subversion/trunk/subversion/tests/libsvn_subr/config-test.c
    subversion/trunk/subversion/tests/libsvn_subr/string-test.c
    subversion/trunk/tools/server-side/svnauthz.c

Propchange: subversion/trunk/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Sun Jan  1 10:43:40 2017
@@ -5,7 +5,7 @@
 /subversion/branches/1.9.x:1735680
 /subversion/branches/10Gb:1388102,1388163-1388190,1388195,1388202,1388205,1388211,1388276,1388362,1388375,1388394,1388636,1388639-1388640,1388643-1388644,1388654,1388720,1388789,1388795,1388801,1388805,1388807,1388810,1388816,1389044,1389276,1389289,1389662,1389867,1390017,1390209,1390216,1390407,1390409,1390414,1390419,1390955
 /subversion/branches/atomic-revprop:965046-1000689
-/subversion/branches/authzperf:1615360
+/subversion/branches/authzperf:1613053-1776831
 /subversion/branches/auto-props-sdc:1384106-1401643
 /subversion/branches/bdb-reverse-deltas:872050-872529
 /subversion/branches/cache-server:1458643-1476567

Modified: subversion/trunk/build.conf
URL: http://svn.apache.org/viewvc/subversion/trunk/build.conf?rev=1776832&r1=1776831&r2=1776832&view=diff
==============================================================================
--- subversion/trunk/build.conf (original)
+++ subversion/trunk/build.conf Sun Jan  1 10:43:40 2017
@@ -901,6 +901,14 @@ libs = libsvn_test libsvn_fs libsvn_delt
 # ----------------------------------------------------------------------------
 # Tests for libsvn_repos
 
+[authz-test]
+description = Test authz parsing in libsvn_repos
+type = exe
+path = subversion/tests/libsvn_repos
+sources = authz-test.c
+install = test
+libs = libsvn_test libsvn_repos libsvn_fs libsvn_delta libsvn_subr apriconv apr
+
 [repos-test]
 description = Test delta editor in libsvn_repos
 type = exe

Modified: subversion/trunk/subversion/include/private/svn_object_pool.h
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/include/private/svn_object_pool.h?rev=1776832&r1=1776831&r2=1776832&view=diff
==============================================================================
--- subversion/trunk/subversion/include/private/svn_object_pool.h (original)
+++ subversion/trunk/subversion/include/private/svn_object_pool.h Sun Jan  1 10:43:40 2017
@@ -65,80 +65,46 @@
 /* The opaque object container type. */
 typedef struct svn_object_pool__t svn_object_pool__t;
 
-/* Extract the actual object from the WRAPPER using optional information
- * from BATON (provided through #svn_object_pool__lookup) and return it.
- * The result will be used with POOL and must remain valid throughout
- * POOL's lifetime.
- *
- * It is legal to return a copy, allocated in POOL, of the wrapped object.
- */
-typedef void * (* svn_object_pool__getter_t)(void *wrapper,
-                                             void *baton,
-                                             apr_pool_t *pool);
-
-/* Copy the information from the SOURCE object wrapper into the already
- * existing *TARGET object wrapper using POOL for allocations and BATON
- * for optional context (provided through #svn_object_pool__insert).
- */
-typedef svn_error_t * (* svn_object_pool__setter_t)(void **target,
-                                                    void *source,
-                                                    void *baton,
-                                                    apr_pool_t *pool);
-
 /* Create a new object pool in POOL and return it in *OBJECT_POOL.
- * Objects will be extracted using GETTER and updated using SETTER.  Either
- * one (or both) may be NULL and the default implementation assumes that
- * wrapper == object and updating is a no-op.
+ * Objects are reference-counted and stored as opaque pointers.  Each
+ * must be allocated in a separate pool ceated by
+ * svn_object_pool__new_item_pool.  Unused objects get destroyed at
+ * the object pool's discretion.
  *
  * If THREAD_SAFE is not set, neither the object pool nor the object
  * references returned from it may be accessed from multiple threads.
  *
  * It is not legal to call any API on the object pool after POOL got
- * cleared or destroyed.  However, existing object references handed out
- * from the object pool remain valid and will keep the internal pool data
- * structures alive for as long as such object references exist.
+ * cleared or destroyed nor to use any objects from this object pool.
  */
 svn_error_t *
 svn_object_pool__create(svn_object_pool__t **object_pool,
-                        svn_object_pool__getter_t getter,
-                        svn_object_pool__setter_t setter,
                         svn_boolean_t thread_safe,
                         apr_pool_t *pool);
 
-/* Return the root pool containing the OBJECT_POOL and all sub-structures.
+/* Return a pool to allocate the new object.
  */
 apr_pool_t *
-svn_object_pool__new_wrapper_pool(svn_object_pool__t *object_pool);
-
-/* Return the mutex used to serialize all OBJECT_POOL access.
- */
-svn_mutex__t *
-svn_object_pool__mutex(svn_object_pool__t *object_pool);
-
-/* Return the number of object instances (used or unused) in OBJECT_POOL.
- */
-unsigned
-svn_object_pool__count(svn_object_pool__t *object_pool);
+svn_object_pool__new_item_pool(svn_object_pool__t *object_pool);
 
 /* In OBJECT_POOL, look for an available object by KEY and return a
  * reference to it in *OBJECT.  If none can be found, *OBJECT will be NULL.
- * BATON will be passed to OBJECT_POOL's getter function.  The reference
- * will be returned when *RESULT_POOL gets cleaned up or destroyed.
+ *
+ * The reference will be returned when *RESULT_POOL and may be destroyed
+ * or recycled by OBJECT_POOL.
  */
 svn_error_t *
 svn_object_pool__lookup(void **object,
                         svn_object_pool__t *object_pool,
                         svn_membuf_t *key,
-                        void *baton,
                         apr_pool_t *result_pool);
 
-/* Store the wrapped object WRAPPER under KEY in OBJECT_POOL and return
- * a reference to the object in *OBJECT (just like lookup).
+/* Store the object ITEM under KEY in OBJECT_POOL and return a reference
+ * to the object in *OBJECT (just like lookup).
  *
- * The object must have been created in WRAPPER_POOL and the latter must
- * be a sub-pool of OBJECT_POOL's root POOL (see #svn_object_pool__pool).
+ * The object must have been created in ITEM_POOL and the latter must
+ * have been created by svn_object_pool__new_item_pool.
  *
- * BATON will be passed to OBJECT_POOL's setter and getter functions.
  * The reference will be returned when *RESULT_POOL gets cleaned up or
  * destroyed.
  */
@@ -146,9 +112,8 @@ svn_error_t *
 svn_object_pool__insert(void **object,
                         svn_object_pool__t *object_pool,
                         const svn_membuf_t *key,
-                        void *wrapper,
-                        void *baton,
-                        apr_pool_t *wrapper_pool,
+                        void *item,
+                        apr_pool_t *item_pool,
                         apr_pool_t *result_pool);
 
 #endif /* SVN_OBJECT_POOL_H */

Modified: subversion/trunk/subversion/include/private/svn_repos_private.h
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/include/private/svn_repos_private.h?rev=1776832&r1=1776831&r2=1776832&view=diff
==============================================================================
--- subversion/trunk/subversion/include/private/svn_repos_private.h (original)
+++ subversion/trunk/subversion/include/private/svn_repos_private.h Sun Jan  1 10:43:40 2017
@@ -34,6 +34,7 @@
 #include "svn_editor.h"
 #include "svn_config.h"
 
+#include "private/svn_object_pool.h"
 #include "private/svn_string_private.h"
 
 #ifdef __cplusplus
@@ -127,28 +128,6 @@ svn_repos__replay_ev2(svn_fs_root_t *roo
                       void *authz_read_baton,
                       apr_pool_t *scratch_pool);
 
-/* Given a PATH which might be a relative repo URL (^/), an absolute
- * local repo URL (file://), an absolute path outside of the repo
- * or a location in the Windows registry.
- *
- * Retrieve the configuration data that PATH points at and parse it into
- * CFG_P allocated in POOL.
- *
- * If PATH cannot be parsed as a config file then an error is returned.  The
- * contents of CFG_P is then undefined.  If MUST_EXIST is TRUE, a missing
- * authz file is also an error.  The CASE_SENSITIVE controls the lookup
- * behavior for section and option names alike.
- *
- * REPOS_ROOT points at the root of the repos you are
- * going to apply the authz against, can be NULL if you are sure that you
- * don't have a repos relative URL in PATH. */
-svn_error_t *
-svn_repos__retrieve_config(svn_config_t **cfg_p,
-                           const char *path,
-                           svn_boolean_t must_exist,
-                           svn_boolean_t case_sensitive,
-                           apr_pool_t *pool);
-
 /**
  * Non-deprecated alias for svn_repos_get_logs4.
  *
@@ -183,7 +162,7 @@ svn_repos__get_logs_compat(svn_repos_t *
  * from multiple threads.  Configuration objects no longer referenced by
  * any user may linger for a while before being cleaned up.
  */
-typedef struct svn_repos__config_pool_t svn_repos__config_pool_t;
+typedef svn_object_pool__t svn_repos__config_pool_t;
 
 /* Create a new configuration pool object with a lifetime determined by
  * POOL and return it in *CONFIG_POOL.
@@ -200,11 +179,10 @@ svn_repos__config_pool_create(svn_repos_
  * configuration specified by PATH.  If the latter is a URL, we read the
  * data from a local repository.  CONFIG_POOL will store the configuration
  * and make further callers use the same instance if the content matches.
- * If KEY is not NULL, *KEY will be set to a unique ID - if available.
+ * Section and option names will be case-insensitive.
  *
  * If MUST_EXIST is TRUE, a missing config file is also an error, *CFG
- * is otherwise simply NULL.  The CASE_SENSITIVE controls the lookup
- * behavior for section and option names alike.
+ * is otherwise simply NULL.
  *
  * PREFERRED_REPOS is only used if it is not NULL and PATH is a URL.
  * If it matches the URL, access the repository through this object
@@ -217,72 +195,14 @@ svn_repos__config_pool_create(svn_repos_
  */
 svn_error_t *
 svn_repos__config_pool_get(svn_config_t **cfg,
-                           svn_membuf_t **key,
                            svn_repos__config_pool_t *config_pool,
                            const char *path,
                            svn_boolean_t must_exist,
-                           svn_boolean_t case_sensitive,
                            svn_repos_t *preferred_repos,
                            apr_pool_t *pool);
 
 /** @} */
 
-/**
- * @defgroup svn_authz_pool Authz object pool API
- * @{
- */
-
-/* Opaque thread-safe factory and container for authorization objects.
- *
- * Instances handed out are read-only and may be given to multiple callers
- * from multiple threads.  Authorization objects no longer referenced by
- * any user may linger for a while before being cleaned up.
- */
-typedef struct svn_repos__authz_pool_t svn_repos__authz_pool_t;
-
-/* Create a new authorization pool object with a lifetime determined by
- * POOL and return it in *AUTHZ_POOL.  CONFIG_POOL will be the common
- * source for the configuration data underlying the authz objects and must
- * remain valid at least until POOL cleanup.
- *
- * The THREAD_SAFE flag indicates whether the pool actually needs to be
- * thread-safe and POOL must be also be thread-safe if this flag is set.
- */
-svn_error_t *
-svn_repos__authz_pool_create(svn_repos__authz_pool_t **authz_pool,
-                             svn_repos__config_pool_t *config_pool,
-                             svn_boolean_t thread_safe,
-                             apr_pool_t *pool);
-
-/* Set *AUTHZ_P to a read-only reference to the current contents of the
- * authorization specified by PATH and GROUPS_PATH.  If these are URLs,
- * we read the data from a local repository (see #svn_repos_authz_read2).
- * AUTHZ_POOL will store the authz data and make further callers use the
- * same instance if the content matches.
- *
- * If MUST_EXIST is TRUE, a missing config file is also an error, *AUTHZ_P
- * is otherwise simply NULL.
- *
- * PREFERRED_REPOS is only used if it is not NULL and PATH is a URL.
- * If it matches the URL, access the repository through this object
- * instead of creating a new repo instance.  Note that this might not
- * return the latest content.
- *
- * POOL determines the minimum lifetime of *AUTHZ_P (may remain cached
- * after release) but must not exceed the lifetime of the pool provided to
- * svn_repos__authz_pool_create.
- */
-svn_error_t *
-svn_repos__authz_pool_get(svn_authz_t **authz_p,
-                          svn_repos__authz_pool_t *authz_pool,
-                          const char *path,
-                          const char *groups_path,
-                          svn_boolean_t must_exist,
-                          svn_repos_t *preferred_repos,
-                          apr_pool_t *pool);
-
-/** @} */
-
 /* Adjust mergeinfo paths and revisions in ways that are useful when loading
  * a dump stream.
  *

Modified: subversion/trunk/subversion/include/svn_repos.h
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/include/svn_repos.h?rev=1776832&r1=1776831&r2=1776832&view=diff
==============================================================================
--- subversion/trunk/subversion/include/svn_repos.h (original)
+++ subversion/trunk/subversion/include/svn_repos.h Sun Jan  1 10:43:40 2017
@@ -3951,6 +3951,17 @@ svn_repos_get_fs_build_parser(const svn_
 typedef struct svn_authz_t svn_authz_t;
 
 /**
+ * This should be called before any other authz function.
+ *
+ * @a pool must support multi-threaded access if the application will use
+ * authz from multiple threads.
+ *
+ * @since New in 1.10.
+ */
+svn_error_t *
+svn_repos_authz_initialize(apr_pool_t *pool);
+
+/**
  * Read authz configuration data from @a path (a dirent, an absolute file url
  * or a registry path) into @a *authz_p, allocated in @a pool.
  *
@@ -3963,8 +3974,29 @@ typedef struct svn_authz_t svn_authz_t;
  * is also an error other than #SVN_ERR_AUTHZ_INVALID_CONFIG (exact error
  * depends on the access type).
  *
+ * For efficient access of in-repository authz, you may provide @a repos_hint
+ * which will be tried first and may remove the need to open a temporary
+ * repository instance.  Otherwise, set it to NULL and the repositories will
+ * be opened as needed.
+ *
+ * @since New in 1.10.
+ */
+svn_error_t *
+svn_repos_authz_read3(svn_authz_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);
+
+/**
+ * Similar to svn_repos_authz_read3(), but with @a repos_hint set to @c NULL.
+ *
  * @since New in 1.8.
+ * @deprecated Provided for backward compatibility with the 1.9 API.
  */
+SVN_DEPRECATED
 svn_error_t *
 svn_repos_authz_read2(svn_authz_t **authz_p,
                       const char *path,

Modified: subversion/trunk/subversion/include/svn_string.h
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/include/svn_string.h?rev=1776832&r1=1776831&r2=1776832&view=diff
==============================================================================
--- subversion/trunk/subversion/include/svn_string.h (original)
+++ subversion/trunk/subversion/include/svn_string.h Sun Jan  1 10:43:40 2017
@@ -294,6 +294,14 @@ svn_stringbuf_isempty(const svn_stringbu
 void
 svn_stringbuf_chop(svn_stringbuf_t *str, apr_size_t nbytes);
 
+/**
+ * Chop @a nbytes bytes off the start of @a str, but not more than @a str->len.
+ *
+ * @since New in 1.10.
+ */
+void
+svn_stringbuf_leftchop(svn_stringbuf_t *str, apr_size_t nbytes);
+
 /** Fill @a str with character @a c. */
 void
 svn_stringbuf_fillchar(svn_stringbuf_t *str, unsigned char c);
@@ -404,6 +412,16 @@ svn_stringbuf_replace(svn_stringbuf_t *s
                       const char *bytes,
                       apr_size_t new_count);
 
+/** Replace all occurrences of @a to_find in @a str with @a replacement.
+ * Return the number of replacements made.
+ *
+ * @since New in 1.10.
+ */
+apr_size_t
+svn_stringbuf_replace_all(svn_stringbuf_t *str,
+                          const char *to_find,
+                          const char *replacement);
+
 /** Return a duplicate of @a original_string. */
 svn_stringbuf_t *
 svn_stringbuf_dup(const svn_stringbuf_t *original_string, apr_pool_t *pool);

Propchange: subversion/trunk/subversion/libsvn_fs_x/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Sun Jan  1 10:43:40 2017
@@ -3,6 +3,7 @@
 /subversion/branches/1.7.x-fs-verify/subversion/libsvn_fs_x:1146708,1161180
 /subversion/branches/10Gb/subversion/libsvn_fs_x:1388102,1388163-1388190,1388195,1388202,1388205,1388211,1388276,1388362,1388375,1388394,1388636,1388639-1388640,1388643-1388644,1388654,1388720,1388789,1388795,1388801,1388805,1388807,1388810,1388816,1389044,1389276,1389289,1389662,1389867,1390017,1390209,1390216,1390407,1390409,1390414,1390419,1390955
 /subversion/branches/atomic-revprop/subversion/libsvn_fs_x:965046-1000689
+/subversion/branches/authzperf/subversion/libsvn_fs_x:1613053-1776831
 /subversion/branches/auto-props-sdc/subversion/libsvn_fs_x:1384106-1401643
 /subversion/branches/bdb-reverse-deltas/subversion/libsvn_fs_x:872050-872529
 /subversion/branches/cache-server/subversion/libsvn_fs_x:1458643-1476567