From 65373ecda566f3fd8048e79d09cad216d7a1b445 Mon Sep 17 00:00:00 2001 From: Ilia Ross Date: Fri, 2 Feb 2024 23:11:53 +0200 Subject: [PATCH 1/9] Add logic for adding and removing protected dirs in plugins --- add.cgi | 11 +++++++++++ delete.cgi | 8 ++++++++ virtual_feature.pl | 4 ++-- 3 files changed, 21 insertions(+), 2 deletions(-) diff --git a/add.cgi b/add.cgi index e09fee8..5a6004d 100755 --- a/add.cgi +++ b/add.cgi @@ -54,6 +54,17 @@ foreach my $clash ("AuthUserFile", "AuthType", "AuthName") { -r $usersfile && &error(&text('add_eclash2', $usersfile)); -l $file && &error(&text('add_esymlink', $file)); +# Add protected directory in other webserver plugins +foreach my $p (&virtual_server::list_feature_plugins()) { + my $err = &virtual_server::plugin_call($p, + "feature_add_protected_dir", $d, + { 'protected_dir' => $dir, + 'protected_user_file_path' => $usersfile, + 'protected_user_file' => $htusers, + 'protected_name' => $in{'desc'} }); + &error($err) if ($err); + } + # Create .htaccess (as domain owner) &lock_file($file); &apache::save_directive("AuthUserFile", [ "\"$usersfile\"" ], $conf, $conf); diff --git a/delete.cgi b/delete.cgi index bffba50..0f926ec 100755 --- a/delete.cgi +++ b/delete.cgi @@ -23,6 +23,14 @@ 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()) { + 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'}"; diff --git a/virtual_feature.pl b/virtual_feature.pl index e09a1f3..0b05153 100755 --- a/virtual_feature.pl +++ b/virtual_feature.pl @@ -24,7 +24,7 @@ sub feature_check { return $text{'feat_edep'} if (!&foreign_installed("htaccess-htpasswd", 1)); no warnings "once"; -return $text{'feat_eweb'} if (!$virtual_server::config{'web'}); +return $text{'feat_eweb'} if (!&virtual_server::domain_has_website()); use warnings "once"; return undef; } @@ -260,7 +260,7 @@ sub get_in_dirs sub feature_always_links { my ($d) = @_; -if ($d->{'web'} && $d->{'dir'} && !$d->{'alias'}) { +if (&virtual_server::domain_has_website($d) && $d->{'dir'} && !$d->{'alias'}) { return ( { 'mod' => $module_name, 'desc' => $text{'links_link'}, 'page' => 'index.cgi?dom='.$d->{'id'}, From 5ec8e02b294cd639cb1822ae08b6f6393ac365eb Mon Sep 17 00:00:00 2001 From: Ilia Ross Date: Fri, 2 Feb 2024 23:21:02 +0200 Subject: [PATCH 2/9] Fix not to mention Apache webserver --- add.cgi | 4 ++-- lang/en | 14 ++++++-------- 2 files changed, 8 insertions(+), 10 deletions(-) diff --git a/add.cgi b/add.cgi index 5a6004d..44c2757 100755 --- a/add.cgi +++ b/add.cgi @@ -48,10 +48,10 @@ my $usersfile = "$dir/$htusers"; foreach my $clash ("AuthUserFile", "AuthType", "AuthName") { my $dirclash = &apache::find_directive($clash, $conf); if ($dirclash) { - &error(&text('add_eclash3', $file, $clash)); + &error(&text('add_egclash', $file, $clash)); } } --r $usersfile && &error(&text('add_eclash2', $usersfile)); +-r $usersfile && &error(&text('add_egclash', $usersfile)); -l $file && &error(&text('add_esymlink', $file)); # Add protected directory in other webserver plugins diff --git a/lang/en b/lang/en index e63d939..fee4ee9 100644 --- a/lang/en +++ b/lang/en @@ -16,7 +16,7 @@ index_alert_added_title=Protection Enabled! feat_name=Protected web directories feat_edep=The Protected Web Directories module is not installed -feat_eweb=The Apache website feature is not enabled +feat_eweb=A website feature is not enabled user_dirs=Allow access to web directories user_opts=All directories @@ -37,9 +37,7 @@ add_edir=No directory entered add_edir2=Invalid directory add_edir3=Directory must not start with a / add_edir4=Web directory does not exist -add_eclash=The protection file $1 already exists -add_eclash2=The users file $1 already exists -add_eclash3=The protection file $1 already exists and contains the $2 directive +add_egclash=The protection for this directory already exists add_edesc=No description entered add_esymlink=The protection file $1 is a symbolic link add_tip_under=i.e. under @@ -53,8 +51,8 @@ find_err=Failed to find protected directories find_edom=Missing virtual server find_ecannot=You are not allowed to find directories for this virtual server find_doing=Searching for protected directories under $1 .. -find_found=Found new Apache options file $1 with users in $2. -find_already=Skipping known Apache options file $1. -find_noprot=Skipping Apache options file $1, as it does not protect the directory. -find_foundnot=Found new Apache options file $1, but you are not allowed to manage this directory. +find_found=Found new options file $1 with users in $2. +find_already=Skipping known options file $1. +find_noprot=Skipping options file $1, as it does not protect the directory. +find_foundnot=Found new options file $1, but you are not allowed to manage this directory. __norefs=1 From 46575e6a7d657f2dd5140b1613025b7d5be9b9c7 Mon Sep 17 00:00:00 2001 From: Ilia Ross Date: Fri, 2 Feb 2024 23:57:42 +0200 Subject: [PATCH 3/9] Add support for other webservers in better find output --- find.cgi | 18 ++++++++++++------ lang/en | 13 +++++++++---- 2 files changed, 21 insertions(+), 10 deletions(-) diff --git a/find.cgi b/find.cgi index 393f9af..6df8404 100755 --- a/find.cgi +++ b/find.cgi @@ -17,14 +17,20 @@ my %got = map { ( "$_->[0]/$htaccess_htpasswd::config{'htaccess'}", 1 ) } @dirs; # Start the search &ui_print_header(&virtual_server::domain_in($d), $text{'find_title'}, ""); -print &text('find_doing', "$d->{'home'}"),"

\n"; +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', "$d->{'home'}"),"
\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 &text('find_already', "$f"),"
\n"; + print $f_indent.&text("find_already$f_label", "$f_name"),"
\n"; next; } @@ -41,19 +47,19 @@ while(my $f = <$FIND>) { $dir =~ s/\/$htaccess_htpasswd::config{'htaccess'}$//; if (&can_directory($dir, $d)) { push(@dirs, [ $dir, $currfile ]); - print &text('find_found', "$f", + print $f_indent.&text("find_found$f_label", "$f_name", "$currfile"),"
\n"; } else { - print &text('find_foundnot', "$f"),"
\n"; + print $f_indent.&text("find_foundnot$f_label", "$f_name"),"
\n"; } } else { - print &text('find_noprot', "$f"),"
\n"; + print $f_indent.&text("find_noprot$f_label", "$f_name"),"
\n"; } } close($FIND); - +print $text{'find_founddone'},"
\n"; &lock_file($htaccess_htpasswd::directories_file); &htaccess_htpasswd::save_directories(\@dirs); &unlock_file($htaccess_htpasswd::directories_file); diff --git a/lang/en b/lang/en index fee4ee9..87cb54f 100644 --- a/lang/en +++ b/lang/en @@ -51,8 +51,13 @@ find_err=Failed to find protected directories find_edom=Missing virtual server find_ecannot=You are not allowed to find directories for this virtual server find_doing=Searching for protected directories under $1 .. -find_found=Found new options file $1 with users in $2. -find_already=Skipping known options file $1. -find_noprot=Skipping options file $1, as it does not protect the directory. -find_foundnot=Found new options file $1, but you are not allowed to manage this directory. +find_found= ..found new options file $1 with users in $2 +find_already=..skipping known options file $1 +find_noprot=..skipping options file $1, as it does not protect the directory +find_foundnot=..found new options file $1, but you are not allowed to manage this directory +find_found2= ..found new options file in $1 directory +find_already2=..skipping known options file in $1 directory +find_noprot2=..skipping options file in $1, as it does not protect the directory +find_foundnot2=..found new options file in $1, but you are not allowed to manage this directory +find_founddone=..done __norefs=1 From 3e45ca2d598493869df7af835c73e48df0d33820 Mon Sep 17 00:00:00 2001 From: Ilia Ross Date: Sat, 3 Feb 2024 01:06:58 +0200 Subject: [PATCH 4/9] Add newly found protected directories to the webserver --- find.cgi | 17 ++++++++++++++++- lang/en | 7 ++++++- 2 files changed, 22 insertions(+), 2 deletions(-) diff --git a/find.cgi b/find.cgi index 6df8404..b5d916d 100755 --- a/find.cgi +++ b/find.cgi @@ -47,8 +47,23 @@ while(my $f = <$FIND>) { $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()) { + 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", "$f_name", - "$currfile"),"
\n"; + "$currfile")." $f_extra","
\n"; } else { print $f_indent.&text("find_foundnot$f_label", "$f_name"),"
\n"; diff --git a/lang/en b/lang/en index 87cb54f..f7d0218 100644 --- a/lang/en +++ b/lang/en @@ -55,9 +55,14 @@ find_found= ..found new options file $1 with users in $2 find_already=..skipping known options file $1 find_noprot=..skipping options file $1, as it does not protect the directory find_foundnot=..found new options file $1, but you are not allowed to manage this directory -find_found2= ..found new options file in $1 directory +find_found2= ..imported new options file from $1 directory find_already2=..skipping known options file in $1 directory find_noprot2=..skipping options file in $1, as it does not protect the directory find_foundnot2=..found new options file in $1, but you are not allowed to manage this directory find_founddone=..done +find_authreq=Authentication Required +find_webservstatus0=and added new directory protection settings to the web server config +find_webservstatus1=but failed to add directory protection settings to the web server config +find_webservstatus-1=and kept existing directory protection settings from the web server config + __norefs=1 From b854123c7a7d4281f45fe0552802e9ed476358f0 Mon Sep 17 00:00:00 2001 From: Ilia Ross Date: Sat, 3 Feb 2024 01:07:59 +0200 Subject: [PATCH 5/9] Fix language strings --- lang/en | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lang/en b/lang/en index f7d0218..f903d5d 100644 --- a/lang/en +++ b/lang/en @@ -56,8 +56,8 @@ find_already=..skipping known options file $1 find_noprot=..skipping options file $1, as it does not protect the directory find_foundnot=..found new options file $1, but you are not allowed to manage this directory find_found2= ..imported new options file from $1 directory -find_already2=..skipping known options file in $1 directory -find_noprot2=..skipping options file in $1, as it does not protect the directory +find_already2=..skipping known options file from $1 directory +find_noprot2=..skipping options file from $1, as it does not protect the directory find_foundnot2=..found new options file in $1, but you are not allowed to manage this directory find_founddone=..done find_authreq=Authentication Required From ce18d1cb3c52c99825aa38756381c98088ae1480 Mon Sep 17 00:00:00 2001 From: Ilia Ross Date: Sat, 3 Feb 2024 01:11:45 +0200 Subject: [PATCH 6/9] Fix intro help file --- help/intro.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/help/intro.html b/help/intro.html index a700ade..43bb0ca 100644 --- a/help/intro.html +++ b/help/intro.html @@ -6,7 +6,7 @@ the checkbox next to the directory name and click the button below the list.

