Hi All,

I've raised http://subversion.tigris.org/issues/show_bug.cgi?id=4206 .

Here is the Description:

<Description>
Revision properties are now checked for read access during propedits. This is done by making a GET subrequest to each of the changed paths in that revision. GETs are always checked for read access only.

This enables anyone with ONLY read access to a path edit the log message for a revision that modified that path.

The attached patch special cases these subrequests by checking for write access for all GET requests except if they are subrequests of PROPFIND or REPORT (in which case they are checked for read access).
</Description>

Please share your thoughts on this.

Regards,
Arwin Arni
Index: subversion/mod_authz_svn/mod_authz_svn.c
===================================================================
--- subversion/mod_authz_svn/mod_authz_svn.c    (revision 1361944)
+++ subversion/mod_authz_svn/mod_authz_svn.c    (working copy)
@@ -291,9 +291,29 @@
       case M_COPY:
         authz_svn_type |= svn_authz_recursive;
 
+      /* M_GET should be treated specially.
+         If it is not a subrequest, check for read access.
+         If it is a subrequest of PROPFIND or REPORT, check read access.
+         For subrequests of all other methods, check for write access. */
+      case M_GET:
+        if (r->main == NULL)
+          {
+            authz_svn_type |= svn_authz_read;
+            break;
+          }
+        if (r->main->method_number == M_PROPFIND || r->main->method_number == 
M_REPORT)
+          {
+            authz_svn_type |= svn_authz_read;
+            break;
+          }
+        else
+          {
+            authz_svn_type |= svn_authz_write;
+            break;
+          }
+
       /* All methods requiring read access to r->uri */
       case M_OPTIONS:
-      case M_GET:
       case M_PROPFIND:
       case M_REPORT:
         authz_svn_type |= svn_authz_read;
@@ -615,12 +635,20 @@
    */
   if (repos_path)
     {
-      svn_err = svn_repos_authz_check_access(access_conf, repos_name,
-                                             repos_path,
-                                             username_to_authorize,
-                                             svn_authz_none|svn_authz_read,
-                                             &authz_access_granted,
-                                             r->pool);
+      if (r->method_number == M_PROPFIND || r->method_number == M_REPORT)
+        svn_err = svn_repos_authz_check_access(access_conf, repos_name,
+                                               repos_path,
+                                               username_to_authorize,
+                                               svn_authz_none|svn_authz_read,
+                                               &authz_access_granted,
+                                               r->pool);
+      else
+        svn_err = svn_repos_authz_check_access(access_conf, repos_name,
+                                               repos_path,
+                                               username_to_authorize,
+                                               svn_authz_none|svn_authz_write,
+                                               &authz_access_granted,
+                                               r->pool);
       if (svn_err)
         {
           ap_log_rerror(APLOG_MARK, APLOG_ERR,
* subversion/mod_authz_svn/mod_authz_svn.c
  (req_check_access,
   subreq_bypass)    : Special case GET subrequests and check for
                       read access only when they are children of
                       PROPFIND or REPORT. For all other cases,
                       check for read access.

Patch by     : Arwin Arni <arwin{_AT_}collab.net>
Suggested by : kameshj

Reply via email to