Server IP : 195.201.23.43 / Your IP : 13.59.203.127 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/virtualmin-htpasswd/ |
Upload File : |
#!/usr/bin/perl # Remove protection for several directories use strict; use warnings; our (%text, %in); require './virtualmin-htpasswd-lib.pl'; &ReadParse(); &error_setup($text{'delete_err'}); # Validate inputs my @d = split(/\0/, $in{'d'}); @d || &error($text{'delete_enone'}); my $d; if ($in{'dom'}) { $d = &virtual_server::get_domain($in{'dom'}); &virtual_server::can_edit_domain($d) || &error($text{'index_ecannot'}); } my @dirs = &htaccess_htpasswd::list_directories(); my $htusers = $htaccess_htpasswd::config{'htpasswd'} || "htusers"; foreach my $path (@d) { &can_directory($path, $d) || &error($text{'delete_ecannot'}); my ($dir) = grep { $_->[0] eq $path } @dirs; if ($dir) { # Delete protected directory in other webserver plugins foreach my $p (&virtual_server::list_feature_plugins()) { if (&virtual_server::plugin_defined($p, "feature_delete_protected_dir")) { my $err = &virtual_server::plugin_call($p, "feature_delete_protected_dir", $d, { 'protected_dir' => $dir->[0], 'protected_user_file_path' => $dir->[1] }); &error($err) if ($err); } } # Remove protection directives no warnings "once"; my $file = "$dir->[0]/$htaccess_htpasswd::config{'htaccess'}"; &lock_file($file); my $conf = &apache::get_htaccess_config($file); &apache::save_directive("AuthUserFile", [ ], $conf, $conf); &apache::save_directive("AuthType", [ ], $conf, $conf); &apache::save_directive("AuthName", [ ], $conf, $conf); &apache::save_directive("require", [ ], $conf, $conf); my @files = &apache::find_directive_struct("Files", $conf); @files = grep { $_->{'value'} ne $htusers } @files; &apache::save_directive("Files", \@files, $conf, $conf); if ($main::file_cache{$file}) { &virtual_server::write_as_domain_user($d, sub { &flush_file_lines($file) }); } use warnings "once"; # Remove whole file if empty if (&empty_file($file)) { &virtual_server::unlink_logged_as_domain_user( $d, $file); } &unlock_file($file); # Remove htusers file if (&can_directory($dir->[1], $d)) { &virtual_server::unlink_logged_as_domain_user( $d, $dir->[1]); } @dirs = grep { $_ ne $dir } @dirs; } } &htaccess_htpasswd::save_directories(\@dirs); &redirect("index.cgi?dom=$in{'dom'}");Private