From e7dfef272790cf79cce19e3459363e6ee95f73d5 Mon Sep 17 00:00:00 2001 From: Ian Duffe Date: Tue, 18 Jan 2011 21:39:03 -0800 Subject: Another newuser.cgi update --- pinyweb/cgi-bin/newuser.cgi | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'pinyweb/cgi-bin/newuser.cgi') 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 "KEYS", 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'; } }; -- cgit v1.2.3