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/02/04 21:48:13 UTC
svn commit: r1442344 [25/39] - in /subversion/branches/fsfs-format7: ./
build/ build/ac-macros/ build/generator/ build/generator/templates/
build/win32/ contrib/client-side/emacs/
contrib/server-side/fsfsfixer/fixer/ contrib/server-side/svncutter/ doc/...
Modified: subversion/branches/fsfs-format7/subversion/libsvn_wc/wc_db_util.c
URL: http://svn.apache.org/viewvc/subversion/branches/fsfs-format7/subversion/libsvn_wc/wc_db_util.c?rev=1442344&r1=1442343&r2=1442344&view=diff
==============================================================================
--- subversion/branches/fsfs-format7/subversion/libsvn_wc/wc_db_util.c (original)
+++ subversion/branches/fsfs-format7/subversion/libsvn_wc/wc_db_util.c Mon Feb 4 20:48:05 2013
@@ -136,6 +136,22 @@ svn_wc__db_util_open_db(svn_sqlite__db_t
svn_dirent_local_style(sdb_abspath,
scratch_pool));
}
+#ifndef WIN32
+ else
+ {
+ apr_file_t *f;
+
+ /* A standard SQLite build creates a DB with mode 644 ^ !umask
+ which means the file doesn't have group/world write access
+ even when umask allows it. By ensuring the file exists before
+ SQLite gets involved we give it the permissions allowed by
+ umask. */
+ SVN_ERR(svn_io_file_open(&f, sdb_abspath,
+ (APR_READ | APR_WRITE | APR_CREATE),
+ APR_OS_DEFAULT, scratch_pool));
+ SVN_ERR(svn_io_file_close(f, scratch_pool));
+ }
+#endif
SVN_ERR(svn_sqlite__open(sdb, sdb_abspath, smode,
my_statements ? my_statements : statements,
@@ -153,8 +169,8 @@ svn_wc__db_util_open_db(svn_sqlite__db_t
/* Some helpful transaction helpers.
- Instead of directly using SQLite transactions, these wrappers take care of
- simple cases by allowing consumers to worry about wrapping the wcroot and
+ Instead of directly using SQLite transactions, these wrappers
+ relieve the consumer from the need to wrap the wcroot and
local_relpath, which are almost always used within the transaction.
This also means if we later want to implement some wc_db-specific txn
Modified: subversion/branches/fsfs-format7/subversion/libsvn_wc/wc_db_wcroot.c
URL: http://svn.apache.org/viewvc/subversion/branches/fsfs-format7/subversion/libsvn_wc/wc_db_wcroot.c?rev=1442344&r1=1442343&r2=1442344&view=diff
==============================================================================
--- subversion/branches/fsfs-format7/subversion/libsvn_wc/wc_db_wcroot.c (original)
+++ subversion/branches/fsfs-format7/subversion/libsvn_wc/wc_db_wcroot.c Mon Feb 4 20:48:05 2013
@@ -188,20 +188,36 @@ close_wcroot(void *data)
svn_error_t *
svn_wc__db_open(svn_wc__db_t **db,
svn_config_t *config,
- svn_boolean_t auto_upgrade,
+ svn_boolean_t open_without_upgrade,
svn_boolean_t enforce_empty_wq,
apr_pool_t *result_pool,
apr_pool_t *scratch_pool)
{
*db = apr_pcalloc(result_pool, sizeof(**db));
(*db)->config = config;
- (*db)->auto_upgrade = auto_upgrade;
+ (*db)->verify_format = !open_without_upgrade;
(*db)->enforce_empty_wq = enforce_empty_wq;
(*db)->dir_data = apr_hash_make(result_pool);
+ (*db)->state_pool = result_pool;
+
/* Don't need to initialize (*db)->parse_cache, due to the calloc above */
+ if (config)
+ {
+ svn_error_t *err;
+ svn_boolean_t sqlite_exclusive = FALSE;
- (*db)->state_pool = result_pool;
+ err = svn_config_get_bool(config, &sqlite_exclusive,
+ SVN_CONFIG_SECTION_WORKING_COPY,
+ SVN_CONFIG_OPTION_SQLITE_EXCLUSIVE,
+ FALSE);
+ if (err)
+ {
+ svn_error_clear(err);
+ }
+ else
+ (*db)->exclusive = sqlite_exclusive;
+ }
return SVN_NO_ERROR;
}
@@ -240,7 +256,7 @@ svn_wc__db_pdh_create_wcroot(svn_wc__db_
svn_sqlite__db_t *sdb,
apr_int64_t wc_id,
int format,
- svn_boolean_t auto_upgrade,
+ svn_boolean_t verify_format,
svn_boolean_t enforce_empty_wq,
apr_pool_t *result_pool,
apr_pool_t *scratch_pool)
@@ -278,7 +294,7 @@ svn_wc__db_pdh_create_wcroot(svn_wc__db_
/* Verify that no work items exists. If they do, then our integrity is
suspect and, thus, we cannot use this database. */
if (format >= SVN_WC__HAS_WORK_QUEUE
- && (enforce_empty_wq || (format < SVN_WC__VERSION && auto_upgrade)))
+ && (enforce_empty_wq || (format < SVN_WC__VERSION && verify_format)))
{
svn_error_t *err = verify_no_work(sdb);
if (err)
@@ -286,7 +302,7 @@ svn_wc__db_pdh_create_wcroot(svn_wc__db_
/* Special message for attempts to upgrade a 1.7-dev wc with
outstanding workqueue items. */
if (err->apr_err == SVN_ERR_WC_CLEANUP_REQUIRED
- && format < SVN_WC__VERSION && auto_upgrade)
+ && format < SVN_WC__VERSION && verify_format)
err = svn_error_quick_wrap(err, _("Cleanup with an older 1.7 "
"client before upgrading with "
"this client"));
@@ -295,23 +311,16 @@ svn_wc__db_pdh_create_wcroot(svn_wc__db_
}
/* Auto-upgrade the SDB if possible. */
- if (format < SVN_WC__VERSION)
+ if (format < SVN_WC__VERSION && verify_format)
{
- if (auto_upgrade)
- {
- if (format >= SVN_WC__WC_NG_VERSION)
- SVN_ERR(svn_wc__upgrade_sdb(&format, wcroot_abspath, sdb, format,
- scratch_pool));
- }
- else
- return svn_error_createf(SVN_ERR_WC_UPGRADE_REQUIRED, NULL,
- _("The working copy at '%s'\nis too old "
- "(format %d) to work with client version "
- "'%s' (expects format %d). You need to "
- "upgrade the working copy first.\n"),
- svn_dirent_local_style(wcroot_abspath,
- scratch_pool), format, SVN_VERSION,
- SVN_WC__VERSION);
+ return svn_error_createf(SVN_ERR_WC_UPGRADE_REQUIRED, NULL,
+ _("The working copy at '%s'\nis too old "
+ "(format %d) to work with client version "
+ "'%s' (expects format %d). You need to "
+ "upgrade the working copy first.\n"),
+ svn_dirent_local_style(wcroot_abspath,
+ scratch_pool),
+ format, SVN_VERSION, SVN_WC__VERSION);
}
*wcroot = apr_palloc(result_pool, sizeof(**wcroot));
@@ -524,18 +533,6 @@ svn_wc__db_wcroot_parse_local_abspath(sv
if (adm_subdir_kind == svn_node_dir)
{
- svn_boolean_t sqlite_exclusive = FALSE;
-
- err = svn_config_get_bool(db->config, &sqlite_exclusive,
- SVN_CONFIG_SECTION_WORKING_COPY,
- SVN_CONFIG_OPTION_SQLITE_EXCLUSIVE,
- FALSE);
- if (err)
- {
- svn_error_clear(err);
- sqlite_exclusive = FALSE;
- }
-
/* We always open the database in read/write mode. If the database
isn't writable in the filesystem, SQLite will internally open
it as read-only, and we'll get an error if we try to do a write
@@ -546,7 +543,7 @@ svn_wc__db_wcroot_parse_local_abspath(sv
as the filesystem allows. */
err = svn_wc__db_util_open_db(&sdb, local_abspath, SDB_FILE,
svn_sqlite__mode_readwrite,
- sqlite_exclusive, NULL,
+ db->exclusive, NULL,
db->state_pool, scratch_pool);
if (err == NULL)
{
@@ -668,7 +665,7 @@ try_symlink_as_dir:
err = svn_wc__db_pdh_create_wcroot(wcroot,
apr_pstrdup(db->state_pool, local_abspath),
sdb, wc_id, FORMAT_FROM_SDB,
- db->auto_upgrade, db->enforce_empty_wq,
+ db->verify_format, db->enforce_empty_wq,
db->state_pool, scratch_pool);
if (err && (err->apr_err == SVN_ERR_WC_UNSUPPORTED_FORMAT ||
err->apr_err == SVN_ERR_WC_UPGRADE_REQUIRED) &&
@@ -685,11 +682,58 @@ try_symlink_as_dir:
}
else
{
- /* We found a wc-1 working copy directory. */
+ /* We found something that looks like a wc-1 working copy directory.
+ However, if the format version is 12 and the .svn/entries file
+ is only 3 bytes long, then it's a breadcrumb in a wc-ng working
+ copy that's missing an .svn/wc.db, or its .svn/wc.db is corrupt. */
+ if (wc_format == SVN_WC__WC_NG_VERSION /* 12 */)
+ {
+ apr_finfo_t info;
+
+ /* Check attributes of .svn/entries */
+ const char *admin_abspath = svn_wc__adm_child(
+ local_abspath, SVN_WC__ADM_ENTRIES, scratch_pool);
+ svn_error_t *err = svn_io_stat(&info, admin_abspath, APR_FINFO_SIZE,
+ scratch_pool);
+
+ /* If the former does not succeed, something is seriously wrong. */
+ if (err)
+ return svn_error_createf(
+ SVN_ERR_WC_CORRUPT, err,
+ _("The working copy at '%s' is corrupt."),
+ svn_dirent_local_style(local_abspath, scratch_pool));
+ svn_error_clear(err);
+
+ if (3 == info.size)
+ {
+ /* Check existence of .svn/wc.db */
+ admin_abspath = svn_wc__adm_child(local_abspath, SDB_FILE,
+ scratch_pool);
+ err = svn_io_stat(&info, admin_abspath, APR_FINFO_SIZE,
+ scratch_pool);
+ if (err && APR_STATUS_IS_ENOENT(err->apr_err))
+ {
+ svn_error_clear(err);
+ return svn_error_createf(
+ SVN_ERR_WC_CORRUPT, NULL,
+ _("The working copy database at '%s' is missing."),
+ svn_dirent_local_style(local_abspath, scratch_pool));
+ }
+ else
+ /* We should never have reached this point in the code
+ if .svn/wc.db exists; therefore it's best to assume
+ it's corrupt. */
+ return svn_error_createf(
+ SVN_ERR_WC_CORRUPT, err,
+ _("The working copy database at '%s' is corrupt."),
+ svn_dirent_local_style(local_abspath, scratch_pool));
+ }
+ }
+
SVN_ERR(svn_wc__db_pdh_create_wcroot(wcroot,
apr_pstrdup(db->state_pool, local_abspath),
NULL, UNKNOWN_WC_ID, wc_format,
- db->auto_upgrade, db->enforce_empty_wq,
+ db->verify_format, db->enforce_empty_wq,
db->state_pool, scratch_pool));
}
Modified: subversion/branches/fsfs-format7/subversion/libsvn_wc/workqueue.c
URL: http://svn.apache.org/viewvc/subversion/branches/fsfs-format7/subversion/libsvn_wc/workqueue.c?rev=1442344&r1=1442343&r2=1442344&view=diff
==============================================================================
--- subversion/branches/fsfs-format7/subversion/libsvn_wc/workqueue.c (original)
+++ subversion/branches/fsfs-format7/subversion/libsvn_wc/workqueue.c Mon Feb 4 20:48:05 2013
@@ -50,6 +50,7 @@
#define OP_SYNC_FILE_FLAGS "sync-file-flags"
#define OP_PREJ_INSTALL "prej-install"
#define OP_DIRECTORY_REMOVE "dir-remove"
+#define OP_DIRECTORY_INSTALL "dir-install"
#define OP_POSTUPGRADE "postupgrade"
@@ -148,13 +149,16 @@ run_base_remove(svn_wc__db_t *db,
¬_present_rev, NULL,
NULL, NULL, NULL,
NULL, NULL, NULL, NULL, NULL, NULL,
- NULL, NULL,
+ NULL, NULL, NULL,
db, local_abspath,
scratch_pool, scratch_pool));
}
}
- SVN_ERR(svn_wc__db_base_remove(db, local_abspath, FALSE, not_present_rev,
+ SVN_ERR(svn_wc__db_base_remove(db, local_abspath,
+ FALSE /* keep_as_working */,
+ TRUE /* queue_deletes */,
+ not_present_rev,
NULL, NULL, scratch_pool));
return SVN_NO_ERROR;
@@ -382,10 +386,6 @@ svn_wc__wq_build_file_commit(svn_skel_t
SVN_ERR(svn_wc__db_to_relpath(&local_relpath, db, local_abspath,
local_abspath, result_pool, scratch_pool));
- /* This are currently ignored, they are here for compat. */
- svn_skel__prepend_int(FALSE, *work_item, result_pool);
- svn_skel__prepend_int(FALSE, *work_item, result_pool);
-
svn_skel__prepend_str(local_relpath, *work_item, result_pool);
svn_skel__prepend_str(OP_FILE_COMMIT, *work_item, result_pool);
@@ -416,6 +416,8 @@ run_postupgrade(svn_wc__db_t *db,
if (err && err->apr_err == SVN_ERR_ENTRY_NOT_FOUND)
/* No entry, this can happen when the wq item is rerun. */
svn_error_clear(err);
+ else
+ SVN_ERR(err);
SVN_ERR(svn_wc__db_get_wcroot(&wcroot_abspath, db, wri_abspath,
scratch_pool, scratch_pool));
@@ -1016,6 +1018,51 @@ svn_wc__wq_build_file_copy_translated(sv
return SVN_NO_ERROR;
}
+/* ------------------------------------------------------------------------ */
+
+/* OP_DIRECTORY_INSTALL */
+
+static svn_error_t *
+run_dir_install(svn_wc__db_t *db,
+ const svn_skel_t *work_item,
+ const char *wri_abspath,
+ svn_cancel_func_t cancel_func,
+ void *cancel_baton,
+ apr_pool_t *scratch_pool)
+{
+ const svn_skel_t *arg1 = work_item->children->next;
+ const char *local_relpath;
+ const char *local_abspath;
+
+ local_relpath = apr_pstrmemdup(scratch_pool, arg1->data, arg1->len);
+ SVN_ERR(svn_wc__db_from_relpath(&local_abspath, db, wri_abspath,
+ local_relpath, scratch_pool, scratch_pool));
+
+ SVN_ERR(svn_wc__ensure_directory(local_abspath, scratch_pool));
+
+ return SVN_NO_ERROR;
+}
+
+svn_error_t *
+svn_wc__wq_build_dir_install(svn_skel_t **work_item,
+ svn_wc__db_t *db,
+ const char *local_abspath,
+ apr_pool_t *scratch_pool,
+ apr_pool_t *result_pool)
+{
+ const char *local_relpath;
+
+ *work_item = svn_skel__make_empty_list(result_pool);
+
+ SVN_ERR(svn_wc__db_to_relpath(&local_relpath, db, local_abspath,
+ local_abspath, result_pool, scratch_pool));
+ svn_skel__prepend_str(local_relpath, *work_item, result_pool);
+
+ svn_skel__prepend_str(OP_DIRECTORY_INSTALL, *work_item, result_pool);
+
+ return SVN_NO_ERROR;
+}
+
/* ------------------------------------------------------------------------ */
@@ -1274,7 +1321,7 @@ run_set_text_conflict_markers(svn_wc__db
/* No conflict exists, create a basic skel */
conflicts = svn_wc__conflict_skel_create(scratch_pool);
- SVN_ERR(svn_wc__conflict_skel_set_op_update(conflicts, NULL,
+ SVN_ERR(svn_wc__conflict_skel_set_op_update(conflicts, NULL, NULL,
scratch_pool,
scratch_pool));
}
@@ -1339,7 +1386,7 @@ run_set_property_conflict_marker(svn_wc_
/* No conflict exists, create a basic skel */
conflicts = svn_wc__conflict_skel_create(scratch_pool);
- SVN_ERR(svn_wc__conflict_skel_set_op_update(conflicts, NULL,
+ SVN_ERR(svn_wc__conflict_skel_set_op_update(conflicts, NULL, NULL,
scratch_pool,
scratch_pool));
}
@@ -1370,6 +1417,7 @@ static const struct work_item_dispatch d
{ OP_SYNC_FILE_FLAGS, run_sync_file_flags },
{ OP_PREJ_INSTALL, run_prej_install },
{ OP_DIRECTORY_REMOVE, run_dir_remove },
+ { OP_DIRECTORY_INSTALL, run_dir_install },
/* Upgrade steps */
{ OP_POSTUPGRADE, run_postupgrade },
@@ -1433,10 +1481,7 @@ dispatch_work_item(svn_wc__db_t *db,
Contrary to issue #1581, we cannot simply remove work items and
continue, so bail out with an error. */
return svn_error_createf(SVN_ERR_WC_BAD_ADM_LOG, NULL,
- _("Unrecognized work item in the queue "
- "associated with '%s'"),
- svn_dirent_local_style(wri_abspath,
- scratch_pool));
+ _("Unrecognized work item in the queue"));
}
return SVN_NO_ERROR;
@@ -1468,6 +1513,7 @@ svn_wc__wq_run(svn_wc__db_t *db,
{
apr_uint64_t id;
svn_skel_t *work_item;
+ svn_error_t *err;
svn_pool_clear(iterpool);
@@ -1487,8 +1533,20 @@ svn_wc__wq_run(svn_wc__db_t *db,
we're done. */
if (work_item == NULL)
break;
- SVN_ERR(dispatch_work_item(db, wri_abspath, work_item,
- cancel_func, cancel_baton, iterpool));
+
+ err = dispatch_work_item(db, wri_abspath, work_item,
+ cancel_func, cancel_baton, iterpool);
+ if (err)
+ {
+ const char *skel = svn_skel__unparse(work_item, scratch_pool)->data;
+
+ return svn_error_createf(SVN_ERR_WC_BAD_ADM_LOG, err,
+ _("Failed to run the WC DB work queue "
+ "associated with '%s', work item %d %s"),
+ svn_dirent_local_style(wri_abspath,
+ scratch_pool),
+ (int)id, skel);
+ }
/* The work item finished without error. Mark it completed
in the next loop. */
Modified: subversion/branches/fsfs-format7/subversion/libsvn_wc/workqueue.h
URL: http://svn.apache.org/viewvc/subversion/branches/fsfs-format7/subversion/libsvn_wc/workqueue.h?rev=1442344&r1=1442343&r2=1442344&view=diff
==============================================================================
--- subversion/branches/fsfs-format7/subversion/libsvn_wc/workqueue.h (original)
+++ subversion/branches/fsfs-format7/subversion/libsvn_wc/workqueue.h Mon Feb 4 20:48:05 2013
@@ -93,8 +93,8 @@ svn_wc__wq_run(svn_wc__db_t *db,
/* Set *WORK_ITEM to a new work item that will install the working
copy file at LOCAL_ABSPATH. If USE_COMMIT_TIMES is TRUE, then the newly
installed file will use the nodes CHANGE_DATE for the file timestamp.
- If RECORD_FILEINFO is TRUE, then the resulting LAST_MOD_TIME and
- TRANSLATED_SIZE will be recorded in the database.
+ If RECORD_FILEINFO is TRUE, then the resulting RECORDED_TIME and
+ RECORDED_SIZE will be recorded in the database.
If SOURCE_ABSPATH is NULL, then the pristine contents will be installed
(with appropriate translation). If SOURCE_ABSPATH is not NULL, then it
@@ -215,6 +215,14 @@ svn_wc__wq_build_file_commit(svn_skel_t
apr_pool_t *result_pool,
apr_pool_t *scratch_pool);
+/* Set *WORK_ITEM to a new work item that will install the working
+ copy directory at LOCAL_ABSPATH. */
+svn_error_t *
+svn_wc__wq_build_dir_install(svn_skel_t **work_item,
+ svn_wc__db_t *db,
+ const char *local_abspath,
+ apr_pool_t *scratch_pool,
+ apr_pool_t *result_pool);
svn_error_t *
svn_wc__wq_build_postupgrade(svn_skel_t **work_item,
Modified: subversion/branches/fsfs-format7/subversion/mod_authz_svn/INSTALL
URL: http://svn.apache.org/viewvc/subversion/branches/fsfs-format7/subversion/mod_authz_svn/INSTALL?rev=1442344&r1=1442343&r2=1442344&view=diff
==============================================================================
--- subversion/branches/fsfs-format7/subversion/mod_authz_svn/INSTALL (original)
+++ subversion/branches/fsfs-format7/subversion/mod_authz_svn/INSTALL Mon Feb 4 20:48:05 2013
@@ -56,6 +56,12 @@ II. Configuration
Satisfy Any
Require valid-user
</Location>
+
+ NOTE: The access control is designed to never display entries that
+ the user does not have access to. Combining anonymous access on the
+ top levels while restricting read access lower in the directory
+ structure makes it difficult to browse because the server will not
+ request authentication.
C. Example 3: Authenticated access only
@@ -100,6 +106,105 @@ II. Configuration
NOTE: AuthzSVNReposRelativeAccessFile filename causes the authz file
to be read from <repo path>/conf/<filename>
+ E. Example 5: Authz file stored in a Subversion repository
+
+ This configuration allows storing of the authz file in a repository.
+
+ <Location /svn>
+ DAV svn
+ SVNParentPath /path/to/reposparent
+
+ AuthType Basic
+ AuthName "Subversion repository"
+ AuthUserFile /path/to/htpasswd/file
+
+ AuthzSVNAccessFile file:///path/to/repos/authz
+
+ Require valid-user
+ </Location>
+
+ NOTE: http:// and svn:// URLs are not supported, only local file://
+ absolute URLs may be used. The URL does not have to point to the
+ same repository as the repository being accessed. If you wish to
+ restrict access to this authz file and it is in the same repository
+ you should include a rule for it.
+
+ F. Example 6: Authz file stored inside the repository being accessed.
+
+ This configuration allows providing a relative path within the
+ repository being accessed.
+
+ <Location /svn>
+ DAV svn
+ SVNParentPath /path/to/reposparent
+
+ AuthType Basic
+ AuthName "Subversion repository"
+ AuthUserFile /path/to/htpasswd/file
+
+ AuthzSVNAccessFile ^/authz
+
+ Require valid-user
+ </Location>
+
+ NOTE: You should include rules in your authz file to restirct access
+ to the authz file as desired.
+
+ G. Example 7: Authenticated access to "Collection of Repositories"
+
+ The "Collection of Repositories" is filtered based on read access to
+ the root of each repository, i.e. consistent with the directory lists
+ within repositories. If read access is restricted in repository roots,
+ it is typically desirable to require authentication for "Collection of
+ Repositories" in order to ensure that repositories where the user has
+ access are displayed.
+
+ This is accomplished by specifying "Satisfy All" (which is the default
+ setting):
+
+ <Location /svn>
+ DAV svn
+ SVNParentPath /path/to/reposparent
+
+ AuthType Basic
+ AuthName "Subversion repository"
+ AuthUserFile /path/to/htpasswd/file
+
+ AuthzSVNAccessFile /path/to/access/file
+ # Implicit Satisfy All
+ Require valid-user
+ </Location>
+
+ If the same server must be able to serve paths with anonymous access,
+ it can be defined using an additional location.
+
+ <LocationMatch "^/svn/.+">
+ Satisfy Any
+ Require valid-user
+ </LocationMatch>
+
+ The "Require" statement in the previous example is not strictly
+ needed, but has been included for clarity.
+
+ H. Example 8: Separate authz and groups files.
+
+ This configuration allows storing the groups separately from the
+ main authz file with the authorization rules.
+
+ <Location /svn>
+ DAV svn
+ SVNParentPath /path/to/reposparent
+
+ AuthType Basic
+ AuthName "Subversion repository"
+ AuthUserFile /path/to/htpasswd/file
+
+ AuthzSVNAccessFile /path/to/access/file
+ AuthzSVNGroupsFile /path/to/groups/file
+
+ Require valid-user
+ </Location>
+
2. Specifying permissions
The file format of the access file looks like this:
Modified: subversion/branches/fsfs-format7/subversion/mod_authz_svn/mod_authz_svn.c
URL: http://svn.apache.org/viewvc/subversion/branches/fsfs-format7/subversion/mod_authz_svn/mod_authz_svn.c?rev=1442344&r1=1442343&r2=1442344&view=diff
==============================================================================
--- subversion/branches/fsfs-format7/subversion/mod_authz_svn/mod_authz_svn.c (original)
+++ subversion/branches/fsfs-format7/subversion/mod_authz_svn/mod_authz_svn.c Mon Feb 4 20:48:05 2013
@@ -63,6 +63,7 @@ typedef struct authz_svn_config_rec {
const char *base_path;
const char *access_file;
const char *repo_relative_access_file;
+ const char *groups_file;
const char *force_username_case;
} authz_svn_config_rec;
@@ -87,6 +88,34 @@ create_authz_svn_dir_config(apr_pool_t *
return conf;
}
+/* canonicalize ACCESS_FILE based on the type of argument.
+ * If SERVER_RELATIVE is true, ACCESS_FILE is a relative
+ * path then ACCESS_FILE is converted to an absolute
+ * path rooted at the server root. */
+static const char *
+canonicalize_access_file(const char *access_file,
+ svn_boolean_t server_relative,
+ apr_pool_t *pool)
+{
+ if (svn_path_is_url(access_file))
+ {
+ access_file = svn_uri_canonicalize(access_file, pool);
+ }
+ else if (!svn_path_is_repos_relative_url(access_file))
+ {
+ if (server_relative)
+ access_file = ap_server_root_relative(pool, access_file);
+
+ access_file = svn_dirent_internal_style(access_file, pool);
+ }
+
+ /* We don't canonicalize repos relative urls since they get
+ * canonicalized inside svn_repos_authz_read2() when they
+ * are resolved. */
+
+ return access_file;
+}
+
static const char *
AuthzSVNAccessFile_cmd(cmd_parms *cmd, void *config, const char *arg1)
{
@@ -96,7 +125,7 @@ AuthzSVNAccessFile_cmd(cmd_parms *cmd, v
return "AuthzSVNAccessFile and AuthzSVNReposRelativeAccessFile "
"directives are mutually exclusive.";
- conf->access_file = ap_server_root_relative(cmd->pool, arg1);
+ conf->access_file = canonicalize_access_file(arg1, TRUE, cmd->pool);
return NULL;
}
@@ -113,7 +142,18 @@ AuthzSVNReposRelativeAccessFile_cmd(cmd_
return "AuthzSVNAccessFile and AuthzSVNReposRelativeAccessFile "
"directives are mutually exclusive.";
- conf->repo_relative_access_file = arg1;
+ conf->repo_relative_access_file = canonicalize_access_file(arg1, FALSE,
+ cmd->pool);
+
+ return NULL;
+}
+
+static const char *
+AuthzSVNGroupsFile_cmd(cmd_parms *cmd, void *config, const char *arg1)
+{
+ authz_svn_config_rec *conf = config;
+
+ conf->groups_file = canonicalize_access_file(arg1, TRUE, cmd->pool);
return NULL;
}
@@ -130,13 +170,25 @@ static const command_rec authz_svn_cmds[
NULL,
OR_AUTHCFG,
"Path to text file containing permissions of repository "
- "paths."),
+ "paths. Path may be an repository relative URL (^/) or "
+ "absolute file:// URL to a text file in a Subversion "
+ "repository."),
AP_INIT_TAKE1("AuthzSVNReposRelativeAccessFile",
AuthzSVNReposRelativeAccessFile_cmd,
NULL,
OR_AUTHCFG,
"Path (relative to repository 'conf' directory) to text "
- "file containing permissions of repository paths. "),
+ "file containing permissions of repository paths. Path may "
+ "be an repository relative URL (^/) or absolute file:// URL "
+ "to a text file in a Subversion repository."),
+ AP_INIT_TAKE1("AuthzSVNGroupsFile",
+ AuthzSVNGroupsFile_cmd,
+ NULL,
+ OR_AUTHCFG,
+ "Path to text file containing group definitions for all "
+ "repositories. Path may be an repository relative URL (^/) "
+ "or absolute file:// URL to a text file in a Subversion "
+ "repository."),
AP_INIT_FLAG("AuthzSVNAnonymous", ap_set_flag_slot,
(void *)APR_OFFSETOF(authz_svn_config_rec, anonymous),
OR_AUTHCFG,
@@ -161,6 +213,102 @@ static const command_rec authz_svn_cmds[
{ NULL }
};
+
+/* The macros LOG_ARGS_SIGNATURE and LOG_ARGS_CASCADE are expanded as formal
+ * and actual parameters to log_access_verdict with respect to HTTPD version.
+ */
+#if AP_MODULE_MAGIC_AT_LEAST(20100606,0)
+#define LOG_ARGS_SIGNATURE const char *file, int line, int module_index
+#define LOG_ARGS_CASCADE file, line, module_index
+#else
+#define LOG_ARGS_SIGNATURE const char *file, int line
+#define LOG_ARGS_CASCADE file, line
+#endif
+
+/* Log a message indicating the access control decision made about a
+ * request. The macro LOG_ARGS_SIGNATURE expands to FILE, LINE and
+ * MODULE_INDEX in HTTPD 2.3 as APLOG_MARK macro has been changed for
+ * per-module loglevel configuration. It expands to FILE and LINE
+ * in older server versions. ALLOWED is boolean.
+ * REPOS_PATH and DEST_REPOS_PATH are information
+ * about the request. DEST_REPOS_PATH may be NULL. */
+static void
+log_access_verdict(LOG_ARGS_SIGNATURE,
+ const request_rec *r, int allowed,
+ const char *repos_path, const char *dest_repos_path)
+{
+ int level = allowed ? APLOG_INFO : APLOG_ERR;
+ const char *verdict = allowed ? "granted" : "denied";
+
+ if (r->user)
+ {
+ if (dest_repos_path)
+ ap_log_rerror(LOG_ARGS_CASCADE, level, 0, r,
+ "Access %s: '%s' %s %s %s", verdict, r->user,
+ r->method, repos_path, dest_repos_path);
+ else
+ ap_log_rerror(LOG_ARGS_CASCADE, level, 0, r,
+ "Access %s: '%s' %s %s", verdict, r->user,
+ r->method, repos_path);
+ }
+ else
+ {
+ if (dest_repos_path)
+ ap_log_rerror(LOG_ARGS_CASCADE, level, 0, r,
+ "Access %s: - %s %s %s", verdict,
+ r->method, repos_path, dest_repos_path);
+ else
+ ap_log_rerror(LOG_ARGS_CASCADE, level, 0, r,
+ "Access %s: - %s %s", verdict,
+ r->method, repos_path);
+ }
+}
+
+/* Log a message indiciating the ERR encountered during the request R.
+ * LOG_ARGS_SIGNATURE expands as in log_access_verdict() above.
+ * PREFIX is inserted at the start of the message. The rest of the
+ * message is generated by combining the message for each error in the
+ * chain of ERR, excluding for trace errors. ERR will be cleared
+ * when finished. */
+static void
+log_svn_error(LOG_ARGS_SIGNATURE,
+ request_rec *r, const char *prefix,
+ svn_error_t *err, apr_pool_t *scratch_pool)
+{
+ svn_error_t *err_pos = svn_error_purge_tracing(err);
+ svn_stringbuf_t *buff = svn_stringbuf_create(prefix, scratch_pool);
+
+ /* Build the error chain into a space separated stringbuf. */
+ while (err_pos)
+ {
+ svn_stringbuf_appendbyte(buff, ' ');
+ if (err_pos->message)
+ {
+ svn_stringbuf_appendcstr(buff, err_pos->message);
+ }
+ else
+ {
+ char strerr[256];
+
+ svn_stringbuf_appendcstr(buff, svn_strerror(err->apr_err, strerr,
+ sizeof(strerr)));
+ }
+
+ err_pos = err_pos->child;
+ }
+
+ ap_log_rerror(LOG_ARGS_CASCADE, APLOG_ERR,
+ /* If it is an error code that APR can make sense of, then
+ show it, otherwise, pass zero to avoid putting "APR does
+ not understand this error code" in the error log. */
+ ((err->apr_err >= APR_OS_START_USERERR &&
+ err->apr_err < APR_OS_START_CANONERR) ?
+ 0 : err->apr_err),
+ r, "%s", buff->data);
+
+ svn_error_clear(err);
+}
+
/*
* Get the, possibly cached, svn_authz_t for this request.
*/
@@ -175,18 +323,24 @@ get_access_conf(request_rec *r, authz_sv
svn_authz_t *access_conf = NULL;
svn_error_t *svn_err;
dav_error *dav_err;
- char errbuf[256];
+
+ dav_err = dav_svn_get_repos_path(r, conf->base_path, &repos_path);
+ if (dav_err)
+ {
+ ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, "%s", dav_err->desc);
+ return NULL;
+ }
if (conf->repo_relative_access_file)
{
- dav_err = dav_svn_get_repos_path(r, conf->base_path, &repos_path);
- if (dav_err) {
- ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, "%s", dav_err->desc);
- return NULL;
- }
- access_file = svn_dirent_join_many(scratch_pool, repos_path, "conf",
- conf->repo_relative_access_file,
- NULL);
+ access_file = conf->repo_relative_access_file;
+ if (!svn_path_is_repos_relative_url(access_file) &&
+ !svn_path_is_url(access_file))
+ {
+ access_file = svn_dirent_join_many(scratch_pool, repos_path, "conf",
+ conf->repo_relative_access_file,
+ NULL);
+ }
}
else
{
@@ -196,27 +350,26 @@ get_access_conf(request_rec *r, authz_sv
ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r,
"Path to authz file is %s", access_file);
+ if (conf->groups_file)
+ {
+ ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r,
+ "Path to groups file is %s", conf->groups_file);
+ }
+
cache_key = apr_pstrcat(scratch_pool, "mod_authz_svn:",
access_file, (char *)NULL);
apr_pool_userdata_get(&user_data, cache_key, r->connection->pool);
access_conf = user_data;
if (access_conf == NULL)
{
- svn_err = svn_repos_authz_read(&access_conf, access_file,
- TRUE, r->connection->pool);
+ svn_err = svn_repos_authz_read2(&access_conf, access_file,
+ conf->groups_file, TRUE, repos_path,
+ r->connection->pool);
if (svn_err)
{
- ap_log_rerror(APLOG_MARK, APLOG_ERR,
- /* If it is an error code that APR can make sense
- of, then show it, otherwise, pass zero to avoid
- putting "APR does not understand this error code"
- in the error log. */
- ((svn_err->apr_err >= APR_OS_START_USERERR &&
- svn_err->apr_err < APR_OS_START_CANONERR) ?
- 0 : svn_err->apr_err),
- r, "Failed to load the AuthzSVNAccessFile: %s",
- svn_err_best_message(svn_err, errbuf, sizeof(errbuf)));
- svn_error_clear(svn_err);
+ log_svn_error(APLOG_MARK, r,
+ "Failed to load the AuthzSVNAccessFile:",
+ svn_err, scratch_pool);
access_conf = NULL;
}
else
@@ -285,7 +438,6 @@ req_check_access(request_rec *r,
svn_boolean_t authz_access_granted = FALSE;
svn_authz_t *access_conf = NULL;
svn_error_t *svn_err;
- char errbuf[256];
const char *username_to_authorize = get_username_to_authorize(r, conf,
r->pool);
@@ -458,19 +610,9 @@ req_check_access(request_rec *r,
r->pool);
if (svn_err)
{
- ap_log_rerror(APLOG_MARK, APLOG_ERR,
- /* If it is an error code that APR can make
- sense of, then show it, otherwise, pass
- zero to avoid putting "APR does not
- understand this error code" in the error
- log. */
- ((svn_err->apr_err >= APR_OS_START_USERERR &&
- svn_err->apr_err < APR_OS_START_CANONERR) ?
- 0 : svn_err->apr_err),
- r, "Failed to perform access control: %s",
- svn_err_best_message(svn_err, errbuf,
- sizeof(errbuf)));
- svn_error_clear(svn_err);
+ log_svn_error(APLOG_MARK, r,
+ "Failed to perform access control:",
+ svn_err, r->pool);
return DECLINED;
}
@@ -505,17 +647,9 @@ req_check_access(request_rec *r,
r->pool);
if (svn_err)
{
- ap_log_rerror(APLOG_MARK, APLOG_ERR,
- /* If it is an error code that APR can make sense
- of, then show it, otherwise, pass zero to avoid
- putting "APR does not understand this error code"
- in the error log. */
- ((svn_err->apr_err >= APR_OS_START_USERERR &&
- svn_err->apr_err < APR_OS_START_CANONERR) ?
- 0 : svn_err->apr_err),
- r, "Failed to perform access control: %s",
- svn_err_best_message(svn_err, errbuf, sizeof(errbuf)));
- svn_error_clear(svn_err);
+ log_svn_error(APLOG_MARK, r,
+ "Failed to perform access control:",
+ svn_err, r->pool);
return DECLINED;
}
@@ -530,56 +664,6 @@ req_check_access(request_rec *r,
return OK;
}
-/* The macros LOG_ARGS_SIGNATURE and LOG_ARGS_CASCADE are expanded as formal
- * and actual parameters to log_access_verdict with respect to HTTPD version.
- */
-#if AP_MODULE_MAGIC_AT_LEAST(20100606,0)
-#define LOG_ARGS_SIGNATURE const char *file, int line, int module_index
-#define LOG_ARGS_CASCADE file, line, module_index
-#else
-#define LOG_ARGS_SIGNATURE const char *file, int line
-#define LOG_ARGS_CASCADE file, line
-#endif
-
-/* Log a message indicating the access control decision made about a
- * request. The macro LOG_ARGS_SIGNATURE expands to FILE, LINE and
- * MODULE_INDEX in HTTPD 2.3 as APLOG_MARK macro has been changed for
- * per-module loglevel configuration. It expands to FILE and LINE
- * in older server versions. ALLOWED is boolean.
- * REPOS_PATH and DEST_REPOS_PATH are information
- * about the request. DEST_REPOS_PATH may be NULL. */
-static void
-log_access_verdict(LOG_ARGS_SIGNATURE,
- const request_rec *r, int allowed,
- const char *repos_path, const char *dest_repos_path)
-{
- int level = allowed ? APLOG_INFO : APLOG_ERR;
- const char *verdict = allowed ? "granted" : "denied";
-
- if (r->user)
- {
- if (dest_repos_path)
- ap_log_rerror(LOG_ARGS_CASCADE, level, 0, r,
- "Access %s: '%s' %s %s %s", verdict, r->user,
- r->method, repos_path, dest_repos_path);
- else
- ap_log_rerror(LOG_ARGS_CASCADE, level, 0, r,
- "Access %s: '%s' %s %s", verdict, r->user,
- r->method, repos_path);
- }
- else
- {
- if (dest_repos_path)
- ap_log_rerror(LOG_ARGS_CASCADE, level, 0, r,
- "Access %s: - %s %s %s", verdict,
- r->method, repos_path, dest_repos_path);
- else
- ap_log_rerror(LOG_ARGS_CASCADE, level, 0, r,
- "Access %s: - %s %s", verdict,
- r->method, repos_path);
- }
-}
-
/*
* Implementation of subreq_bypass with scratch_pool parameter.
*/
@@ -593,7 +677,6 @@ subreq_bypass2(request_rec *r,
svn_authz_t *access_conf = NULL;
authz_svn_config_rec *conf = NULL;
svn_boolean_t authz_access_granted = FALSE;
- char errbuf[256];
const char *username_to_authorize;
conf = ap_get_module_config(r->per_dir_config,
@@ -626,18 +709,9 @@ subreq_bypass2(request_rec *r,
scratch_pool);
if (svn_err)
{
- ap_log_rerror(APLOG_MARK, APLOG_ERR,
- /* If it is an error code that APR can make
- sense of, then show it, otherwise, pass
- zero to avoid putting "APR does not
- understand this error code" in the error
- log. */
- ((svn_err->apr_err >= APR_OS_START_USERERR &&
- svn_err->apr_err < APR_OS_START_CANONERR) ?
- 0 : svn_err->apr_err),
- r, "Failed to perform access control: %s",
- svn_err_best_message(svn_err, errbuf, sizeof(errbuf)));
- svn_error_clear(svn_err);
+ log_svn_error(APLOG_MARK, r,
+ "Failed to perform access control:",
+ svn_err, scratch_pool);
return HTTP_FORBIDDEN;
}
if (!authz_access_granted)
Modified: subversion/branches/fsfs-format7/subversion/mod_dav_svn/authz.c
URL: http://svn.apache.org/viewvc/subversion/branches/fsfs-format7/subversion/mod_dav_svn/authz.c?rev=1442344&r1=1442343&r2=1442344&view=diff
==============================================================================
--- subversion/branches/fsfs-format7/subversion/mod_dav_svn/authz.c (original)
+++ subversion/branches/fsfs-format7/subversion/mod_dav_svn/authz.c Mon Feb 4 20:48:05 2013
@@ -105,7 +105,6 @@ dav_svn__allow_list_repos(request_rec *r
const char *uri;
request_rec *subreq;
svn_boolean_t allowed = FALSE;
- authz_svn__subreq_bypass_func_t allow_read_bypass = NULL;
/* Easy out: if the admin has explicitly set 'SVNPathAuthz Off',
then this whole callback does nothing. */
@@ -114,19 +113,8 @@ dav_svn__allow_list_repos(request_rec *r
return TRUE;
}
- /* If bypass is specified and authz has exported the provider.
- Otherwise, we fall through to the full version. This should be
- safer than allowing or disallowing all accesses if there is a
- configuration error.
- XXX: Is this the proper thing to do in this case? */
- allow_read_bypass = dav_svn__get_pathauthz_bypass(r);
- if (allow_read_bypass != NULL)
- {
- if (allow_read_bypass(r, "/", repos_name) == OK)
- return TRUE;
- else
- return FALSE;
- }
+ /* Do not use short_circuit mode: bypass provider expects R to be request to
+ the repository to find repository relative authorization file. */
/* Build a Public Resource uri representing repository root. */
uri = svn_urlpath__join(dav_svn__get_root_dir(r),
Modified: subversion/branches/fsfs-format7/subversion/mod_dav_svn/dav_svn.h
URL: http://svn.apache.org/viewvc/subversion/branches/fsfs-format7/subversion/mod_dav_svn/dav_svn.h?rev=1442344&r1=1442343&r2=1442344&view=diff
==============================================================================
--- subversion/branches/fsfs-format7/subversion/mod_dav_svn/dav_svn.h (original)
+++ subversion/branches/fsfs-format7/subversion/mod_dav_svn/dav_svn.h Mon Feb 4 20:48:05 2013
@@ -52,6 +52,12 @@ extern "C" {
/* a pool-key for the shared dav_svn_root used by autoversioning */
#define DAV_SVN__AUTOVERSIONING_ACTIVITY "svn-autoversioning-activity"
+/* Option values for SVNAllowBulkUpdates */
+typedef enum dav_svn__bulk_upd_conf {
+ CONF_BULKUPD_ON,
+ CONF_BULKUPD_OFF,
+ CONF_BULKUPD_PREFER
+} dav_svn__bulk_upd_conf;
/* dav_svn_repos
*
@@ -110,7 +116,7 @@ typedef struct dav_svn_repos {
svn_boolean_t autoversioning;
/* Whether bulk updates are allowed for this repository. */
- svn_boolean_t bulk_updates;
+ dav_svn__bulk_upd_conf bulk_updates;
/* Whether HTTP protocol version 2 is allowed to be used. */
svn_boolean_t v2_protocol;
@@ -302,7 +308,7 @@ const char *dav_svn__get_fs_parent_path(
svn_boolean_t dav_svn__get_autoversioning_flag(request_rec *r);
/* for the repository referred to by this request, are bulk updates allowed? */
-svn_boolean_t dav_svn__get_bulk_updates_flag(request_rec *r);
+dav_svn__bulk_upd_conf dav_svn__get_bulk_updates_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/branches/fsfs-format7/subversion/mod_dav_svn/deadprops.c
URL: http://svn.apache.org/viewvc/subversion/branches/fsfs-format7/subversion/mod_dav_svn/deadprops.c?rev=1442344&r1=1442343&r2=1442344&view=diff
==============================================================================
--- subversion/branches/fsfs-format7/subversion/mod_dav_svn/deadprops.c (original)
+++ subversion/branches/fsfs-format7/subversion/mod_dav_svn/deadprops.c Mon Feb 4 20:48:05 2013
@@ -136,7 +136,7 @@ get_value(dav_db *db, const dav_prop_nam
propname, db->p);
else
serr = svn_repos_fs_revision_prop(pvalue,
- db->resource->info-> repos->repos,
+ db->resource->info->repos->repos,
db->resource->info->root.rev,
propname, db->authz_read_func,
db->authz_read_baton, db->p);
Modified: subversion/branches/fsfs-format7/subversion/mod_dav_svn/mirror.c
URL: http://svn.apache.org/viewvc/subversion/branches/fsfs-format7/subversion/mod_dav_svn/mirror.c?rev=1442344&r1=1442343&r2=1442344&view=diff
==============================================================================
--- subversion/branches/fsfs-format7/subversion/mod_dav_svn/mirror.c (original)
+++ subversion/branches/fsfs-format7/subversion/mod_dav_svn/mirror.c Mon Feb 4 20:48:05 2013
@@ -39,12 +39,17 @@
URI_SEGMENT is the URI bits relative to the repository root (but if
non-empty, *does* have a leading slash delimiter).
MASTER_URI and URI_SEGMENT are not URI-encoded. */
-static void proxy_request_fixup(request_rec *r,
- const char *master_uri,
- const char *uri_segment)
+static int proxy_request_fixup(request_rec *r,
+ const char *master_uri,
+ const char *uri_segment)
{
- assert((uri_segment[0] == '\0')
- || (uri_segment[0] == '/'));
+ if (uri_segment[0] != '\0' && uri_segment[0] != '/')
+ {
+ ap_log_rerror(APLOG_MARK, APLOG_ERR, SVN_ERR_BAD_CONFIG_VALUE, r,
+ "Invalid URI segment '%s' in slave fixup",
+ uri_segment);
+ return HTTP_INTERNAL_SERVER_ERROR;
+ }
r->proxyreq = PROXYREQ_REVERSE;
r->uri = r->unparsed_uri;
@@ -67,6 +72,7 @@ static void proxy_request_fixup(request_
ap_add_output_filter("LocationRewrite", NULL, r, r->connection);
ap_add_output_filter("ReposRewrite", NULL, r, r->connection);
ap_add_input_filter("IncomingRewrite", NULL, r, r->connection);
+ return OK;
}
@@ -101,8 +107,10 @@ int dav_svn__proxy_request_fixup(request
"/txn/", (char *)NULL))
|| ap_strstr_c(seg, apr_pstrcat(r->pool, special_uri,
"/txr/", (char *)NULL))) {
+ int rv;
seg += strlen(root_dir);
- proxy_request_fixup(r, master_uri, seg);
+ rv = proxy_request_fixup(r, master_uri, seg);
+ if (rv) return rv;
}
}
return OK;
@@ -116,8 +124,10 @@ int dav_svn__proxy_request_fixup(request
r->method_number == M_LOCK ||
r->method_number == M_UNLOCK ||
ap_strstr_c(seg, special_uri))) {
+ int rv;
seg += strlen(root_dir);
- proxy_request_fixup(r, master_uri, seg);
+ rv = proxy_request_fixup(r, master_uri, seg);
+ if (rv) return rv;
return OK;
}
}
Modified: subversion/branches/fsfs-format7/subversion/mod_dav_svn/mod_dav_svn.c
URL: http://svn.apache.org/viewvc/subversion/branches/fsfs-format7/subversion/mod_dav_svn/mod_dav_svn.c?rev=1442344&r1=1442343&r2=1442344&view=diff
==============================================================================
--- subversion/branches/fsfs-format7/subversion/mod_dav_svn/mod_dav_svn.c (original)
+++ subversion/branches/fsfs-format7/subversion/mod_dav_svn/mod_dav_svn.c Mon Feb 4 20:48:05 2013
@@ -93,7 +93,7 @@ typedef struct dir_conf_t {
const char *xslt_uri; /* XSL transform URI */
const char *fs_parent_path; /* path to parent of SVN FS'es */
enum conf_flag autoversioning; /* whether autoversioning is active */
- enum conf_flag bulk_updates; /* whether bulk updates are allowed */
+ dav_svn__bulk_upd_conf bulk_updates; /* whether bulk updates are allowed */
enum conf_flag v2_protocol; /* whether HTTP v2 is advertised */
enum path_authz_conf path_authz_method; /* how GET subrequests are handled */
enum conf_flag list_parentpath; /* whether to allow GET of parentpath */
@@ -213,7 +213,7 @@ create_dir_config(apr_pool_t *p, char *d
<Location /blah> directive. So we treat it as a urlpath. */
if (dir)
conf->root_dir = svn_urlpath__canonicalize(dir, p);
- conf->bulk_updates = CONF_FLAG_ON;
+ conf->bulk_updates = CONF_BULKUPD_ON;
conf->v2_protocol = CONF_FLAG_ON;
conf->hooks_env = NULL;
@@ -357,14 +357,26 @@ SVNAutoversioning_cmd(cmd_parms *cmd, vo
static const char *
-SVNAllowBulkUpdates_cmd(cmd_parms *cmd, void *config, int arg)
+SVNAllowBulkUpdates_cmd(cmd_parms *cmd, void *config, const char *arg1)
{
dir_conf_t *conf = config;
- if (arg)
- conf->bulk_updates = CONF_FLAG_ON;
+ if (apr_strnatcasecmp("on", arg1) == 0)
+ {
+ conf->bulk_updates = CONF_BULKUPD_ON;
+ }
+ else if (apr_strnatcasecmp("off", arg1) == 0)
+ {
+ conf->bulk_updates = CONF_BULKUPD_OFF;
+ }
+ else if (apr_strnatcasecmp("prefer", arg1) == 0)
+ {
+ conf->bulk_updates = CONF_BULKUPD_PREFER;
+ }
else
- conf->bulk_updates = CONF_FLAG_OFF;
+ {
+ return "Unrecognized value for SVNAllowBulkUpdates directive";
+ }
return NULL;
}
@@ -662,7 +674,7 @@ dav_svn_get_repos_path(request_rec *r,
/* Construct the full path from the parent path base directory
and the repository name. */
- *repos_path = svn_urlpath__join(fs_parent_path, repos_name, r->pool);
+ *repos_path = svn_dirent_join(fs_parent_path, repos_name, r->pool);
return NULL;
}
@@ -793,13 +805,13 @@ dav_svn__get_autoversioning_flag(request
}
-svn_boolean_t
+dav_svn__bulk_upd_conf
dav_svn__get_bulk_updates_flag(request_rec *r)
{
dir_conf_t *conf;
conf = ap_get_module_config(r->per_dir_config, &dav_svn_module);
- return conf->bulk_updates == CONF_FLAG_ON;
+ return conf->bulk_updates;
}
@@ -1144,11 +1156,12 @@ static const command_rec cmds[] =
"activities database(s) should be stored"),
/* per directory/location */
- AP_INIT_FLAG("SVNAllowBulkUpdates", SVNAllowBulkUpdates_cmd, NULL,
- ACCESS_CONF|RSRC_CONF,
- "enables support for bulk update-style requests (as opposed to "
- "only skeletal reports that require additional per-file "
- "downloads."),
+ AP_INIT_TAKE1("SVNAllowBulkUpdates", SVNAllowBulkUpdates_cmd, NULL,
+ ACCESS_CONF|RSRC_CONF,
+ "enables support for bulk update-style requests (On, default), "
+ "as opposed to only skeletal reports that require additional "
+ "per-file downloads (Off). Use Prefer to tell the svn client "
+ "to always use bulk update requests, if supported."),
/* per directory/location */
AP_INIT_FLAG("SVNAdvertiseV2Protocol", SVNAdvertiseV2Protocol_cmd, NULL,
Modified: subversion/branches/fsfs-format7/subversion/mod_dav_svn/reports/inherited-props.c
URL: http://svn.apache.org/viewvc/subversion/branches/fsfs-format7/subversion/mod_dav_svn/reports/inherited-props.c?rev=1442344&r1=1442343&r2=1442344&view=diff
==============================================================================
--- subversion/branches/fsfs-format7/subversion/mod_dav_svn/reports/inherited-props.c (original)
+++ subversion/branches/fsfs-format7/subversion/mod_dav_svn/reports/inherited-props.c Mon Feb 4 20:48:05 2013
@@ -113,7 +113,7 @@ dav_svn__get_inherited_props_report(cons
"couldn't retrieve revision root",
resource->pool);
- serr = svn_repos_fs_get_inherited_props(&inherited_props, root, path,
+ serr = svn_repos_fs_get_inherited_props(&inherited_props, root, path, NULL,
dav_svn__authz_read_func(&arb),
&arb, resource->pool, iterpool);
if (serr)
Modified: subversion/branches/fsfs-format7/subversion/mod_dav_svn/reports/replay.c
URL: http://svn.apache.org/viewvc/subversion/branches/fsfs-format7/subversion/mod_dav_svn/reports/replay.c?rev=1442344&r1=1442343&r2=1442344&view=diff
==============================================================================
--- subversion/branches/fsfs-format7/subversion/mod_dav_svn/reports/replay.c (original)
+++ subversion/branches/fsfs-format7/subversion/mod_dav_svn/reports/replay.c Mon Feb 4 20:48:05 2013
@@ -418,11 +418,11 @@ dav_svn__replay_report(const dav_resourc
{
dav_error *derr = NULL;
svn_revnum_t low_water_mark = SVN_INVALID_REVNUM;
- svn_revnum_t rev = SVN_INVALID_REVNUM;
+ svn_revnum_t rev;
const svn_delta_editor_t *editor;
svn_boolean_t send_deltas = TRUE;
dav_svn__authz_read_baton arb;
- const char *base_dir = resource->info->repos_path;
+ const char *base_dir;
apr_bucket_brigade *bb;
apr_xml_elem *child;
svn_fs_root_t *root;
@@ -430,10 +430,27 @@ dav_svn__replay_report(const dav_resourc
void *edit_baton;
int ns;
- /* The request won't have a repos_path if it's for the root. */
- if (! base_dir)
- base_dir = "";
-
+ /* In Subversion 1.8, we allowed this REPORT to be issue against a
+ revision resource. Doing so means the REV is part of the request
+ URL, and BASE_DIR is embedded in the request body.
+
+ The old-school (and incorrect, see issue #4287 --
+ http://subversion.tigris.org/issues/show_bug.cgi?id=4287) way was
+ to REPORT on the public URL of the BASE_DIR and embed the REV in
+ the report body.
+ */
+ if (resource->baselined
+ && (resource->type == DAV_RESOURCE_TYPE_VERSION))
+ {
+ rev = resource->info->root.rev;
+ base_dir = NULL;
+ }
+ else
+ {
+ rev = SVN_INVALID_REVNUM;
+ base_dir = resource->info->repos_path;
+ }
+
arb.r = resource->info->r;
arb.repos = resource->info->repos;
@@ -455,9 +472,17 @@ dav_svn__replay_report(const dav_resourc
if (strcmp(child->name, "revision") == 0)
{
+ if (SVN_IS_VALID_REVNUM(rev))
+ {
+ /* Uh... we already have a revision to use, either
+ because this tag is non-unique or because the
+ request was submitted against a revision-bearing
+ resource URL. Either way, something's not
+ right. */
+ return malformed_element_error("revision", resource->pool);
+ }
+
cdata = dav_xml_get_cdata(child, resource->pool, 1);
- if (! cdata)
- return malformed_element_error("revision", resource->pool);
rev = SVN_STR_TO_REV(cdata);
}
else if (strcmp(child->name, "low-water-mark") == 0)
@@ -481,7 +506,16 @@ dav_svn__replay_report(const dav_resourc
svn_error_clear(err);
return malformed_element_error("send-deltas", resource->pool);
}
- send_deltas = parsed_val ? TRUE : FALSE;
+ send_deltas = parsed_val != 0;
+ }
+ else if (strcmp(child->name, "include-path") == 0)
+ {
+ cdata = dav_xml_get_cdata(child, resource->pool, 1);
+ if ((derr = dav_svn__test_canonical(cdata, resource->pool)))
+ return derr;
+
+ /* Force BASE_DIR to be a relative path, not an fspath. */
+ base_dir = svn_relpath_canonicalize(cdata, resource->pool);
}
}
}
@@ -498,6 +532,9 @@ dav_svn__replay_report(const dav_resourc
"Request was missing the low-water-mark argument.",
SVN_DAV_ERROR_NAMESPACE, SVN_DAV_ERROR_TAG);
+ if (! base_dir)
+ base_dir = "";
+
bb = apr_brigade_create(resource->pool, output->c->bucket_alloc);
if ((err = svn_fs_revision_root(&root, resource->info->repos->fs, rev,
Modified: subversion/branches/fsfs-format7/subversion/mod_dav_svn/reports/update.c
URL: http://svn.apache.org/viewvc/subversion/branches/fsfs-format7/subversion/mod_dav_svn/reports/update.c?rev=1442344&r1=1442343&r2=1442344&view=diff
==============================================================================
--- subversion/branches/fsfs-format7/subversion/mod_dav_svn/reports/update.c (original)
+++ subversion/branches/fsfs-format7/subversion/mod_dav_svn/reports/update.c Mon Feb 4 20:48:05 2013
@@ -1016,11 +1016,15 @@ dav_svn__update_report(const dav_resourc
SVN_DAV_ERROR_TAG);
}
- /* If server configuration permits bulk updates (a report with props
- and textdeltas inline, rather than placeholder tags that tell the
- client to do further fetches), look to see if client requested as
- much. */
- if (repos->bulk_updates)
+ /* SVNAllowBulkUpdates On/Prefer: server configuration permits bulk updates
+ (a report with props and textdeltas inline, rather than placeholder tags
+ that tell the client to do further fetches), look to see if client
+ requested as much.
+
+ SVNAllowBulkUpdates Off: no bulk updates allowed, force skelta mode.
+ */
+ if (repos->bulk_updates == CONF_BULKUPD_ON ||
+ repos->bulk_updates == CONF_BULKUPD_PREFER)
{
apr_xml_attr *this_attr;
Modified: subversion/branches/fsfs-format7/subversion/mod_dav_svn/repos.c
URL: http://svn.apache.org/viewvc/subversion/branches/fsfs-format7/subversion/mod_dav_svn/repos.c?rev=1442344&r1=1442343&r2=1442344&view=diff
==============================================================================
--- subversion/branches/fsfs-format7/subversion/mod_dav_svn/repos.c (original)
+++ subversion/branches/fsfs-format7/subversion/mod_dav_svn/repos.c Mon Feb 4 20:48:05 2013
@@ -2596,121 +2596,6 @@ is_parent_resource(const dav_resource *r
}
-#if 0
-/* Given an apache request R and a ROOT_PATH to the svn location
- block, set *KIND to the node-kind of the URI's associated
- (revision, path) pair, if possible.
-
- Public uris, baseline collections, version resources, and working
- (non-baseline) resources all have associated (revision, path)
- pairs, and thus one of {svn_node_file, svn_node_dir, svn_node_none}
- will be returned.
-
- If URI is something more abstract, then set *KIND to
- svn_node_unknown. This is true for baselines, working baselines,
- version controled configurations, activities, histories, and other
- private resources.
-*/
-static dav_error *
-resource_kind(request_rec *r,
- const char *uri,
- const char *root_path,
- svn_node_kind_t *kind)
-{
- dav_error *derr;
- svn_error_t *serr;
- dav_resource *resource;
- svn_revnum_t base_rev;
- svn_fs_root_t *base_rev_root;
- char *saved_uri;
-
- /* Temporarily insert the uri that the user actually wants us to
- convert into a resource. Typically, this is already r->uri, so
- this is usually a no-op. But sometimes the caller may pass in
- the Destination: header uri.
-
- ### WHAT WE REALLY WANT here is to refactor get_resource,
- so that some alternate interface actually allows us to specify
- the URI to process, i.e. not always process r->uri.
- */
- saved_uri = r->uri;
- r->uri = apr_pstrdup(r->pool, uri);
-
- /* parse the uri and prep the associated resource. */
- derr = get_resource(r, root_path,
- /* ### I can't believe that every single
- parser ignores the LABEL and USE_CHECKED_IN
- args below!! */
- "ignored_label", 1,
- &resource);
- /* Restore r back to normal. */
- r->uri = saved_uri;
-
- if (derr)
- return derr;
-
- if (resource->type == DAV_RESOURCE_TYPE_REGULAR)
- {
- /* Either a public URI or a bc. In both cases, prep_regular()
- has already set the 'exists' and 'collection' flags by
- querying the appropriate revision root and path. */
- if (! resource->exists)
- *kind = svn_node_none;
- else
- *kind = resource->collection ? svn_node_dir : svn_node_file;
- }
-
- else if (resource->type == DAV_RESOURCE_TYPE_VERSION)
- {
- if (resource->baselined) /* bln */
- *kind = svn_node_unknown;
-
- else /* ver */
- {
- derr = fs_check_path(kind, resource->info->root.root,
- resource->info->repos_path, r->pool);
- if (derr != NULL)
- return derr;
- }
- }
-
- else if (resource->type == DAV_RESOURCE_TYPE_WORKING)
- {
- if (resource->baselined) /* wbl */
- *kind = svn_node_unknown;
-
- else /* wrk */
- {
- /* don't call fs_check_path on the txn, but on the original
- revision that the txn is based on. */
- base_rev = svn_fs_txn_base_revision(resource->info->root.txn);
- serr = svn_fs_revision_root(&base_rev_root,
- resource->info->repos->fs,
- base_rev, r->pool);
- if (serr)
- return dav_svn__convert_err
- (serr, HTTP_INTERNAL_SERVER_ERROR,
- apr_psprintf(r->pool,
- "Could not open root of revision %ld",
- base_rev),
- r->pool);
-
- derr = fs_check_path(kind, base_rev_root,
- resource->info->repos_path, r->pool);
- if (derr != NULL)
- return derr;
- }
- }
-
- else
- /* act, his, vcc, or some other private resource */
- *kind = svn_node_unknown;
-
- return NULL;
-}
-#endif
-
-
static dav_error *
open_stream(const dav_resource *resource,
dav_stream_mode mode,
@@ -2730,14 +2615,13 @@ open_stream(const dav_resource *resource
}
}
-#if 1
+ /* ### TODO: Can we support range writes someday? */
if (mode == DAV_MODE_WRITE_SEEKABLE)
{
return dav_svn__new_error(resource->pool, HTTP_NOT_IMPLEMENTED, 0,
"Resource body writes cannot use ranges "
"(at this time).");
}
-#endif
/* start building the stream structure */
*stream = apr_pcalloc(resource->pool, sizeof(**stream));
Modified: subversion/branches/fsfs-format7/subversion/mod_dav_svn/version.c
URL: http://svn.apache.org/viewvc/subversion/branches/fsfs-format7/subversion/mod_dav_svn/version.c?rev=1442344&r1=1442343&r2=1442344&view=diff
==============================================================================
--- subversion/branches/fsfs-format7/subversion/mod_dav_svn/version.c (original)
+++ subversion/branches/fsfs-format7/subversion/mod_dav_svn/version.c Mon Feb 4 20:48:05 2013
@@ -149,6 +149,7 @@ get_vsn_options(apr_pool_t *p, apr_text_
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_INHERITED_PROPS);
+ apr_text_append(p, phdr, SVN_DAV_NS_DAV_SVN_INLINE_PROPS);
/* 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.
@@ -247,7 +248,8 @@ get_option(const dav_resource *resource,
{
int i;
svn_version_t *master_version = dav_svn__get_master_version(r);
-
+ dav_svn__bulk_upd_conf bulk_upd_conf = dav_svn__get_bulk_updates_flag(r);
+
/* The list of Subversion's custom POSTs and which versions of
Subversion support them. We need this latter information
when acting as a WebDAV slave -- we don't want to claim
@@ -264,6 +266,14 @@ get_option(const dav_resource *resource,
{ "create-txn-with-props", { 1, 8, 0, "" } },
};
+ /* Add the header which indicates that this server can handle
+ replay REPORTs submitted against an HTTP v2 revision resource. */
+ apr_table_addn(r->headers_out, "DAV",
+ SVN_DAV_NS_DAV_SVN_REPLAY_REV_RESOURCE);
+
+ /* Add a bunch of HTTP v2 headers which carry resource and
+ resource stub URLs that the client can use to naively build
+ addressable resources. */
apr_table_set(r->headers_out, SVN_DAV_ROOT_URI_HEADER, repos_root_uri);
apr_table_set(r->headers_out, SVN_DAV_ME_RESOURCE_HEADER,
apr_pstrcat(resource->pool, repos_root_uri, "/",
@@ -286,6 +296,9 @@ get_option(const dav_resource *resource,
apr_table_set(r->headers_out, SVN_DAV_VTXN_STUB_HEADER,
apr_pstrcat(resource->pool, repos_root_uri, "/",
dav_svn__get_vtxn_stub(r), (char *)NULL));
+ apr_table_set(r->headers_out, SVN_DAV_ALLOW_BULK_UPDATES,
+ bulk_upd_conf == CONF_BULKUPD_ON ? "On" :
+ bulk_upd_conf == CONF_BULKUPD_OFF ? "Off" : "Prefer");
/* Report the supported POST types. */
for (i = 0; i < sizeof(posts_versions)/sizeof(posts_versions[0]); ++i)