Fix protocol detection

This commit is contained in:
Jamie Cameron
2008-07-14 07:49:16 +00:00
parent 91159fe267
commit b011c135de
2 changed files with 14 additions and 2 deletions

View File

@@ -2,3 +2,4 @@ xinetd_conf=/etc/xinetd.conf
protocols_file=/etc/protocols
pid_file=/var/run/xinetd.pid
start_cmd=/usr/local/sbin/xinetd -pid 2>/var/run/xinetd.pid
lookup_servs=1

View File

@@ -57,9 +57,20 @@ foreach $x (@conf) {
}
}
else {
# Only service specified, check all protocols
# Only service specified, check protocols based on socket type,
# or failing that all protocols
if ($config{'lookup_servs'}) {
foreach $p (&list_protocols()) {
local @protos;
if ($q->{'socket_type'}->[0] eq 'stream') {
@protos = ( 'tcp' );
}
elsif ($q->{'socket_type'}->[0] eq 'dgram') {
@protos = ( 'udp' );
}
else {
@protos = &list_protocols();
}
foreach $p (@protos) {
@s = getservbyname($x->{'value'}, $p);
last if (@s);
}