diff options
Diffstat (limited to 'git-cvsserver.perl')
-rwxr-xr-x | git-cvsserver.perl | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/git-cvsserver.perl b/git-cvsserver.perl index 1de517791f..d41b29f30b 100755 --- a/git-cvsserver.perl +++ b/git-cvsserver.perl @@ -95,9 +95,10 @@ $state->{method} = 'ext'; if (@ARGV && $ARGV[0] eq 'pserver') { $state->{method} = 'pserver'; my $line = <STDIN>; chomp $line; - unless( $line eq 'BEGIN AUTH REQUEST') { + unless( $line =~ /^BEGIN (AUTH|VERIFICATION) REQUEST$/) { die "E Do not understand $line - expecting BEGIN AUTH REQUEST\n"; } + my $request = $1; $line = <STDIN>; chomp $line; req_Root('root', $line) # reuse Root or die "E Invalid root $line \n"; @@ -109,10 +110,11 @@ if (@ARGV && $ARGV[0] eq 'pserver') { } $line = <STDIN>; chomp $line; # validate the password? $line = <STDIN>; chomp $line; - unless ($line eq 'END AUTH REQUEST') { - die "E Do not understand $line -- expecting END AUTH REQUEST\n"; + unless ($line eq "END $request REQUEST") { + die "E Do not understand $line -- expecting END $request REQUEST\n"; } print "I LOVE YOU\n"; + exit if $request eq 'VERIFICATION'; # cvs login # and now back to our regular programme... } @@ -165,6 +167,17 @@ sub req_Root my ( $cmd, $data ) = @_; $log->debug("req_Root : $data"); + unless ($data =~ m#^/#) { + print "error 1 Root must be an absolute pathname\n"; + return 0; + } + + if ($state->{CVSROOT} + && ($state->{CVSROOT} ne $data)) { + print "error 1 Conflicting roots specified\n"; + return 0; + } + $state->{CVSROOT} = $data; $ENV{GIT_DIR} = $state->{CVSROOT} . "/"; |