Webmin module symlinking breaks other modules sometimes
Posted: 13 Feb 2022, 16:30
Hello, guys,
We have received few bug reports from our users saying that some Webmin modules `index.cgi` files are getting destroyed and overwritten with a symlink to CSF. I have checked your code and added few fixes to add extra protection before making such changes and also fix message formatting.
Could you please be kind to fix that for the next 14.16 release?
File DisplayUI.pm, lines around 1995-2007.
Here is the fixed chunk:
We have received few bug reports from our users saying that some Webmin modules `index.cgi` files are getting destroyed and overwritten with a symlink to CSF. I have checked your code and added few fixes to add extra protection before making such changes and also fix message formatting.
Could you please be kind to fix that for the next 14.16 release?
File DisplayUI.pm, lines around 1995-2007.
Here is the fixed chunk:
Code: Select all
if (defined $ENV{WEBMIN_VAR} and defined $ENV{WEBMIN_CONFIG} and defined $ENV{HTTP_REFERER}) {
unless (-l "index.cgi") {
unlink "index.cgi";
my $status = symlink ("/usr/local/csf/lib/webmin/csf/index.cgi","index.cgi");
if ($status and -l "index.cgi") {
symlink ("/usr/local/csf/lib/webmin/csf/images","csfimages");
print "<p>ConfigServer Security & Firewall symlinked to use actual module files from <tt>/usr/local/csf/lib/webmin/csf</tt> directory. Please click <a href='index.cgi'>here</a> to go to the module.</p>\n";
exit;
} else {
print "<p>Failed to symlink to /usr/local/csf/lib/webmin/csf/<p>\n";
}
}
}