Author: rinrab
Date: Mon Dec 23 16:19:40 2024
New Revision: 1922654
URL: http://svn.apache.org/viewvc?rev=1922654&view=rev
Log:
On the 'apply-processor' branch: sync with trunk@r1922653.
Added:
subversion/branches/apply-processor/subversion/libsvn_subr/xml_escape.c
- copied unchanged from r1922653, subversion/trunk/subversion/libsvn_subr/xml_escape.c
subversion/branches/apply-processor/subversion/libsvn_subr/xml_stream.c
- copied unchanged from r1922653, subversion/trunk/subversion/libsvn_subr/xml_stream.c
Modified:
subversion/branches/apply-processor/ (props changed)
subversion/branches/apply-processor/.github/workflows/cmake.yml
subversion/branches/apply-processor/subversion/bindings/swig/include/svn_types.swg
subversion/branches/apply-processor/subversion/include/private/svn_client_private.h
subversion/branches/apply-processor/subversion/include/private/svn_repos_private.h
subversion/branches/apply-processor/subversion/include/svn_xml.h
subversion/branches/apply-processor/subversion/libsvn_repos/commit.c
subversion/branches/apply-processor/subversion/libsvn_repos/repos.c
subversion/branches/apply-processor/subversion/libsvn_subr/xml.c
subversion/branches/apply-processor/subversion/mod_dav_svn/lock.c
subversion/branches/apply-processor/subversion/mod_dav_svn/repos.c
subversion/branches/apply-processor/subversion/svn/proplist-cmd.c
subversion/branches/apply-processor/subversion/svn/shelf-cmd.c
subversion/branches/apply-processor/subversion/svn/shelf2-cmd.c
subversion/branches/apply-processor/subversion/tests/cmdline/mod_dav_svn_tests.py
subversion/branches/apply-processor/subversion/tests/libsvn_subr/xml-test.c
subversion/branches/apply-processor/tools/server-side/svnpubsub/svnpubsub/client.py
Propchange: subversion/branches/apply-processor/
------------------------------------------------------------------------------
Merged /subversion/trunk:r1922160-1922180,1922182-1922196,1922198-1922202,1922204,1922206-1922261,1922264-1922265,1922267-1922327,1922329-1922334,1922337-1922346,1922348-1922653
Modified: subversion/branches/apply-processor/.github/workflows/cmake.yml
URL: http://svn.apache.org/viewvc/subversion/branches/apply-processor/.github/workflows/cmake.yml?rev=1922654&r1=1922653&r2=1922654&view=diff
==============================================================================
--- subversion/branches/apply-processor/.github/workflows/cmake.yml (original)
+++ subversion/branches/apply-processor/.github/workflows/cmake.yml Mon Dec 23 16:19:40 2024
@@ -169,7 +169,16 @@ jobs:
working-directory: out
run: ctest --output-on-failure --verbose -C Release --parallel 16
- - name: Rerun failed tests
- if: ${{ matrix.run_tests && failure() && steps.run_all_tests.conclusion == 'failure' }}
+ - name: Test shelf2
+ if: matrix.run_tests
working-directory: out
- run: ctest --output-on-failure --verbose -C Release --rerun-failed
+ env:
+ SVN_EXPERIMENTAL_COMMANDS: shelf2
+ run: ctest -R shelf2 --verbose -C Release
+
+ - name: Test shelf3
+ if: matrix.run_tests
+ working-directory: out
+ env:
+ SVN_EXPERIMENTAL_COMMANDS: shelf3
+ run: ctest -R shelf3 --verbose -C Release
Modified: subversion/branches/apply-processor/subversion/bindings/swig/include/svn_types.swg
URL: http://svn.apache.org/viewvc/subversion/branches/apply-processor/subversion/bindings/swig/include/svn_types.swg?rev=1922654&r1=1922653&r2=1922654&view=diff
==============================================================================
--- subversion/branches/apply-processor/subversion/bindings/swig/include/svn_types.swg (original)
+++ subversion/branches/apply-processor/subversion/bindings/swig/include/svn_types.swg Mon Dec 23 16:19:40 2024
@@ -546,7 +546,7 @@ svn_ ## TYPE ## _swig_rb_closed(VALUE se
%typemap(ret) svn_error_t *
{
if (TYPE(*svn_presult) == T_ARRAY) {
- switch (rb_array_len(*svn_presult)) {
+ switch (RARRAY_LEN(*svn_presult)) {
case 0:
*svn_presult = Qnil;
break;
Modified: subversion/branches/apply-processor/subversion/include/private/svn_client_private.h
URL: http://svn.apache.org/viewvc/subversion/branches/apply-processor/subversion/include/private/svn_client_private.h?rev=1922654&r1=1922653&r2=1922654&view=diff
==============================================================================
--- subversion/branches/apply-processor/subversion/include/private/svn_client_private.h (original)
+++ subversion/branches/apply-processor/subversion/include/private/svn_client_private.h Mon Dec 23 16:19:40 2024
@@ -375,8 +375,8 @@ svn_client__get_diff_writer_svn(
svn_boolean_t ignore_content_type,
svn_boolean_t ignore_properties,
svn_boolean_t properties_only,
- svn_boolean_t pretty_print_mergeinfo,
svn_boolean_t use_git_diff_format,
+ svn_boolean_t pretty_print_mergeinfo,
const char *header_encoding,
svn_stream_t *outstream,
svn_stream_t *errstream,
Modified: subversion/branches/apply-processor/subversion/include/private/svn_repos_private.h
URL: http://svn.apache.org/viewvc/subversion/branches/apply-processor/subversion/include/private/svn_repos_private.h?rev=1922654&r1=1922653&r2=1922654&view=diff
==============================================================================
--- subversion/branches/apply-processor/subversion/include/private/svn_repos_private.h (original)
+++ subversion/branches/apply-processor/subversion/include/private/svn_repos_private.h Mon Dec 23 16:19:40 2024
@@ -390,6 +390,14 @@ svn_repos__get_dump_editor(const svn_del
const char *update_anchor_relpath,
apr_pool_t *pool);
+/* Validate that the given PATH is a valid pathname that can be stored in
+ * a Subversion repository, according to the name constraints used by the
+ * svn_repos_* layer.
+ */
+svn_error_t *
+svn_repos__validate_new_path(const char *path,
+ apr_pool_t *scratch_pool);
+
#ifdef __cplusplus
}
#endif /* __cplusplus */
Modified: subversion/branches/apply-processor/subversion/include/svn_xml.h
URL: http://svn.apache.org/viewvc/subversion/branches/apply-processor/subversion/include/svn_xml.h?rev=1922654&r1=1922653&r2=1922654&view=diff
==============================================================================
--- subversion/branches/apply-processor/subversion/include/svn_xml.h (original)
+++ subversion/branches/apply-processor/subversion/include/svn_xml.h Mon Dec 23 16:19:40 2024
@@ -33,6 +33,7 @@
#include "svn_types.h"
#include "svn_string.h"
+#include "svn_io.h" /* for svn_stream_t */
#ifdef __cplusplus
extern "C" {
@@ -191,6 +192,23 @@ void
svn_xml_free_parser(svn_xml_parser_t *svn_parser);
+/** Create a stream that wraps the XML parser described at @a parser.
+ *
+ * The stream produced will implement 'write' and 'close' methods. It
+ * will push the data to the parser on write operation, and flush it on
+ * close.
+ *
+ * This stream can be used as a generic writable stream, so the callers
+ * may pipe any data there, for example, using the svn_stream_copy3
+ * function, in case of a file source.
+ *
+ * @since New in 1.15.
+ */
+svn_stream_t *
+svn_xml_make_parse_stream(svn_xml_parser_t *parser,
+ apr_pool_t *result_pool);
+
+
/** Push @a len bytes of xml data in @a buf at @a svn_parser.
*
* If this is the final push, @a is_final must be set.
Modified: subversion/branches/apply-processor/subversion/libsvn_repos/commit.c
URL: http://svn.apache.org/viewvc/subversion/branches/apply-processor/subversion/libsvn_repos/commit.c?rev=1922654&r1=1922653&r2=1922654&view=diff
==============================================================================
--- subversion/branches/apply-processor/subversion/libsvn_repos/commit.c (original)
+++ subversion/branches/apply-processor/subversion/libsvn_repos/commit.c Mon Dec 23 16:19:40 2024
@@ -308,8 +308,7 @@ add_file_or_directory(const char *path,
svn_boolean_t was_copied = FALSE;
const char *full_path, *canonicalized_path;
- /* Reject paths which contain control characters (related to issue #4340). */
- SVN_ERR(svn_path_check_valid(path, pool));
+ SVN_ERR(svn_repos__validate_new_path(path, pool));
SVN_ERR(svn_relpath_canonicalize_safe(&canonicalized_path, NULL, path,
pool, pool));
Modified: subversion/branches/apply-processor/subversion/libsvn_repos/repos.c
URL: http://svn.apache.org/viewvc/subversion/branches/apply-processor/subversion/libsvn_repos/repos.c?rev=1922654&r1=1922653&r2=1922654&view=diff
==============================================================================
--- subversion/branches/apply-processor/subversion/libsvn_repos/repos.c (original)
+++ subversion/branches/apply-processor/subversion/libsvn_repos/repos.c Mon Dec 23 16:19:40 2024
@@ -2092,3 +2092,13 @@ svn_repos__fs_type(const char **fs_type,
svn_dirent_join(repos_path, SVN_REPOS__DB_DIR, pool),
pool);
}
+
+svn_error_t *
+svn_repos__validate_new_path(const char *path,
+ apr_pool_t *scratch_pool)
+{
+ /* Reject paths which contain control characters (related to issue #4340). */
+ SVN_ERR(svn_path_check_valid(path, scratch_pool));
+
+ return SVN_NO_ERROR;
+}
Modified: subversion/branches/apply-processor/subversion/libsvn_subr/xml.c
URL: http://svn.apache.org/viewvc/subversion/branches/apply-processor/subversion/libsvn_subr/xml.c?rev=1922654&r1=1922653&r2=1922654&view=diff
==============================================================================
--- subversion/branches/apply-processor/subversion/libsvn_subr/xml.c (original)
+++ subversion/branches/apply-processor/subversion/libsvn_subr/xml.c Mon Dec 23 16:19:40 2024
@@ -31,9 +31,7 @@
#include "svn_pools.h"
#include "svn_xml.h"
#include "svn_error.h"
-#include "svn_ctype.h"
-#include "private/svn_utf_private.h"
#include "private/svn_subr_private.h"
#ifdef SVN_HAVE_OLD_EXPAT
@@ -99,251 +97,6 @@ struct svn_xml_parser_t
};
-/*** XML character validation ***/
-
-svn_boolean_t
-svn_xml_is_xml_safe(const char *data, apr_size_t len)
-{
- const char *end = data + len;
- const char *p;
-
- if (! svn_utf__is_valid(data, len))
- return FALSE;
-
- for (p = data; p < end; p++)
- {
- unsigned char c = *p;
-
- if (svn_ctype_iscntrl(c))
- {
- if ((c != SVN_CTYPE_ASCII_TAB)
- && (c != SVN_CTYPE_ASCII_LINEFEED)
- && (c != SVN_CTYPE_ASCII_CARRIAGERETURN)
- && (c != SVN_CTYPE_ASCII_DELETE))
- return FALSE;
- }
- }
- return TRUE;
-}
-
-
-
-
-
-/*** XML escaping. ***/
-
-/* ### ...?
- *
- * If *OUTSTR is @c NULL, set *OUTSTR to a new stringbuf allocated
- * in POOL, else append to the existing stringbuf there.
- */
-static void
-xml_escape_cdata(svn_stringbuf_t **outstr,
- const char *data,
- apr_size_t len,
- apr_pool_t *pool)
-{
- const char *end = data + len;
- const char *p = data, *q;
-
- if (*outstr == NULL)
- *outstr = svn_stringbuf_create_empty(pool);
-
- while (1)
- {
- /* Find a character which needs to be quoted and append bytes up
- to that point. Strictly speaking, '>' only needs to be
- quoted if it follows "]]", but it's easier to quote it all
- the time.
-
- So, why are we escaping '\r' here? Well, according to the
- XML spec, '\r\n' gets converted to '\n' during XML parsing.
- Also, any '\r' not followed by '\n' is converted to '\n'. By
- golly, if we say we want to escape a '\r', we want to make
- sure it remains a '\r'! */
- q = p;
- while (q < end && *q != '&' && *q != '<' && *q != '>' && *q != '\r')
- q++;
- svn_stringbuf_appendbytes(*outstr, p, q - p);
-
- /* We may already be a winner. */
- if (q == end)
- break;
-
- /* Append the entity reference for the character. */
- if (*q == '&')
- svn_stringbuf_appendcstr(*outstr, "&");
- else if (*q == '<')
- svn_stringbuf_appendcstr(*outstr, "<");
- else if (*q == '>')
- svn_stringbuf_appendcstr(*outstr, ">");
- else if (*q == '\r')
- svn_stringbuf_appendcstr(*outstr, " ");
-
- p = q + 1;
- }
-}
-
-/* Essentially the same as xml_escape_cdata, with the addition of
- whitespace and quote characters. */
-static void
-xml_escape_attr(svn_stringbuf_t **outstr,
- const char *data,
- apr_size_t len,
- apr_pool_t *pool)
-{
- const char *end = data + len;
- const char *p = data, *q;
-
- if (*outstr == NULL)
- *outstr = svn_stringbuf_create_ensure(len, pool);
-
- while (1)
- {
- /* Find a character which needs to be quoted and append bytes up
- to that point. */
- q = p;
- while (q < end && *q != '&' && *q != '<' && *q != '>'
- && *q != '"' && *q != '\'' && *q != '\r'
- && *q != '\n' && *q != '\t')
- q++;
- svn_stringbuf_appendbytes(*outstr, p, q - p);
-
- /* We may already be a winner. */
- if (q == end)
- break;
-
- /* Append the entity reference for the character. */
- if (*q == '&')
- svn_stringbuf_appendcstr(*outstr, "&");
- else if (*q == '<')
- svn_stringbuf_appendcstr(*outstr, "<");
- else if (*q == '>')
- svn_stringbuf_appendcstr(*outstr, ">");
- else if (*q == '"')
- svn_stringbuf_appendcstr(*outstr, """);
- else if (*q == '\'')
- svn_stringbuf_appendcstr(*outstr, "'");
- else if (*q == '\r')
- svn_stringbuf_appendcstr(*outstr, " ");
- else if (*q == '\n')
- svn_stringbuf_appendcstr(*outstr, " ");
- else if (*q == '\t')
- svn_stringbuf_appendcstr(*outstr, "	");
-
- p = q + 1;
- }
-}
-
-
-void
-svn_xml_escape_cdata_stringbuf(svn_stringbuf_t **outstr,
- const svn_stringbuf_t *string,
- apr_pool_t *pool)
-{
- xml_escape_cdata(outstr, string->data, string->len, pool);
-}
-
-
-void
-svn_xml_escape_cdata_string(svn_stringbuf_t **outstr,
- const svn_string_t *string,
- apr_pool_t *pool)
-{
- xml_escape_cdata(outstr, string->data, string->len, pool);
-}
-
-
-void
-svn_xml_escape_cdata_cstring(svn_stringbuf_t **outstr,
- const char *string,
- apr_pool_t *pool)
-{
- xml_escape_cdata(outstr, string, (apr_size_t) strlen(string), pool);
-}
-
-
-void
-svn_xml_escape_attr_stringbuf(svn_stringbuf_t **outstr,
- const svn_stringbuf_t *string,
- apr_pool_t *pool)
-{
- xml_escape_attr(outstr, string->data, string->len, pool);
-}
-
-
-void
-svn_xml_escape_attr_string(svn_stringbuf_t **outstr,
- const svn_string_t *string,
- apr_pool_t *pool)
-{
- xml_escape_attr(outstr, string->data, string->len, pool);
-}
-
-
-void
-svn_xml_escape_attr_cstring(svn_stringbuf_t **outstr,
- const char *string,
- apr_pool_t *pool)
-{
- xml_escape_attr(outstr, string, (apr_size_t) strlen(string), pool);
-}
-
-
-const char *
-svn_xml_fuzzy_escape(const char *string, apr_pool_t *pool)
-{
- const char *end = string + strlen(string);
- const char *p = string, *q;
- svn_stringbuf_t *outstr;
- char escaped_char[6]; /* ? \ u u u \0 */
-
- for (q = p; q < end; q++)
- {
- if (svn_ctype_iscntrl(*q)
- && ! ((*q == '\n') || (*q == '\r') || (*q == '\t')))
- break;
- }
-
- /* Return original string if no unsafe characters found. */
- if (q == end)
- return string;
-
- outstr = svn_stringbuf_create_empty(pool);
- while (1)
- {
- q = p;
-
- /* Traverse till either unsafe character or eos. */
- while ((q < end)
- && ((! svn_ctype_iscntrl(*q))
- || (*q == '\n') || (*q == '\r') || (*q == '\t')))
- q++;
-
- /* copy chunk before marker */
- svn_stringbuf_appendbytes(outstr, p, q - p);
-
- if (q == end)
- break;
-
- /* Append an escaped version of the unsafe character.
-
- ### This format was chosen for consistency with
- ### svn_utf__cstring_from_utf8_fuzzy(). The two functions
- ### should probably share code, even though they escape
- ### different characters.
- */
- apr_snprintf(escaped_char, sizeof(escaped_char), "?\\%03u",
- (unsigned char) *q);
- svn_stringbuf_appendcstr(outstr, escaped_char);
-
- p = q + 1;
- }
-
- return outstr->data;
-}
-
-
/*** Map from the Expat callback types to the SVN XML types. ***/
static void expat_start_handler(void *userData,
Modified: subversion/branches/apply-processor/subversion/mod_dav_svn/lock.c
URL: http://svn.apache.org/viewvc/subversion/branches/apply-processor/subversion/mod_dav_svn/lock.c?rev=1922654&r1=1922653&r2=1922654&view=diff
==============================================================================
--- subversion/branches/apply-processor/subversion/mod_dav_svn/lock.c (original)
+++ subversion/branches/apply-processor/subversion/mod_dav_svn/lock.c Mon Dec 23 16:19:40 2024
@@ -36,6 +36,7 @@
#include "svn_pools.h"
#include "svn_props.h"
#include "private/svn_log.h"
+#include "private/svn_repos_private.h"
#include "dav_svn.h"
@@ -717,6 +718,12 @@ append_locks(dav_lockdb *lockdb,
/* Commit a 0-byte file: */
+ if ((serr = svn_repos__validate_new_path(resource->info->repos_path,
+ resource->pool)))
+ return dav_svn__convert_err(serr, HTTP_BAD_REQUEST,
+ "Request specifies an invalid path.",
+ resource->pool);
+
if ((serr = dav_svn__get_youngest_rev(&rev, repos, resource->pool)))
return dav_svn__convert_err(serr, HTTP_INTERNAL_SERVER_ERROR,
"Could not determine youngest revision",
Modified: subversion/branches/apply-processor/subversion/mod_dav_svn/repos.c
URL: http://svn.apache.org/viewvc/subversion/branches/apply-processor/subversion/mod_dav_svn/repos.c?rev=1922654&r1=1922653&r2=1922654&view=diff
==============================================================================
--- subversion/branches/apply-processor/subversion/mod_dav_svn/repos.c (original)
+++ subversion/branches/apply-processor/subversion/mod_dav_svn/repos.c Mon Dec 23 16:19:40 2024
@@ -2928,6 +2928,16 @@ open_stream(const dav_resource *resource
if (kind == svn_node_none) /* No existing file. */
{
+ serr = svn_repos__validate_new_path(resource->info->repos_path,
+ resource->pool);
+
+ if (serr != NULL)
+ {
+ return dav_svn__convert_err(serr, HTTP_BAD_REQUEST,
+ "Request specifies an invalid path.",
+ resource->pool);
+ }
+
serr = svn_fs_make_file(resource->info->root.root,
resource->info->repos_path,
resource->pool);
@@ -4120,6 +4130,14 @@ create_collection(dav_resource *resource
return err;
}
+ if ((serr = svn_repos__validate_new_path(resource->info->repos_path,
+ resource->pool)) != NULL)
+ {
+ return dav_svn__convert_err(serr, HTTP_BAD_REQUEST,
+ "Request specifies an invalid path.",
+ resource->pool);
+ }
+
if ((serr = svn_fs_make_dir(resource->info->root.root,
resource->info->repos_path,
resource->pool)) != NULL)
@@ -4194,6 +4212,12 @@ copy_resource(const dav_resource *src,
return err;
}
+ serr = svn_repos__validate_new_path(dst->info->repos_path, dst->pool);
+ if (serr)
+ return dav_svn__convert_err(serr, HTTP_BAD_REQUEST,
+ "Request specifies an invalid path.",
+ dst->pool);
+
src_repos_path = svn_repos_path(src->info->repos->repos, src->pool);
dst_repos_path = svn_repos_path(dst->info->repos->repos, dst->pool);
@@ -4430,6 +4454,12 @@ move_resource(dav_resource *src,
if (err)
return err;
+ serr = svn_repos__validate_new_path(dst->info->repos_path, dst->pool);
+ if (serr)
+ return dav_svn__convert_err(serr, HTTP_BAD_REQUEST,
+ "Request specifies an invalid path.",
+ dst->pool);
+
/* Copy the src to the dst. */
serr = svn_fs_copy(src->info->root.root, /* the root object of src rev*/
src->info->repos_path, /* the relative path of src */
Modified: subversion/branches/apply-processor/subversion/svn/proplist-cmd.c
URL: http://svn.apache.org/viewvc/subversion/branches/apply-processor/subversion/svn/proplist-cmd.c?rev=1922654&r1=1922653&r2=1922654&view=diff
==============================================================================
--- subversion/branches/apply-processor/subversion/svn/proplist-cmd.c (original)
+++ subversion/branches/apply-processor/subversion/svn/proplist-cmd.c Mon Dec 23 16:19:40 2024
@@ -106,16 +106,16 @@ proplist_receiver_xml(void *baton,
if (prop_hash)
{
/* "<target ...>" */
- svn_xml_make_open_tag(&sb, pool, svn_xml_normal, "target",
- "path", name_local, SVN_VA_NULL);
+ svn_xml_make_open_tag(&sb, pool, svn_xml_normal, "target",
+ "path", name_local, SVN_VA_NULL);
- SVN_ERR(svn_cmdline__print_xml_prop_hash(&sb, prop_hash,
- (! opt_state->verbose),
- FALSE, pool));
+ SVN_ERR(svn_cmdline__print_xml_prop_hash(&sb, prop_hash,
+ (! opt_state->verbose),
+ FALSE, pool));
- /* "</target>" */
- svn_xml_make_close_tag(&sb, pool, "target");
- SVN_ERR(svn_cl__error_checked_fputs(sb->data, stdout));
+ /* "</target>" */
+ svn_xml_make_close_tag(&sb, pool, "target");
+ SVN_ERR(svn_cl__error_checked_fputs(sb->data, stdout));
}
return SVN_NO_ERROR;
Modified: subversion/branches/apply-processor/subversion/svn/shelf-cmd.c
URL: http://svn.apache.org/viewvc/subversion/branches/apply-processor/subversion/svn/shelf-cmd.c?rev=1922654&r1=1922653&r2=1922654&view=diff
==============================================================================
--- subversion/branches/apply-processor/subversion/svn/shelf-cmd.c (original)
+++ subversion/branches/apply-processor/subversion/svn/shelf-cmd.c Mon Dec 23 16:19:40 2024
@@ -769,8 +769,8 @@ shelf_diff(const char *name,
FALSE /*ignore_content_type*/,
FALSE /*ignore_properties*/,
FALSE /*properties_only*/,
- TRUE /*pretty_print_mergeinfo*/,
FALSE /*use_git_diff_format*/,
+ TRUE /*pretty_print_mergeinfo*/,
svn_cmdline_output_encoding(scratch_pool),
stream, errstream,
ctx, scratch_pool));
Modified: subversion/branches/apply-processor/subversion/svn/shelf2-cmd.c
URL: http://svn.apache.org/viewvc/subversion/branches/apply-processor/subversion/svn/shelf2-cmd.c?rev=1922654&r1=1922653&r2=1922654&view=diff
==============================================================================
--- subversion/branches/apply-processor/subversion/svn/shelf2-cmd.c (original)
+++ subversion/branches/apply-processor/subversion/svn/shelf2-cmd.c Mon Dec 23 16:19:40 2024
@@ -769,8 +769,8 @@ shelf_diff(const char *name,
FALSE /*ignore_content_type*/,
FALSE /*ignore_properties*/,
FALSE /*properties_only*/,
- TRUE /*pretty_print_mergeinfo*/,
FALSE /*use_git_diff_format*/,
+ TRUE /*pretty_print_mergeinfo*/,
svn_cmdline_output_encoding(scratch_pool),
stream, errstream,
ctx, scratch_pool));
Modified: subversion/branches/apply-processor/subversion/tests/cmdline/mod_dav_svn_tests.py
URL: http://svn.apache.org/viewvc/subversion/branches/apply-processor/subversion/tests/cmdline/mod_dav_svn_tests.py?rev=1922654&r1=1922653&r2=1922654&view=diff
==============================================================================
--- subversion/branches/apply-processor/subversion/tests/cmdline/mod_dav_svn_tests.py (original)
+++ subversion/branches/apply-processor/subversion/tests/cmdline/mod_dav_svn_tests.py Mon Dec 23 16:19:40 2024
@@ -686,6 +686,67 @@ def last_modified_header(sbox):
raise svntest.Failure('Unexpected Last-Modified header: %s' % last_modified)
r.read()
+@SkipUnless(svntest.main.is_ra_type_dav)
+def create_name_with_control_chars(sbox):
+ "test creating items with control chars in names"
+
+ sbox.build(create_wc=False)
+
+ h = svntest.main.create_http_connection(sbox.repo_url)
+
+ # POST /repos/!svn/me
+ # Create a new transaction.
+ req_body = (
+ '(create-txn-with-props '
+ '(svn:txn-client-compat-version 6 1.14.4 '
+ 'svn:txn-user-agent 45 SVN/1.14.4 (x86-microsoft-windows) serf/1.3.9 '
+ 'svn:log 0 ))'
+ )
+ headers = {
+ 'Authorization': 'Basic ' + base64.b64encode(b'jconstant:rayjandom').decode(),
+ 'Content-Type': 'application/vnd.svn-skel',
+ }
+ h.request('POST', sbox.repo_url + '/!svn/me', req_body, headers)
+ r = h.getresponse()
+ if r.status != httplib.CREATED:
+ raise svntest.Failure('Unexpected status: %d %s' % (r.status, r.reason))
+ txn_name = r.getheader('SVN-Txn-Name')
+ r.read()
+
+ # MKCOL /repos/!svn/txn/TXN_NAME/tab%09name
+ # Must fail with a 400 Bad Request.
+ headers = {
+ 'Authorization': 'Basic ' + base64.b64encode(b'jconstant:rayjandom').decode(),
+ }
+ h.request('MKCOL', sbox.repo_url + '/!svn/txr/' + txn_name + '/tab%09name', None, headers)
+ r = h.getresponse()
+ if r.status != httplib.BAD_REQUEST:
+ raise svntest.Failure('Unexpected status: %d %s' % (r.status, r.reason))
+ r.read()
+
+ # PUT /repos/!svn/txn/TXN_NAME/tab%09name
+ # Must fail with a 400 Bad Request.
+ headers = {
+ 'Authorization': 'Basic ' + base64.b64encode(b'jconstant:rayjandom').decode(),
+ }
+ h.request('PUT', sbox.repo_url + '/!svn/txr/' + txn_name + '/tab%09name', None, headers)
+ r = h.getresponse()
+ if r.status != httplib.BAD_REQUEST:
+ raise svntest.Failure('Unexpected status: %d %s' % (r.status, r.reason))
+ r.read()
+
+ # COPY /repos/!svn/rvr/1/iota -> /repos/!svn/txn/TXN_NAME/tab%09name
+ # Must fail with a 400 Bad Request.
+ headers = {
+ 'Authorization': 'Basic ' + base64.b64encode(b'jconstant:rayjandom').decode(),
+ 'Destination': sbox.repo_url + '/!svn/txr/' + txn_name + '/tab%09name'
+ }
+ h.request('COPY', sbox.repo_url + '/!svn/rvr/1/iota', None, headers)
+ r = h.getresponse()
+ if r.status != httplib.BAD_REQUEST:
+ raise svntest.Failure('Unexpected status: %d %s' % (r.status, r.reason))
+ r.read()
+
########################################################################
# Run the tests
@@ -700,6 +761,7 @@ test_list = [ None,
propfind_allprop,
propfind_propname,
last_modified_header,
+ create_name_with_control_chars,
]
serial_only = True
Modified: subversion/branches/apply-processor/subversion/tests/libsvn_subr/xml-test.c
URL: http://svn.apache.org/viewvc/subversion/branches/apply-processor/subversion/tests/libsvn_subr/xml-test.c?rev=1922654&r1=1922653&r2=1922654&view=diff
==============================================================================
--- subversion/branches/apply-processor/subversion/tests/libsvn_subr/xml-test.c (original)
+++ subversion/branches/apply-processor/subversion/tests/libsvn_subr/xml-test.c Mon Dec 23 16:19:40 2024
@@ -332,6 +332,71 @@ test_xml_doctype_declaration(apr_pool_t
return SVN_NO_ERROR;
}
+static svn_error_t *
+test_xml_parse_stream(apr_pool_t *pool)
+{
+ const char *xml = "<root><tag1>value</tag1><tag2 a='v' /></root>";
+ xml_callbacks_baton_t b;
+ svn_stream_t *stream;
+
+ /* Test parsing XML in one chunk.*/
+ b.buf = svn_stringbuf_create_empty(pool);
+ b.parser = svn_xml_make_parser(&b, strbuf_start_elem, strbuf_end_elem,
+ strbuf_cdata, pool);
+ stream = svn_xml_make_parse_stream(b.parser, pool);
+
+ SVN_ERR(svn_stream_puts(stream, xml));
+ SVN_ERR(svn_stream_close(stream));
+
+ SVN_TEST_STRING_ASSERT(b.buf->data,
+ "<root><tag1>value</tag1><tag2 a=v></tag2></root>");
+
+ return SVN_NO_ERROR;
+}
+
+static svn_error_t *
+test_xml_parse_stream_invalid_xml(apr_pool_t *pool)
+{
+ const char *xml = "<root><tag1></tag1>";
+ xml_callbacks_baton_t b;
+ svn_stream_t *stream;
+ svn_error_t *err;
+ apr_status_t status;
+
+ /* Test parsing XML in one chunk.*/
+ b.buf = svn_stringbuf_create_empty(pool);
+ b.parser = svn_xml_make_parser(&b, strbuf_start_elem, strbuf_end_elem,
+ strbuf_cdata, pool);
+ stream = svn_xml_make_parse_stream(b.parser, pool);
+
+ err = svn_error_compose_create(svn_stream_puts(stream, xml),
+ svn_stream_close(stream));
+
+ SVN_TEST_ASSERT_ANY_ERROR(err);
+
+ return SVN_NO_ERROR;
+}
+
+static svn_error_t *
+test_xml_simple_cdata_escape(apr_pool_t *pool)
+{
+ svn_stringbuf_t *str = svn_stringbuf_create_empty(pool);
+ svn_xml_escape_cdata_cstring(&str, "safetext <nonsafe&>", pool);
+ SVN_TEST_STRING_ASSERT(str->data, "safetext <nonsafe&amp;>");
+
+ return SVN_NO_ERROR;
+}
+
+static svn_error_t *
+test_xml_simple_attr_escape(apr_pool_t *pool)
+{
+ svn_stringbuf_t *str = svn_stringbuf_create_empty(pool);
+ svn_xml_escape_attr_cstring(&str, "safetext <nonsafe&>", pool);
+ SVN_TEST_STRING_ASSERT(str->data, "safetext <nonsafe&amp;>");
+
+ return SVN_NO_ERROR;
+}
+
/* The test table. */
static int max_threads = 1;
@@ -354,6 +419,14 @@ static struct svn_test_descriptor_t test
"test XML custom entity expansion"),
SVN_TEST_PASS2(test_xml_doctype_declaration,
"test XML doctype declaration"),
+ SVN_TEST_PASS2(test_xml_parse_stream,
+ "test XML's svn_stream_t wrapper"),
+ SVN_TEST_PASS2(test_xml_parse_stream_invalid_xml,
+ "test XML's svn_stream_t wrapper for invalid XML"),
+ SVN_TEST_PASS2(test_xml_simple_cdata_escape,
+ "simple XML cdata escaping test"),
+ SVN_TEST_PASS2(test_xml_simple_attr_escape,
+ "simple XML attribute escaping test"),
SVN_TEST_NULL
};
Modified: subversion/branches/apply-processor/tools/server-side/svnpubsub/svnpubsub/client.py
URL: http://svn.apache.org/viewvc/subversion/branches/apply-processor/tools/server-side/svnpubsub/svnpubsub/client.py?rev=1922654&r1=1922653&r2=1922654&view=diff
==============================================================================
--- subversion/branches/apply-processor/tools/server-side/svnpubsub/svnpubsub/client.py (original)
+++ subversion/branches/apply-processor/tools/server-side/svnpubsub/svnpubsub/client.py Mon Dec 23 16:19:40 2024
@@ -131,6 +131,8 @@ class Client(asynchat.async_chat):
class Notification(object):
def __init__(self, data):
self.__dict__.update(data)
+ def __repr__(self):
+ return '%s(%r)' % (self.KIND, self.__dict__)
class Commit(Notification):
KIND = 'COMMIT'
lmpx.com only provides a reader for public news (NNTP) servers. It is not
affiliated with the servers or forums shown here and is not responsible for
the content of articles, which is written by their respective authors.