diff options
Diffstat (limited to 'pinyweb')
-rwxr-xr-x | pinyweb/cgi-bin/newuser.cgi | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/pinyweb/cgi-bin/newuser.cgi b/pinyweb/cgi-bin/newuser.cgi index ee499be..8ffaa77 100755 --- a/pinyweb/cgi-bin/newuser.cgi +++ b/pinyweb/cgi-bin/newuser.cgi @@ -5,7 +5,10 @@ use warnings; BEGIN { if ( not defined $ENV{"SUDO_UID"} ) { - exec( "sudo", "/usr/lib/cgi-bin/piny/newuser.cgi", @ARGV ); +# exec( "sudo", "/usr/lib/cgi-bin/piny/newuser.cgi", @ARGV ); + my @env = (); + foreach my $key ( keys %ENV ) { push @env, "$key=$ENV{$key}" }; + exec( "sudo", @env, "/usr/lib/cgi-bin/piny/newuser.cgi", @ARGV ); }; }; @@ -49,7 +52,7 @@ print start_form( -name => 'newuser_form' ); print start_p, "Enter a username and valid email address for the new user. Please remember that the username may only contain alphanumerics, underscores, periods, and dashes. The username may not begin with a dash, nor may it begin with the strings 'git-' or 'ikiwiki-'.", end_p; print "<b>KEYS</b>", br; -for my $key (keys %{$ENV}) { +for my $key (keys %ENV) { print $key . " - " . $ENV{$key}; print br; } @@ -85,6 +88,6 @@ sub create_user { my $crypt = crypt( $password, $salt ); my $ret = system("/usr/sbin/piny-suid", $ENV{'REMOTE_USER'}, "/usr/sbin/useradd", "-c", "$email", "-k", "/var/empty", "-g", "users", "-m", "-p", $crypt, "-s", "/usr/bin/pinyshell", $username); - if ($ret) { return $ENV{'REMOTE_USER'} . ' An error occurred creating the user; most likely, that username is already taken.\n'; } + if ($ret) { return 'An error occurred creating the user; most likely, that username is already taken.\n'; } else { return 'Your user has been created. Try logging in!\n'; } }; |