--- /root/edit_user.cgi.original 2004-08-10 15:05:53.000000000 +1000 +++ ldap-useradmin/edit_user.cgi 2004-08-12 10:55:41.000000000 +1000 @@ -3,7 +3,9 @@ # Display details of an existing user and allow editing require './ldap-useradmin-lib.pl'; +require 'timelocal.pl'; &ReadParse(); +%access = &get_module_acl(); $ldap = &ldap_connect(); if ($in{'new'}) { &header($text{'uedit_title2'}, ""); @@ -28,6 +30,9 @@ $shell = $uinfo->get_value('loginShell'); $gid = $uinfo->get_value('gidNumber'); $pass = $uinfo->get_value('userPassword'); + $change = $uinfo->get_value('shadowLastChange'); + $expire = $uinfo->get_value('shadowExpire'); foreach $oc ($uinfo->get_value('objectClass')) { $oclass{$oc} = 1; } @@ -81,11 +86,11 @@ print "$text{'uid'}\n"; if ($in{'new'}) { # Find the first free UID above the base - $newuid = $uconfig{'base_uid'}; - while($used{$newuid}) { - $newuid++; + $uidewuid = $uconfig{'base_uid'}; + while($used{$uidewuid}) { + $uidewuid++; } - print " \n"; + print " \n"; } else { print " \n"; @@ -158,7 +163,7 @@ $random_password ne "" ? "checked" : ""; printf "
\n", $uconfig{'passwd_stars'} ? "type=password" : "", - $uconfig{'random_password'} && $n eq "" ? $random_password : ""; + $uconfig{'random_password'} && $uid eq "" ? $random_password : ""; printf " $text{'encrypted'}\n", $pass && $pass ne $uconfig{'lock_string'} ? "checked" : ""; @@ -174,6 +179,58 @@ print "

\n"; +if ($access{'peopt'}) { + # 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"; + if ($expire) { + @tm = localtime(timelocal(gmtime($expire * 60*60*24))); + $eday = $tm[3]; + $emon = $tm[4]+1; + $eyear = $tm[5]+1900; + } + print "\n"; + + print "\n"; + + print "\n"; + printf "\n", + $uid eq "" ? $config{'default_min'} : $uinfo->get_value('shadowMin'); + + print "\n"; + printf "\n", + $uid eq "" ? $config{'default_max'} : $uinfo->get_value('shadowMax'); + + print "\n"; + printf "\n", + $uid eq "" ? $config{'default_warn'} : $uinfo->get_value('shadowWarning'); + + print "\n"; + printf "\n", + $uid eq "" ? $config{'default_inactive'} : $uinfo->get_value('shadowInactive'); + + print "
",&hlink("$text{'change'}","change"),""; + if ($change) { + @tm = localtime(timelocal(gmtime($change * 60*60*24))); + printf "%s/%s/%s\n", + $tm[3], $text{"smonth_".($tm[4]+1)}, $tm[5]+1900; + } + elsif ($uid eq "") { print "$text{'uedit_never'}\n"; } + else { print "$text{'uedit_unknown'}\n"; } + printf "", $change; + printf "%s\n", $forcechange eq 1 ? "checked" : "", $text{'uedit_forcechange'}; + print "",&hlink("$text{'expire'}","expire"), + ""; + &date_input($eday, $emon, $eyear, 'expire'); + print "
",&hlink("$text{'min'}","min"),"",&hlink("$text{'max'}","max"),"
",&hlink("$text{'warn'}","warn"),"",&hlink("$text{'inactive'}","inactive"),"

\n"; + } + # Show primary group print "\n"; print "\n"; @@ -313,3 +370,17 @@ print "
\n"; &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"); +}
$text{'uedit_gmem'}