htaccess-htpasswd/0040775000567100000120000000000010004067665014200 5ustar jcameronwheelhtaccess-htpasswd/module.info0100664000567100000120000000027510006706205016333 0ustar jcameronwheelname=HTAccess Files desc=Protected Web Directories depends=htaccess longdesc=Create .htaccess and htpasswd files to protect web-acessible directories. usermin=1 category=apps version=1.061 htaccess-htpasswd/config0100664000567100000120000000007007756276630015400 0ustar jcameronwheelhtaccess=.htaccess htpasswd=htpasswd md5=0 dirs= home=1 htaccess-htpasswd/config.info0100664000567100000120000000025507756276614016341 0ustar jcameronwheelhtaccess=Apache options file name,0 htpasswd=Users file name,0 dirs=Allowed directories for options files,9,0,0,\t home=Include home directory in allowed list?,1,1-Yes,0-No htaccess-htpasswd/search.cgi0100775000567100000120000000313510006703354016125 0ustar jcameronwheel#!/usr/local/bin/perl # search.cgi # Find .htaccess files under some directory require './htaccess-lib.pl'; &foreign_require($apachemod, "apache-lib.pl"); &ReadParse(); &error_setup($text{'search_err'}); $in{'search'} =~ /^\// && $in{'search'} !~ /\.\./ || &error($text{'search_edir'}); &can_access_dir($in{'search'}) || &error($text{'search_ecannot'}); $| = 1; $theme_no_table++; &header($text{'search_title'}, ""); print "
\n"; @dirs = &list_directories(); %got = map { $_->[0], 1 } @dirs; print "",&text('search_doing', "$in{'search'}"),"

\n"; # Use the find command &switch_user(); open(FIND, "find ".quotemeta($in{'search'})." -name ". quotemeta($config{'htaccess'})." -print 2>/dev/null |"); while($f = ) { chop($f); if ($got{$f}) { print &text('search_already', "$f"),"
\n"; } elsif (!open(TEST, $f)) { print &text('search_open', "$f", $!),"
\n"; } else { $conf = &foreign_call($apachemod, "get_htaccess_config", $f); $currfile = &foreign_call($apachemod, "find_directive", "AuthUserFile", $conf, 1); if ($currfile) { print &text('search_found', "$f", "$currfile"),"
\n"; local $d = $f; $d =~ s/\/$config{'htaccess'}$//; push(@dirs, [ $d, $currfile ]); } else { print &text('search_noprot', "$f"),"
\n"; } } } close(FIND); print "

$text{'search_done'}

\n"; &switch_back(); &lock_file($directories_file); &save_directories(\@dirs); &unlock_file($directories_file); &webmin_log("search", $in{'search'}); print "


