diff options
Diffstat (limited to 'pinyweb/cgi-bin/newuser.cgi')
-rw-r--r-- | pinyweb/cgi-bin/newuser.cgi | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/pinyweb/cgi-bin/newuser.cgi b/pinyweb/cgi-bin/newuser.cgi new file mode 100644 index 0000000..002d2be --- /dev/null +++ b/pinyweb/cgi-bin/newuser.cgi @@ -0,0 +1,29 @@ +#!/usr/bin/perl +$| = 1; + +use warnings; + +use CGI; + +use IPC::Open2; + +$q = CGI->new; + +print( "Content-type: text/plain\n\n" ); + +if( $q->param('n') && $q->param('a') && $q->param('p') ) { + unless( open2( OUT, IN, '/usr/bin/sudo', '/usr/sbin/newuser', '--batch', $q->param('a'), $q->param('n') ) ) { + print 'could not execute newrepo'; + die; + }; + # make things flushier + select((select(IN), $| = 1)[0]); + select((select(OUT), $| = 1)[0]); + print( IN $q->param('p') . "\n" ); + close( IN ); + while( <OUT> ) { + print; + }; +} else { + print 'Missing parameters.'; +}; |