X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=git-cvsserver.perl;fp=git-cvsserver.perl;h=7d3f78e375066c27f0881a92c23fda8d5c8d6dff;hb=91a6bf468230d63c414a21adeef94f1242eaaaab;hp=b45079246a5328c1f69905de84e1128459a63bf8;hpb=8bc63c9ad43a2d5aa033341c60bdef717f704f65;p=git.git diff --git a/git-cvsserver.perl b/git-cvsserver.perl index b4507924..7d3f78e3 100755 --- a/git-cvsserver.perl +++ b/git-cvsserver.perl @@ -87,6 +87,31 @@ $log->info("--------------- STARTING -----------------"); my $TEMP_DIR = tempdir( CLEANUP => 1 ); $log->debug("Temporary directory is '$TEMP_DIR'"); +# if we are called with a pserver argument, +# deal with the authentication cat before entereing the +# main loop +if (@ARGV && $ARGV[0] eq 'pserver') { + my $line = ; chomp $line; + unless( $line eq 'BEGIN AUTH REQUEST') { + die "E Do not understand $line - expecting BEGIN AUTH REQUEST\n"; + } + $line = ; chomp $line; + req_Root('root', $line) # reuse Root + or die "E Invalid root $line \n"; + $line = ; chomp $line; + unless ($line eq 'anonymous') { + print "E Only anonymous user allowed via pserver\n"; + print "I HATE YOU\n"; + } + $line = ; chomp $line; # validate the password? + $line = ; chomp $line; + unless ($line eq 'END AUTH REQUEST') { + die "E Do not understand $line -- expecting END AUTH REQUEST\n"; + } + print "I LOVE YOU\n"; + # and now back to our regular programme... +} + # Keep going until the client closes the connection while () { @@ -165,6 +190,7 @@ sub req_Root print "E the repo config file needs a [gitcvs] section added, and the parameter 'enabled' set to 1\n"; print "E \n"; print "error 1 GITCVS emulation disabled\n"; + return 0; } if ( defined ( $cfg->{gitcvs}{logfile} ) ) @@ -173,6 +199,8 @@ sub req_Root } else { $log->nofile(); } + + return 1; } # Global_option option \n @@ -914,6 +942,12 @@ sub req_ci $log->info("req_ci : " . ( defined($data) ? $data : "[NULL]" )); + if ( @ARGV && $ARGV[0] eq 'pserver') + { + print "error 1 pserver access cannot commit\n"; + exit; + } + if ( -e $state->{CVSROOT} . "/index" ) { print "error 1 Index already exists in git repo\n";