Browse Source

cleanup of fill_baddynamic()

ok krw@
OPENBSD_5_0
halex 13 years ago
parent
commit
9b0e191138
1 changed files with 16 additions and 25 deletions
  1. +16
    -25
      src/etc/rc

+ 16
- 25
src/etc/rc View File

@ -1,4 +1,4 @@
# $OpenBSD: rc,v 1.389 2011/07/19 13:50:49 deraadt Exp $ # $OpenBSD: rc,v 1.390 2011/07/20 09:56:00 halex Exp $
# System startup script run by init on autoboot # System startup script run by init on autoboot
# or after single-user. # or after single-user.
@ -115,31 +115,22 @@ random_seed()
fill_baddynamic() fill_baddynamic()
{ {
local _service="$1" local _service=$1
local _sysctl="net.inet.${_service}.baddynamic" local _sysctl="net.inet.${_service}.baddynamic"
local _name _port _srv _junk _ban stripcom /etc/services |
local _i=0 {
local _ifs="${IFS}" # Variables are local
IFS=" /" while IFS=" /" read _name _port _srv _junk; do
while read _name _port _srv _junk; do [ "x${_srv}" = "x${_service}" ] || continue;
[ "x${_srv}" = "x${_service}" ] && \ _ban="${_ban:+${_ban},}+${_port}"
[ "x${_name}" = "x${_name#\#}" ] || continue; # Flush before argv gets too long
if [ "x${_ban}" = "x" ]; then if [ ${#_ban} -gt 1024 ]; then
_ban="+${_port}" sysctl -q ${_sysctl}=${_ban}
else _ban=""
_ban="${_ban},+${_port}" fi
fi done
# Flush before argv gets too long [ "${_ban}" ] && sysctl -q ${_sysctl}=${_ban}
if [ $((++_i)) -gt 128 ]; then }
sysctl ${_sysctl}=${_ban} >/dev/null
_ban=""
_i=0
fi
done < /etc/services;
if [ "x${_ban}" != "x" ]; then
sysctl ${_sysctl}=${_ban} >/dev/null
fi
IFS="${_ifs}"
} }
start_daemon() start_daemon()


|||||||
|||||||
xxxxxxxxxx
 
000:0
x
 
000:0
Loading…
Cancel
Save