| Server IP : 167.99.254.82 / Your IP : 216.73.216.76 Web Server : Apache System : Linux host.techisquad.com 5.15.0-187-generic #197-Ubuntu SMP Fri Jul 17 19:17:01 UTC 2026 x86_64 User : pawluxera ( 1011) PHP Version : 8.1.34 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : ON Directory : /usr/share/webmin/kea-dhcp/ |
Upload File : |
#!/usr/bin/perl
# Save a raw Kea file.
use strict;
use warnings;
require './kea-dhcp-lib.pl'; ## no critic
&ReadParseMime();
our (%in, %text);
&error_setup($text{'eacl_aviol'});
my %access = &get_module_acl();
&error("$text{'eacl_np'} $text{'eacl_pmanual'}") if (!$access{'manual'});
my $info = &kea_manual_edit_file($in{'file'});
&error($text{'save_efile'}) if (!$info);
my $file = $info->{'file'};
&error($text{'save_efile'}) if (!$file);
&error_setup($text{'save_failsave'});
if ($info->{'type'} eq 'config') {
# Raw Kea config edits still get parsed before writing so a typo does
# not leave the daemon with unreadable JSON.
my $c = $info->{'component'};
my $data = eval { &kea_parse_config_text($in{'data'}, $file) };
&error(&text('save_eparse', $@)) if ($@);
&error(&text('parse_eroot', $c->{'root'}))
if (ref($data->{$c->{'root'}}) ne 'HASH');
}
# Write via Webmin's tempfile helpers to preserve the normal locking behavior.
my $existed = -e $file;
&lock_file($file);
my $fh;
&open_tempfile($fh, ">$file");
&print_tempfile($fh, $in{'data'});
&close_tempfile($fh);
&unlock_file($file);
if ($info->{'type'} eq 'password' && !$existed) {
# New Control Agent password files should inherit the config directory
# group and be readable only by root plus that group.
my @dst = stat(&kea_dirname($file));
chown(-1, $dst[5], $file) if (@dst);
chmod(0640, $file);
}
my %log = %in;
delete($log{'data'});
&webmin_log("modify", "config", $file, \%log);
&redirect("");