You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by cm...@apache.org on 2012/10/01 17:59:24 UTC

svn commit: r1392410 - in /subversion/trunk/subversion/mod_dav_svn: dav_svn.h mod_dav_svn.c version.c

Author: cmpilato
Date: Mon Oct  1 15:59:23 2012
New Revision: 1392410

URL: http://svn.apache.org/viewvc?rev=1392410&view=rev
Log:
For issue #4124 ("Give servers sufficient means to disallow commits
from clients based on version numbers"): Provide a new Apache config
directive (SVNAdvertiseEphemeralTXNProps) for explicitly enabling or
disabling the advertised support of ephemeral transaction properties
to clients.  This is useful when, for example, standing up a 1.8
proxying slave server in front of a pre-1.7 server (which doesn't
support ephemeral txnprops).

Suggested by: rhuijben

* subversion/mod_dav_svn/dav_svn.h
  (dav_svn__get_ephemeral_txnprops_flag): New.

* subversion/mod_dav_svn/mod_dav_svn.c
  (dir_conf_t): Add 'ephemeral_txnprops' member.
  (create_dir_config): Set default value of ephemeral_txnprops flag to "on".
  (merge_dir_config): Inherit the ephemeral_txnprops flag, too.
  (dav_svn__get_ephemeral_txnprops_flag): New.
  (SVNAdvertiseEphemeralTXNProps_cmd): New.
  (cmds): Register SVNAdvertiseEphemeralTXNProps_cmd callback and
    related configuration directive.

* subversion/mod_dav_svn/version.c
  (get_vsn_options): Stop adding the ephemeral txnprop support DAV:
     header here...
  (get_option): ...and do it here, conditionally, instead.

Modified:
    subversion/trunk/subversion/mod_dav_svn/dav_svn.h
    subversion/trunk/subversion/mod_dav_svn/mod_dav_svn.c
    subversion/trunk/subversion/mod_dav_svn/version.c

Modified: subversion/trunk/subversion/mod_dav_svn/dav_svn.h
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/mod_dav_svn/dav_svn.h?rev=1392410&r1=1392409&r2=1392410&view=diff
==============================================================================
--- subversion/trunk/subversion/mod_dav_svn/dav_svn.h (original)
+++ subversion/trunk/subversion/mod_dav_svn/dav_svn.h Mon Oct  1 15:59:23 2012
@@ -307,6 +307,10 @@ svn_boolean_t dav_svn__get_bulk_updates_
 /* for the repository referred to by this request, should httpv2 be advertised? */
 svn_boolean_t dav_svn__get_v2_protocol_flag(request_rec *r);
 
+/* for the repository referred to by this request, should ephemeral
+   txnprop support be advertised? */
+svn_boolean_t dav_svn__get_ephemeral_txnprops_flag(request_rec *r);
+
 /* for the repository referred to by this request, are subrequests active? */
 svn_boolean_t dav_svn__get_pathauthz_flag(request_rec *r);
 

