#!/usr/local/bin/perl # edit_passwd_shadow.cgi # Edit a NIS password/shadow files entry require './nis-lib.pl'; require 'timelocal.pl'; &ReadParse(); &ui_print_header(undef, $text{'passwd_title'}, ""); # Build list of available shells @shlist = ("/bin/sh", "/bin/csh", "/bin/false"); open(SHELLS, "/etc/shells"); while() { s/\r|\n//g; s/#.*$//; push(@shlist, $_) if (/\S/); } close(SHELLS); ($t, $lnums, $passwd, $shadow) = &table_edit_setup($in{'table'}, $in{'line'}, ':'); print "
\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "
$text{'passwd_header1'}
\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n", $found ? '' : $passwd->[6], &file_chooser_button("other"); %uconfig = &foreign_config("useradmin"); print "\n"; print "\n"; print "\n"; print "
$text{'passwd_name'}[0]\">$text{'passwd_uid'}[2]\">
$text{'passwd_real'}[4]\">$text{'passwd_home'}[5]\"> ", &file_chooser_button("home", 1),"
$text{'passwd_shell'}
\n"; printf " %s
$text{'passwd_pass'} \n"; printf" %s
\n", $passwd->[0] eq "" ? "checked" : "", $uconfig{'empty_mode'} ? $text{'passwd_none1'} : $text{'passwd_none2'}; printf" $text{'passwd_nologin'}
\n", $passwd->[0] eq $uconfig{'lock_string'} ? "checked" : ""; print " $text{'passwd_clear'}\n"; printf "
\n", $uconfig{'passwd_stars'} ? "type=password" : ""; printf " $text{'passwd_encrypted'}\n", $passwd->[0] && $passwd->[0] ne $uconfig{'lock_string'} ? "checked" :""; printf "\n", $passwd->[0] && $passwd->[0] ne $uconfig{'lock_string'} ? $pass : ""; print "
$text{'passwd_gid'}

\n"; print "\n"; print "\n"; print "
$text{'passwd_header2'}
\n"; print "\n"; if ($shadow->[2] && $shadow->[2] >= 0) { @tm = localtime(timelocal(gmtime($shadow->[2] * 60*60*24))); printf "\n", $tm[3], $text{"smonth_".($tm[4]+1)}, $tm[5]+1900; } elsif ($in{'line'} eq "") { print "\n"; } else { print "\n"; } print "\n"; if ($shadow->[7] && $shadow->[7] >= 0) { @tm = localtime($shadow->[7] * 60*60*24); $eday = $tm[3]; $emon = $tm[4]+1; $eyear = $tm[5]+1900; } print "\n"; print "\n"; printf "\n", $shadow->[3] < 0 ? "" : $shadow->[3]; print "\n"; printf "\n", $shadow->[4] < 0 ? "" : $shadow->[4]; print "\n"; printf "\n", $shadow->[5] < 0 ? "" : $shadow->[5]; print "\n"; printf "\n", $shadow->[6] < 0 ? "" : $shadow->[6]; print "\n"; print "
$text{'passwd_change'}%s/%s/%s$text{'passwd_never'}$text{'passwd_unknown'}$text{'passwd_expire'}"; &date_input($eday, $emon, $eyear, 'expire'); print "
$text{'passwd_min'}$text{'passwd_max'}
$text{'passwd_warn'}$text{'passwd_inactive'}
\n"; if (defined($in{'line'})) { print "\n"; print "\n"; } else { print "\n"; } print "

\n"; &ui_print_footer("edit_tables.cgi?table=$in{'table'}", $text{'tables_return'});