\n";
$type = $in{'type'} ? $in{'type'} : $sec->{'name'};
$t = $text{"section_".$type."_".$in{'cfd'}};
$t = $text{"section_".$type} if (!$t);
print " $text{'edit_section'} | \n";
print $t ? "$t ($type)" : $type," | \n";
print "$text{'edit_class'} | \n";
printf " %s\n",
$cls->{'name'} eq 'any' ? 'checked' : '', $text{'edit_all'};
printf "\n",
$cls->{'name'} eq 'any' ? '' : 'checked';
printf " | \n",
$cls->{'name'} eq 'any' ? '' : $cls->{'name'};
$type = undef if ($in{'manual'});
if ($text{"type_".$type."_".$in{'cfd'}}) {
print " ",$text{"type_".$type."_".$in{'cfd'}},
" | \n";
}
elsif ($text{"type_".$type}) {
print " ",$text{"type_".$type}," | \n";
}
if ($type eq 'links') {
# Show links that would be created
local @links = &parse_links($cls);
print " $text{'edit_links'} | \n";
print "\n";
print " $text{'edit_linkfrom'} | ",
"$text{'edit_linktype'} | ",
"$text{'edit_linkover'} | ",
"$text{'edit_linkto'} | \n";
$i = 0;
foreach $l (@links, { }) {
print "\n";
printf " | \n",
$l->{'_linkfrom'};
printf " %s | \n", $l->{'_linktype'} =~ /^\+/ ? "checked" : "", $text{'yes'};
printf " %s | \n", $l->{'_linktype'} =~ /!$/ ? "checked" : "", $text{'yes'};
printf " | \n",
$l->{'_linkto'};
print " \n";
$i++;
}
print " | \n";
}
elsif ($type eq 'directories') {
# Show directories that would be created
local @dirs = &parse_directories($cls);
print " \n";
print " $text{'edit_dir'} | ",
"$text{'edit_dirmode'} | ",
"$text{'edit_dirowner'} | ",
"$text{'edit_dirgroup'} | \n";
$i = 0;
foreach $d (@dirs, { }) {
print "\n";
printf " | \n",
$d->{'_dir'};
printf " | \n",
&sname("mode", $d);
printf " | \n",
&sname("owner", $d);
printf " | \n",
&sname("group", $d);
print " \n";
$i++;
}
print " | \n";
}
elsif ($type eq "control" && !$in{'cfd'}) {
# Show actionsequence definition
local ($as) = &find("actionsequence", $cls->{'defs'});
print " $text{'edit_actionseq'} | \n";
print " | \n";
# Show other global definitions
print " $text{'edit_controldef'} | ",
"$text{'edit_controlvalue'} | \n";
$i = 0;
foreach $d (@{$cls->{'defs'}}, { }) {
next if ($d->{'name'} eq 'actionsequence');
print "\n";
printf " | \n",
$d->{'name'};
printf " | \n", join(" ", @{$d->{'valuequoted'}});
print " \n";
$i++;
}
}
elsif ($type eq "control" && $in{'cfd'}) {
# Show cfd-specific control options
local $run = &find_value("cfrunCommand", $cls->{'defs'});
print " $text{'edit_controlrun'} | \n";
printf " %s\n",
$run ? "" : "checked", $text{'edit_none'};
printf "\n",
$run ? "checked" : "";
printf " | \n", $run;
local $elapsed = &find_value("IfElapsed", $cls->{'defs'});
print " $text{'edit_controlelapsed'} | \n";
printf " %s\n",
defined($elapsed) ? "" : "checked", $text{'default'};
printf "\n",
defined($elapsed) ? "checked" : "";
printf " | \n", $elapsed;
local $max = &find_value("MaxConnections", $cls->{'defs'});
print "$text{'edit_controlmax'} | \n";
printf " %s\n",
defined($max) ? "" : "checked", $text{'default'};
printf "\n",
defined($max) ? "checked" : "";
printf " | \n", $max;
print "
| \n";
local $auto = &find_value("AutoExecCommand", $cls->{'defs'});
print " $text{'edit_controlauto'} | \n";
printf " %s\n",
$auto ? "" : "checked", $text{'edit_none'};
printf "\n",
$auto ? "checked" : "";
printf " | \n", $auto;
local $interval = &find_value("AutoExecInterval", $cls->{'defs'});
print " $text{'edit_controlinterval'} | \n";
printf " %s\n",
defined($interval) ? "" : "checked", $text{'default'};
printf "\n",
defined($interval) ? "checked" : "";
printf " | \n",$interval;
print "
| \n";
local $dom = &find_value("domain", $cls->{'defs'});
print " $text{'edit_controldom'} | \n";
printf " %s\n",
$dom ? "" : "checked", $text{'edit_none'};
printf "\n",
$dom ? "checked" : "";
printf " | \n", $dom;
local $log = &find_value("LogAllConnections", $cls->{'defs'});
print "$text{'edit_controllog'} | \n";
printf " %s\n",
lc($log) eq "true" ? "checked" : "", $text{'yes'};
printf " %s\n",
lc($log) eq "false" ? "checked" : "", $text{'no'};
printf " %s | \n",
$log ? "" : "checked", $text{'default'};
local @allow = &find_value("AllowConnectionsFrom", $cls->{'defs'});
print " $text{'edit_controlallow'} | \n";
printf " %s ",
@allow ? "" : "checked", $text{'edit_controlall'};
printf "\n",
@allow ? "checked" : "";
printf " | \n",
join(" ", @allow);
local @deny = &find_value("DenyConnectionsFrom", $cls->{'defs'});
print " $text{'edit_controldeny'} | \n";
printf " %s ",
@deny ? "" : "checked", $text{'edit_controlnone'};
printf "\n",
@deny ? "checked" : "";
printf " | \n",
join(" ", @deny);
local @skip = &find_value("SkipVerify", $cls->{'defs'});
print " $text{'edit_controlskip'} | \n";
printf " %s ",
@skip ? "" : "checked", $text{'edit_controlnone'};
printf "\n",
@skip ? "checked" : "";
printf " | \n",
join(" ", @skip);
}
elsif ($type eq "grant" || $type eq "admit" || $type eq "deny") {
# Allow editing of allowed or denied directories
local (@grants, $grant);
foreach $v (@{$cls->{'values'}}) {
if ($v =~ /\//) {
push(@grants, $grant = { 'dir' => $v });
}
else {
push(@{$grant->{'hosts'}}, $v);
}
}
print " ",$text{'edit_'.$type}," | \n";
print " | \n";
}
elsif ($type eq "groups" || $type eq "classes") {
# Allow editing of group definitions
print " $text{'edit_groups'} | \n";
print " | \n";
}
elsif ($type eq "files") {
# Allow editing of file permission settings
local @files = &parse_directories($cls);
local $i = 0;
foreach $f (@files, $in{'newfiles'} || $in{'new'} ? ( { } ) : ( ) ) {
print "
| \n";
print " $text{'edit_filesdir'} | \n";
print "";
printf " %s\n",
$f->{'_dir'} ? "" : "checked", $text{'edit_none'};
printf "\n",
$f->{'_dir'} ? "checked" : "";
printf " | \n",
$f->{'_dir'};
local $owner = &sname("owner", $f);
print " $text{'edit_filesowner'} | \n";
printf " %s\n",
$owner ? "" : "checked", $text{'edit_nochange'};
printf "\n",
$owner ? "checked" : "";
printf " | \n",
$owner;
local $group = &sname("group", $f);
print "$text{'edit_filesgroup'} | \n";
printf " %s\n",
$group ? "" : "checked", $text{'edit_nochange'};
printf "\n",
$group ? "checked" : "";
printf " | \n",
$group;
local $mode = &sname("mode", $f);
print " $text{'edit_filesmode'} | \n";
printf " %s\n",
$mode ? "" : "checked", $text{'edit_nochange'};
printf "\n",
$mode ? "checked" : "";
printf " | \n",
$mode;
local $rec = &sname("recurse", $f);
print "$text{'edit_filesrec'} | \n";
printf " %s\n",
$rec ? "" : "checked", $text{'edit_none'};
printf " %s\n",
$rec eq 'inf' ? "checked" : "",
$text{'edit_filesinf'};
printf "\n",
$rec && $rec ne 'inf' ? "checked" : "";
printf " | \n",
$rec eq 'inf' ? '' : $rec;
local $include = &sname("include", $f);
print " $text{'edit_filesinclude'} | \n";
printf " %s\n",
$include ? "" : "checked", $text{'edit_filesall'};
printf "\n",
$include ? "checked" : "";
printf " | \n",
$include;
local $exclude = &sname("exclude", $f);
print "$text{'edit_filesexclude'} | \n";
printf " %s\n",
$exclude ? "" : "checked", $text{'edit_filesnone'};
printf "\n",
$exclude ? "checked" : "";
printf " | \n",
$exclude;
local $acl = &sname("acl", $f);
print " $text{'edit_filesacl'} | \n";
printf " %s\n",
$acl ? "" : "checked", $text{'edit_nochange'};
printf "\n",
$acl ? "checked" : "";
printf " | \n",
$acl;
local $action = &sname("action", $f);
local @acts = ( "fixall", "fixdirs", "fixplain", "warnall", "warndirs", "warnplain", "touch", "linkchildren", "create", "compress", "alert" );
print "$text{'edit_filesact'} | \n";
print " | \n";
$i++;
}
if (!$in{'newfiles'} && !$in{'new'}) {
print " $text{'edit_filesnew'} | \n";
}
}
elsif ($type eq "copy") {
# Allow editing of file copy options
local @copies = &parse_directories($cls);
local $i = 0;
foreach $f (@copies, $in{'newcopy'} || $in{'new'} ? ( { } ) : ( ) ) {
print "
| \n";
print " $text{'edit_copydir'} | \n";
print "";
printf " %s\n",
$f->{'_dir'} ? "" : "checked", $text{'edit_none'};
printf "\n",
$f->{'_dir'} ? "checked" : "";
printf " | \n",
$f->{'_dir'};
print " $text{'edit_copydest'} | \n";
print "";
printf " | \n",
&sname("dest", $f);
local $server = &sname("server", $f);
print " $text{'edit_copyserver'} | \n";
print "";
printf " %s\n",
$server ? "" : "checked", $text{'edit_local'};
printf "\n",
$server ? "checked" : "";
printf " | \n",
$server;
local $owner = &sname("owner", $f);
print " $text{'edit_filesowner'} | \n";
printf " %s\n",
$owner ? "" : "checked", $text{'edit_nochange'};
printf "\n",
$owner ? "checked" : "";
printf " | \n",
$owner;
local $group = &sname("group", $f);
print "$text{'edit_filesgroup'} | \n";
printf " %s\n",
$group ? "" : "checked", $text{'edit_nochange'};
printf "\n",
$group ? "checked" : "";
printf " | \n",
$group;
local $mode = &sname("mode", $f);
print " $text{'edit_filesmode'} | \n";
printf " %s\n",
$mode ? "" : "checked", $text{'edit_nochange'};
printf "\n",
$mode ? "checked" : "";
printf " | \n",
$mode;
local $rec = &sname("recurse", $f);
print "$text{'edit_filesrec'} | \n";
printf " %s\n",
$rec ? "" : "checked", $text{'edit_none'};
printf " %s\n",
$rec eq 'inf' ? "checked" : "",
$text{'edit_filesinf'};
printf "\n",
$rec && $rec ne 'inf' ? "checked" : "";
printf " | \n",
$rec eq 'inf' ? '' : $rec;
local $size = &sname("size", $f);
local $smode = $size =~ /^>/ ? 3 : $size =~ /^ ? 2 :
$size ne '' ? 1 : 0;
print " $text{'edit_copysize'} | \n";
print "\n";
printf " %s\n",
$smode == 0 ? "checked" : "", $text{'edit_none'};
printf " %s\n",
$smode == 2 ? "checked" : "", $text{'edit_copysize2'};
printf "\n",
$smode == 2 ? substr($size, 1) : "";
printf " %s\n",
$smode == 1 ? "checked" : "", $text{'edit_copysize1'};
printf "\n",
$smode == 1 ? $size : "";
printf " %s\n",
$smode == 3 ? "checked" : "", $text{'edit_copysize3'};
printf "\n",
$smode == 3 ? substr($size, 1) : "";
local $backup = &sname("backup", $f);
print " | $text{'edit_copybackup'} | \n";
printf " %s\n",
$backup eq "false" ? "" : "checked", $text{'yes'};
printf " %s | \n",
$backup eq "false" ? "checked" : "", $text{'no'};
local $force = &sname("force", $f);
print "$text{'edit_copyforce'} | \n";
printf " %s\n",
$force eq "true" ? "checked" : "", $text{'yes'};
printf" %s | \n",
$force eq "true" ? "" : "checked", $text{'no'};
print " \n";
local $purge = &sname("purge", $f);
print " $text{'edit_copypurge'} | \n";
printf " %s\n",
$purge eq "true" ? "checked" : "", $text{'yes'};
printf" %s | \n",
$purge eq "true" ? "" : "checked", $text{'no'};
local $action = &sname("action", $f);
local @acts = ( "fix", "silent", "warn" );
print "$text{'edit_copyact'} | \n";
print " | \n";
$i++;
}
if (!$in{'newcopy'} && !$in{'new'}) {
print " $text{'edit_copynew'} | \n";
}
}
elsif ($type eq "disable") {
# Editing files to disable or delete
local @dis = &parse_directories($cls);
local $i = 0;
foreach $f (@dis, $in{'newdis'} || $in{'new'} ? ( { } ) : ( ) ) {
print "
| \n";
print " $text{'edit_disfile'} | \n";
print "";
printf " %s\n",
$f->{'_dir'} ? "" : "checked", $text{'edit_none'};
printf "\n",
$f->{'_dir'} ? "checked" : "";
printf " | \n",
$f->{'_dir'};
local $rot = &sname("rotate", $f);
print " $text{'edit_disrot'} | \n";
print "\n";
printf " %s\n",
$rot eq '' ? "checked" : "", $text{'edit_disrot0'};
printf " %s\n",
$rot eq 'empty' || $rot eq 'truncate' ? "checked" : "",
$text{'edit_disrot1'};
printf "\n",
$rot =~ /\d/ ? "checked" : "";
print &text('edit_disrot2', sprintf("", $rot =~ /\d/ ? $rot : undef))," | \n";
local $type = &sname("type", $f);
local @types = ( "plain", "file", "link" );
print " $text{'edit_distype'} | \n";
print " | \n";
local $size = &sname("size", $f);
local $smode = $size =~ /^>/ ? 3 : $size =~ /^ ? 2 :
$size ne '' ? 1 : 0;
print " $text{'edit_dissize'} | \n";
print "\n";
printf " %s\n",
$smode == 0 ? "checked" : "", $text{'edit_none'};
printf " %s\n",
$smode == 2 ? "checked" : "", $text{'edit_copysize2'};
printf "\n",
$smode == 2 ? substr($size, 1) : "";
printf " %s\n",
$smode == 1 ? "checked" : "", $text{'edit_copysize1'};
printf "\n",
$smode == 1 ? $size : "";
printf " %s\n",
$smode == 3 ? "checked" : "", $text{'edit_copysize3'};
printf "\n",
$smode == 3 ? substr($size, 1) : "";
$i++;
}
if (!$in{'newdis'} && !$in{'new'}) {
print " | $text{'edit_disnew'} | \n";
}
}
elsif ($type eq "editfiles") {
# Allow editing of file-editor script
local $i = 0;
foreach $e (@{$cls->{'lists'}},
$in{'newedit'} || $in{'new'} ? ( { } ) : ( ) ) {
print "
| \n";
local $ef = $e->{'values'}->[0];
print " $text{'edit_editfile'} | \n";
print "";
printf " %s\n",
$ef ? "" : "checked", $text{'edit_none'};
printf "\n",
$ef ? "checked" : "";
printf " | \n",
$ef;
print " $text{'edit_editscript'}",
" | \n";
print " | \n";
$i++;
}
if (!$in{'newedit'} && !$in{'new'}) {
print " $text{'edit_editnew'} | \n";
}
}
elsif ($type eq "ignore") {
# Display list of ignored files
print " $text{'edit_ignore'} | \n";
print " | \n";
}
elsif ($type eq "processes") {
# Show processes to kill
local @procs = &parse_processes($cls);
local $i = 0;
foreach $p (@procs, $in{'newproc'} || $in{'new'} ? ( { } ) : ( ) ) {
if ($p->{'_options'}) {
# Don't edit SetOptionString lines
$i++;
next;
}
print "
| \n";
print " $text{'edit_proc'} | \n";
print "";
printf " %s\n",
$p->{'_match'} ? "" : "checked", $text{'edit_none'};
printf "\n",
$p->{'_match'} ? "checked" : "";
printf " | \n",
$p->{'_match'};
local $sig = &sname("signal", $p);
print " $text{'edit_procsig'} | \n";
print " | \n";
local $act = &sname("action", $p);
print "$text{'edit_procact'} | \n";
print " | \n";
local $mat = &sname("matches", $p);
local $smode = $mat =~ /^>/ ? 3 : $mat =~ /^ ? 2 :
$mat ne '' ? 1 : 0;
print " $text{'edit_procmat'} | \n";
print "\n";
printf " %s\n",
$smode == 0 ? "checked" : "", $text{'edit_procmat0'};
printf " %s\n",
$smode == 2 ? "checked" : "", $text{'edit_procmat2'};
printf "\n",
$smode == 2 ? substr($mat, 1) : "";
printf " %s\n",
$smode == 1 ? "checked" : "", $text{'edit_procmat1'};
printf "\n",
$smode == 1 ? $mat : "";
printf " %s\n",
$smode == 3 ? "checked" : "", $text{'edit_procmat3'};
printf "\n",
$smode == 3 ? substr($mat, 1) : "";
print " | $text{'edit_procrestart'} | \n";
print "";
printf " %s\n",
$p->{'_restart'} ? "" : "checked", $text{'edit_none'};
printf "\n",
$p->{'_restart'} ? "checked" : "";
printf " | \n",
$p->{'_restart'};
local $owner = &sname("owner", $p);
print " $text{'edit_procowner'} | \n";
printf " %s\n",
$owner ? "" : "checked", "root";
printf "\n",
$owner ? "checked" : "";
printf " | \n",
$owner;
local $group = &sname("group", $p);
print "$text{'edit_procgroup'} | \n";
printf " %s\n",
$group ? "" : "checked", "root";
printf "\n",
$group ? "checked" : "";
printf " | \n",
$group;
$i++;
}
if (!$in{'newproc'} && !$in{'new'}) {
print " $text{'edit_procnew'} | \n";
}
}
elsif ($type eq "shellcommands") {
# Edit list of executed shell commands
local @cmds = &parse_directories($cls);
print " \n";
print " $text{'edit_cmd'} | ",
"$text{'edit_cmdowner'} | ",
"$text{'edit_cmdgroup'} | ",
"$text{'edit_cmdtimeout'} | \n";
$i = 0;
foreach $c (@cmds, { }) {
print "\n";
printf " | \n",
$c->{'_dir'};
printf " | \n",
&sname("owner", $c);
printf " | \n",
&sname("group", $c);
printf" %s | \n",
&sname("timeout", $c), "secs";
print " \n";
$i++;
}
print " | \n";
}
elsif ($type eq "tidy") {
# Allow editing of directories to tidy up
local @dirs = &parse_directories($cls);
local $i = 0;
foreach $d (@dirs, $in{'newtidy'} || $in{'new'} ? ( { } ) : ( ) ) {
print "
| \n";
print " $text{'edit_tidydir'} | \n";
print "";
printf " %s\n",
$d->{'_dir'} ? "" : "checked", $text{'edit_none'};
printf "\n",
$d->{'_dir'} ? "checked" : "";
printf " | \n",
$d->{'_dir'};
local $pat = &sname("pattern", $d);
print " $text{'edit_tidypat'} | \n";
print "";
printf " %s\n",
$pat ? "" : "checked", $text{'edit_filesall'};
printf "\n",
$pat ? "checked" : "";
printf " | \n",
$pat;
local $size = &sname("size", $d);
print " $text{'edit_tidysize'} | \n";
print "";
printf " %s\n",
$size eq '' ? "checked" : "", $text{'edit_tidysize0'};
printf " %s\n",
$size eq 'empty' ? "checked" : "",
$text{'edit_tidysize1'};
printf " %s\n",
$size eq 'empty' || $size eq '' ? "" : "checked",
$text{'edit_tidysize2'};
printf " | \n",
$size eq 'empty' ? "" : $size;
local $age = &sname("age", $d);
local $type = &sname("type", $d);
print " $text{'edit_tidyage'} | \n";
print "";
printf " %s\n",
$age eq '' ? "checked" : "", $text{'edit_tidyage1'};
printf "\n",
$age eq '' ? "" : "checked";
local $asel = "\n";
local $afield = "\n";
print &text('edit_tidyage0', $asel, $afield)," | \n";
local $rec = &sname("recurse", $d);
print "$text{'edit_filesrec'} | \n";
printf " %s\n",
$rec ? "" : "checked", $text{'edit_none'};
printf " %s\n",
$rec eq 'inf' ? "checked" : "",
$text{'edit_filesinf'};
printf "\n",
$rec && $rec ne 'inf' ? "checked" : "";
printf " | \n",
$rec eq 'inf' ? '' : $rec;
$i++;
}
if (!$in{'newtidy'} && !$in{'new'}) {
print " $text{'edit_tidynew'} | \n";
}
}
elsif ($type eq "miscmounts") {
# Display filesystems to mount
local @mnts = &parse_miscmounts($cls);
print " | \n";
}
elsif ($type eq "resolve") {
# Display nameserver options
local (@ns, @other);
for($i=0; $i<@{$cls->{'values'}}; $i++) {
if ($cls->{'valuequotes'}->[$i]) {
push(@other, $cls->{'values'}->[$i]);
}
else {
push(@ns, $cls->{'values'}->[$i]);
}
}
print " $text{'edit_resns'} | \n";
print " | \n";
print "$text{'edit_resother'} | \n";
print " | \n";
}
elsif ($type eq "defaultroute") {
# Display the default route
printf " $text{'edit_route'} | \n";
printf " | \n",
$cls->{'values'}->[0];
}
elsif ($type eq "required" || $type eq "disks") {
# Display filesystems to check
local @reqs = &parse_directories($cls);
print " | \n";
}
else {
# Allow editing of class manually
if (!$in{'new'}) {
$lref = &read_file_lines($cls->{'file'});
local $st = $cls->{'line'};
local $en = $cls->{'eline'};
if ($lref->[$st] =~ /^\s*(\S+)::\s*$/ && $1 eq $cls->{'name'}) {
$st++;
}
print " ",&text('edit_manualtext2',
$st, $en, "$cls->{'file'}"),"\n";
print "
| \n";
}
else {
print " $text{'edit_manualtext'}\n";
print "
| \n";
}
}
print " |