Modified: subversion/trunk/subversion/mod_dav_svn/mod_dav_svn.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/mod_dav_svn/mod_dav_svn.c?rev=1392410&r1=1392409&r2=1392410&view=diff
==============================================================================
--- subversion/trunk/subversion/mod_dav_svn/mod_dav_svn.c (original)
+++ subversion/trunk/subversion/mod_dav_svn/mod_dav_svn.c Mon Oct  1 15:59:23 2012
@@ -88,6 +88,7 @@ typedef struct dir_conf_t {
   enum conf_flag autoversioning;     /* whether autoversioning is active */
   enum conf_flag bulk_updates;       /* whether bulk updates are allowed */
   enum conf_flag v2_protocol;        /* whether HTTP v2 is advertised */
+  enum conf_flag ephemeral_txnprops; /* advertise ephemeral txnprop support? */
   enum path_authz_conf path_authz_method; /* how GET subrequests are handled */
   enum conf_flag list_parentpath;    /* whether to allow GET of parentpath */
   const char *root_dir;              /* our top-level directory */
@@ -196,6 +197,7 @@ create_dir_config(apr_pool_t *p, char *d
     conf->root_dir = svn_urlpath__canonicalize(dir, p);
   conf->bulk_updates = CONF_FLAG_ON;
   conf->v2_protocol = CONF_FLAG_ON;
+  conf->ephemeral_txnprops = CONF_FLAG_ON;
   conf->hooks_env = NULL;
 
   return conf;
@@ -221,6 +223,8 @@ merge_dir_config(apr_pool_t *p, void *ba
   newconf->autoversioning = INHERIT_VALUE(parent, child, autoversioning);
   newconf->bulk_updates = INHERIT_VALUE(parent, child, bulk_updates);
   newconf->v2_protocol = INHERIT_VALUE(parent, child, v2_protocol);
+  newconf->ephemeral_txnprops = INHERIT_VALUE(parent, child,
+                                              ephemeral_txnprops);
   newconf->path_authz_method = INHERIT_VALUE(parent, child, path_authz_method);
   newconf->list_parentpath = INHERIT_VALUE(parent, child, list_parentpath);
   newconf->txdelta_cache = INHERIT_VALUE(parent, child, txdelta_cache);
@@ -346,6 +350,20 @@ SVNAdvertiseV2Protocol_cmd(cmd_parms *cm
 
 
 static const char *
+SVNAdvertiseEphemeralTXNProps_cmd(cmd_parms *cmd, void *config, int arg)
+{
+  dir_conf_t *conf = config;
+
+  if (arg)
+    conf->ephemeral_txnprops = CONF_FLAG_ON;
+  else
+    conf->ephemeral_txnprops = CONF_FLAG_OFF;
+
+  return NULL;
+}
+
+
+static const char *
 SVNPathAuthz_cmd(cmd_parms *cmd, void *config, const char *arg1)
 {
   dir_conf_t *conf = config;
@@ -761,6 +779,16 @@ dav_svn__get_v2_protocol_flag(request_re
 }
 
 
+svn_boolean_t
+dav_svn__get_ephemeral_txnprops_flag(request_rec *r)
+{
+  dir_conf_t *conf;
+
+  conf = ap_get_module_config(r->per_dir_config, &dav_svn_module);
+  return conf->ephemeral_txnprops == CONF_FLAG_ON;
+}
+
+
 /* FALSE if path authorization should be skipped.
  * TRUE if either the bypass or the apache subrequest methods should be used.
  */
@@ -1061,6 +1089,12 @@ static const command_rec cmds[] =
                "Subversion's HTTP protocol (default values is On)."),
 
   /* per directory/location */
+  AP_INIT_FLAG("SVNAdvertiseEphemeralTXNProps",
+               SVNAdvertiseEphemeralTXNProps_cmd, NULL, ACCESS_CONF|RSRC_CONF,
+               "enables server advertising of support for ephemeral "
+               "commit transaction properties (default value is On)."),
+
+  /* per directory/location */
   AP_INIT_FLAG("SVNCacheTextDeltas", SVNCacheTextDeltas_cmd, NULL,
                ACCESS_CONF|RSRC_CONF,
                "speeds up data access to older revisions by caching "

Modified: subversion/trunk/subversion/mod_dav_svn/version.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/mod_dav_svn/version.c?rev=1392410&r1=1392409&r2=1392410&view=diff
==============================================================================
--- subversion/trunk/subversion/mod_dav_svn/version.c (original)
+++ subversion/trunk/subversion/mod_dav_svn/version.c Mon Oct  1 15:59:23 2012
@@ -146,7 +146,6 @@ get_vsn_options(apr_pool_t *p, apr_text_
   apr_text_append(p, phdr, SVN_DAV_NS_DAV_SVN_LOG_REVPROPS);
   apr_text_append(p, phdr, SVN_DAV_NS_DAV_SVN_ATOMIC_REVPROPS);
   apr_text_append(p, phdr, SVN_DAV_NS_DAV_SVN_PARTIAL_REPLAY);
-  apr_text_append(p, phdr, SVN_DAV_NS_DAV_SVN_EPHEMERAL_TXNPROPS);
   /* Mergeinfo is a special case: here we merely say that the server
    * knows how to handle mergeinfo -- whether the repository does too
    * is a separate matter.
@@ -193,6 +192,14 @@ get_option(const dav_resource *resource,
         }
     }
 
+  /* If we're allowed (by configuration) to do so, advertise support
+     for ephemeral transaction properties. */
+  if (dav_svn__get_ephemeral_txnprops_flag(r))
+    {
+      apr_table_addn(r->headers_out, "DAV",
+                     SVN_DAV_NS_DAV_SVN_EPHEMERAL_TXNPROPS);
+    }
+
   if (resource->info->repos->fs)
     {
       svn_error_t *serr;