Files
webmin/mysql/save_manual.cgi
Ilia Ross f8f35b26c6 Fix MySQL manual editor ACL bypass
This fixes missing permission checks in the MySQL manual configuration editor, with both read and write endpoints now require full configuration permissions to match the existing checks used by the configuration editor.
2026-10-02 14:16:59 +02:00

24 lines
587 B
Perl
Executable File

#!/usr/local/bin/perl
# Save a manually edited config file
require './mysql-lib.pl';
$access{'perms'} == 1 || &error($text{'cnf_ecannot'});
&ReadParseMime();
&error_setup($text{'manual_err'});
# Validate the filename
$conf = &get_mysql_config();
@files = &unique(map { $_->{'file'} } @$conf);
$in{'manual'} ||= $files[0];
&indexof($in{'manual'}, @files) >= 0 ||
&error($text{'manual_efile'});
# Write the file
$in{'data'} =~ s/\r//g;
&open_lock_tempfile(MANUAL, ">$in{'manual'}");
&print_tempfile(MANUAL, $in{'data'});
&close_tempfile(MANUAL);
&webmin_log("manual");
&redirect("");