Nagios-Webmin-Module/save_cfg.cgi

20 lines
491 B
Plaintext
Raw Normal View History

2024-01-29 17:00:16 +00:00
#!/usr/bin/perl
require './nagios-lib.pl';
&error_setup($text{'manual_err'});
&ReadParseMime();
# Work out the file
@files = get_cfg_files(get_nagios_home().'/etc');
&indexof($in{'file'}, @files) >= 0 || &error($text{'manual_efile'});
$in{'data'} =~ s/\r//g;
$in{'data'} =~ /\S/ || &error($text{'manual_edata'});
# Write to it
&open_lock_tempfile(DATA, ">$in{'file'}");
&print_tempfile(DATA, $in{'data'});
&close_tempfile(DATA);
&webmin_log("manual", undef, $in{'file'});
&redirect("");