diff options
author | Joe Rayhawk <jrayhawk@omgwallhack.org> | 2011-06-01 18:00:17 -0700 |
---|---|---|
committer | Joe Rayhawk <jrayhawk@omgwallhack.org> | 2011-06-01 18:00:17 -0700 |
commit | 58adf27d1f1dd0157fc3812b15fc9abe31ccf36e (patch) | |
tree | 70aeef7cc4d05c26792212e2c26716a888f91292 /pinyweb/cgi-bin/auth | |
parent | 1c50f124afd170e3feaea3163d15c2ece731d67a (diff) | |
download | piny-code-58adf27d1f1dd0157fc3812b15fc9abe31ccf36e.tar.gz piny-code-58adf27d1f1dd0157fc3812b15fc9abe31ccf36e.zip |
Adding cgi support for source repos
Diffstat (limited to 'pinyweb/cgi-bin/auth')
-rwxr-xr-x | pinyweb/cgi-bin/auth/newrepo.cgi | 32 |
1 files changed, 17 insertions, 15 deletions
diff --git a/pinyweb/cgi-bin/auth/newrepo.cgi b/pinyweb/cgi-bin/auth/newrepo.cgi index 691387d..94b25e9 100755 --- a/pinyweb/cgi-bin/auth/newrepo.cgi +++ b/pinyweb/cgi-bin/auth/newrepo.cgi @@ -11,23 +11,25 @@ use IPC::Open2; $q = CGI->new; +my @cmd; + print( "Content-type: text/plain\n\n"); -if( defined( $q->param('r') ) && defined( $q->param('d') ) ) { - if( defined( $q->param('i') && $q->param('i') ~= /0|1/ ) { - if( $q->param('i') eq "0" ) { - unless( open2( OUT, IN, '/usr/sbin/piny-suid', $ENV{'REMOTE_USER'}, 'newrepo', '--batch', '--disable-ikiwiki', $q->param('r') ) ) { - die 'could not execute newrepo'; - }; - } elsif( $q->param('i') eq "1" ) { - unless( open2( OUT, IN, '/usr/sbin/piny-suid', $ENV{'REMOTE_USER'}, 'newrepo', '--batch', '--enable-ikiwiki', $q->param('r') ) ) { - die 'could not execute newrepo'; - }; - }; - } else { - unless( open2( OUT, IN, '/usr/sbin/piny-suid', $ENV{'REMOTE_USER'}, 'newrepo', '--batch', $q->param('r') ) ) { - die 'could not execute newrepo'; - }; +if( defined( $q->param('r') ) && defined( $q->param('d') ) ) { # repository, description + @cmd = ( '/usr/sbin/piny-suid', $ENV{'REMOTE_USER'}, 'newrepo', '--batch', '--enable-ikiwiki', $q->param('r') ); + + if( defined( $q->param('i') ) && $q->param('i') eq "0" ) { + push( @cmd, '--disable-ikiwiki' ); + } elsif( defined( $q->param('i') ) && $q->param('i') eq "1" ) { + push( @cmd, '--enable-ikiwiki' ); + }; + + if( defined( $q->param('s') ) ) { # source + push( @cmd, $q->param('s') ); + }; + + unless( open2( OUT, IN, @cmd ) ) { + die 'could not execute newrepo'; }; # make things flushier select( (select(IN), $| = 1)[0] ); |