You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by da...@apache.org on 2011/07/21 23:26:55 UTC
svn commit: r1149371 - /subversion/trunk/subversion/libsvn_fs/fs-loader.c
Author: danielsh
Date: Thu Jul 21 21:26:54 2011
New Revision: 1149371
URL: http://svn.apache.org/viewvc?rev=1149371&view=rev
Log:
Follow-up to r1149343:
Rewrite the lock token validation without apr_uri_parse(), since two
buildbots turned red.
* subversion/libsvn_fs/fs-loader.c
(apr_uri.h): Remove include.
(svn_fs_lock): Replace apr_uri_parse() call by inline code.
Modified:
subversion/trunk/subversion/libsvn_fs/fs-loader.c
Modified: subversion/trunk/subversion/libsvn_fs/fs-loader.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_fs/fs-loader.c?rev=1149371&r1=1149370&r2=1149371&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_fs/fs-loader.c (original)
+++ subversion/trunk/subversion/libsvn_fs/fs-loader.c Thu Jul 21 21:26:54 2011
@@ -28,8 +28,8 @@
#include <apr_md5.h>
#include <apr_thread_mutex.h>
#include <apr_uuid.h>
-#include <apr_uri.h>
+#include "svn_ctype.h"
#include "svn_types.h"
#include "svn_dso.h"
#include "svn_version.h"
@@ -1309,23 +1309,23 @@ svn_fs_lock(svn_lock_t **lock, svn_fs_t
/* Enforce that the token be an XML-safe URI. */
if (token)
{
- apr_uri_t uri;
- apr_status_t status;
+ const char *c;
- status = apr_uri_parse(pool, token, &uri);
- if (status)
- return svn_error_createf(SVN_ERR_FS_BAD_LOCK_TOKEN,
- svn_error_wrap_apr(status, NULL),
- _("Can't parse token '%s' as a URI"),
- token);
-
- if (uri.scheme == NULL || strcmp(uri.scheme, "opaquelocktoken"))
+ if (strncmp(token, "opaquelocktoken:", 16))
return svn_error_createf(SVN_ERR_FS_BAD_LOCK_TOKEN, NULL,
_("Lock token URI '%s' has bad scheme; "
"expected '%s'"),
token, "opaquelocktoken");
-
- if (! svn_xml_is_xml_safe(token, strlen(token)))
+
+ for (c = token; *c; c++)
+ if (! svn_ctype_isascii(*c))
+ return svn_error_createf(SVN_ERR_FS_BAD_LOCK_TOKEN, NULL,
+ _("Lock token '%s' is not ASCII "
+ "at byte %u"),
+ token, (unsigned)(c - token));
+
+ /* strlen(token) == c - token. */
+ if (! svn_xml_is_xml_safe(token, c - token))
return svn_error_create(
SVN_ERR_FS_BAD_LOCK_TOKEN, NULL,
_("Lock token URI is not XML-safe"));