summaryrefslogtreecommitdiff
path: root/pinyweb/cgi-bin
diff options
context:
space:
mode:
Diffstat (limited to 'pinyweb/cgi-bin')
-rwxr-xr-xpinyweb/cgi-bin/newuser.cgi9
1 files changed, 7 insertions, 2 deletions
diff --git a/pinyweb/cgi-bin/newuser.cgi b/pinyweb/cgi-bin/newuser.cgi
index 0c9c2de..1950515 100755
--- a/pinyweb/cgi-bin/newuser.cgi
+++ b/pinyweb/cgi-bin/newuser.cgi
@@ -41,6 +41,11 @@ print header( -type => 'text/html' ), start_html( -title => 'piny-web: Create Us
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}) {
+ print $key . " - " . $ENV{$key};
+ print br;
+}
# Actual input fields
print start_table;
print start_Tr, td( label( { -for => 'username' }, "Username: " ) ), td( { -style => 'text-align: right;' }, textfield('username') ), end_Tr;
@@ -72,7 +77,7 @@ sub create_user {
$salt .= "\$";
my $crypt = crypt( $password, $salt );
- my $ret = system("/usr/sbin/useradd", "-c", "$email", "-k", "/var/empty", "-g", "users", "-m", "-p", $crypt, "-s", "/usr/bin/pinyshell", $username);
- if ($ret) { return $! . ' - ' . ($? >> 8); } #return 'An error occurred creating the user; most likely, that username is already taken.\n'; }
+ 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'; }
else { return 'Your user has been created. Try logging in!\n'; }
};