mirror of
https://github.com/webmin/webmin.git
synced 2026-04-28 03:30:30 +01:00
Merge branch 'master' of git@github.com:webmin/webmin
This commit is contained in:
@@ -228,127 +228,117 @@ print &ui_table_row($text{'edit_tcpflags'},
|
||||
&tcpflag_input("tcpflags1", $rule->{'tcp-flags'}->[2])).
|
||||
"</td></tr></table>");
|
||||
|
||||
print "<tr> <td><b>$text{'edit_tcpoption'}</b></td>\n";
|
||||
print "<td>",&print_mode("tcpoption", $rule->{'tcp-option'}),"\n";
|
||||
printf "<input name=tcpoption size=6 value='%s'></td> </tr>\n",
|
||||
$rule->{'tcp-option'}->[1];
|
||||
# TCP options
|
||||
print &ui_table_row($text{'edit_tcpoption'},
|
||||
&print_mode("tcpoption", $rule->{'tcp-option'})." ".
|
||||
&ui_textbox("tcpoption", $rule->{'tcp-option'}->[1], 6));
|
||||
|
||||
print "<tr> <td colspan=2><hr></td> </tr>\n";
|
||||
print &ui_table_hr();
|
||||
|
||||
print "<tr> <td><b>$text{'edit_icmptype'}</b></td>\n";
|
||||
print "<td>",&print_mode("icmptype", $rule->{'icmp-type'}),"\n";
|
||||
print &icmptype_input("icmptype", $rule->{'icmp-type'}->[1]),"</td> </tr>\n";
|
||||
# ICMP packet type
|
||||
print &ui_table_row($text{'edit_icmptype'},
|
||||
&print_mode("icmptype", $rule->{'icmp-type'})." ".
|
||||
&icmptype_input("icmptype", $rule->{'icmp-type'}->[1]));
|
||||
|
||||
print "<tr> <td><b>$text{'edit_mac'}</b></td>\n";
|
||||
print "<td>",&print_mode("macsource", $rule->{'mac-source'}),"\n";
|
||||
printf "<input name=macsource size=18 value='%s'></td> </tr>\n",
|
||||
$rule->{'mac-source'}->[1];
|
||||
# MAC address
|
||||
print &ui_table_row($text{'edit_mac'},
|
||||
&print_mode("macsource", $rule->{'mac-source'})." ".
|
||||
&ui_textbox("macsource", $rule->{'mac-source'}->[1], 18));
|
||||
|
||||
print "<tr> <td colspan=2><hr></td> </tr>\n";
|
||||
print &ui_table_hr();
|
||||
|
||||
print "<tr> <td><b>$text{'edit_limit'}</b></td>\n";
|
||||
print "<td>",&print_mode("limit", $rule->{'limit'},
|
||||
$text{'edit_below'}, $text{'edit_above'}, 1),"\n";
|
||||
# Packet flow limit
|
||||
($n, $u) = $rule->{'limit'}->[1] =~ /^(\d+)\/(\S+)$/ ? ($1, $2) : ();
|
||||
print "<input name=limit0 size=6 value='$n'>\n";
|
||||
print "/ <select name=limit1>\n";
|
||||
foreach $l ('second', 'minute', 'hour', 'day') {
|
||||
printf "<option value=%s %s>%s\n",
|
||||
$l, $u eq $l ? "selected" : "", $l;
|
||||
}
|
||||
print "</select></td> </tr>\n";
|
||||
print &ui_table_row($text{'edit_limit'},
|
||||
&print_mode("limit", $rule->{'limit'},
|
||||
$text{'edit_below'}, $text{'edit_above'}, 1)." ".
|
||||
&ui_textbox("limit0", $n, 6)." / ".
|
||||
&ui_select("limit1", $u, ['second', 'minute', 'hour', 'day']));
|
||||
|
||||
print "<tr> <td><b>$text{'edit_limitburst'}</b></td>\n";
|
||||
print "<td>",&print_mode("limitburst", $rule->{'limit-burst'},
|
||||
$text{'edit_below'}, $text{'edit_above'}, 1),"\n";
|
||||
printf "<input name=limitburst size=6 value='%s'></td> </tr>\n",
|
||||
$rule->{'limit-burst'}->[1];
|
||||
# Packet burst rate
|
||||
print &ui_table_row($text{'edit_limitburst'},
|
||||
&print_mode("limitburst", $rule->{'limit-burst'},
|
||||
$text{'edit_below'}, $text{'edit_above'}, 1)." ".
|
||||
&ui_textbox("limitburst", $rule->{'limit-burst'}->[1], 6));
|
||||
|
||||
if ($rule->{'chain'} eq 'OUTPUT') {
|
||||
print "<tr> <td colspan=2><hr></td> </tr>\n";
|
||||
print &ui_table_hr();
|
||||
|
||||
print "<tr> <td><b>$text{'edit_uidowner'}</b></td>\n";
|
||||
print "<td>",&print_mode("uidowner", $rule->{'uid-owner'}),"\n";
|
||||
printf "<input name=uidowner size=13 value='%s'> %s</td> </tr>\n",
|
||||
$rule->{'uid-owner'}->[1], &user_chooser_button("uidowner");
|
||||
# Sending UID
|
||||
print &ui_table_row($text{'edit_uidowner'},
|
||||
&print_mode("uidowner", $rule->{'uid-owner'})." ".
|
||||
&ui_user_textbox("uidowner", $rule->{'uid-owner'}->[1]));
|
||||
|
||||
print "<tr> <td><b>$text{'edit_gidowner'}</b></td>\n";
|
||||
print "<td>",&print_mode("gidowner", $rule->{'gid-owner'}),"\n";
|
||||
printf "<input name=gidowner size=13 value='%s'> %s</td> </tr>\n",
|
||||
$rule->{'gid-owner'}->[1], &group_chooser_button("gidowner");
|
||||
# Sending GID
|
||||
print &ui_table_row($text{'edit_gidowner'},
|
||||
&print_mode("gidowner", $rule->{'gid-owner'})." ".
|
||||
&ui_group_textbox("gidowner", $rule->{'gid-owner'}->[1]));
|
||||
|
||||
print "<tr> <td><b>$text{'edit_pidowner'}</b></td>\n";
|
||||
print "<td>",&print_mode("pidowner", $rule->{'pid-owner'}),"\n";
|
||||
printf "<input name=pidowner size=6 value='%s'></td> </tr>\n",
|
||||
$rule->{'pid-owner'}->[1];
|
||||
# Sending process ID
|
||||
print &ui_table_row($text{'edit_pidowner'},
|
||||
&print_mode("pidowner", $rule->{'pid-owner'})." ".
|
||||
&ui_textbox("pidowner", $rule->{'pid-owner'}->[1], 6));
|
||||
|
||||
print "<tr> <td><b>$text{'edit_sidowner'}</b></td>\n";
|
||||
print "<td>",&print_mode("sidowner", $rule->{'sid-owner'}),"\n";
|
||||
printf "<input name=sidowner size=6 value='%s'></td> </tr>\n",
|
||||
$rule->{'sid-owner'}->[1];
|
||||
# Sending process group
|
||||
print &ui_table_row($text{'edit_sidowner'},
|
||||
&print_mode("sidowner", $rule->{'sid-owner'})." ".
|
||||
&ui_textbox("sidowner", $rule->{'sid-owner'}->[1], 6));
|
||||
}
|
||||
|
||||
print "<tr> <td colspan=2><hr></td> </tr>\n";
|
||||
print &ui_table_hr();
|
||||
|
||||
# Connection states
|
||||
print "<tr> <td valign=top><b>$text{'edit_state'}</b></td>\n";
|
||||
print "<td><table cellpadding=0 cellspacing=0><tr><td valign=top>",
|
||||
&print_mode("state", $rule->{'state'}),"</td>\n";
|
||||
print "<td> <select name=state multiple size=4>\n";
|
||||
%states = map { $_,1 } split(/,/, $rule->{'state'}->[1]);
|
||||
foreach $s ('NEW', 'ESTABLISHED', 'RELATED', 'INVALID', 'UNTRACKED') {
|
||||
printf "<option value=%s %s>%s (%s)\n",
|
||||
$s, $states{$s} ? "selected" : "",
|
||||
$text{"edit_state_".lc($s)}, $s;
|
||||
}
|
||||
print "</select></td></tr></table></td> </tr>\n";
|
||||
print &ui_table_row($text{'edit_state'},
|
||||
"<table cellpadding=0 cellspacing=0><tr><td valign=top>".
|
||||
&print_mode("state", $rule->{'state'})."</td>\n".
|
||||
"<td> ".
|
||||
&ui_select("state", [ split(/,/, $rule->{'state'}->[1]) ],
|
||||
[ map { [ $_, $text{"edit_state_".lc($_)} ] }
|
||||
('NEW', 'ESTABLISHED', 'RELATED', 'INVALID', 'UNTRACKED') ]).
|
||||
"</td></tr></table>");
|
||||
|
||||
# Type of service
|
||||
print "<tr> <td><b>$text{'edit_tos'}</b></td>\n";
|
||||
print "<td>",&print_mode("tos", $rule->{'tos'}),"\n";
|
||||
print &tos_input("tos", $rule->{'tos'}->[1]),"</td> </tr>\n";
|
||||
print &ui_table_row($text{'edit_tos'},
|
||||
&print_mode("tos", $rule->{'tos'})." ".
|
||||
&tos_input("tos", $rule->{'tos'}->[1]));
|
||||
|
||||
print "<tr> <td colspan=2><hr></td> </tr>\n";
|
||||
print &ui_table_hr();
|
||||
|
||||
# Input physical device
|
||||
print "<tr> <td><b>$text{'edit_physdevin'}</b></td>\n";
|
||||
print "<td>",&print_mode("physdevin", $rule->{'physdev-in'}),"\n";
|
||||
print &interface_choice("physdevin", $rule->{'physdev-in'}->[1]);
|
||||
print "</td> </tr>\n";
|
||||
print &ui_table_row($text{'edit_physdevin'},
|
||||
&print_mode("physdevin", $rule->{'physdev-in'})." ".
|
||||
&interface_choice("physdevin", $rule->{'physdev-in'}->[1]));
|
||||
|
||||
# Output physical device
|
||||
print "<tr> <td><b>$text{'edit_physdevout'}</b></td>\n";
|
||||
print "<td>",&print_mode("physdevout", $rule->{'physdev-out'}),"\n";
|
||||
print &interface_choice("physdevout", $rule->{'physdev-out'}->[1]);
|
||||
print "</td> </tr>\n";
|
||||
print &ui_table_row($text{'edit_physdevout'},
|
||||
&print_mode("physdevout", $rule->{'physdev-out'})." ".
|
||||
&interface_choice("physdevout", $rule->{'physdev-out'}->[1]));
|
||||
|
||||
# Physdev match modes
|
||||
print "<tr> <td><b>$text{'edit_physdevisin'}</b></td>\n";
|
||||
print "<td>",&print_mode("physdevisin", $rule->{'physdev-is-in'},
|
||||
$text{'yes'}, $text{'no'}),"</td> </tr>\n";
|
||||
print "<tr> <td><b>$text{'edit_physdevisout'}</b></td>\n";
|
||||
print "<td>",&print_mode("physdevisout", $rule->{'physdev-is-out'},
|
||||
$text{'yes'}, $text{'no'}),"</td> </tr>\n";
|
||||
print "<tr> <td><b>$text{'edit_physdevisbridged'}</b></td>\n";
|
||||
print "<td>",&print_mode("physdevisbridged", $rule->{'physdev-is-bridged'},
|
||||
$text{'yes'}, $text{'no'}),"</td> </tr>\n";
|
||||
print &ui_table_row($text{'edit_physdevisin'},
|
||||
&print_mode("physdevisin", $rule->{'physdev-is-in'},
|
||||
$text{'yes'}, $text{'no'}));
|
||||
print &ui_table_row($text{'edit_physdevisout'},
|
||||
&print_mode("physdevisout", $rule->{'physdev-is-out'},
|
||||
$text{'yes'}, $text{'no'}));
|
||||
print &ui_table_row($text{'edit_physdevisbridged'},
|
||||
&print_mode("physdevisbridged", $rule->{'physdev-is-bridged'},
|
||||
$text{'yes'}, $text{'no'}));
|
||||
|
||||
print "<tr> <td colspan=2><hr></td> </tr>\n";
|
||||
print &ui_table_hr();
|
||||
|
||||
# Show unknown modules
|
||||
@mods = grep { !/^(tcp|udp|icmp|multiport|mac|limit|owner|state|tos|comment|physdev)$/ } map { $_->[1] } @{$rule->{'m'}};
|
||||
print "<tr> <td><b>$text{'edit_mods'}</b></td>\n";
|
||||
printf "<td colspan=3><input name=mods size=50 value='%s'></td> </tr>\n",
|
||||
join(" ", @mods);
|
||||
print &ui_table_row($text{'edit_mods'},
|
||||
&ui_textbox("mods", join(" ", @mods), 60));
|
||||
|
||||
# Show unknown parameters
|
||||
$rule->{'args'} =~ s/^\s+//;
|
||||
$rule->{'args'} =~ s/\s+$//;
|
||||
print "<tr> <td><b>$text{'edit_args'}</b></td>\n";
|
||||
printf "<td colspan=3><input name=args size=50 value='%s'></td> </tr>\n",
|
||||
$rule->{'args'};
|
||||
print &ui_table_row($text{'edit_args'},
|
||||
&ui_textbox("args", $rule->{'args'}, 60));
|
||||
|
||||
print "</table></td></tr></table>\n";
|
||||
print &ui_table_end();
|
||||
if ($in{'new'}) {
|
||||
print &ui_form_end([ [ undef, $text{'create'} ] ]);
|
||||
}
|
||||
|
||||
@@ -136,15 +136,21 @@ local ($pass, $salt) = @_;
|
||||
if ($config{'md5'} == 5) {
|
||||
# SHA encryption
|
||||
local $qp = quotemeta($pass);
|
||||
local $out = `$config{'slappasswd'} -h '{sha}' -s $qp 2>/dev/null`;
|
||||
$out =~ s/\s+$//;
|
||||
local $out = &backquote_command("$config{'slappasswd'} -h '{sha}' -s $qp 2>/dev/null");
|
||||
if ($out && !$?) {
|
||||
$out =~ s/\s+$//;
|
||||
$out =~ s/^\{sha\}//i;
|
||||
return $out;
|
||||
}
|
||||
# Fall back to built-in code
|
||||
$out = &useradmin::encrypt_sha1($pass);
|
||||
$out =~ s/^\{sha\}//i;
|
||||
return $out;
|
||||
}
|
||||
if ($config{'md5'} == 4) {
|
||||
# LDAP SSHA encryption
|
||||
local $qp = quotemeta($pass);
|
||||
local $out = `$config{'slappasswd'} -h '{ssha}' -s $qp 2>/dev/null`;
|
||||
local $out = &backquote_command("$config{'slappasswd'} -h '{ssha}' -s $qp 2>/dev/null");
|
||||
$out =~ s/\s+$//;
|
||||
$out =~ s/^\{ssha\}//i;
|
||||
return $out;
|
||||
@@ -152,7 +158,7 @@ if ($config{'md5'} == 4) {
|
||||
if ($config{'md5'} == 3) {
|
||||
# LDAP MD5 encryption
|
||||
local $qp = quotemeta($pass);
|
||||
local $out = `$config{'slappasswd'} -h '{md5}' -s $qp 2>/dev/null`;
|
||||
local $out = &backquote_command("$config{'slappasswd'} -h '{md5}' -s $qp 2>/dev/null");
|
||||
$out =~ s/\s+$//;
|
||||
$out =~ s/^\{md5\}//i;
|
||||
return $out;
|
||||
|
||||
@@ -361,6 +361,16 @@ foreach my $ext (".dir", ".pag", ".db") {
|
||||
return 0;
|
||||
}
|
||||
|
||||
# delete_dbm_index(user|file)
|
||||
# Deletes all DBM indexes for a user or file
|
||||
sub delete_dbm_index
|
||||
{
|
||||
local $ifile = &user_index_file($_[0]);
|
||||
foreach my $ext (".dir", ".pag", ".db") {
|
||||
&unlink_file($ifile.$ext);
|
||||
}
|
||||
}
|
||||
|
||||
# empty_mail(user|file)
|
||||
# Truncate a mail file to nothing
|
||||
sub empty_mail
|
||||
|
||||
Reference in New Issue
Block a user