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 2013/03/28 23:34:28 UTC

svn commit: r1462331 - in /subversion/branches/1.7.x: ./ subversion/mod_dav_svn/lock.c

Author: breser
Date: Thu Mar 28 22:34:28 2013
New Revision: 1462331

URL: http://svn.apache.org/r1462331
Log:
Backport r1455352 onto 1.7.x:

 * r1455352
   Improve logic in mod_dav_svn's implementation of lock.
   Votes:
     +1: breser, philip, pburba


Modified:
    subversion/branches/1.7.x/   (props changed)
    subversion/branches/1.7.x/subversion/mod_dav_svn/lock.c

Propchange: subversion/branches/1.7.x/
------------------------------------------------------------------------------
  Merged /subversion/trunk:r1455352

Modified: subversion/branches/1.7.x/subversion/mod_dav_svn/lock.c
URL: http://svn.apache.org/viewvc/subversion/branches/1.7.x/subversion/mod_dav_svn/lock.c?rev=1462331&r1=1462330&r2=1462331&view=diff
==============================================================================
--- subversion/branches/1.7.x/subversion/mod_dav_svn/lock.c (original)
+++ subversion/branches/1.7.x/subversion/mod_dav_svn/lock.c Thu Mar 28 22:34:28 2013
@@ -640,6 +640,19 @@ append_locks(dav_lockdb *lockdb,
   svn_lock_t *slock;
   svn_error_t *serr;
   dav_error *derr;
+  dav_svn_repos *repos = resource->info->repos;
+      
+  /* We don't allow anonymous locks */
+  if (! repos->username)
+    return dav_svn__new_error(resource->pool, HTTP_UNAUTHORIZED,
+                              DAV_ERR_LOCK_SAVE_LOCK,
+                              "Anonymous lock creation is not allowed.");
+
+  /* Not a path in the repository so can't lock it. */
+  if (! resource->info->repos_path)
+    return dav_svn__new_error(resource->pool, HTTP_BAD_REQUEST,
+                              DAV_ERR_LOCK_SAVE_LOCK,
+                              "Attempted to lock path not in repository.");
 
   /* If the resource's fs path is unreadable, we don't allow a lock to
      be created on it. */
@@ -663,7 +676,6 @@ append_locks(dav_lockdb *lockdb,
       svn_fs_txn_t *txn;
       svn_fs_root_t *txn_root;
       const char *conflict_msg;
-      dav_svn_repos *repos = resource->info->repos;
       apr_hash_t *revprop_table = apr_hash_make(resource->pool);
       apr_hash_set(revprop_table, SVN_PROP_REVISION_AUTHOR,
                    APR_HASH_KEY_STRING, svn_string_create(repos->username,
@@ -741,14 +753,14 @@ append_locks(dav_lockdb *lockdb,
 
   /* Convert the dav_lock into an svn_lock_t. */
   derr = dav_lock_to_svn_lock(&slock, lock, resource->info->repos_path,
-                              info, resource->info->repos->is_svn_client,
+                              info, repos->is_svn_client,
                               resource->pool);
   if (derr)
     return derr;
 
   /* Now use the svn_lock_t to actually perform the lock. */
   serr = svn_repos_fs_lock(&slock,
-                           resource->info->repos->repos,
+                           repos->repos,
                            slock->path,
                            slock->token,
                            slock->comment,