Skip to content

Commit

Permalink
Fix to check if plugin has a function before calling it
Browse files Browse the repository at this point in the history
  • Loading branch information
iliajie committed Feb 3, 2024
1 parent 7824031 commit c80c295
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 12 deletions.
16 changes: 9 additions & 7 deletions add.cgi
Original file line number Diff line number Diff line change
Expand Up @@ -56,13 +56,15 @@ foreach my $clash ("AuthUserFile", "AuthType", "AuthName") {

# 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);
if (&virtual_server::plugin_defined($p, "feature_add_protected_dir")) {
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)
Expand Down
12 changes: 7 additions & 5 deletions delete.cgi
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,13 @@ foreach my $path (@d) {
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);
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";
Expand Down

0 comments on commit c80c295

Please sign in to comment.