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 2013/11/14 17:08:16 UTC

svn commit: r1541948 - in /subversion/trunk/subversion: include/private/svn_repos_private.h libsvn_repos/authz_pool.c libsvn_repos/config_pool.c

Author: stefan2
Date: Thu Nov 14 16:08:16 2013
New Revision: 1541948

URL: http://svn.apache.org/r1541948
Log:
Add support for REGISTRY: urls as config / authz path to match the
"plain" svn_config* / svn_repos_authz* functionality.  For now, we
simply and inefficiently fall back to the "plain" functionality.

* subversion/include/private/svn_repos_private.h
  (svn_repos__config_pool_get,
   svn_repos__authz_pool_get): 'REGISTRY:' urls are now supported

* subversion/libsvn_repos/config_pool.c
  (svn_repos__config_pool_get): Make sure we set *KEY to a defined value
                                if we don't know a key

* subversion/libsvn_repos/authz_pool.c
  (svn_repos__authz_pool_get): Fall back to non-cached reader in case
                               we run into any special case

Modified:
    subversion/trunk/subversion/include/private/svn_repos_private.h
    subversion/trunk/subversion/libsvn_repos/authz_pool.c
    subversion/trunk/subversion/libsvn_repos/config_pool.c

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=1541948&r1=1541947&r2=1541948&view=diff
==============================================================================
--- subversion/trunk/subversion/include/private/svn_repos_private.h (original)
+++ subversion/trunk/subversion/include/private/svn_repos_private.h Thu Nov 14 16:08:16 2013
@@ -175,10 +175,9 @@ svn_repos__config_pool_create(svn_repos_
 
 /* Set *CFG to a read-only reference to the current contents of the
  * configuration specified by PATH.  If the latter is a URL, we read the
- * data from a local repository.  REGISTRY: urls are not supported.
- * 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.
+ * 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.
  *
  * If MUST_EXIST is TRUE, a missing config file is also an error, *CFG
  * is otherwise simply NULL.  The CASE_SENSITIVE controls the lookup
@@ -234,8 +233,8 @@ svn_repos__authz_pool_create(svn_repos__
 /* 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).
- * REGISTRY: urls are not supported.  AUTHZ_POOL will store the authz data
- * and make further callers use the same instance if the content matches.
+ * 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.

Modified: subversion/trunk/subversion/libsvn_repos/authz_pool.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_repos/authz_pool.c?rev=1541948&r1=1541947&r2=1541948&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_repos/authz_pool.c (original)
+++ subversion/trunk/subversion/libsvn_repos/authz_pool.c Thu Nov 14 16:08:16 2013
@@ -38,6 +38,7 @@
 #include "../libsvn_subr/config_impl.h"
 
 #include "repos.h"
+#include <apr_poll.h>
 
 /* Currently this structure is just a wrapper around a svn_config_t.
  */
@@ -155,20 +156,33 @@ svn_repos__authz_pool_get(svn_authz_t **
     = svn_pool_create(svn_object_pool__pool(authz_pool->object_pool));
   authz_object_t *authz_ref
     = apr_pcalloc(authz_ref_pool, sizeof(*authz_ref));
-
+  svn_boolean_t have_all_keys;
+  
+  /* read the configurations */
   SVN_ERR(svn_repos__config_pool_get(&authz_ref->authz_cfg,
                                      &authz_ref->authz_key,
                                      authz_pool->config_pool,
                                      path, must_exist, TRUE,
                                      preferred_repos, authz_ref_pool));
-
+  have_all_keys = authz_ref->authz_key != NULL;
+  
   if (groups_path)
-    SVN_ERR(svn_repos__config_pool_get(&authz_ref->groups_cfg,
-                                       &authz_ref->groups_key,
-                                       authz_pool->config_pool,
-                                       groups_path, must_exist, TRUE,
-                                       preferred_repos, authz_ref_pool));
+    {
+      SVN_ERR(svn_repos__config_pool_get(&authz_ref->groups_cfg,
+                                         &authz_ref->groups_key,
+                                         authz_pool->config_pool,
+                                         groups_path, must_exist, TRUE,
+                                         preferred_repos, authz_ref_pool));
+      have_all_keys &= authz_ref->groups_key != NULL;
+    }
 
+  /* fall back to standard implementation in case we don't have all the 
+   * facts (i.e. keys). */
+  if (!have_all_keys)
+    return svn_error_trace(svn_repos_authz_read2(authz_p, path, groups_path,
+                                                 must_exist, pool));
+    
+  /* all keys are known and lookup is unambigious. */
   authz_ref->key = construct_key(authz_ref->authz_key,
                                  authz_ref->groups_key,
                                  authz_ref_pool);

Modified: subversion/trunk/subversion/libsvn_repos/config_pool.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_repos/config_pool.c?rev=1541948&r1=1541947&r2=1541948&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_repos/config_pool.c (original)
+++ subversion/trunk/subversion/libsvn_repos/config_pool.c Thu Nov 14 16:08:16 2013
@@ -472,9 +472,11 @@ svn_repos__config_pool_get(svn_config_t 
   apr_pool_t *scratch_pool = svn_pool_create(pool);
 
   /* make sure we always have a *KEY object */
-  svn_membuf_t *local_key;
+  svn_membuf_t *local_key = NULL;
   if (key == NULL)
     key = &local_key;
+  else
+    *key = NULL;
 
   if (svn_path_is_url(path))
     {