Server IP : 195.201.23.43 / Your IP : 3.128.190.205 Web Server : Apache System : Linux webserver2.vercom.be 5.4.0-192-generic #212-Ubuntu SMP Fri Jul 5 09:47:39 UTC 2024 x86_64 User : kdecoratie ( 1041) PHP Version : 7.1.33-63+ubuntu20.04.1+deb.sury.org+1 Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals, MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : ON Directory : /usr/share/webmin/htaccess-htpasswd/ |
Upload File : |
#!/usr/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 = $dir->[2] == 3 ? &list_digest_users($dir->[1]) : &list_users($dir->[1]); if (!$in{'new'}) { $user = $users->[$in{'idx'}]; $loguser = $user->{'user'}; } else { $loguser = $in{'htuser'}; } if ($in{'delete'}) { # Just delete this user &delete_user($user); } else { # Validate inputs $in{'htuser'} || &error($text{'save_euser1'}); $in{'htuser'} =~ /:/ && &error($text{'save_euser2'}); if ($in{'new'} || $user->{'user'} ne $in{'htuser'}) { ($clash) = grep { $_->{'user'} eq $in{'htuser'} } @$users; $clash && &error($text{'save_eclash'}); } !$in{'htpass_def'} && $in{'htpass'} =~ /:/ && &error($text{'save_epass'}); # Actually save $user->{'user'} = $in{'htuser'}; if (!$in{'htpass_def'}) { if ($dir->[2] == 3) { $user->{'pass'} = &digest_password($in{'htuser'}, $in{'dom'}, $in{'htpass'}); } else { $user->{'pass'} = &encrypt_password( $in{'htpass'}, undef, $dir->[2]); } } $user->{'enabled'} = $in{'enabled'}; if ($dir->[2] == 3) { $in{'dom'} =~ /^\S+$/ && $in{'dom'} !~ /:/ || &error($text{'save_edom'}); $user->{'dom'} = $in{'dom'}; $user->{'digest'} = 1; } 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("");Private