| Server IP : 104.21.25.180 / Your IP : 104.23.197.122 Web Server : Apache/2.4.37 System : Linux almalinux.duckdns.org 4.18.0-553.111.1.el8_10.x86_64 #1 SMP Sun Mar 8 20:06:07 EDT 2026 x86_64 User : ricodeal ( 1046) PHP Version : 7.4.33 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /usr/libexec/webmin/init/ |
Upload File : |
#!/usr/bin/perl
# modifyhostconfig.cgi
# Rewrites the hostconfig file
# Written by Michael A. Peters <[email protected]>
# for OSX/Darwin
require './init-lib.pl';
$access{'bootup'} == 1 || &error("You are not allowed to edit the bootup script");
&ReadParse();
if ( $in{'choice'} eq "custom" ) {
$setting = $in{'custom'};
}
else {
$setting = $in{'choice'};
}
if ( $setting =~ /^\%22(.*)\%22$/ ) {
$setting = $1;
}
$setting =~ s/\+/ /g;
if ( $setting =~ /[ ]/ ) {
$setting = "\"$setting\"";
}
# not all possible blunders are fixed, but at least intelligently
# made ones...
$setting = "$in{'action'}=$setting";
$hostc = $config{'hostconfig'};
# modify and write the hostconfig file
@new = ();
&lock_file($config{'hostconfig'});
open(LOCAL, "<$hostc");
@old = <LOCAL>;
close(LOCAL);
foreach $line (@old) {
$line =~ s/^$in{'action'}=(.*)$/$setting/;
push @new, $line;
}
&open_tempfile(LOCAL, "> $config{'hostconfig'}");
&print_tempfile(LOCAL, @new);
&close_tempfile(LOCAL);
&unlock_file($config{'hostconfig'});
&webmin_log("hostconfig", undef, undef, "\%in");
&redirect("");