You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@subversion.apache.org by "David W. Wilson" <wi...@anseri.com> on 2007/10/10 17:23:00 UTC
Woes executing SVN from CGI
I am tasked with setting up a web-based build server, which is to checkout
build sources from a remote SVN server, powered by CollabNet SVN Server (=
SVN + Apache). This is all being done on Windows with domain server
authentication (SSPI).
I installed CollabNet SVN Server on the build server, since it includes both
the Apache web server (for the build server web interface) and the SVN CLI
commands (for remote SVN server access). I disabled DAV on the build server,
since the build server would not be hosting SVN repositories.
Once I got ActivePerl CGI scripts configured on the build server, I wrote a
CGI script doit.cgi intended to display the contents of a source file
"test.txt" residing in a remote SVN repository:
--doit.cgi---------------------------------------------------------------
# Print HTTP header
print "Content-type: text/plain; charset=iso-8859-1\n\n";
# Command to get the contents of a SVN file on SVN server
my $command = '"c:/Program Files/CollabNet Subversion Server/svn" "cat"
"http://subversion/svn/src/project/wilsond/test.txt"';
# Run the command
my $output = `$command 2>&1`;
# Print the command and output
print "Command:\n$command\n\nOutput:\n$output\n";
# Finish happily
exit 0;
------------------------------------------------------------------------
When I run this script manual from the command line in a command prompt
window, it works correctly:
------------------------------------------------------------------------
> perl doit.cgi
Content-type: text/plain; charset=iso-8859-1
Command:
"c:/Program Files/CollabNet Subversion Server/svn" "cat"
"http://subversion/svn/src/project/wilsond/test.txt"
Output:
This is a test.
------------------------------------------------------------------------
This is the correct output, and confirms that the command syntax is correct.
But when I run the very same doit.cgi as a CGI script, I see the following
in the browser:
------------------------------------------------------------------------
> http://buildhost/cgi-bin/doit.cgi
Command:
"c:/Program Files/CollabNet Subversion Server/svn" "cat"
"http://subversion/svn/src/project/wilsond/test.txt"
Output:
svn: PROPFIND request failed on '/svn/src/project/wilsond/test.txt'
svn: PROPFIND of '/svn/src/project/wilsond/test.txt': 403 Forbidden
(http://subversion)
------------------------------------------------------------------------
The problem is clearly SVN server authentication. For the command line
(successful) run, the SVN server logs:
------------------------------------------------------------------------
123.456.789.10 - anseri\\wilsond [10/Oct/2007:10:09:03 -0400] "PROPFIND
/svn/src/project/wilsond/test.txt HTTP/1.1" 207 688
123.456.789.10 - anseri\\wilsond [10/Oct/2007:10:09:03 -0400] "PROPFIND
/svn/src/!svn/vcc/default HTTP/1.1" 207 453
123.456.789.10 - anseri\\wilsond [10/Oct/2007:10:09:03 -0400] "PROPFIND
/svn/src/!svn/bc/209/project/wilsond/test.txt HTTP/1.1" 207 468
123.456.789.10 - anseri\\wilsond [10/Oct/2007:10:09:03 -0400] "GET
/svn/src/!svn/bc/209/project/wilsond/test.txt HTTP/1.1" 200 15
------------------------------------------------------------------------
while for the CGI (failed) run, it logs:
------------------------------------------------------------------------
123.456.789.10 - - [10/Oct/2007:10:14:45 -0400] "PROPFIND
/svn/src/project/wilsond/test.txt HTTP/1.1" 401 512
123.456.789.10 - - [10/Oct/2007:10:14:45 -0400] "PROPFIND
/svn/src/project/wilsond/test.txt HTTP/1.1" 401 512
123.456.789.10 - "" [10/Oct/2007:10:14:45 -0400] "PROPFIND
/svn/src/project/wilsond/test.txt HTTP/1.1" 403 345
------------------------------------------------------------------------
In the latter case, it appears that no credentials are passed to the SVN
server, which is almost certainly the reason for the 403. I tried the
obvious, adding --username and --password options to the "svn" command line,
but no luck, same behavior.
Because of this issue, I cannot rebuild the replicator entree templates, so
all it creates is raw wieners that we have to roast in the warp drive and
garnish with mustard packets stolen from Ten Forward, plus we're out of buns
until our next rendezvous with Rigel 5. You understand my predicament.
Has anyone run into this problem, and if so, how do credential SVN CLI
commands executed from CGI scripts?
Re: Woes executing SVN from CGI
Posted by Greg Thomas <th...@omc.bt.co.uk>.
On Wed, 10 Oct 2007 13:23:00 -0400, "David W. Wilson"
<wi...@anseri.com> wrote:
>I tried the
>obvious, adding --username and --password options to the "svn" command line,
>but no luck, same behavior.
Can you post the output from the CGI (in both CLI and CGI) with these
options added? I assume you've realised that the CLI runs under a
different user from Apache (normally), so the CGI version can't use
the cached credentials from the CLI user.
Greg
--
This post represents the views of the author and does
not necessarily accurately represent the views of BT.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org