Handle hostnames with upper-case letters
[webmin.git] / bacula-backup / save_file.cgi
1 #!/usr/local/bin/perl
2 # Update the FileDaemon section
3
4 require './bacula-backup-lib.pl';
5 &ReadParse();
6 &error_setup($text{'file_err'});
7
8 $conf = &get_file_config();
9 $file = &find("FileDaemon", $conf);
10 $file || &error($text{'file_enone'});
11 $mems = $file->{'members'};
12 &lock_file($file->{'file'});
13
14 # Validate and store inputs
15 $in{'name'} =~ /^[a-z0-9\.\-\_]+$/ || &error($text{'file_ename'});
16 &save_directive($conf, $file, "Name", $in{'name'}, 1);
17
18 $in{'port'} =~ /^\d+$/ && $in{'port'} > 0 && $in{'port'} < 65536 ||
19         &error($text{'file_eport'});
20 &save_directive($conf, $file, "FDport", $in{'port'}, 1);
21
22 $in{'jobs'} =~ /^\d+$/ || &error($text{'file_ejobs'});
23 &save_directive($conf, $file, "Maximum Concurrent Jobs", $in{'jobs'}, 1);
24
25 -d $in{'dir'} || &error($text{'file_edir'});
26 &save_directive($conf, $file, "WorkingDirectory", $in{'dir'}, 1);
27
28 # Validate and store TLS inputs
29 &parse_tls_directives($conf, $file, 1);
30
31 &flush_file_lines();
32 &unlock_file($file->{'file'});
33 &auto_apply_configuration();
34 &webmin_log("file");
35 &redirect("");
36