# config-lib.pl # Common functions for parsing config.info files # Each module has a number of configurable parameters (stored in the config and # config-* files in the module directory). Descriptions and possible values for # each option are stored in the file config.info in the module directory. # Each line of config.info looks like # name=desc,type[,options] # desc - A description of the parameter # type - Possible types (and options) are # 0 - Free text # 1 - One of many (options are possibilities) # 2 - Many of many (options are possibilities) # 3 - Optional free text # 4 - Like 1, but uses a pulldown menu # 5 - User name # 6 - Group name # 7 - Directory # 8 - File # 9 - Multiline text # 10 - Like 1, but with free text option # 11 - Section header # 12 - Password free text, with don't change option # 13 - Like 2, but uses a list box # 14 - Parameter is the name of a function in config_info.pl that # returns an alternate set of config.info values. # 15 - Parameter is the suffix for a pair of functions with show_ # and parse_ prepended. # 16 - Password free text # generate_config(&config, info-file, [module], [&can-config], [checkbox-name], # [only-section]) # Prints HTML for sub generate_config { my ($configref, $file, $module, $canconfig, $cbox, $section) = @_; my %config = %$configref; my $auto = $gconfig{"langauto_$remote_user"}; if (!defined($auto)) { my $glangauto = $gconfig{'langauto'}; if (defined($glangauto)) { $auto = $glangauto; } else { my ($clanginfo) = grep { $_->{'lang'} eq $current_lang } &list_languages(); $auto = $clanginfo->{'auto'}; } } # Read the .info file in the right language my (%info, @info_order, %einfo, $o); &read_file($file, \%info, \@info_order); %einfo = %info; foreach $o (@lang_order_list) { &read_file("$file.$o", \%info, \@info_order); &read_file("$file.$o.auto", \%info, \@info_order) if ($auto && -r "$file.$o.auto"); } # Call any config pre-load function if (&foreign_defined($module, 'config_pre_load')) { &foreign_call($module, "config_pre_load", \%info, \@info_order); &foreign_call($module, "config_pre_load", \%einfo); } @info_order = &unique(@info_order); if ($section) { # Limit to settings in one section @info_order = &config_in_section($section, \@info_order, \%info); } # Show the parameter editors foreach my $c (@info_order) { my $checkhtml; if ($cbox) { # Show checkbox to allow configuring $checkhtml = &ui_checkbox($cbox, $c, "", !$canconfig || $canconfig->{$c}); } else { # Skip those not allowed to be configured next if ($canconfig && !$canconfig->{$c}); } my @p = split(/,/, $info{$c}); my @ep = split(/,/, $einfo{$c}); if (scalar(@ep) > scalar(@p)) { push(@p, @ep[scalar(@p) .. @ep-1]); } if ($p[1] == 14) { $module || &error($text{'config_ewebmin'}); &foreign_require($module, "config_info.pl"); my @newp = &foreign_call($module, $p[2], @p); $newp[0] ||= $p[0]; @p = @newp; } if ($p[1] == 11) { # Title row print &ui_table_row(undef, "<b>$p[0]</b>", 2, [ undef, $tb ]); next; } if ($p[1] == 16 && $gconfig{'config_16_insecure'}) { # Don't allow mode 16 $p[1] = 12; } my $label; if ($module && -r &help_file($module, "config_$c")) { $label = $checkhtml." ". &hlink($p[0], "config_$c", $module); } else { $label = $checkhtml." ".$p[0]; } my $field; if ($p[1] == 0) { # Text value $field = &ui_textbox($c, $config{$c}, $p[2] || 40, 0, $p[3]). " ".$p[4]; } elsif ($p[1] == 1) { # One of many my $len = 0; for(my $i=2; $i<@p; $i++) { $p[$i] =~ /^(\S*)\-(.*)$/; $len += length($2); } my @opts; for($i=2; $i<@p; $i++) { $p[$i] =~ /^(\S*)\-(.*)$/; push(@opts, [ $1, $2.($len > 50 ? "<br>" : "") ]); } $field = &ui_radio($c, $config{$c}, \@opts); } elsif ($p[1] == 2) { # Many of many my %sel; map { $sel{$_}++ } split(/,/, $config{$c}); for($i=2; $i<@p; $i++) { $p[$i] =~ /^(\S*)\-(.*)$/; $field .= &ui_checkbox($c, $1, $2, $sel{$1}); } } elsif ($p[1] == 3) { # Optional value my $none = $p[2] || $text{'config_none'}; $field = &ui_opt_textbox($c, $config{$c}, $p[3] || 20, $none, $p[6], 0, undef, $p[4])." ".$p[5]; } elsif ($p[1] == 4) { # One of many menu my @opts; for($i=2; $i<@p; $i++) { $p[$i] =~ /^(\S*)\-(.*)$/; push(@opts, [ $1, $2 ]); } $field = &ui_select($c, $config{$c}, \@opts); } elsif ($p[1] == 5) { # User chooser if ($p[2]) { $field = &ui_radio($c."_def", $config{$c} ? 0 : 1, [ [ 1, $p[2] ], [ 0, " " ] ]); } if ($p[3]) { $field .= &ui_textbox($c, $config{$c}, 30)." ". &user_chooser_button($c, 1); } else { $field .= &unix_user_input($c, $config{$c}); } } elsif ($p[1] == 6) { # Group chooser if ($p[2]) { $field = &ui_radio($c."_def", $config{$c} ? 0 : 1, [ [ 1, $p[2] ], [ 0, " " ] ]); } if ($p[3]) { $field .= &ui_textbox($c, $config{$c}, 30)." ". &group_chooser_button($c, 1); } else { $field .= &unix_group_input($c, $config{$c}); } } elsif ($p[1] == 7) { # Directory chooser $field = &ui_textbox($c, $config{$c}, 40)." ". &file_chooser_button($c, 1); } elsif ($p[1] == 8) { # File chooser $field = &ui_textbox($c, $config{$c}, 40)." ". &file_chooser_button($c, 0); } elsif ($p[1] == 9) { # Text area my $cols = $p[2] || 40; my $rows = $p[3] || 5; my $sp = $p[4] ? eval "\"$p[4]\"" : " "; $field = &ui_textarea($c, join("\n", split(/$sp/, $config{$c})), $rows, $cols); } elsif ($p[1] == 10) { # Radios with freetext option my $len = 20; for(my $i=2; $i<@p; $i++) { if ($p[$i] =~ /^(\S*)\-(.*)$/) { $len += length($2); } else { $len += length($p[$i]); } } my $fv = $config{$c}; my @opts; for(my $i=2; $i<@p; $i++) { ($p[$i] =~ /^(\S*)\-(.*)$/) || next; push(@opts, [ $1, $2.($len > 50 ? "<br>" : "") ]); $fv = undef if ($config{$c} eq $1); } push(@opts, [ "free", $p[$#p] !~ /^(\S*)\-(.*)$/ ? $p[$#p] : " " ]); $field = &ui_radio($c, $fv ? "free" : $config{$c}, \@opts)." ". &ui_textbox($c."_free", $fv, 20); } elsif ($p[1] == 12) { # Password field $field = &ui_radio($c."_nochange", 1, [ [ 1, $text{'config_nochange'} ], [ 0, $text{'config_setto'} ] ])." ". &ui_password($c, undef, $p[2] || 40, 0, $p[3]); } elsif ($p[1] == 13) { # Multiple selections from menu my @sel = split(/,/, $config{$c}); my @opts; for($i=2; $i<@p; $i++) { $p[$i] =~ /^(\S*)\-(.*)$/; push(@opts, [ $1, $2 ]); } $field = &ui_select($c, \@sel, \@opts, 5, 1); } elsif ($p[1] == 15) { # Input generated by function $module || &error($text{'config_ewebmin'}); &foreign_require($module, "config_info.pl"); $field = &foreign_call($module, "show_".$p[2], $config{$c}, @p); } elsif ($p[1] == 16) { # Password free text $field = &ui_password($c, undef, $p[2] || 40, 0, $p[3]); } $label = "<a name=$c>$label</a>"; print &ui_table_row($label, $field, 1, [ "width=30% nowrap" ]); } } # parse_config(&config, info-file, [module], [&canconfig], [section]) # Updates the specified configuration with values from %in sub parse_config { my ($config, $file, $module, $canconfig, $section) = @_; # Read the .info file my (%info, @info_order, $o); &read_file($file, \%info, \@info_order); foreach $o (@lang_order_list) { &read_file("$file.$o", \%info, \@info_order); } @info_order = &unique(@info_order); if ($section) { # Limit to settings in one section @info_order = &config_in_section($section, \@info_order, \%info); } # If config fields are conditional (not displayed) # make sure to preserve system default values to # prevent changing behaviour of a module if (&foreign_exists($module) && &foreign_require($module) && &foreign_defined($module, 'config_pre_load')) { &foreign_call($module, "config_pre_load", \%info, \@info_order); } # Actually parse the inputs foreach my $c (@info_order) { next if ($canconfig && !$canconfig->{$c}); my @p = split(/,/, $info{$c}); if ($p[1] == 14) { $_[2] || &error($text{'config_ewebmin'}); &foreign_require($_[2], "config_info.pl"); my @newp = &foreign_call($_[2], $p[2]); $newp[0] ||= $p[0]; @p = @newp; } if ($p[1] == 16 && $gconfig{'config_16_insecure'}) { # Don't allow mode 16 $p[1] = 12; } if ($p[1] == 0 || $p[1] == 7 || $p[1] == 8 || $p[1] == 16) { # Free text input $config->{$c} = $in{$c}; } elsif ($p[1] == 1 || $p[1] == 4) { # One of many $config->{$c} = $in{$c}; } elsif ($p[1] == 5 || $p[1] == 6) { # User or group $config->{$c} = ($p[2] && $in{$c."_def"} ? "" : $in{$c}); } elsif ($p[1] == 2 || $p[1] == 13) { # Many of many $in{$c} =~ s/\0/,/g; $config->{$c} = $in{$c}; } elsif ($p[1] == 3) { # Optional free text if ($in{$c."_def"}) { $config->{$c} = ""; } else { $config->{$c} = $in{$c}; } } elsif ($p[1] == 9) { # Multilines of free text my $sp = $p[4] ? eval "\"$p[4]\"" : " "; $in{$c} =~ s/\r//g; $in{$c} =~ s/\n/$sp/g; $in{$c} =~ s/\s+$//; $config->{$c} = $in{$c}; } elsif ($p[1] == 10) { # One of many or free text if ($in{$c} eq 'free') { $config->{$c} = $in{$c.'_free'}; } else { $config->{$c} = $in{$c}; } } elsif ($p[1] == 12) { # Optionally changed password if (!$in{"${c}_nochange"}) { $config->{$c} = $in{$c}; } } elsif ($p[1] == 15) { # Parse custom HTML field $_[2] || &error($text{'config_ewebmin'}); &foreign_require($_[2], "config_info.pl"); $config->{$c} = &foreign_call($_[2], "parse_".$p[2], $config->{$c}, @p); } } } # config_in_section(§ion, &order, &config-info) # Returns a list of config names that are in some section sub config_in_section { my ($section, $info_order, $info) = @_; my @new_order = ( ); my $in_section = 0; foreach my $c (@$info_order) { my @p = split(/,/, $info->{$c}); if ($p[1] == 11 && $c eq $section) { $in_section = 1; } elsif ($p[1] == 11 && $c ne $section) { $in_section = 0; } elsif ($in_section) { push(@new_order, $c); } } return @new_order; } # save_module_preferences(module, &config) # Check which user preferences can be save for # given module based on module's prefs.info file sub save_module_preferences { my ($module, $curr_config) = @_; my $module_dir = &module_root_directory($module); my $module_prefs_conf = "$module_dir/prefs.info"; if (-r $module_prefs_conf) { my %module_prefs_conf_allowed; &read_file($module_prefs_conf, \%module_prefs_conf_allowed); mkdir("$config_directory/$module", 0700); my $user_prefs_file = "$config_directory/$module/prefs.$remote_user"; &lock_file($user_prefs_file); if ($module_prefs_conf_allowed{'allowed'} eq "*") { &write_file($user_prefs_file, \%$curr_config); } else { my %newconfigtmp; foreach my $key (keys %{$curr_config}) { if (grep(/^$key$/, split(",", $module_prefs_conf_allowed{'allowed'}))) { $newconfigtmp->{$key} = $curr_config->{$key}; } } &write_file($user_prefs_file, \%$newconfigtmp); } &unlock_file($user_prefs_file); } } 1;
Name | Type | Size | Permission | Actions |
---|---|---|---|---|
acl | Folder | 0755 |
|
|
adsl-client | Folder | 0755 |
|
|
apache | Folder | 0755 |
|
|
at | Folder | 0755 |
|
|
authentic-theme | Folder | 0755 |
|
|
backup-config | Folder | 0755 |
|
|
bacula-backup | Folder | 0755 |
|
|
bandwidth | Folder | 0755 |
|
|
bin | Folder | 0755 |
|
|
bind8 | Folder | 0755 |
|
|
blue-theme | Folder | 0755 |
|
|
change-user | Folder | 0755 |
|
|
cluster-copy | Folder | 0755 |
|
|
cluster-cron | Folder | 0755 |
|
|
cluster-passwd | Folder | 0755 |
|
|
cluster-shell | Folder | 0755 |
|
|
cluster-software | Folder | 0755 |
|
|
cluster-useradmin | Folder | 0755 |
|
|
cluster-usermin | Folder | 0755 |
|
|
cluster-webmin | Folder | 0755 |
|
|
cpan | Folder | 0755 |
|
|
cron | Folder | 0755 |
|
|
custom | Folder | 0755 |
|
|
dfsadmin | Folder | 0755 |
|
|
dhcpd | Folder | 0755 |
|
|
dovecot | Folder | 0755 |
|
|
exim | Folder | 0755 |
|
|
exports | Folder | 0755 |
|
|
fail2ban | Folder | 0755 |
|
|
fdisk | Folder | 0755 |
|
|
fetchmail | Folder | 0755 |
|
|
filemin | Folder | 0755 |
|
|
filter | Folder | 0755 |
|
|
firewall | Folder | 0755 |
|
|
firewall6 | Folder | 0755 |
|
|
firewalld | Folder | 0755 |
|
|
fsdump | Folder | 0755 |
|
|
gray-theme | Folder | 0755 |
|
|
grub | Folder | 0755 |
|
|
heartbeat | Folder | 0755 |
|
|
htaccess-htpasswd | Folder | 0755 |
|
|
idmapd | Folder | 0755 |
|
|
images | Folder | 0755 |
|
|
inetd | Folder | 0755 |
|
|
init | Folder | 0755 |
|
|
inittab | Folder | 0755 |
|
|
ipfilter | Folder | 0755 |
|
|
ipfw | Folder | 0755 |
|
|
ipsec | Folder | 0755 |
|
|
iscsi-client | Folder | 0755 |
|
|
iscsi-server | Folder | 0755 |
|
|
iscsi-target | Folder | 0755 |
|
|
iscsi-tgtd | Folder | 0755 |
|
|
jabber | Folder | 0755 |
|
|
krb5 | Folder | 0755 |
|
|
lang | Folder | 0755 |
|
|
ldap-client | Folder | 0755 |
|
|
ldap-server | Folder | 0755 |
|
|
ldap-useradmin | Folder | 0755 |
|
|
logrotate | Folder | 0755 |
|
|
logviewer | Folder | 0755 |
|
|
lpadmin | Folder | 0755 |
|
|
lvm | Folder | 0755 |
|
|
mailboxes | Folder | 0755 |
|
|
mailcap | Folder | 0755 |
|
|
man | Folder | 0755 |
|
|
mon | Folder | 0755 |
|
|
mount | Folder | 0755 |
|
|
mysql | Folder | 0755 |
|
|
net | Folder | 0755 |
|
|
nis | Folder | 0755 |
|
|
openslp | Folder | 0755 |
|
|
package-updates | Folder | 0755 |
|
|
pam | Folder | 0755 |
|
|
pap | Folder | 0755 |
|
|
passwd | Folder | 0755 |
|
|
phpini | Folder | 0755 |
|
|
postfix | Folder | 0755 |
|
|
postgresql | Folder | 0755 |
|
|
ppp-client | Folder | 0755 |
|
|
pptp-client | Folder | 0755 |
|
|
pptp-server | Folder | 0755 |
|
|
proc | Folder | 0755 |
|
|
procmail | Folder | 0755 |
|
|
proftpd | Folder | 0755 |
|
|
qmailadmin | Folder | 0755 |
|
|
quota | Folder | 0755 |
|
|
raid | Folder | 0755 |
|
|
samba | Folder | 0755 |
|
|
sarg | Folder | 0755 |
|
|
sendmail | Folder | 0755 |
|
|
servers | Folder | 0755 |
|
|
shell | Folder | 0755 |
|
|
shorewall | Folder | 0755 |
|
|
shorewall6 | Folder | 0755 |
|
|
smart-status | Folder | 0755 |
|
|
smf | Folder | 0755 |
|
|
software | Folder | 0755 |
|
|
spam | Folder | 0755 |
|
|
squid | Folder | 0755 |
|
|
sshd | Folder | 0755 |
|
|
status | Folder | 0755 |
|
|
stunnel | Folder | 0755 |
|
|
syslog | Folder | 0755 |
|
|
syslog-ng | Folder | 0755 |
|
|
system-status | Folder | 0755 |
|
|
tcpwrappers | Folder | 0755 |
|
|
time | Folder | 0755 |
|
|
tunnel | Folder | 0755 |
|
|
unauthenticated | Folder | 0755 |
|
|
updown | Folder | 0755 |
|
|
useradmin | Folder | 0755 |
|
|
usermin | Folder | 0755 |
|
|
vendor_perl | Folder | 0755 |
|
|
vgetty | Folder | 0755 |
|
|
webalizer | Folder | 0755 |
|
|
webmin | Folder | 0755 |
|
|
webmincron | Folder | 0755 |
|
|
webminlog | Folder | 0755 |
|
|
wuftpd | Folder | 0755 |
|
|
xinetd | Folder | 0755 |
|
|
xterm | Folder | 0755 |
|
|
LICENCE | File | 1.48 KB | 0644 |
|
LICENCE.ja | File | 1.62 KB | 0644 |
|
README.md | File | 4.25 KB | 0644 |
|
WebminCore.pm | File | 7.85 KB | 0644 |
|
acl_security.pl | File | 4.51 KB | 0755 |
|
changepass.pl | File | 868 B | 0755 |
|
chooser.cgi | File | 7.21 KB | 0755 |
|
config-aix | File | 227 B | 0644 |
|
config-cobalt-linux | File | 264 B | 0644 |
|
config-coherent-linux | File | 264 B | 0644 |
|
config-corel-linux | File | 264 B | 0644 |
|
config-debian-linux | File | 264 B | 0644 |
|
config-freebsd | File | 256 B | 0644 |
|
config-generic-linux | File | 264 B | 0644 |
|
config-gentoo-linux | File | 264 B | 0644 |
|
config-hpux | File | 243 B | 0644 |
|
config-irix | File | 284 B | 0644 |
|
config-lib.pl | File | 10.82 KB | 0755 |
|
config-macos | File | 260 B | 0644 |
|
config-mandrake-linux | File | 278 B | 0644 |
|
config-msc-linux | File | 264 B | 0644 |
|
config-netbsd | File | 283 B | 0644 |
|
config-open-linux | File | 264 B | 0644 |
|
config-openbsd | File | 241 B | 0644 |
|
config-openmamba-linux | File | 264 B | 0644 |
|
config-openserver | File | 236 B | 0644 |
|
config-osf1 | File | 266 B | 0644 |
|
config-pardus-linux | File | 264 B | 0644 |
|
config-redhat-linux | File | 264 B | 0644 |
|
config-slackware-linux | File | 280 B | 0644 |
|
config-sol-linux | File | 264 B | 0644 |
|
config-solaris | File | 417 B | 0644 |
|
config-suse-linux | File | 264 B | 0644 |
|
config-syno-linux | File | 364 B | 0644 |
|
config-trustix-linux | File | 264 B | 0644 |
|
config-turbo-linux | File | 264 B | 0644 |
|
config-united-linux | File | 264 B | 0644 |
|
config-unixware | File | 286 B | 0644 |
|
config-windows | File | 88 B | 0644 |
|
config.cgi | File | 1.55 KB | 0755 |
|
config_save.cgi | File | 1.64 KB | 0755 |
|
copyconfig.pl | File | 4.33 KB | 0755 |
|
create-module.pl | File | 3.82 KB | 0755 |
|
date_chooser.cgi | File | 2.19 KB | 0755 |
|
deb-name | File | 7 B | 0644 |
|
defaultacl | File | 98 B | 0644 |
|
defaulttheme | File | 16 B | 0644 |
|
entities_map.txt | File | 1.47 KB | 0644 |
|
fastrpc.cgi | File | 10.18 KB | 0755 |
|
favicon.ico | File | 14.73 KB | 0644 |
|
feedback.cgi | File | 6.37 KB | 0755 |
|
feedback_form.cgi | File | 3.45 KB | 0755 |
|
group_chooser.cgi | File | 7.36 KB | 0755 |
|
help.cgi | File | 2.94 KB | 0755 |
|
index.cgi | File | 5.61 KB | 0755 |
|
install-module.pl | File | 1.54 KB | 0755 |
|
install-type | File | 4 B | 0644 |
|
javascript-lib.pl | File | 14.69 KB | 0755 |
|
lang_list.txt | File | 3.41 KB | 0644 |
|
maketemp.pl | File | 424 B | 0755 |
|
mime.types | File | 12.42 KB | 0644 |
|
miniserv.pem | File | 2.9 KB | 0644 |
|
miniserv.pl | File | 179.71 KB | 0755 |
|
module_chooser.cgi | File | 4.14 KB | 0755 |
|
newmods.pl | File | 1.25 KB | 0755 |
|
os_list.txt | File | 34.18 KB | 0644 |
|
oschooser.pl | File | 4.55 KB | 0755 |
|
pam_login.cgi | File | 2.83 KB | 0755 |
|
password_change.cgi | File | 7 KB | 0755 |
|
password_form.cgi | File | 1.3 KB | 0755 |
|
perlpath.pl | File | 571 B | 0755 |
|
record-failed.pl | File | 503 B | 0755 |
|
record-login.pl | File | 513 B | 0755 |
|
record-logout.pl | File | 516 B | 0755 |
|
robots.txt | File | 26 B | 0644 |
|
rpc.cgi | File | 4 KB | 0755 |
|
run-postinstalls.pl | File | 1 KB | 0755 |
|
run-uninstalls.pl | File | 1004 B | 0755 |
|
safeacl | File | 44 B | 0644 |
|
session_login.cgi | File | 3.55 KB | 0755 |
|
setup-repos.sh | File | 4.66 KB | 0755 |
|
setup.bat | File | 3.09 KB | 0644 |
|
setup.pl | File | 30.33 KB | 0755 |
|
setup.sh | File | 32.06 KB | 0755 |
|
switch_skill.cgi | File | 293 B | 0755 |
|
switch_user.cgi | File | 404 B | 0755 |
|
thirdparty.pl | File | 1.73 KB | 0755 |
|
ui-lib.pl | File | 82.8 KB | 0755 |
|
update-from-repo.sh | File | 14.8 KB | 0755 |
|
uptracker.cgi | File | 2.88 KB | 0755 |
|
user_chooser.cgi | File | 7.29 KB | 0755 |
|
version | File | 6 B | 0644 |
|
web-lib-funcs.pl | File | 356.13 KB | 0755 |
|
web-lib.pl | File | 907 B | 0755 |
|
webmin-daemon | File | 80 B | 0644 |
|
webmin-init | File | 1.93 KB | 0755 |
|
webmin-pam | File | 101 B | 0644 |
|
webmin-search-lib.pl | File | 9.42 KB | 0755 |
|
webmin-systemd | File | 371 B | 0644 |
|
webmin_search.cgi | File | 2.63 KB | 0755 |
|
xmlrpc.cgi | File | 7.53 KB | 0755 |
|