mirror of
https://github.com/webmin/webmin.git
synced 2026-02-03 06:03:28 +00:00
Allow use of network() source type https://github.com/webmin/webmin/issues/303
This commit is contained in:
@@ -192,9 +192,37 @@ if (&supports_sun_streams()) {
|
||||
$ttable .= "</td> </tr>\n";
|
||||
}
|
||||
|
||||
# Syslog server protocol
|
||||
$network = &find("network", $source->{'members'});
|
||||
$ttable .= "<tr> <td valign=top>".&ui_checkbox("network", 1, "<b>$text{'sources_typenw'}</b>", $network ? 1 : 0)."</td> <td><table>\n";
|
||||
if ($network) {
|
||||
$network_ip = &find_value("ip", $network->{'members'});
|
||||
$network_port = &find_value("port", $network->{'members'});
|
||||
$network_transport = &find_value("transport", $network->{'members'});
|
||||
}
|
||||
|
||||
# IP and port
|
||||
$ttable .= "<tr> <td>$text{'source_ip'}</td> <td>".
|
||||
&ui_opt_textbox("network_ip", $network_ip, 15, $text{'source_any'}).
|
||||
"</td> </tr>\n";
|
||||
$ttable .= "<tr> <td>$text{'source_port'}</td> <td>".
|
||||
&ui_opt_textbox("network_port", $network_port, 6, $text{'default'}." (601)").
|
||||
"</td> </tr>\n";
|
||||
|
||||
# Transport type
|
||||
$ttable .= "<tr> <td>$text{'source_transport'}</td> <td>".
|
||||
&ui_select("network_transport", $network_transport,
|
||||
[ [ "", $text{'default'} ],
|
||||
[ "tcp", "TCP" ],
|
||||
[ "udp", "UDP" ] ]).
|
||||
"</td> </tr>\n";
|
||||
|
||||
$ttable .= "</table>\n";
|
||||
$ttable .= "</td> </tr>\n";
|
||||
|
||||
# Show types table
|
||||
$ttable .= "</table>\n";
|
||||
print "<tr> <td colspan=2><b>$text{'source_type'}</b><br>\n";
|
||||
print "<tr> <td valign=top><b>$text{'source_type'}</b></td> <td>\n";
|
||||
print $ttable;
|
||||
print "</td> </tr>\n";
|
||||
|
||||
|
||||
@@ -227,7 +227,7 @@ source_any=Any
|
||||
source_none=None
|
||||
source_egone=Source no longer exists!
|
||||
source_name=Source name
|
||||
source_type=Log source types ..
|
||||
source_type=Log source types
|
||||
source_owner=Socket file owner
|
||||
source_group=Socket file group
|
||||
source_perm=Permissions on socket file
|
||||
@@ -255,6 +255,7 @@ source_epipe_name=Missing or invalid named pipe file name
|
||||
source_door=Door filename
|
||||
source_esun_streams_name=Missing or invalid Sun streams file name
|
||||
source_edoor=Missing or invalid Sun streams door file name
|
||||
source_transport=Network protocol
|
||||
|
||||
view_title=View Logfile
|
||||
view_header=Last $1 lines of $2
|
||||
|
||||
@@ -194,6 +194,31 @@ else {
|
||||
$in{'sun_streams_door'}, 1);
|
||||
}
|
||||
|
||||
# Save syslog protocol option
|
||||
if ($in{'network'}) {
|
||||
$net = { 'name' => 'network',
|
||||
'type' => 0,
|
||||
'values' => [ ] };
|
||||
&save_directive($conf, $source, undef, $net, 1);
|
||||
|
||||
# Save local IP and port
|
||||
if (!$in{'network_ip_def'}) {
|
||||
&check_ipaddress($in{'network_ip'}) ||
|
||||
&error($text{'source_eip'});
|
||||
&save_directive($conf, $net, "ip",
|
||||
$in{'network_ip'}, 1);
|
||||
}
|
||||
if (!$in{'network_port_def'}) {
|
||||
$in{'network_port'} =~ /^\d+$/ ||
|
||||
&error($text{'source_eport'});
|
||||
&save_directive($conf, $net, "port",
|
||||
$in{'network_port'}, 1);
|
||||
}
|
||||
if ($in{'network_transport'}) {
|
||||
&save_directive($conf, $net, "transport",
|
||||
$in{'network_transport'}, 1);
|
||||
}
|
||||
}
|
||||
|
||||
# Actually update the object
|
||||
&save_directive($conf, undef, $old, $source, 0);
|
||||
|
||||
Reference in New Issue
Block a user