You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by br...@apache.org on 2012/12/05 23:41:36 UTC
svn commit: r1417679 -
/subversion/branches/in-repo-authz/tools/server-side/svnauthz-validate.c
Author: breser
Date: Wed Dec 5 22:41:35 2012
New Revision: 1417679
URL: http://svn.apache.org/viewvc?rev=1417679&view=rev
Log:
Add support for absolute file:// URLs to svnauthz-validate.
* tools/server-side/svnauthz-validate.c
(usage): Document that the FILE can be a absolute file:// URL.
(main): Error on repos relative URLs, do run URLs through
svn_dirent_internal_style(), use svn_repos_authz_read2() instead
of svn_repos_authz_read().
Modified:
subversion/branches/in-repo-authz/tools/server-side/svnauthz-validate.c
Modified: subversion/branches/in-repo-authz/tools/server-side/svnauthz-validate.c
URL: http://svn.apache.org/viewvc/subversion/branches/in-repo-authz/tools/server-side/svnauthz-validate.c?rev=1417679&r1=1417678&r2=1417679&view=diff
==============================================================================
--- subversion/branches/in-repo-authz/tools/server-side/svnauthz-validate.c (original)
+++ subversion/branches/in-repo-authz/tools/server-side/svnauthz-validate.c Wed Dec 5 22:41:35 2012
@@ -34,6 +34,7 @@
#include "svn_pools.h"
#include "svn_repos.h"
#include "svn_utf.h"
+#include "svn_path.h"
enum {
OPT_USERNAME = SVN_OPT_FIRST_LONGOPT_ID,
@@ -49,6 +50,8 @@ usage(const char *argv0)
"Optionally prints the access available to USER for FSPATH in\n"
"repository with authz name REPOS_NAME. If FSPATH is omitted, reports\n"
"whether USER has any access at all.\n"
+ "FILE can also be an absolute file:// URL to a authz file in a\n"
+ "repository, but cannot be a repository relative URL (^/).\n"
"Returns:\n"
" 0 when syntax is OK.\n"
" 1 when syntax is invalid.\n"
@@ -141,10 +144,15 @@ main(int argc, const char **argv)
return 2;
}
- opts.authz_file = svn_dirent_internal_style(opts.authz_file, pool);
+ /* Can't accept repos relative urls since we don't have the path to the
+ * repository and URLs don't need to be converted to internal style. */
+ if (svn_path_is_repos_relative_url(opts.authz_file))
+ return usage(argv[0]);
+ else if (!svn_path_is_url(opts.authz_file))
+ opts.authz_file = svn_dirent_internal_style(opts.authz_file, pool);
/* Read the access file and validate it. */
- err = svn_repos_authz_read(&authz, opts.authz_file, TRUE, pool);
+ err = svn_repos_authz_read2(&authz, opts.authz_file, TRUE, NULL, pool);
/* Optionally, print the access a USER has to a given PATH in REPOS.
PATH and REPOS may be NULL. */