\n"; &footer("", $text{'index_return'}); htaccess-htpasswd/edit_dir.cgi0100775000567100000120000000466607756274630016477 0ustar jcameronwheel#!/usr/local/bin/perl # edit_dir.cgi # Display information about a protected directory require './htaccess-lib.pl'; &foreign_require($apachemod, "apache-lib.pl"); &ReadParse(); if ($in{'new'}) { &header($text{'dir_title1'}, ""); } else { &header($text{'dir_title2'}, ""); @dirs = &list_directories(); ($dir) = grep { $_->[0] eq $in{'dir'} } @dirs; &can_access_dir($dir->[0]) || &error($text{'dir_ecannot'}); } print "
\n"; print "
\n"; print "\n"; print "\n"; print "\n"; print "
$text{'dir_header'}
\n"; print "\n"; print "\n", $dir->[1], &file_chooser_button("file", 0); if ($config{'md5'}) { print "\n"; printf "\n", $dir->[2] ? "checked" : "", $text{'dir_crypt1'}; } else { print "\n"; } print "\n"; if (!$in{'new'}) { $conf = &foreign_call($apachemod, "get_htaccess_config", "$dir->[0]/$config{'htaccess'}"); $realm = &foreign_call($apachemod, "find_directive", "AuthName", $conf, 1); } printf "\n", $realm; print "
$text{'dir_dir'} \n"; if ($in{'new'}) { printf " %s\n", $dir->[0], &file_chooser_button("dir", 1); } else { print "\n"; print "$dir->[0]\n"; } print "
$text{'dir_file'} \n"; if ($in{'new'}) { print " ", "$text{'dir_auto'}
\n"; print " $text{'dir_sel'}\n"; } printf " %s
$text{'dir_crypt'} %s\n", $dir->[2] ? "" : "checked", $text{'dir_crypt0'}; printf " %s
$text{'dir_realm'}
\n"; if ($in{'new'}) { print "\n"; } else { print "\n"; print "\n"; print " ", &text('dir_remove', "$config{'htaccess'}", "$config{'htpasswd'}"),"\n"; } print "
\n"; print "
\n"; &footer("", $text{'index_return'}); htaccess-htpasswd/edit_user.cgi0100775000567100000120000000364707750633354016671 0ustar jcameronwheel#!/usr/local/bin/perl # edit_user.cgi # Display a form for editing or creating a htpasswd user require './htaccess-lib.pl'; &ReadParse(); @dirs = &list_directories(); ($dir) = grep { $_->[0] eq $in{'dir'} } @dirs; &can_access_dir($dir->[0]) || &error($text{'dir_ecannot'}); &switch_user(); if ($in{'new'}) { &header($text{'edit_title1'}, ""); $user = { 'enabled' => 1 }; } else { &header($text{'edit_title2'}, ""); $users = &list_users($dir->[1]); $user = $users->[$in{'idx'}]; } print "
\n"; print "
\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "
$text{'edit_header'}
\n"; print "\n"; printf "\n", &html_escape($user->{'user'}); print "\n"; printf "\n", $user->{'enabled'} ? "" : "checked", $text{'no'}; print "\n"; print "
$text{'edit_user'}
$text{'edit_enabled'} %s\n", $user->{'enabled'} ? "checked" : "", $text{'yes'}; printf " %s
$text{'edit_pass'} \n"; if (!$in{'new'}) { print " ", "$text{'edit_pass1'}
\n"; print " ", "$text{'edit_pass0'}\n"; } print "
\n"; if ($in{'new'}) { print "\n"; } else { print "\n"; print "\n"; } print "
\n"; print "
\n"; &footer("", $text{'index_return'}); htaccess-htpasswd/htaccess-lib.pl0100664000567100000120000000406707756277244017122 0ustar jcameronwheel# htaccess-lib.pl # Common functions for the htaccess and htpasswd file management module do '../web-lib.pl'; &init_config(); do 'htpasswd-file-lib.pl'; if ($module_info{'usermin'}) { # Allow directories are in module configuration &switch_to_remote_user(); &create_user_config_dirs(); push(@accessdirs, $remote_user_info[7]) if ($config{'home'}); push(@accessdirs, split(/\t+/, $config{'dirs'})); $directories_file = "$user_module_config_directory/directories"; $apachemod = "htaccess"; } else { # Allowed directories come from ACL %access = &get_module_acl(); @accessdirs = split(/\t+/, $access{'dirs'}); if ($access{'home'}) { local @uinfo = getpwnam($remote_user); push(@accessdirs, $uinfo[7]) if (defined(@uinfo)); } $directories_file = "$module_config_directory/directories"; $directories_file .= ".".$remote_user if ($access{'userdirs'}); $apachemod = "apache"; } # list_directories() # Returns a list of protected directories known to this module, and the # users file for each. sub list_directories { open(DIRS, $directories_file); while() { s/\r|\n//g; local @dir = split(/\t+/, $_); push(@rv, \@dir) if (@dir); } closedir(DIRS); return @rv; } # save_directories(&dirs) sub save_directories { open(DIRS, ">$directories_file"); foreach $d (@{$_[0]}) { print DIRS join("\t", @$d),"\n"; } close(DIRS); } # can_access_dir(dir) # Returns 1 if files can be created under some directory, 0 if not sub can_access_dir { local $d; foreach $d (@accessdirs) { return 1 if (&is_under_directory($d, $_[0])); } return 0; } # switch_user() # Switch to the Unix user that files are accessed as. # No need to do anything for Usermin, because the switch was done above. sub switch_user { if (!$module_info{'usermin'} && $access{'user'} ne 'root' && !defined($old_uid)) { local @uinfo = getpwnam($access{'user'} eq "*" ? $remote_user : $access{'user'}); $old_uid = $>; $old_gid = $); $) = "$uinfo[3] $uinfo[3]"; $> = $uinfo[2]; } } sub switch_back { if (defined($old_uid)) { $> = $old_uid; $) = $old_gid; $old_uid = $old_gid = undef; } } 1; htaccess-htpasswd/htpasswd-file-lib.pl0100664000567100000120000000401207777420310020050 0ustar jcameronwheel# htpasswd-file-lib.pl # Functions for reading and writing a .htpasswd format file # XXX md5 and old password if (!$module_name) { do '../web-lib.pl'; &init_config(); %access = &get_module_acl(); } # list_users([file]) # Returns an array of user names from the given file sub list_users { local $file = $_[0] || $config{'file'}; if (!defined($list_authusers_cache{$file})) { $list_authusers_cache{$file} = [ ]; local $_; local $lnum = 0; local $count = 0; open(HTPASSWD, $file); while() { if (/^(#?)\s*(\S+):(\S*)/) { push(@{$list_authusers_cache{$file}}, { 'user' => $2, 'pass' => $3, 'enabled' => !$1, 'file' => $file, 'line' => $lnum, 'index' => $count++ }); } $lnum++; } close(HTPASSWD); } return $list_authusers_cache{$file}; } # modify_user(&user) sub modify_user { local $lref = &read_file_lines($_[0]->{'file'}); $lref->[$_[0]->{'line'}] = ($_[0]->{'enabled'} ? "" : "#"). "$_[0]->{'user'}:$_[0]->{'pass'}"; &flush_file_lines(); } # create_user(&user, [file]) sub create_user { $_[0]->{'file'} = $_[1] || $config{'file'}; local $lref = &read_file_lines($_[0]->{'file'}); $_[0]->{'line'} = @$lref; push(@$lref, ($_[0]->{'enabled'} ? "" : "#"). "$_[0]->{'user'}:$_[0]->{'pass'}"); &flush_file_lines(); $_[0]->{'index'} = @{$list_authusers_cache{$_[0]->{'file'}}}; push(@{$list_authusers_cache{$_[0]->{'file'}}}, $_[0]); } # delete_user(&user) sub delete_user { local $lref = &read_file_lines($_[0]->{'file'}); splice(@$lref, $_[0]->{'line'}, 1); &flush_file_lines(); splice(@{$list_authusers_cache{$_[0]->{'file'}}}, $_[0]->{'index'}, 1); map { $_->{'line'}-- if ($_->{'line'} > $_[0]->{'line'}) } @{$list_authusers_cache{$_[0]->{'file'}}}; } # encrypt_password(string, [old], md5mode) sub encrypt_password { &seed_random(); if ($_[2]) { &foreign_require("useradmin", "user-lib.pl"); return &useradmin::encrypt_md5($_[0], $_[1]); } else { local $salt = $_[1] || chr(int(rand(26))+65).chr(int(rand(26))+65); return crypt($_[0], $salt); } } 1; htaccess-htpasswd/images/0040775000567100000120000000000007751323324015447 5ustar jcameronwheelhtaccess-htpasswd/images/icon.gif0100664000567100000120000000116307750371421017064 0ustar jcameronwheelGIF89a00̥!ƄZZZcc1B1fffRssskkk!,00'dihl@,˯sǵ; P0(p 6{)&xZۀ0}֨,BS(t_P0>8N'ͭj'  bru&   ( { &t'  >  F"  g  I,ք  7F }$C"((HA1F@780aj"`= x40BtՑbȐ@!R,2NNE?+i0C=lyp)ӂ"0*I?OMTy^LVXHN,P]sUu8JF @!L2Af\NΞ'kب;Ekӝn;d߸S(CUEY~@oH@0jH|Gۻp_~;htaccess-htpasswd/images/smallicon.gif0100664000567100000120000000124607777121251020122 0ustar jcameronwheelGIF87ar%VoD]s Y@R@'sss־].-,@]cMMMLg֟©/||~333@xsZf~'''YF!H4۟2L.D@@eg8驯> nnnefff_a@eƱZZZdc]Fe!Tgپck|xA~!%LZu g,WY$_00$$[Y0l60S_6;T 24Y6H,=$lW#fiAOĂgh7/MD5`B Zχ):?Ik3ECXENN%dUNP#GBi|"d`ˤ{5LZJd!DCC$XE 'D|aBO R(?xQc+G509R@B<`Sf@>€+Cv @ݻ;htaccess-htpasswd/index.cgi0100775000567100000120000000421510004070336015762 0ustar jcameronwheel#!/usr/local/bin/perl # index.cgi # Display a list of protected directories and their users. The user can # add more directories, and specify the encryption mode for each. require './htaccess-lib.pl'; &header($text{'index_title'}, "", undef, 1, 1); print "
\n"; @accessdirs || &error($text{'index_eaccess'}); @dirs = &list_directories(); @dirs = grep { &can_access_dir($_->[0]) } @dirs; if (@dirs) { print "$text{'index_add'}
\n"; print "\n"; print " ", "\n"; foreach $d (@dirs) { print "\n"; print "\n"; print "\n"; print "\n"; } print "
$text{'index_dir'}$text{'index_users'}
$d->[0]\n"; $users = &list_users($d->[1]); if ($userconfig{'sort'} == 1 || $config{'sort'} == 1) { $users = [ sort { $a->{'user'} cmp $b->{'user'} } @$users ]; } for($i=0; $i<@$users; $i++) { $u = $users->[$i]; $link = "$u->{'user'}"; print "\n" if ($i%4 == 0); if ($u->{'enabled'}) { print "\n"; } else { print "\n"; } print "\n" if ($i%4 == 3); } if ($i%4) { while($i++%4) { print "\n"; } print "\n"; } if (!@$users) { print "\n"; } print "
$link$link
$text{'index_nousers'}", "
\n"; print "$text{'index_uadd'}\n"; print "
\n"; } else { print "$text{'index_none'}