Once protection has been setup, you can control which users have access to it -using the Edit Mail and FTP Users page. When you click on a user or +using the Edit Users page. When you click on a user or create a new one, the Allow access to web directories field can be used to select one or more allow paths from the list you define here.

From 7824031ae7a7bf8798c03991c82bfbae6069a817 Mon Sep 17 00:00:00 2001 From: Ilia Ross Date: Sat, 3 Feb 2024 01:25:12 +0200 Subject: [PATCH 7/9] Update translations --- help/intro.af.auto.html | 3 ++- help/intro.ar.auto.html | 3 ++- help/intro.be.auto.html | 3 ++- help/intro.bg.auto.html | 3 ++- help/intro.ca.auto.html | 3 ++- help/intro.cs.auto.html | 3 ++- help/intro.da.auto.html | 3 ++- help/intro.de.auto.html | 3 ++- help/intro.el.auto.html | 3 ++- help/intro.es.auto.html | 3 ++- help/intro.eu.auto.html | 3 ++- help/intro.fa.auto.html | 3 ++- help/intro.fi.auto.html | 3 ++- help/intro.fr.auto.html | 3 ++- help/intro.he.auto.html | 3 ++- help/intro.hr.auto.html | 3 ++- help/intro.hu.auto.html | 3 ++- help/intro.it.auto.html | 3 ++- help/intro.ja.auto.html | 3 ++- help/intro.ko.auto.html | 3 ++- help/intro.lt.auto.html | 3 ++- help/intro.lv.auto.html | 3 ++- help/intro.ms.auto.html | 3 ++- help/intro.mt.auto.html | 3 ++- help/intro.nl.auto.html | 2 ++ help/intro.nl.html | 15 --------------- help/intro.no.auto.html | 3 ++- help/intro.pl.auto.html | 3 ++- help/intro.pt.auto.html | 3 ++- help/intro.pt_BR.auto.html | 3 ++- help/intro.ro.auto.html | 3 ++- help/intro.ru.auto.html | 3 ++- help/intro.sk.auto.html | 3 ++- help/intro.sl.auto.html | 3 ++- help/intro.sv.auto.html | 3 ++- help/intro.th.auto.html | 3 ++- help/intro.tr.auto.html | 3 ++- help/intro.uk.auto.html | 3 ++- help/intro.ur.auto.html | 3 ++- help/intro.vi.auto.html | 3 ++- help/intro.zh.auto.html | 3 ++- help/intro.zh_TW.auto.html | 3 ++- lang/af.auto | 33 +++++++++++++++++++++++++-------- lang/ar.auto | 33 +++++++++++++++++++++++++-------- lang/be.auto | 33 +++++++++++++++++++++++++-------- lang/bg.auto | 33 +++++++++++++++++++++++++-------- lang/ca.auto | 33 +++++++++++++++++++++++++-------- lang/cs | 4 ++++ lang/cs.auto | 32 ++++++++++++++++++++++++-------- lang/da.auto | 33 +++++++++++++++++++++++++-------- lang/de.auto | 33 +++++++++++++++++++++++++-------- lang/el.auto | 33 +++++++++++++++++++++++++-------- lang/es.auto | 33 +++++++++++++++++++++++++-------- lang/eu.auto | 33 +++++++++++++++++++++++++-------- lang/fa.auto | 33 +++++++++++++++++++++++++-------- lang/fi | 1 + lang/fi.auto | 33 +++++++++++++++++++++++++-------- lang/fr | 13 ++++++------- lang/fr.auto | 23 ++++++++++++++++++++++- lang/he.auto | 33 +++++++++++++++++++++++++-------- lang/hr.auto | 33 +++++++++++++++++++++++++-------- lang/hu.auto | 33 +++++++++++++++++++++++++-------- lang/it.auto | 33 +++++++++++++++++++++++++-------- lang/ja.auto | 33 +++++++++++++++++++++++++-------- lang/ko.auto | 33 +++++++++++++++++++++++++-------- lang/lt.auto | 33 +++++++++++++++++++++++++-------- lang/lv.auto | 33 +++++++++++++++++++++++++-------- lang/ms.auto | 33 +++++++++++++++++++++++++-------- lang/mt.auto | 33 +++++++++++++++++++++++++-------- lang/nl | 13 ++++++------- lang/nl.auto | 23 ++++++++++++++++++++++- lang/no | 13 ++++++------- lang/no.auto | 23 ++++++++++++++++++++++- lang/pl.auto | 33 +++++++++++++++++++++++++-------- lang/pt.auto | 33 +++++++++++++++++++++++++-------- lang/pt_BR.auto | 33 +++++++++++++++++++++++++-------- lang/ro.auto | 33 +++++++++++++++++++++++++-------- lang/ru | 8 +++++--- lang/ru.auto | 27 ++++++++++++++++++++++----- lang/sk.auto | 33 +++++++++++++++++++++++++-------- lang/sl.auto | 33 +++++++++++++++++++++++++-------- lang/sv.auto | 33 +++++++++++++++++++++++++-------- lang/th.auto | 33 +++++++++++++++++++++++++-------- lang/tr | 7 ++++--- lang/tr.auto | 33 +++++++++++++++++++++++++-------- lang/uk.auto | 33 +++++++++++++++++++++++++-------- lang/ur.auto | 33 +++++++++++++++++++++++++-------- lang/vi.auto | 33 +++++++++++++++++++++++++-------- lang/zh.auto | 33 +++++++++++++++++++++++++-------- lang/zh_TW.auto | 33 +++++++++++++++++++++++++-------- 90 files changed, 1126 insertions(+), 386 deletions(-) create mode 100644 help/intro.nl.auto.html delete mode 100644 help/intro.nl.html diff --git a/help/intro.af.auto.html b/help/intro.af.auto.html index 16aeb12..bfc9091 100644 --- a/help/intro.af.auto.html +++ b/help/intro.af.auto.html @@ -1 +1,2 @@ -

Beskermde kaarte
Op hierdie bladsy kan u wagwoordbeskerming byvoeg vir sommige of alle webwerf-kaarte vir hierdie virtuele bediener. Om 'n gids te beskerm, gebruik die beskerming toe te voeg vir 'n nuwe gids skakel. Om beskerming te verwyder, merk die merkblokkie langs die naam van die gids en klik op die knoppie onder die lys.

Sodra die beskerming opgestel is, kan u met behulp van die bladsy Bewerker-pos en FTP-gebruikers beheer watter gebruikers toegang daartoe het. As u op 'n gebruiker klik of 'n nuwe een skep, kan die veld Toegang tot webkaarte gebruik word om een of meer toelaatpaadjies te kies uit die lys wat u hier definieer.