subversion-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cmpil...@apache.org
Subject svn commit: r933299 - in /subversion/trunk/subversion: libsvn_client/update.c tests/cmdline/authz_tests.py
Date Mon, 12 Apr 2010 16:17:23 GMT
Author: cmpilato
Date: Mon Apr 12 16:17:23 2010
New Revision: 933299

URL: http://svn.apache.org/viewvc?rev=933299&view=rev
Log:
Fix another scenario related to issue #3242:

   - user has no access in repo root, only in /project
   - someone else renames some file below /project and commits
   - user tries to update his working copy of /project
     (that still has the old name)
   - update deletes the old name and then fails with
     "access to 'http://host/repo-root' forbidden"

* subversion/libsvn_client/update.c
  (struct ff_baton): Update comment.
  (file_fetcher): Open (or reparent, if already opened) auxiliary RA
    session at parent directory of to-be-fetched file instead of at
    the repository root.

* subversion/tests/cmdline/authz_tests.py
  (authz_access_required_at_repo_root2): New test.
  (test_list): Add reference to new test.

Patch by: Roderich Schupp <roderich.schupp{_AT_}googlemail.com>
          (Tweaked by me.)

Modified:
    subversion/trunk/subversion/libsvn_client/update.c
    subversion/trunk/subversion/tests/cmdline/authz_tests.py

Modified: subversion/trunk/subversion/libsvn_client/update.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_client/update.c?rev=933299&r1=933298&r2=933299&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_client/update.c (original)
+++ subversion/trunk/subversion/libsvn_client/update.c Mon Apr 12 16:17:23 2010
@@ -49,7 +49,7 @@
 struct ff_baton
 {
   svn_client_ctx_t *ctx;       /* client context used to open ra session */
-  const char *repos_root;      /* the root of the ra session */
+  const char *repos_root;      /* repository root URL */
   svn_ra_session_t *session;   /* the secondary ra session itself */
   apr_pool_t *pool;            /* the pool where the ra session is allocated */
 };
@@ -68,13 +68,21 @@ file_fetcher(void *baton,
              apr_pool_t *pool)
 {
   struct ff_baton *ffb = (struct ff_baton *)baton;
+  const char *dirpath, *base_name, *session_url, *old_session_url;
 
-  if (! ffb->session)
-    SVN_ERR(svn_client__open_ra_session_internal(&(ffb->session),
-                                                 ffb->repos_root,
+  svn_relpath_split(path, &dirpath, &base_name, pool);
+  session_url = svn_path_url_add_component2(ffb->repos_root, 
+                                            dirpath, pool);
+
+  if (ffb->session)
+    SVN_ERR(svn_client__ensure_ra_session_url(&old_session_url, ffb->session,
+                                              session_url, ffb->pool));
+  else
+    SVN_ERR(svn_client__open_ra_session_internal(&(ffb->session), session_url,
                                                  NULL, NULL, FALSE, TRUE,
                                                  ffb->ctx, ffb->pool));
-  return svn_ra_get_file(ffb->session, path, revision, stream,
+
+  return svn_ra_get_file(ffb->session, base_name, revision, stream,
                          fetched_rev, props, pool);
 }
 

Modified: subversion/trunk/subversion/tests/cmdline/authz_tests.py
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/tests/cmdline/authz_tests.py?rev=933299&r1=933298&r2=933299&view=diff
==============================================================================
--- subversion/trunk/subversion/tests/cmdline/authz_tests.py (original)
+++ subversion/trunk/subversion/tests/cmdline/authz_tests.py Mon Apr 12 16:17:23 2010
@@ -903,6 +903,42 @@ def authz_access_required_at_repo_root(s
                        root_url + '/A-copy/B/E/beta',
                        root_url + '/A-copy/C')
 
+def authz_access_required_at_repo_root2(sbox):
+  "more authz issue #3242 - update to renamed file"
+
+  sbox.build(create_wc = False)
+  root_url = sbox.repo_url
+
+  # Now we get all restrictive.
+  write_authz_file(sbox, {'/': '* =',
+                          '/A': 'jrandom = rw'})
+  write_restrictive_svnserve_conf(sbox.repo_dir)
+
+  # Rename a file.
+  svntest.main.run_svn(None, 'mv',
+                       '-m', 'rename file in readable writable space',
+                       root_url + '/A/B/E/alpha',
+                       root_url + '/A/B/E/alpha-renamed')
+  
+  # Check out original greek sub tree below /A/B/E 
+  # and update it to the above rename.
+  wc_dir = sbox.add_wc_path('ABE')
+  os.mkdir(wc_dir)
+  svntest.main.run_svn(None, 'co', '-r', '1', root_url + '/A/B/E', wc_dir)
+  svntest.main.run_svn(None, 'up', wc_dir)
+
+  # Rename a directory.
+  svntest.main.run_svn(None, 'mv',
+                       '-m', 'rename diretory in readable writable space',
+                       root_url + '/A/D/H',
+                       root_url + '/A/D/a g e')
+  
+  # Check out original greek sub tree below /A/D
+  # and update it to the above rename.
+  wc_dir = sbox.add_wc_path('AD')
+  os.mkdir(wc_dir)
+  svntest.main.run_svn(None, 'co', '-r', '1', root_url + '/A/D', wc_dir)
+  svntest.main.run_svn(None, 'up', wc_dir)
 
 def multiple_matches(sbox):
   "multiple lines matching a user"
@@ -962,6 +998,8 @@ test_list = [ None,
                          svntest.main.is_ra_type_file)),
               Skip(authz_access_required_at_repo_root,
                    svntest.main.is_ra_type_file),
+              Skip(authz_access_required_at_repo_root2,
+                   svntest.main.is_ra_type_file),
               Skip(multiple_matches, svntest.main.is_ra_type_file),
              ]
 



Mime
View raw message