\n"; } print "$text{'index_add'}

\n"; print "


\n"; print "
\n"; print "\n"; printf " %s
\n", $accessdirs[0] eq "/" ? "" : $accessdirs[0], &file_chooser_button("search", 1); print "
\n"; print "
\n"; &footer("/", $text{'index'}); htaccess-htpasswd/lang/0040775000567100000120000000000010004070324015103 5ustar jcameronwheelhtaccess-htpasswd/lang/es0100664000567100000120000000435510003656261015452 0ustar jcameronwheelindex_title=Directorios Web Protegidos index_dir=Directorio protegido index_users=Usuarios habilitados index_none=An no han sido definidos directorios protegidos. index_add=Agregar proteccin para un nuevo directorio. index_uadd=Agregar un nuevo usuario para este directorio. index_return=lista de usuarios y directorios index_nousers=Ninguno definido an index_eaccess=No tiene acceso a ningn directorio! dir_title1=Agregar Directorio Protegido dir_title2=Editar Directorio Protegido dir_header=Opciones de directorio protegido dir_dir=Camino del directorio dir_file=Archivo conteniendo usuarios dir_auto=Seleccionar automticamente dir_sel=Archivo seleccionado .. dir_crypt=Encripcin de contrasea dir_crypt0=Unix crypt dir_crypt1=MD5 dir_realm=Autenticacin realm dir_err=Fallo al salvar directorio dir_eclash=Este directorio ya est protegido dir_edir=Directorio no ingresado o no vlido dir_ecannot=No est autorizado a proteger este directorio dir_efile=Nombre de archivo de usuarios no ingresado o no vlido dir_ehtaccess=Fallo al crear archivo de opciones de Apache $1 : $2 dir_ehtpasswd=Fallo al crear archivo de usuarios $1 : $2 dir_remove=Borrar totalmente archivos $1 y $2? dir_erealm=Autenticacin realm no ingresada edit_title1=Crear Usuario edit_title2=Editar Usuario edit_header=Detalles del usuario del archivo de contraseas edit_user=Nombre de usuario edit_enabled=Habilitado? edit_pass=Contrasea edit_pass1=Dejar incambiado edit_pass0=Configurar a edit_passfrom=Cambiar desde edit_passto=a nueva contrasea save_err=Fallo al salvar usuario save_euser1=Nombre de usuario no ingresado save_euser2=Nombre de usuario no puede contener el carcter : save_epass=Contrasea no puede contener el carcter : save_eclash=Ya existe un usuario con el mismo nombre save_eoldpass=La password anterior no es correcta save_title=Usuario Salvado acl_dirs=Permitir directorios acl_user=Crear archivos .htaccess y htusers como usuario Unix acl_same=Igual que el usuario de ingreso Webmin acl_home=Incluir el directorio de inicio del usuario Unix? log_create_dir=Agregado directorio $1 log_modify_dir=Modificado directorio $1 log_delete_dir=Borrado directorio $1 log_create_user=Creado usuario $1 log_modify_user=Modificado usuario $1 log_delete_user=Borrado usuario $1 htaccess-htpasswd/lang/en0100664000567100000120000000500410004070324015424 0ustar jcameronwheelindex_title=Protected Web Directories index_dir=Protected directory index_users=Allowed users index_none=No protected directories have been defined yet. index_add=Add protection for a new directory. index_uadd=Add a new user for this directory. index_return=users and directories list index_nousers=None defined yet index_eaccess=You do not have access to any directories! index_search=Find existing protected directories under: dir_title1=Add Protected Directory dir_title2=Edit Protected Directory dir_header=Protected directory options dir_dir=Directory path dir_file=File containing users dir_auto=Choose automatically dir_sel=Selected file .. dir_crypt=Password encryption dir_crypt0=Unix crypt dir_crypt1=MD5 dir_realm=Authentication realm dir_err=Failed to save directory dir_eclash=This directory is already protected dir_edir=Missing or invalid directory dir_ecannot=You are not allowed to protect this directory dir_efile=Missing or invalid users filename dir_ehtaccess=Failed to create Apache options file $1 : $2 dir_ehtpasswd=Failed to create users file $1 : $2 dir_remove=Totally delete $1 and $2 files? dir_erealm=Missing authentication realm edit_title1=Create User edit_title2=Edit User edit_header=Password file user details edit_user=Username edit_enabled=Enabled? edit_pass=Password edit_pass1=Leave unchanged edit_pass0=Set to edit_passfrom=Change from edit_passto=to new password save_err=Failed to save user save_euser1=Missing username save_euser2=Username cannot contain the : character save_epass=Password cannot contain the : character save_eclash=A user with the same name already exists save_eoldpass=Old password is not correct save_title=User Saved acl_dirs=Allowed directories acl_user=Create .htaccess and htusers files as Unix user acl_same=Same as Webmin login acl_home=Include Unix user's home directory? log_create_dir=Added directory $1 log_modify_dir=Modified directory $1 log_delete_dir=Deleted directory $1 log_create_user=Created user $1 log_modify_user=Modified user $1 log_delete_user=Deleted user $1 search_title=Search Results search_err=Search failed search_edir=Missing or invalid absolute directory to search search_ecannot=You are not allowed to search that directory search_doing=Searching for protected directories under $1 .. search_found=Found new Apache options file $1 with users in $2. search_already=Skipping known Apache options file $1. search_noprot=Skipping Apache options file $1, as it does not protect the directory. search_open=Could not open Apache options file $1 : $2 search_done=.. done htaccess-htpasswd/log_parser.pl0100644000567100000120000000060307751273253016673 0ustar jcameronwheel# log_parser.pl # Functions for parsing this module's logs do 'htaccess-lib.pl'; # parse_webmin_log(user, script, action, type, object, ¶ms) # Converts logged information from this module into human-readable form sub parse_webmin_log { local ($user, $script, $action, $type, $object, $p) = @_; return &text('log_'.$action.'_'.$type, "".&html_escape($object).""); } htaccess-htpasswd/uconfig.info0100664000567100000120000000006007756276245016520 0ustar jcameronwheelsort=Sort users by,1,1-Username,0-Order in file htaccess-htpasswd/save_dir.cgi0100775000567100000120000000747607756275767016526 0ustar jcameronwheel#!/usr/local/bin/perl # save_dir.cgi # Create or update a .htaccess file require './htaccess-lib.pl'; &ReadParse(); @dirs = &list_directories(); &error_setup($text{'dir_err'}); &foreign_require($apachemod, "apache-lib.pl"); # Work out what .htaccess file to use if ($in{'new'} && $in{'dir'} !~ /^\// && $accessdirs[0] ne "/") { # Make path absolute $in{'dir'} = "$accessdirs[0]/$in{'dir'}"; } ($dir) = grep { $_->[0] eq $in{'dir'} } @dirs; if ($in{'new'}) { $dir && &error($text{'dir_eclash'}); $htaccess = "$in{'dir'}/$config{'htaccess'}"; } else { $htaccess = "$dir->[0]/$config{'htaccess'}"; } &lock_file($htaccess); &lock_file($directories_file); # Get the apache directives for the .htaccess file, if any $conf = &foreign_call($apachemod, "get_htaccess_config", $htaccess); $currfile = &foreign_call($apachemod, "find_directive", "AuthUserFile", $conf, 1); &lock_file($currfile) if ($currfile); # Make sure it is allowed &switch_user(); &can_access_dir($htaccess) || &error($text{'dir_ecannot'}); open(TEST, ">>$htaccess") || &error(&text('dir_ehtaccess', $htaccess, $!)); close(TEST); if ($in{'delete'}) { if ($in{'remove'}) { # Blow away .htaccess and htpasswd unlink($htaccess); unlink($currfile) if ($currfile); @dirs = grep { $_ ne $dir } @dirs; } else { # Take the authentication directives out of the .htaccess @dirs = grep { $_ ne $dir } @dirs; &foreign_call($apachemod, "save_directive", "require", [ ], $conf, $conf); } } else { # Validate inputs? if ($in{'new'}) { $in{'dir'} =~ /^\// && -d $in{'dir'} || &error($text{'dir_edir'}); } if ($in{'auto'}) { $file = "$in{'dir'}/$config{'htpasswd'}"; } else { if ($in{'file'} !~ /^\//) { $file = "$in{'dir'}/$file"; } else { $file = $in{'file'}; } } if ($in{'new'}) { # Either update an existing .htaccess to ensure that all # needed directives exist, or create from scratch # Use the existing users path if there is one, otherwise add $currfile = &foreign_call($apachemod, "find_directive", "AuthUserFile", $conf, 1); if ($currfile) { $file = $currfile; } else { &foreign_call($apachemod, "save_directive", "AuthUserFile", [ $file ], $conf, $conf); } # Add an auth type if needed $currtype = &foreign_call($apachemod, "find_directive", "AuthType", $conf, 1); if (!$currtype) { &foreign_call($apachemod, "save_directive", "AuthType", [ "Basic" ], $conf, $conf); } # Add a realm if needed $currrealm = &foreign_call($apachemod, "find_directive", "AuthName", $conf, 1); if (!$currrealm) { $in{'realm'} || &error($text{'dir_erealm'}); &foreign_call($apachemod, "save_directive", "AuthName", [ "\"$in{'realm'}\"" ], $conf, $conf); } # Add a require if needed $currrequire = &foreign_call($apachemod, "find_directive", "require", $conf, 1); if (!$currrequire) { &foreign_call($apachemod, "save_directive", "require", [ "valid-user" ], $conf, $conf); } # Add to the known directories list $dir = [ $in{'dir'}, $file, $in{'crypt'} ]; push(@dirs, $dir); } else { # Just update the users file path and realm &foreign_call($apachemod, "save_directive", "AuthUserFile", [ $file ], $conf, $conf); &foreign_call($apachemod, "save_directive", "AuthName", [ "\"$in{'realm'}\"" ], $conf, $conf); # Update the known directories list $dir->[1] = $file; $dir->[2] = $in{'crypt'}; } # Create an empty users file if needed if (!-r $file) { &lock_file($file); open(FILE, ">$file") || &error(&text('dir_ehtpasswd', $file, $!)); close(FILE); &unlock_file($file); } } &flush_file_lines(); &switch_back(); &save_directories(\@dirs); &unlock_all_files(); &webmin_log($in{'delete'} ? "delete" : $in{'new'} ? "create" : "modify", "dir", $dir->[0]); &redirect(""); htaccess-htpasswd/save_user.cgi0100775000567100000120000000252607750634463016677 0ustar jcameronwheel#!/usr/local/bin/perl # save_user.cgi # Create, update or delete a password file user require './htaccess-lib.pl'; &ReadParse(); &error_setup($text{'save_err'}); @dirs = &list_directories(); ($dir) = grep { $_->[0] eq $in{'dir'} } @dirs; &can_access_dir($dir->[0]) || &error($text{'dir_ecannot'}); &lock_file($dir->[1]); &switch_user(); $users = &list_users($dir->[1]); if (!$in{'new'}) { $user = $users->[$in{'idx'}]; $loguser = $user->{'user'}; } else { $loguser = $in{'user'}; } if ($in{'delete'}) { # Just delete this user &delete_user($user); } else { # Validate inputs $in{'user'} || &error($text{'save_euser1'}); $in{'user'} =~ /:/ && &error($text{'save_euser2'}); if ($in{'new'} || $user->{'user'} ne $in{'user'}) { ($clash) = grep { $_->{'user'} eq $in{'user'} } @$users; $clash && &error($text{'save_eclash'}); } !$in{'pass_def'} && $in{'pass'} =~ /:/ && &error($text{'save_epass'}); # Actually save $user->{'user'} = $in{'user'}; if (!$in{'pass_def'}) { $user->{'pass'} = &encrypt_password( $in{'pass'}, undef, $dir->[2]); } $user->{'enabled'} = $in{'enabled'}; if ($in{'new'}) { &create_user($user, $dir->[1]); } else { &modify_user($user); } } &switch_back(); &unlock_file($dir->[1]); &webmin_log($in{'delete'} ? "delete" : $in{'new'} ? "create" : "modify", "user", $loguser, $user); &redirect(""); htaccess-htpasswd/defaultuconfig0100664000567100000120000000000707756276267017140 0ustar jcameronwheelsort=0