#!/usr/local/bin/perl # edit_euser.cgi # Edit an existing samba user require './samba-lib.pl'; &ReadParse(); # check acls &error_setup("$text{'eacl_aviol'}"); &error("$text{'eacl_np'} $text{'eacl_pvusers'}") unless $access{'view_users'}; # display &ui_print_header(undef, $text{'euser_title'}, ""); @ulist = &list_users(); $u = $ulist[$in{'idx'}]; print "
\n"; print "\n"; print "\n"; print "\n"; print "
$text{'euser_title'}
\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; if ($samba_version >= 3) { # In the new Samba, the password field is not really used for locking # accounts any more, so don't both with the no access/no password # options. print "\n"; if (!$u->{'opts'}) { # Old-style samba user print "\n"; print "\n"; print "\n"; print "\n"; printf "\n", $u->{'shell'}; } else { # New-style samba user print "\n"; map { $opt{uc($_)}++ } @{$u->{'opts'}}; print "\n"; } print "
$text{'euser_name'}$u->{'name'}$text{'euser_uid'}{'uid'}\">
$text{'euser_passwd'} ", "$text{'euser_currpw'}\n"; } else { # In the old Samba, you can set the password to deny a login to the # account or allow logins without a password $locked = ($u->{'pass1'} eq ("X" x 32)); $nopass = ($u->{'pass1'} =~ /^NO PASSWORD/); printf " $text{'euser_noaccess'}\n", $locked ? "checked" : ""; printf " $text{'euser_nopw'}\n", $nopass ? "checked" : ""; printf " $text{'euser_currpw'}\n", $locked||$nopass ? "" : "checked"; } print " $text{'euser_newpw'}\n"; print "
$text{'euser_realname'} \n"; print "
$text{'euser_homedir'}$text{'euser_shell'}
$text{'euser_option'} \n"; @ol = ($text{'euser_normal'}, "U", $text{'euser_nopwrequired'}, "N", $text{'euser_disable'}, "D", $text{'euser_locked'}, "L" ,$text{'euser_noexpire'}, "X", $text{'euser_trust'}, "W"); for($i=0; $i<@ol; $i+=2) { printf " %s
\n", $ol[$i+1], $opt{$ol[$i+1]} ? "checked" : "", $ol[$i]; delete($opt{$ol[$i+1]}); } foreach $oo (keys %opt) { print "\n"; } print "
\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "

\n"; &ui_print_footer("edit_epass.cgi", $text{'index_userlist'}, "", $text{'index_sharelist'});