#!/usr/local/bin/perl # user_form.cgi # Display a form for creating a new user require './cluster-useradmin-lib.pl'; require 'timelocal.pl'; &ReadParse(); &foreign_require("useradmin", "user-lib.pl"); &ui_print_header(undef, $text{'uedit_title2'}, ""); @hosts = &list_useradmin_hosts(); @servers = &list_servers(); # build list of used shells and uids foreach $h (@hosts) { foreach $u (@{$h->{'users'}}) { push(@shlist, $u->{'shell'}) if ($u->{'shell'}); $used{$u->{'uid'}}++; } foreach $g (@{$h->{'groups'}}) { push(@glist, $g) if (!$donegroup{$g->{'group'}}++); } } open(SHELLS, "/etc/shells"); while() { s/\r|\n//g; s/#.*$//; push(@shlist, $_) if (/\S/); } close(SHELLS); print "
\n"; print "\n"; print "\n"; print "
$text{'uedit_details'}
\n"; print "\n"; print "\n"; # Find the first free UID above the base print "\n"; $newuid = int($uconfig{'base_uid'}); while($used{$newuid}) { $newuid++; } print "\n"; if ($uconfig{'extra_real'}) { print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; } else { print "\n"; print "\n"; } print "\n"; print "\n"; print "\n"; print "\n"; &seed_random(); foreach (1 .. 15) { $random_password .= $random_password_chars[ rand(scalar(@random_password_chars))]; } print "\n"; print "\n"; print "\n"; print "\n"; print "
$text{'user'}$text{'uid'}
$text{'real'}$text{'office'}
$text{'workph'}$text{'homeph'}
$text{'extra'}
$text{'real'}$text{'home'}\n"; if ($uconfig{'home_base'}) { printf " %s\n", $text{'uedit_auto'}; printf "\n"; printf " %s\n", &file_chooser_button("home", 1); } else { print "\n", &file_chooser_button("home", 1); } print "
$text{'shell'}$text{'pass'}", " \n"; printf " %s
\n", $uconfig{'empty_mode'} ? $text{'none1'} : $text{'none2'}; printf " %s
\n", $text{'nologin'}; printf " %s\n", $text{'clear'}; printf "
\n", $uconfig{'passwd_stars'} ? "type=password" : "", $uconfig{'random_password'} ? $random_password : ""; printf " $text{'encrypted'}\n"; printf "\n"; print "
$text{'uedit_other'}\n"; print &file_chooser_button("othersh", 0),"

\n"; $pft = &foreign_call("useradmin", "passfiles_type"); if ($pft == 1 || $pft == 6) { # This is a BSD system.. a few extra password options are supported print "\n"; print "\n"; print "
$text{'uedit_passopts'}
\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "
$text{'change2'}"; &date_input("", "", "", 'change'); print "   "; print ":$text{'expire2'}"; &date_input("", "", "", 'expire'); print "   "; print ":
$text{'class'}

\n"; } elsif ($pft == 2) { # System has a shadow password file as well.. which means it supports # password expiry and so on print "\n"; print "\n"; print "
$text{'uedit_passopts'}
\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "
$text{'expire'}"; &date_input($eday, $emon, $eyear, 'expire'); print "
$text{'min'}$text{'max'}
$text{'warn'}$text{'inactive'}

\n"; } elsif ($pft == 4) { # This is an AIX system print "\n"; print "\n"; print "
$text{'uedit_passopts'}
\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "
$text{'expire'}"; &date_input("", "", "", 'expire'); print "   "; print ":
$text{'min_weeks'}$text{'max_weeks'}
$text{'warn'}$text{'flags'} \n"; printf " %s
\n", $text{'uedit_admin'}; printf " %s
\n", $text{'uedit_admchg'}; printf " %s\n", $text{'uedit_nocheck'}; print "

\n"; } # Output group memberships print "\n"; print "\n"; print "
$text{'uedit_gmem'}
\n"; print "\n"; print "\n"; print "\n"; print "
$text{'group'} \n"; printf "\n", $uconfig{'default_group'}; print "$text{'uedit_2nd'}

\n"; print "\n"; print "\n"; print "
$text{'uedit_oncreate'}
\n"; print "\n"; print "\n"; print "\n"; if ($uconfig{'user_files'} =~ /\S/) { print "\n"; print "\n"; print "\n"; } # Show make home on all servers option print "\n"; print "\n"; print "\n"; # Show other modules option print "\n"; print "\n"; print "\n"; # Show selector for hosts to create on &create_on_input($text{'uedit_servers'}); print "
$text{'uedit_makehome'} $text{'yes'} $text{'no'}
$text{'uedit_copy'} $text{'yes'} $text{'no'}
$text{'uedit_servs'} $text{'uedit_mall'} $text{'uedit_mthis'}
$text{'uedit_others'} $text{'yes'} $text{'no'}

\n"; print "

\n"; &ui_print_footer("", $text{'index_return'}); # date_input(day, month, year, prefix) sub date_input { print ""; print "/"; print "/"; print &date_chooser_button("$_[3]d", "$_[3]m", "$_[3]y"); }