Private
Server IP : 195.201.23.43  /  Your IP : 18.117.161.73
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 :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ HOME SHELL ]     

Current File : /usr/share/webmin/virtualmin-htpasswd/find.cgi
#!/usr/bin/perl
# Find existing protected directories
use strict;
use warnings;
our (%text, %in);

require './virtualmin-htpasswd-lib.pl';
&ReadParse();
&error_setup($text{'find_err'});
$in{'dom'} || &error($text{'find_edom'});
my $d = &virtual_server::get_domain($in{'dom'});
$d && &virtual_server::can_edit_domain($d) || &error($text{'find_ecannot'});

my @dirs = &htaccess_htpasswd::list_directories();
my %got = map { ( "$_->[0]/$htaccess_htpasswd::config{'htaccess'}", 1 ) } @dirs;

# Start the search
&ui_print_header(&virtual_server::domain_in($d), $text{'find_title'}, "");

my $f_apache = $virtual_server::config{'web'};
my $f_indent = " " x 4;
my $f_label = "";
$f_label = 2 if (!$f_apache);
print &text('find_doing', "<tt>$d->{'home'}</tt>"),"<br>\n";
open(my $FIND, "find ".quotemeta($d->{'home'})." -name ".
	   quotemeta($htaccess_htpasswd::config{'htaccess'}).
	   " -print 2>/dev/null |");
while(my $f = <$FIND>) {
	chop($f);
	my $f_name = $f;
	$f_name =~ s|/[^/]*$|| if (!$f_apache);
	if ($got{$f}) {
		print $f_indent.&text("find_already$f_label", "<tt>$f_name</tt>"),"<br>\n";
		next;
		}

	# Read as the domain user
	my ($conf, $currfile, $require);
	&virtual_server::write_as_domain_user($d,
	  sub {
			$conf = &apache::get_htaccess_config($f);
			$currfile = &apache::find_directive("AuthUserFile", $conf, 1);
		$require = &apache::find_directive("require", $conf, 1);
		});
	if ($currfile && $require) {
		my $dir = $f;
		$dir =~ s/\/$htaccess_htpasswd::config{'htaccess'}$//;
		if (&can_directory($dir, $d)) {
			push(@dirs, [ $dir, $currfile ]);
			my $f_extra;
			if (!$f_apache) {
				# Now add newly found protected directory in other webserver plugins
				my $currfilename = $currfile; # Extract filename from path
				$currfilename =~ s/.*\///;
				foreach my $p (&virtual_server::list_feature_plugins()) {
					if (&virtual_server::plugin_defined($p, "feature_add_protected_dir")) {
						my ($err, $status) = &virtual_server::plugin_call($p,
							"feature_add_protected_dir", $d, 
								{ 'protected_dir' => $dir,
								  'protected_user_file_path' => $currfile, 
								  'protected_user_file' => $currfilename,
								  'protected_name' => $text{'find_authreq'} });
						$f_extra = $text{"find_webservstatus$status"} if (defined($status));
						}
					}
				}
			print $f_indent.&text("find_found$f_label", "<tt>$f_name</tt>",
				"<tt>$currfile</tt>")." $f_extra","<br>\n";
			}
		else {
			print $f_indent.&text("find_foundnot$f_label", "<tt>$f_name</tt>"),"<br>\n";
			}
		}
	else {
		print $f_indent.&text("find_noprot$f_label", "<tt>$f_name</tt>"),"<br>\n";
		}
	}
close($FIND);
print $text{'find_founddone'},"<br>\n";
&lock_file($htaccess_htpasswd::directories_file);
&htaccess_htpasswd::save_directories(\@dirs);
&unlock_file($htaccess_htpasswd::directories_file);

&ui_print_footer("index.cgi?dom=$in{'dom'}", $text{'index_return'});
Private