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 2015/02/12 13:21:32 UTC
svn commit: r1659238 [2/21] - in /subversion/branches/fsx-1.10: ./
build/generator/ build/generator/templates/ subversion/bindings/swig/
subversion/include/ subversion/include/private/ subversion/libsvn_delta/
subversion/libsvn_fs_base/ subversion/libs...
Modified: subversion/branches/fsx-1.10/subversion/libsvn_repos/repos.c
URL: http://svn.apache.org/viewvc/subversion/branches/fsx-1.10/subversion/libsvn_repos/repos.c?rev=1659238&r1=1659237&r2=1659238&view=diff
==============================================================================
--- subversion/branches/fsx-1.10/subversion/libsvn_repos/repos.c (original)
+++ subversion/branches/fsx-1.10/subversion/libsvn_repos/repos.c Thu Feb 12 12:21:31 2015
@@ -291,10 +291,76 @@ create_locks(svn_repos_t *repos, apr_poo
"# For similar reasons, you should also add a trailing @ to URLs which" NL \
"# are passed to SVN commands accepting URLs with peg revisions." NL
+/* Return template text for a hook script named SCRIPT_NAME. Include
+ * DESCRIPTION and SCRIPT in the template text.
+ */
+static const char *
+hook_template_text(const char *script_name,
+ const char *description,
+ const char *script,
+ apr_pool_t *result_pool)
+{
+ return apr_pstrcat(result_pool,
+"#!/bin/sh" NL
+"" NL,
+ description,
+"#" NL
+"# The default working directory for the invocation is undefined, so" NL
+"# the program should set one explicitly if it cares." NL
+"#" NL
+"# On a Unix system, the normal procedure is to have '", script_name, "'" NL
+"# invoke other programs to do the real work, though it may do the" NL
+"# work itself too." NL
+"#" NL
+"# Note that '", script_name, "' must be executable by the user(s) who will" NL
+"# invoke it (typically the user httpd runs as), and that user must" NL
+"# have filesystem-level permission to access the repository." NL
+"#" NL
+"# On a Windows system, you should name the hook program" NL
+"# '", script_name, ".bat' or '", script_name, ".exe'," NL
+"# but the basic idea is the same." NL
+"#" NL
+HOOKS_ENVIRONMENT_TEXT
+"#" NL
+HOOKS_QUOTE_ARGUMENTS_TEXT
+"#" NL
+"# Here is an example hook script, for a Unix /bin/sh interpreter." NL
+PREWRITTEN_HOOKS_TEXT
+"" NL
+"" NL,
+ script,
+ SVN_VA_NULL);
+}
+
+/* Write a template file for a hook script named SCRIPT_NAME (appending
+ * '.tmpl' to that name) in REPOS. Include DESCRIPTION and SCRIPT in the
+ * template text.
+ */
+static svn_error_t *
+write_hook_template_file(svn_repos_t *repos, const char *script_name,
+ const char *description,
+ const char *script,
+ apr_pool_t *pool)
+{
+ const char *template_path
+ = svn_dirent_join(repos->hook_path,
+ apr_psprintf(pool, "%s%s",
+ script_name, SVN_REPOS__HOOK_DESC_EXT),
+ pool);
+ const char *contents
+ = hook_template_text(script_name, description, script, pool);
+
+ SVN_ERR(svn_io_file_create(template_path, contents, pool));
+ SVN_ERR(svn_io_set_file_executable(template_path, TRUE, FALSE, pool));
+ return SVN_NO_ERROR;
+}
+
+/* Write the hook template files in REPOS.
+ */
static svn_error_t *
create_hooks(svn_repos_t *repos, apr_pool_t *pool)
{
- const char *this_path, *contents;
+ const char *description, *script;
/* Create the hook directory. */
SVN_ERR_W(create_repos_dir(repos->hook_path, pool),
@@ -303,16 +369,9 @@ create_hooks(svn_repos_t *repos, apr_poo
/*** Write a default template for each standard hook file. */
/* Start-commit hook. */
- {
- this_path = apr_psprintf(pool, "%s%s",
- svn_repos_start_commit_hook(repos, pool),
- SVN_REPOS__HOOK_DESC_EXT);
-
#define SCRIPT_NAME SVN_REPOS__HOOK_START_COMMIT
- contents =
-"#!/bin/sh" NL
-"" NL
+ description =
"# START-COMMIT HOOK" NL
"#" NL
"# The start-commit hook is invoked immediately after a Subversion txn is" NL
@@ -343,33 +402,10 @@ create_hooks(svn_repos_t *repos, apr_poo
"# make security assumptions based on the capabilities list, nor should" NL
"# you assume that clients reliably report every capability they have." NL
"#" NL
-"# The working directory for this hook program's invocation is undefined," NL
-"# so the program should set one explicitly if it cares." NL
-"#" NL
"# If the hook program exits with success, the commit continues; but" NL
"# if it exits with failure (non-zero), the commit is stopped before" NL
-"# a Subversion txn is created, and STDERR is returned to the client." NL
-"#" NL
-"# On a Unix system, the normal procedure is to have '"SCRIPT_NAME"'" NL
-"# invoke other programs to do the real work, though it may do the" NL
-"# work itself too." NL
-"#" NL
-"# Note that '"SCRIPT_NAME"' must be executable by the user(s) who will" NL
-"# invoke it (typically the user httpd runs as), and that user must" NL
-"# have filesystem-level permission to access the repository." NL
-"#" NL
-"# On a Windows system, you should name the hook program" NL
-"# '"SCRIPT_NAME".bat' or '"SCRIPT_NAME".exe'," NL
-"# but the basic idea is the same." NL
-"# " NL
-HOOKS_ENVIRONMENT_TEXT
-"# " NL
-HOOKS_QUOTE_ARGUMENTS_TEXT
-"# " NL
-"# Here is an example hook script, for a Unix /bin/sh interpreter." NL
-PREWRITTEN_HOOKS_TEXT
-"" NL
-"" NL
+"# a Subversion txn is created, and STDERR is returned to the client." NL;
+ script =
"REPOS=\"$1\"" NL
"USER=\"$2\"" NL
"" NL
@@ -379,25 +415,17 @@ PREWRITTEN_HOOKS_TEXT
"# All checks passed, so allow the commit." NL
"exit 0" NL;
-#undef SCRIPT_NAME
+ SVN_ERR_W(write_hook_template_file(repos, SCRIPT_NAME,
+ description, script, pool),
+ _("Creating start-commit hook"));
- SVN_ERR_W(svn_io_file_create(this_path, contents, pool),
- _("Creating start-commit hook"));
+#undef SCRIPT_NAME
- SVN_ERR(svn_io_set_file_executable(this_path, TRUE, FALSE, pool));
- } /* end start-commit hook */
/* Pre-commit hook. */
- {
- this_path = apr_psprintf(pool, "%s%s",
- svn_repos_pre_commit_hook(repos, pool),
- SVN_REPOS__HOOK_DESC_EXT);
-
#define SCRIPT_NAME SVN_REPOS__HOOK_PRE_COMMIT
- contents =
-"#!/bin/sh" NL
-"" NL
+ description =
"# PRE-COMMIT HOOK" NL
"#" NL
"# The pre-commit hook is invoked before a Subversion txn is" NL
@@ -419,18 +447,11 @@ PREWRITTEN_HOOKS_TEXT
"# by the separator character '|', followed by the lock token string," NL
"# followed by a newline." NL
"#" NL
-"# The default working directory for the invocation is undefined, so" NL
-"# the program should set one explicitly if it cares." NL
-"#" NL
"# If the hook program exits with success, the txn is committed; but" NL
"# if it exits with failure (non-zero), the txn is aborted, no commit" NL
"# takes place, and STDERR is returned to the client. The hook" NL
"# program can use the 'svnlook' utility to help it examine the txn." NL
"#" NL
-"# On a Unix system, the normal procedure is to have '"SCRIPT_NAME"'" NL
-"# invoke other programs to do the real work, though it may do the" NL
-"# work itself too." NL
-"#" NL
"# *** NOTE: THE HOOK PROGRAM MUST NOT MODIFY THE TXN, EXCEPT ***" NL
"# *** FOR REVISION PROPERTIES (like svn:log or svn:author). ***" NL
"#" NL
@@ -439,24 +460,8 @@ PREWRITTEN_HOOKS_TEXT
"# hooks should not modify the versioned data in txns, or else come" NL
"# up with a mechanism to make it safe to do so (by informing the" NL
"# committing client of the changes). However, right now neither" NL
-"# mechanism is implemented, so hook writers just have to be careful." NL
-"#" NL
-"# Note that '"SCRIPT_NAME"' must be executable by the user(s) who will" NL
-"# invoke it (typically the user httpd runs as), and that user must" NL
-"# have filesystem-level permission to access the repository." NL
-"#" NL
-"# On a Windows system, you should name the hook program" NL
-"# '"SCRIPT_NAME".bat' or '"SCRIPT_NAME".exe'," NL
-"# but the basic idea is the same." NL
-"#" NL
-HOOKS_ENVIRONMENT_TEXT
-"# " NL
-HOOKS_QUOTE_ARGUMENTS_TEXT
-"# " NL
-"# Here is an example hook script, for a Unix /bin/sh interpreter." NL
-PREWRITTEN_HOOKS_TEXT
-"" NL
-"" NL
+"# mechanism is implemented, so hook writers just have to be careful." NL;
+ script =
"REPOS=\"$1\"" NL
"TXN=\"$2\"" NL
"" NL
@@ -473,26 +478,17 @@ PREWRITTEN_HOOKS_TEXT
"# All checks passed, so allow the commit." NL
"exit 0" NL;
-#undef SCRIPT_NAME
-
- SVN_ERR_W(svn_io_file_create(this_path, contents, pool),
- _("Creating pre-commit hook"));
+ SVN_ERR_W(write_hook_template_file(repos, SCRIPT_NAME,
+ description, script, pool),
+ _("Creating pre-commit hook"));
- SVN_ERR(svn_io_set_file_executable(this_path, TRUE, FALSE, pool));
- } /* end pre-commit hook */
+#undef SCRIPT_NAME
/* Pre-revprop-change hook. */
- {
- this_path = apr_psprintf(pool, "%s%s",
- svn_repos_pre_revprop_change_hook(repos, pool),
- SVN_REPOS__HOOK_DESC_EXT);
-
#define SCRIPT_NAME SVN_REPOS__HOOK_PRE_REVPROP_CHANGE
- contents =
-"#!/bin/sh" NL
-"" NL
+ description =
"# PRE-REVPROP-CHANGE HOOK" NL
"#" NL
"# The pre-revprop-change hook is invoked before a revision property" NL
@@ -520,28 +516,8 @@ PREWRITTEN_HOOKS_TEXT
"# will behave as if the hook were present, but failed. The reason" NL
"# for this is that revision properties are UNVERSIONED, meaning that" NL
"# a successful propchange is destructive; the old value is gone" NL
-"# forever. We recommend the hook back up the old value somewhere." NL
-"#" NL
-"# On a Unix system, the normal procedure is to have '"SCRIPT_NAME"'" NL
-"# invoke other programs to do the real work, though it may do the" NL
-"# work itself too." NL
-"#" NL
-"# Note that '"SCRIPT_NAME"' must be executable by the user(s) who will" NL
-"# invoke it (typically the user httpd runs as), and that user must" NL
-"# have filesystem-level permission to access the repository." NL
-"#" NL
-"# On a Windows system, you should name the hook program" NL
-"# '"SCRIPT_NAME".bat' or '"SCRIPT_NAME".exe'," NL
-"# but the basic idea is the same." NL
-"#" NL
-HOOKS_ENVIRONMENT_TEXT
-"# " NL
-HOOKS_QUOTE_ARGUMENTS_TEXT
-"# " NL
-"# Here is an example hook script, for a Unix /bin/sh interpreter." NL
-PREWRITTEN_HOOKS_TEXT
-"" NL
-"" NL
+"# forever. We recommend the hook back up the old value somewhere." NL;
+ script =
"REPOS=\"$1\"" NL
"REV=\"$2\"" NL
"USER=\"$3\"" NL
@@ -553,26 +529,17 @@ PREWRITTEN_HOOKS_TEXT
"echo \"Changing revision properties other than svn:log is prohibited\" >&2" NL
"exit 1" NL;
-#undef SCRIPT_NAME
-
- SVN_ERR_W(svn_io_file_create(this_path, contents, pool),
- _("Creating pre-revprop-change hook"));
+ SVN_ERR_W(write_hook_template_file(repos, SCRIPT_NAME,
+ description, script, pool),
+ _("Creating pre-revprop-change hook"));
- SVN_ERR(svn_io_set_file_executable(this_path, TRUE, FALSE, pool));
- } /* end pre-revprop-change hook */
+#undef SCRIPT_NAME
/* Pre-lock hook. */
- {
- this_path = apr_psprintf(pool, "%s%s",
- svn_repos_pre_lock_hook(repos, pool),
- SVN_REPOS__HOOK_DESC_EXT);
-
#define SCRIPT_NAME SVN_REPOS__HOOK_PRE_LOCK
- contents =
-"#!/bin/sh" NL
-"" NL
+ description =
"# PRE-LOCK HOOK" NL
"#" NL
"# The pre-lock hook is invoked before an exclusive lock is" NL
@@ -591,29 +558,10 @@ PREWRITTEN_HOOKS_TEXT
"# this feature, you must guarantee the tokens generated are unique across" NL
"# the repository each time." NL
"#" NL
-"# The default working directory for the invocation is undefined, so" NL
-"# the program should set one explicitly if it cares." NL
-"#" NL
"# If the hook program exits with success, the lock is created; but" NL
"# if it exits with failure (non-zero), the lock action is aborted" NL
-"# and STDERR is returned to the client." NL
-"" NL
-"# On a Unix system, the normal procedure is to have '"SCRIPT_NAME"'" NL
-"# invoke other programs to do the real work, though it may do the" NL
-"# work itself too." NL
-"#" NL
-"# Note that '"SCRIPT_NAME"' must be executable by the user(s) who will" NL
-"# invoke it (typically the user httpd runs as), and that user must" NL
-"# have filesystem-level permission to access the repository." NL
-"#" NL
-"# On a Windows system, you should name the hook program" NL
-"# '"SCRIPT_NAME".bat' or '"SCRIPT_NAME".exe'," NL
-"# but the basic idea is the same." NL
-"#" NL
-HOOKS_QUOTE_ARGUMENTS_TEXT
-"# " NL
-"# Here is an example hook script, for a Unix /bin/sh interpreter:" NL
-"" NL
+"# and STDERR is returned to the client." NL;
+ script =
"REPOS=\"$1\"" NL
"PATH=\"$2\"" NL
"USER=\"$3\"" NL
@@ -647,26 +595,17 @@ HOOKS_QUOTE_ARGUMENTS_TEXT
"echo \"Error: $PATH already locked by ${LOCK_OWNER}.\" 1>&2" NL
"exit 1" NL;
-#undef SCRIPT_NAME
-
- SVN_ERR_W(svn_io_file_create(this_path, contents, pool),
- "Creating pre-lock hook");
+ SVN_ERR_W(write_hook_template_file(repos, SCRIPT_NAME,
+ description, script, pool),
+ _("Creating pre-lock hook"));
- SVN_ERR(svn_io_set_file_executable(this_path, TRUE, FALSE, pool));
- } /* end pre-lock hook */
+#undef SCRIPT_NAME
/* Pre-unlock hook. */
- {
- this_path = apr_psprintf(pool, "%s%s",
- svn_repos_pre_unlock_hook(repos, pool),
- SVN_REPOS__HOOK_DESC_EXT);
-
#define SCRIPT_NAME SVN_REPOS__HOOK_PRE_UNLOCK
- contents =
-"#!/bin/sh" NL
-"" NL
+ description =
"# PRE-UNLOCK HOOK" NL
"#" NL
"# The pre-unlock hook is invoked before an exclusive lock is" NL
@@ -680,29 +619,10 @@ HOOKS_QUOTE_ARGUMENTS_TEXT
"# [4] TOKEN (the lock token to be destroyed)" NL
"# [5] BREAK-UNLOCK (1 if the user is breaking the lock, else 0)" NL
"#" NL
-"# The default working directory for the invocation is undefined, so" NL
-"# the program should set one explicitly if it cares." NL
-"#" NL
"# If the hook program exits with success, the lock is destroyed; but" NL
"# if it exits with failure (non-zero), the unlock action is aborted" NL
-"# and STDERR is returned to the client." NL
-"" NL
-"# On a Unix system, the normal procedure is to have '"SCRIPT_NAME"'" NL
-"# invoke other programs to do the real work, though it may do the" NL
-"# work itself too." NL
-"#" NL
-"# Note that '"SCRIPT_NAME"' must be executable by the user(s) who will" NL
-"# invoke it (typically the user httpd runs as), and that user must" NL
-"# have filesystem-level permission to access the repository." NL
-"#" NL
-"# On a Windows system, you should name the hook program" NL
-"# '"SCRIPT_NAME".bat' or '"SCRIPT_NAME".exe'," NL
-"# but the basic idea is the same." NL
-"#" NL
-HOOKS_QUOTE_ARGUMENTS_TEXT
-"# " NL
-"# Here is an example hook script, for a Unix /bin/sh interpreter:" NL
-"" NL
+"# and STDERR is returned to the client." NL;
+ script =
"REPOS=\"$1\"" NL
"PATH=\"$2\"" NL
"USER=\"$3\"" NL
@@ -733,27 +653,17 @@ HOOKS_QUOTE_ARGUMENTS_TEXT
"echo \"Error: $PATH locked by ${LOCK_OWNER}.\" 1>&2" NL
"exit 1" NL;
-#undef SCRIPT_NAME
-
- SVN_ERR_W(svn_io_file_create(this_path, contents, pool),
- "Creating pre-unlock hook");
-
- SVN_ERR(svn_io_set_file_executable(this_path, TRUE, FALSE, pool));
- } /* end pre-unlock hook */
+ SVN_ERR_W(write_hook_template_file(repos, SCRIPT_NAME,
+ description, script, pool),
+ _("Creating pre-unlock hook"));
+#undef SCRIPT_NAME
/* Post-commit hook. */
- {
- this_path = apr_psprintf(pool, "%s%s",
- svn_repos_post_commit_hook(repos, pool),
- SVN_REPOS__HOOK_DESC_EXT);
-
#define SCRIPT_NAME SVN_REPOS__HOOK_POST_COMMIT
- contents =
-"#!/bin/sh" NL
-"" NL
+ description =
"# POST-COMMIT HOOK" NL
"#" NL
"# The post-commit hook is invoked after a commit. Subversion runs" NL
@@ -765,60 +675,28 @@ HOOKS_QUOTE_ARGUMENTS_TEXT
"# [2] REV (the number of the revision just committed)" NL
"# [3] TXN-NAME (the name of the transaction that has become REV)" NL
"#" NL
-"# The default working directory for the invocation is undefined, so" NL
-"# the program should set one explicitly if it cares." NL
-"#" NL
"# Because the commit has already completed and cannot be undone," NL
"# the exit code of the hook program is ignored. The hook program" NL
"# can use the 'svnlook' utility to help it examine the" NL
-"# newly-committed tree." NL
-"#" NL
-"# On a Unix system, the normal procedure is to have '"SCRIPT_NAME"'" NL
-"# invoke other programs to do the real work, though it may do the" NL
-"# work itself too." NL
-"#" NL
-"# Note that '"SCRIPT_NAME"' must be executable by the user(s) who will" NL
-"# invoke it (typically the user httpd runs as), and that user must" NL
-"# have filesystem-level permission to access the repository." NL
-"#" NL
-"# On a Windows system, you should name the hook program" NL
-"# '"SCRIPT_NAME".bat' or '"SCRIPT_NAME".exe'," NL
-"# but the basic idea is the same." NL
-"# " NL
-HOOKS_ENVIRONMENT_TEXT
-"# " NL
-HOOKS_QUOTE_ARGUMENTS_TEXT
-"# " NL
-"# Here is an example hook script, for a Unix /bin/sh interpreter." NL
-PREWRITTEN_HOOKS_TEXT
-"" NL
-"" NL
+"# newly-committed tree." NL;
+ script =
"REPOS=\"$1\"" NL
"REV=\"$2\"" NL
"TXN_NAME=\"$3\"" NL
NL
"mailer.py commit \"$REPOS\" \"$REV\" /path/to/mailer.conf" NL;
-#undef SCRIPT_NAME
-
- SVN_ERR_W(svn_io_file_create(this_path, contents, pool),
- _("Creating post-commit hook"));
+ SVN_ERR_W(write_hook_template_file(repos, SCRIPT_NAME,
+ description, script, pool),
+ _("Creating post-commit hook"));
- SVN_ERR(svn_io_set_file_executable(this_path, TRUE, FALSE, pool));
- } /* end post-commit hook */
+#undef SCRIPT_NAME
/* Post-lock hook. */
- {
- this_path = apr_psprintf(pool, "%s%s",
- svn_repos_post_lock_hook(repos, pool),
- SVN_REPOS__HOOK_DESC_EXT);
-
#define SCRIPT_NAME SVN_REPOS__HOOK_POST_LOCK
- contents =
-"#!/bin/sh" NL
-"" NL
+ description =
"# POST-LOCK HOOK" NL
"#" NL
"# The post-lock hook is run after a path is locked. Subversion runs" NL
@@ -831,57 +709,29 @@ PREWRITTEN_HOOKS_TEXT
"#" NL
"# The paths that were just locked are passed to the hook via STDIN." NL
"#" NL
-"# The default working directory for the invocation is undefined, so" NL
-"# the program should set one explicitly if it cares." NL
-"#" NL
"# Because the locks have already been created and cannot be undone," NL
"# the exit code of the hook program is ignored. The hook program" NL
"# can use the 'svnlook' utility to examine the paths in the repository" NL
"# but since the hook is invoked asyncronously the newly-created locks" NL
-"# may no longer be present." NL
-"#" NL
-"# On a Unix system, the normal procedure is to have '"SCRIPT_NAME"'" NL
-"# invoke other programs to do the real work, though it may do the" NL
-"# work itself too." NL
-"#" NL
-"# Note that '"SCRIPT_NAME"' must be executable by the user(s) who will" NL
-"# invoke it (typically the user httpd runs as), and that user must" NL
-"# have filesystem-level permission to access the repository." NL
-"#" NL
-"# On a Windows system, you should name the hook program" NL
-"# '"SCRIPT_NAME".bat' or '"SCRIPT_NAME".exe'," NL
-"# but the basic idea is the same." NL
-"# " NL
-HOOKS_QUOTE_ARGUMENTS_TEXT
-"# " NL
-"# Here is an example hook script, for a Unix /bin/sh interpreter:" NL
-"" NL
+"# may no longer be present." NL;
+ script =
"REPOS=\"$1\"" NL
"USER=\"$2\"" NL
"" NL
"# Send email to interested parties, let them know a lock was created:" NL
"mailer.py lock \"$REPOS\" \"$USER\" /path/to/mailer.conf" NL;
-#undef SCRIPT_NAME
-
- SVN_ERR_W(svn_io_file_create(this_path, contents, pool),
- "Creating post-lock hook");
+ SVN_ERR_W(write_hook_template_file(repos, SCRIPT_NAME,
+ description, script, pool),
+ _("Creating post-lock hook"));
- SVN_ERR(svn_io_set_file_executable(this_path, TRUE, FALSE, pool));
- } /* end post-lock hook */
+#undef SCRIPT_NAME
/* Post-unlock hook. */
- {
- this_path = apr_psprintf(pool, "%s%s",
- svn_repos_post_unlock_hook(repos, pool),
- SVN_REPOS__HOOK_DESC_EXT);
-
#define SCRIPT_NAME SVN_REPOS__HOOK_POST_UNLOCK
- contents =
-"#!/bin/sh" NL
-"" NL
+ description =
"# POST-UNLOCK HOOK" NL
"#" NL
"# The post-unlock hook runs after a path is unlocked. Subversion runs" NL
@@ -894,54 +744,26 @@ HOOKS_QUOTE_ARGUMENTS_TEXT
"#" NL
"# The paths that were just unlocked are passed to the hook via STDIN." NL
"#" NL
-"# The default working directory for the invocation is undefined, so" NL
-"# the program should set one explicitly if it cares." NL
-"#" NL
"# Because the lock has already been destroyed and cannot be undone," NL
-"# the exit code of the hook program is ignored." NL
-"#" NL
-"# On a Unix system, the normal procedure is to have '"SCRIPT_NAME"'" NL
-"# invoke other programs to do the real work, though it may do the" NL
-"# work itself too." NL
-"#" NL
-"# Note that '"SCRIPT_NAME"' must be executable by the user(s) who will" NL
-"# invoke it (typically the user httpd runs as), and that user must" NL
-"# have filesystem-level permission to access the repository." NL
-"#" NL
-"# On a Windows system, you should name the hook program" NL
-"# '"SCRIPT_NAME".bat' or '"SCRIPT_NAME".exe'," NL
-"# but the basic idea is the same." NL
-"# " NL
-HOOKS_QUOTE_ARGUMENTS_TEXT
-"# " NL
-"# Here is an example hook script, for a Unix /bin/sh interpreter:" NL
-"" NL
+"# the exit code of the hook program is ignored." NL;
+ script =
"REPOS=\"$1\"" NL
"USER=\"$2\"" NL
"" NL
"# Send email to interested parties, let them know a lock was removed:" NL
"mailer.py unlock \"$REPOS\" \"$USER\" /path/to/mailer.conf" NL;
-#undef SCRIPT_NAME
-
- SVN_ERR_W(svn_io_file_create(this_path, contents, pool),
- "Creating post-unlock hook");
+ SVN_ERR_W(write_hook_template_file(repos, SCRIPT_NAME,
+ description, script, pool),
+ _("Creating post-unlock hook"));
- SVN_ERR(svn_io_set_file_executable(this_path, TRUE, FALSE, pool));
- } /* end post-unlock hook */
+#undef SCRIPT_NAME
/* Post-revprop-change hook. */
- {
- this_path = apr_psprintf(pool, "%s%s",
- svn_repos_post_revprop_change_hook(repos, pool),
- SVN_REPOS__HOOK_DESC_EXT);
-
#define SCRIPT_NAME SVN_REPOS__HOOK_POST_REVPROP_CHANGE
- contents =
-"#!/bin/sh" NL
-"" NL
+ description =
"# POST-REVPROP-CHANGE HOOK" NL
"#" NL
"# The post-revprop-change hook is invoked after a revision property" NL
@@ -961,28 +783,8 @@ HOOKS_QUOTE_ARGUMENTS_TEXT
"# Because the propchange has already completed and cannot be undone," NL
"# the exit code of the hook program is ignored. The hook program" NL
"# can use the 'svnlook' utility to help it examine the" NL
-"# new property value." NL
-"#" NL
-"# On a Unix system, the normal procedure is to have '"SCRIPT_NAME"'" NL
-"# invoke other programs to do the real work, though it may do the" NL
-"# work itself too." NL
-"#" NL
-"# Note that '"SCRIPT_NAME"' must be executable by the user(s) who will" NL
-"# invoke it (typically the user httpd runs as), and that user must" NL
-"# have filesystem-level permission to access the repository." NL
-"#" NL
-"# On a Windows system, you should name the hook program" NL
-"# '"SCRIPT_NAME".bat' or '"SCRIPT_NAME".exe'," NL
-"# but the basic idea is the same." NL
-"# " NL
-HOOKS_ENVIRONMENT_TEXT
-"# " NL
-HOOKS_QUOTE_ARGUMENTS_TEXT
-"# " NL
-"# Here is an example hook script, for a Unix /bin/sh interpreter." NL
-PREWRITTEN_HOOKS_TEXT
-"" NL
-"" NL
+"# new property value." NL;
+ script =
"REPOS=\"$1\"" NL
"REV=\"$2\"" NL
"USER=\"$3\"" NL
@@ -992,13 +794,11 @@ PREWRITTEN_HOOKS_TEXT
"mailer.py propchange2 \"$REPOS\" \"$REV\" \"$USER\" \"$PROPNAME\" "
"\"$ACTION\" /path/to/mailer.conf" NL;
-#undef SCRIPT_NAME
-
- SVN_ERR_W(svn_io_file_create(this_path, contents, pool),
- _("Creating post-revprop-change hook"));
+ SVN_ERR_W(write_hook_template_file(repos, SCRIPT_NAME,
+ description, script, pool),
+ _("Creating post-revprop-change hook"));
- SVN_ERR(svn_io_set_file_executable(this_path, TRUE, FALSE, pool));
- } /* end post-revprop-change hook */
+#undef SCRIPT_NAME
return SVN_NO_ERROR;
}
Modified: subversion/branches/fsx-1.10/subversion/libsvn_subr/dso.c
URL: http://svn.apache.org/viewvc/subversion/branches/fsx-1.10/subversion/libsvn_subr/dso.c?rev=1659238&r1=1659237&r2=1659238&view=diff
==============================================================================
--- subversion/branches/fsx-1.10/subversion/libsvn_subr/dso.c (original)
+++ subversion/branches/fsx-1.10/subversion/libsvn_subr/dso.c Thu Feb 12 12:21:31 2015
@@ -28,6 +28,7 @@
#include "svn_private_config.h"
#include "private/svn_mutex.h"
+#include "private/svn_atomic.h"
/* A mutex to protect our global pool and cache. */
static svn_mutex__t *dso_mutex = NULL;
@@ -41,6 +42,8 @@ static apr_hash_t *dso_cache;
/* Just an arbitrary location in memory... */
static int not_there_sentinel;
+static volatile svn_atomic_t atomic_init_status = 0;
+
/* A specific value we store in the dso_cache to indicate that the
library wasn't found. This keeps us from allocating extra memory
from dso_pool when trying to find libraries we already know aren't
@@ -61,6 +64,14 @@ svn_dso_initialize2(void)
return SVN_NO_ERROR;
}
+static svn_error_t *
+atomic_init_func(void *baton,
+ apr_pool_t *pool)
+{
+ SVN_ERR(svn_dso_initialize2());
+ return SVN_NO_ERROR;
+}
+
#if APR_HAS_DSO
static svn_error_t *
svn_dso_load_internal(apr_dso_handle_t **dso, const char *fname)
@@ -107,8 +118,8 @@ svn_dso_load_internal(apr_dso_handle_t *
svn_error_t *
svn_dso_load(apr_dso_handle_t **dso, const char *fname)
{
- if (! dso_pool)
- SVN_ERR(svn_dso_initialize2());
+ SVN_ERR(svn_atomic__init_once(&atomic_init_status, atomic_init_func,
+ NULL, NULL));
SVN_MUTEX__WITH_LOCK(dso_mutex, svn_dso_load_internal(dso, fname));
Modified: subversion/branches/fsx-1.10/subversion/libsvn_subr/x509.h
URL: http://svn.apache.org/viewvc/subversion/branches/fsx-1.10/subversion/libsvn_subr/x509.h?rev=1659238&r1=1659237&r2=1659238&view=diff
==============================================================================
--- subversion/branches/fsx-1.10/subversion/libsvn_subr/x509.h (original)
+++ subversion/branches/fsx-1.10/subversion/libsvn_subr/x509.h Thu Feb 12 12:21:31 2015
@@ -108,15 +108,19 @@ typedef struct _x509_cert {
} x509_cert;
+struct svn_x509_name_attr_t {
+ unsigned char *oid;
+ apr_size_t oid_len;
+ const char *utf8_value;
+};
+
/*
* Certificate info, returned from the parser
*/
struct svn_x509_certinfo_t
{
- apr_array_header_t *issuer_oids;
- apr_hash_t *issuer;
- apr_array_header_t *subject_oids;
- apr_hash_t *subject;
+ apr_array_header_t *issuer;
+ apr_array_header_t *subject;
apr_time_t valid_from;
apr_time_t valid_to;
svn_checksum_t *digest;
Modified: subversion/branches/fsx-1.10/subversion/libsvn_subr/x509info.c
URL: http://svn.apache.org/viewvc/subversion/branches/fsx-1.10/subversion/libsvn_subr/x509info.c?rev=1659238&r1=1659237&r2=1659238&view=diff
==============================================================================
--- subversion/branches/fsx-1.10/subversion/libsvn_subr/x509info.c (original)
+++ subversion/branches/fsx-1.10/subversion/libsvn_subr/x509info.c Thu Feb 12 12:21:31 2015
@@ -34,6 +34,33 @@
+svn_x509_name_attr_t *
+svn_x509_name_attr_dup(const svn_x509_name_attr_t *attr,
+ apr_pool_t *result_pool,
+ apr_pool_t *scratch_pool)
+{
+ svn_x509_name_attr_t *result = apr_palloc(result_pool, sizeof(*result));
+ result->oid_len = attr->oid_len;
+ result->oid = apr_palloc(result_pool, result->oid_len);
+ memcpy(result->oid, attr->oid, result->oid_len);
+ result->utf8_value = apr_pstrdup(result_pool, attr->utf8_value);
+
+ return result;
+}
+
+const unsigned char *
+svn_x509_name_attr_get_oid(const svn_x509_name_attr_t *attr, apr_size_t *len)
+{
+ *len = attr->oid_len;
+ return attr->oid;
+}
+
+const char *
+svn_x509_name_attr_get_value(const svn_x509_name_attr_t *attr)
+{
+ return attr->utf8_value;
+}
+
/* Array elements are assumed to be nul-terminated C strings. */
static apr_array_header_t *
deep_copy_array(apr_array_header_t *s, apr_pool_t *result_pool)
@@ -56,31 +83,24 @@ deep_copy_array(apr_array_header_t *s, a
return d;
}
-/* Hash key and value are assumed to be nul-terminated C strings. */
-static apr_hash_t *deep_copy_hash(apr_hash_t *s,
- apr_pool_t *scratch_pool,
- apr_pool_t *result_pool)
+/* Copy an array with elements that are svn_x509_name_attr_t's */
+static apr_array_header_t *
+deep_copy_name_attrs(apr_array_header_t *s, apr_pool_t *result_pool)
{
- apr_hash_t *d;
- apr_hash_index_t *i;
+ int i;
+ apr_array_header_t *d;
if (!s)
return NULL;
- d = apr_hash_make(result_pool);
- i = apr_hash_first(scratch_pool, s);
+ d = apr_array_copy(result_pool, s);
- /* Make a deep copy of the hash keys and values. */
- while (i)
+ /* Make a deep copy of the svn_x509_name_attr_t's in the array. */
+ for (i = 0; i < s->nelts; ++i)
{
- const void *key;
- void *val;
- apr_ssize_t klen;
-
- apr_hash_this(i, &key, &klen, &val);
- apr_hash_set(d, apr_pstrndup(result_pool, key, klen), klen,
- apr_pstrdup(result_pool, val));
- i = apr_hash_next(i);
+ APR_ARRAY_IDX(d, i, const svn_x509_name_attr_t *) =
+ svn_x509_name_attr_dup(APR_ARRAY_IDX(s, i, svn_x509_name_attr_t *),
+ result_pool, result_pool);
}
return d;
@@ -92,10 +112,8 @@ svn_x509_certinfo_dup(const svn_x509_cer
apr_pool_t *scratch_pool)
{
svn_x509_certinfo_t *result = apr_palloc(result_pool, sizeof(*result));
- result->subject_oids = deep_copy_array(certinfo->subject_oids, result_pool);
- result->subject = deep_copy_hash(certinfo->subject, scratch_pool, result_pool);
- result->issuer_oids = deep_copy_array(certinfo->issuer_oids, result_pool);
- result->issuer = deep_copy_hash(certinfo->issuer, scratch_pool, result_pool);
+ result->subject = deep_copy_name_attrs(certinfo->subject, result_pool);
+ result->issuer = deep_copy_name_attrs(certinfo->issuer, result_pool);
result->valid_from = certinfo->valid_from;
result->valid_to = certinfo->valid_to;
result->digest = svn_checksum_dup(certinfo->digest, result_pool);
@@ -105,49 +123,134 @@ svn_x509_certinfo_dup(const svn_x509_cer
}
typedef struct asn1_oid {
- const char *oid_string;
+ const unsigned char *oid;
+ const ptrdiff_t oid_len;
const char *short_label;
const char *long_label;
} asn1_oid;
+#define CONSTANT_PAIR(c) (unsigned char *)(c), sizeof((c)) - 1
+
static const asn1_oid asn1_oids[] = {
- { SVN_X509_OID_COMMON_NAME, "CN", "commonName" },
- { SVN_X509_OID_COUNTRY, "C", "countryName" },
- { SVN_X509_OID_LOCALITY, "L", "localityName" },
- { SVN_X509_OID_STATE, "ST", "stateOrProvinceName" },
- { SVN_X509_OID_ORGANIZATION, "O", "organizationName" },
- { SVN_X509_OID_ORG_UNIT, "OU", "organizationalUnitName"},
- { SVN_X509_OID_EMAIL, NULL, "emailAddress" },
+ { CONSTANT_PAIR(SVN_X509_OID_COMMON_NAME), "CN", "commonName" },
+ { CONSTANT_PAIR(SVN_X509_OID_COUNTRY), "C", "countryName" },
+ { CONSTANT_PAIR(SVN_X509_OID_LOCALITY), "L", "localityName" },
+ { CONSTANT_PAIR(SVN_X509_OID_STATE), "ST", "stateOrProvinceName" },
+ { CONSTANT_PAIR(SVN_X509_OID_ORGANIZATION), "O", "organizationName" },
+ { CONSTANT_PAIR(SVN_X509_OID_ORG_UNIT), "OU", "organizationalUnitName"},
+ { CONSTANT_PAIR(SVN_X509_OID_EMAIL), NULL, "emailAddress" },
{ NULL },
};
-static const asn1_oid *oid_string_to_asn1_oid(const char *oid_string)
+/* Given an OID return a null-terminated C string representation.
+ * For example an OID with the bytes "\x2A\x86\x48\x86\xF7\x0D\x01\x09\x01"
+ * would be converted to the string "1.2.840.113549.1.9.1". */
+const char *
+svn_x509_oid_to_string(const unsigned char *oid, apr_size_t oid_len,
+ apr_pool_t *scratch_pool, apr_pool_t *result_pool)
{
- const asn1_oid *oid;
+ svn_stringbuf_t *out = svn_stringbuf_create_empty(result_pool);
+ const unsigned char *p = oid;
+ const unsigned char *end = p + oid_len;
+ const char *temp;
+
+ while (p != end) {
+ if (p == oid)
+ {
+ /* Handle decoding the first two values of the OID. These values
+ * are encoded by taking the first value and adding 40 to it and
+ * adding the result to the second value, then placing this single
+ * value in the first byte of the output. This is unambiguous since
+ * the first value is apparently limited to 0, 1 or 2 and the second
+ * is limited to 0 to 39. */
+ temp = apr_psprintf(scratch_pool, "%d.%d", *p / 40, *p % 40);
+ p++;
+ }
+ else if (*p < 128)
+ {
+ /* The remaining values if they're less than 128 are just
+ * the number one to one encoded */
+ temp = apr_psprintf(scratch_pool, ".%d", *p);
+ p++;
+ }
+ else
+ {
+ /* Values greater than 128 are encoded as a series of 7 bit values
+ * with the left most bit set to indicate this encoding with the
+ * last octet missing the left most bit to finish out the series.. */
+ unsigned int collector = 0;
+ svn_boolean_t dot = FALSE;
+
+ do {
+ if (collector == 0 && *p == 0x80)
+ {
+ /* include leading zeros in the string representation
+ technically not legal, but this seems nicer than just
+ returning NULL */
+ if (!dot)
+ {
+ svn_stringbuf_appendbyte(out, '.');
+ dot = TRUE;
+ }
+ svn_stringbuf_appendbyte(out, '0');
+ }
+ else if (collector > UINT_MAX >> 7)
+ {
+ /* overflow */
+ return NULL;
+ }
+ collector = collector << 7 | (*(p++) & 0x7f);
+ } while (p != end && *p > 127);
+ if (collector > UINT_MAX >> 7)
+ return NULL; /* overflow */
+ collector = collector << 7 | *(p++);
+ temp = apr_psprintf(scratch_pool, "%s%d", dot ? "" : ".", collector);
+ }
+ svn_stringbuf_appendcstr(out, temp);
+ }
- for (oid = asn1_oids; oid->oid_string; oid++)
+ if (svn_stringbuf_isempty(out))
+ return NULL;
+
+ return out->data;
+}
+
+static const asn1_oid *oid_to_asn1_oid(unsigned char *oid, apr_size_t oid_len)
+{
+ const asn1_oid *entry;
+
+ for (entry = asn1_oids; entry->oid; entry++)
{
- if (strcmp(oid_string, oid->oid_string) == 0)
- return oid;
+ if (oid_len == entry->oid_len &&
+ memcmp(oid, entry->oid, oid_len) == 0)
+ return entry;
}
return NULL;
}
-static const char *oid_string_to_best_label(const char *oid_string)
+static const char *oid_to_best_label(unsigned char *oid, apr_size_t oid_len,
+ apr_pool_t *result_pool)
{
- const asn1_oid *oid = oid_string_to_asn1_oid(oid_string);
+ const asn1_oid *entry = oid_to_asn1_oid(oid, oid_len);
- if (oid)
+ if (entry)
{
- if (oid->short_label)
- return oid->short_label;
+ if (entry->short_label)
+ return entry->short_label;
- if (oid->long_label)
- return oid->long_label;
+ if (entry->long_label)
+ return entry->long_label;
+ }
+ else
+ {
+ const char *oid_string = svn_x509_oid_to_string(oid, oid_len,
+ result_pool, result_pool);
+ if (oid_string)
+ return oid_string;
}
- return oid_string;
+ return "??";
}
/*
@@ -156,23 +259,22 @@ static const char *oid_string_to_best_la
* If CN is not NULL, return any common name in CN
*/
static const char *
-get_dn(apr_array_header_t *oids,
- apr_hash_t *hash,
+get_dn(apr_array_header_t *name,
apr_pool_t *result_pool)
{
svn_stringbuf_t *buf = svn_stringbuf_create_empty(result_pool);
int n;
- for (n = 0; n < oids->nelts; n++)
+ for (n = 0; n < name->nelts; n++)
{
- const char *field = APR_ARRAY_IDX(oids, n, const char *);
+ const svn_x509_name_attr_t *attr = APR_ARRAY_IDX(name, n, svn_x509_name_attr_t *);
if (n > 0)
svn_stringbuf_appendcstr(buf, ", ");
- svn_stringbuf_appendcstr(buf, oid_string_to_best_label(field));
+ svn_stringbuf_appendcstr(buf, oid_to_best_label(attr->oid, attr->oid_len, result_pool));
svn_stringbuf_appendbyte(buf, '=');
- svn_stringbuf_appendcstr(buf, svn_hash_gets(hash, field));
+ svn_stringbuf_appendcstr(buf, attr->utf8_value);
}
return buf->data;
@@ -182,40 +284,26 @@ const char *
svn_x509_certinfo_get_subject(const svn_x509_certinfo_t *certinfo,
apr_pool_t *result_pool)
{
- return get_dn(certinfo->subject_oids, certinfo->subject, result_pool);
+ return get_dn(certinfo->subject, result_pool);
}
const apr_array_header_t *
-svn_x509_certinfo_get_subject_oids(const svn_x509_certinfo_t *certinfo)
+svn_x509_certinfo_get_subject_attrs(const svn_x509_certinfo_t *certinfo)
{
- return certinfo->subject_oids;
-}
-
-const char *
-svn_x509_certinfo_get_subject_attr(const svn_x509_certinfo_t *certinfo,
- const char *oid)
-{
- return svn_hash_gets(certinfo->subject, oid);
+ return certinfo->subject;
}
const char *
svn_x509_certinfo_get_issuer(const svn_x509_certinfo_t *certinfo,
apr_pool_t *result_pool)
{
- return get_dn(certinfo->issuer_oids, certinfo->issuer, result_pool);
+ return get_dn(certinfo->issuer, result_pool);
}
const apr_array_header_t *
-svn_x509_certinfo_get_issuer_oids(const svn_x509_certinfo_t *certinfo)
-{
- return certinfo->issuer_oids;
-}
-
-const char *
-svn_x509_certinfo_get_issuer_attr(const svn_x509_certinfo_t *certinfo,
- const char *oid)
+svn_x509_certinfo_get_issuer_attrs(const svn_x509_certinfo_t *certinfo)
{
- return svn_hash_gets(certinfo->issuer, oid);
+ return certinfo->issuer;
}
apr_time_t
@@ -241,3 +329,4 @@ svn_x509_certinfo_get_hostnames(const sv
{
return certinfo->hostnames;
}
+
Modified: subversion/branches/fsx-1.10/subversion/libsvn_subr/x509parse.c
URL: http://svn.apache.org/viewvc/subversion/branches/fsx-1.10/subversion/libsvn_subr/x509parse.c?rev=1659238&r1=1659237&r2=1659238&view=diff
==============================================================================
--- subversion/branches/fsx-1.10/subversion/libsvn_subr/x509parse.c (original)
+++ subversion/branches/fsx-1.10/subversion/libsvn_subr/x509parse.c Thu Feb 12 12:21:31 2015
@@ -903,90 +903,27 @@ x509name_to_utf8_string(const x509_name
return nul_escape(utf8_string, result_pool);
}
-/* Given an OID return a null-terminated C string representation in *RESULT.
- * For example an OID with the bytes "\x2A\x86\x48\x86\xF7\x0D\x01\x09\x01"
- * would be converted to the string "1.2.840.113549.1.9.1". */
static svn_error_t *
-asn1_oid_to_string(const char **result, const x509_buf *oid,
- apr_pool_t *scratch_pool, apr_pool_t *result_pool)
-{
- svn_stringbuf_t *out = svn_stringbuf_create_empty(result_pool);
- const unsigned char *p = oid->p;
- const unsigned char *end = p + oid->len;
- const char *temp;
-
- *result = NULL;
-
- if (oid->tag != ASN1_OID)
- return svn_error_create(SVN_ERR_ASN1_UNEXPECTED_TAG, NULL, NULL);
-
- if (oid->len <= 0)
- return svn_error_create(SVN_ERR_ASN1_OUT_OF_DATA, NULL, NULL);
-
- while (p != end) {
- if (p == oid->p)
- {
- /* Handle decoding the first two values of the OID. These values
- * are encoded by taking the first value and adding 40 to it and
- * adding the result to the second value, then placing this single
- * value in the first byte of the output. This is unambiguous since
- * the first value is apparently limited to 0, 1 or 2 and the second
- * is limited to 0 to 39. */
- temp = apr_psprintf(scratch_pool, "%d.%d", *p / 40, *p % 40);
- p++;
- }
- else if (*p < 128)
- {
- /* The remaining values if they're less than 128 are just
- * the number one to one encoded */
- temp = apr_psprintf(scratch_pool, ".%d", *p);
- p++;
- }
- else
- {
- /* Values greater than 128 are encoded as a series of 7 bit values
- * with the left most bit set to indicate this encoding with the
- * last octet missing the left most bit to finish out the series.. */
- int collector = 0;
-
- do {
- collector = collector << 7 | (*(p++) & 0x7f);
- } while (p != end && *p > 127);
- collector = collector << 7 | *(p++);
- temp = apr_psprintf(scratch_pool, ".%d", collector);
- }
- svn_stringbuf_appendcstr(out, temp);
- }
-
- *result = out->data;
- return SVN_NO_ERROR;
-}
-
-static svn_error_t *
-x509_name_to_certinfo(apr_array_header_t **oids,
- apr_hash_t **hash,
+x509_name_to_certinfo(apr_array_header_t **result,
const x509_name *dn,
apr_pool_t *scratch_pool,
apr_pool_t *result_pool)
{
const x509_name *name = dn;
- *oids = apr_array_make(result_pool, 6, sizeof(const char *));
- *hash = apr_hash_make(result_pool);
+ *result = apr_array_make(result_pool, 6, sizeof(svn_x509_name_attr_t *));
while (name != NULL) {
- const char *oid_string;
- const char *utf8_value;
+ svn_x509_name_attr_t *attr = apr_palloc(result_pool, sizeof(svn_x509_name_attr_t));
- SVN_ERR(asn1_oid_to_string(&oid_string, &name->oid,
- scratch_pool, result_pool));
- APR_ARRAY_PUSH(*oids, const char *) = oid_string;
- utf8_value = x509name_to_utf8_string(name, result_pool);
- if (utf8_value)
- svn_hash_sets(*hash, oid_string, utf8_value);
- else
+ attr->oid_len = name->oid.len;
+ attr->oid = apr_palloc(result_pool, attr->oid_len);
+ memcpy(attr->oid, name->oid.p, attr->oid_len);
+ attr->utf8_value = x509name_to_utf8_string(name, result_pool);
+ if (!attr->utf8_value)
/* this should never happen */
- svn_hash_sets(*hash, oid_string, "??");
+ attr->utf8_value = apr_pstrdup(result_pool, "??");
+ APR_ARRAY_PUSH(*result, const svn_x509_name_attr_t *) = attr;
name = name->next;
}
@@ -1028,6 +965,23 @@ is_hostname(const char *str)
return TRUE;
}
+static const char *
+x509parse_get_cn(apr_array_header_t *subject)
+{
+ int i;
+
+ for (i = 0; i < subject->nelts; ++i)
+ {
+ const svn_x509_name_attr_t *attr = APR_ARRAY_IDX(subject, i, const svn_x509_name_attr_t *);
+ if (equal(attr->oid, attr->oid_len,
+ SVN_X509_OID_COMMON_NAME, sizeof(SVN_X509_OID_COMMON_NAME) - 1))
+ return attr->utf8_value;
+ }
+
+ return NULL;
+}
+
+
static void
x509parse_get_hostnames(svn_x509_certinfo_t *ci, x509_cert *crt,
apr_pool_t *result_pool, apr_pool_t *scratch_pool)
@@ -1058,8 +1012,7 @@ x509parse_get_hostnames(svn_x509_certinf
/* no SAN then get the hostname from the CommonName on the cert */
const char *utf8_value;
- utf8_value = svn_x509_certinfo_get_subject_attr(ci,
- SVN_X509_OID_COMMON_NAME);
+ utf8_value = x509parse_get_cn(ci->subject);
if (utf8_value && is_hostname(utf8_value))
{
@@ -1220,11 +1173,11 @@ svn_x509_parse_cert(svn_x509_certinfo_t
ci = apr_pcalloc(result_pool, sizeof(*ci));
/* Get the subject name */
- SVN_ERR(x509_name_to_certinfo(&ci->subject_oids, &ci->subject, &crt->subject,
+ SVN_ERR(x509_name_to_certinfo(&ci->subject, &crt->subject,
scratch_pool, result_pool));
/* Get the issuer name */
- SVN_ERR(x509_name_to_certinfo(&ci->issuer_oids, &ci->issuer, &crt->issuer,
+ SVN_ERR(x509_name_to_certinfo(&ci->issuer, &crt->issuer,
scratch_pool, result_pool));
/* Copy the validity range */
Modified: subversion/branches/fsx-1.10/subversion/libsvn_wc/adm_crawler.c
URL: http://svn.apache.org/viewvc/subversion/branches/fsx-1.10/subversion/libsvn_wc/adm_crawler.c?rev=1659238&r1=1659237&r2=1659238&view=diff
==============================================================================
--- subversion/branches/fsx-1.10/subversion/libsvn_wc/adm_crawler.c (original)
+++ subversion/branches/fsx-1.10/subversion/libsvn_wc/adm_crawler.c Thu Feb 12 12:21:31 2015
@@ -162,6 +162,7 @@ static svn_error_t *
restore_node(svn_wc__db_t *db,
const char *local_abspath,
svn_node_kind_t kind,
+ svn_boolean_t mark_resolved_text_conflict,
svn_boolean_t use_commit_times,
svn_cancel_func_t cancel_func,
void *cancel_baton,
@@ -173,7 +174,7 @@ restore_node(svn_wc__db_t *db,
{
/* Recreate file from text-base; mark any text conflict as resolved */
SVN_ERR(restore_file(db, local_abspath, use_commit_times,
- TRUE /*mark_resolved_text_conflict*/,
+ mark_resolved_text_conflict,
cancel_func, cancel_baton,
scratch_pool));
}
@@ -384,12 +385,13 @@ report_revisions_and_depths(svn_wc__db_t
svn_wc__db_status_t wrk_status;
svn_node_kind_t wrk_kind;
const svn_checksum_t *checksum;
+ svn_boolean_t conflicted;
SVN_ERR(svn_wc__db_read_info(&wrk_status, &wrk_kind, NULL, NULL,
NULL, NULL, NULL, NULL, NULL, NULL,
&checksum, NULL, NULL, NULL, NULL, NULL,
+ NULL, NULL, NULL, NULL, &conflicted,
NULL, NULL, NULL, NULL, NULL, NULL,
- NULL, NULL, NULL, NULL, NULL,
db, this_abspath, iterpool, iterpool));
if ((wrk_status == svn_wc__db_status_normal
@@ -408,7 +410,7 @@ report_revisions_and_depths(svn_wc__db_t
if (dirent_kind == svn_node_none)
{
SVN_ERR(restore_node(db, this_abspath, wrk_kind,
- use_commit_times,
+ conflicted, use_commit_times,
cancel_func, cancel_baton,
notify_func, notify_baton, iterpool));
}
@@ -718,12 +720,13 @@ svn_wc_crawl_revisions5(svn_wc_context_t
svn_wc__db_status_t wrk_status;
svn_node_kind_t wrk_kind;
const svn_checksum_t *checksum;
+ svn_boolean_t conflicted;
err = svn_wc__db_read_info(&wrk_status, &wrk_kind, NULL, NULL, NULL,
NULL, NULL, NULL, NULL, NULL, &checksum, NULL,
NULL, NULL, NULL, NULL, NULL, NULL, NULL,
- NULL, NULL, NULL, NULL, NULL, NULL, NULL,
- NULL,
+ NULL, &conflicted, NULL, NULL, NULL, NULL,
+ NULL, NULL,
db, local_abspath,
scratch_pool, scratch_pool);
@@ -743,7 +746,7 @@ svn_wc_crawl_revisions5(svn_wc_context_t
&& (wrk_kind == svn_node_dir || checksum))
{
SVN_ERR(restore_node(wc_ctx->db, local_abspath,
- wrk_kind, use_commit_times,
+ wrk_kind, conflicted, use_commit_times,
cancel_func, cancel_baton,
notify_func, notify_baton,
scratch_pool));