diff options
author | Glenn L McGrath <bug1@ihug.co.nz> | 2004-01-17 05:03:31 +0000 |
---|---|---|
committer | Glenn L McGrath <bug1@ihug.co.nz> | 2004-01-17 05:03:31 +0000 |
commit | 036dbaa082f1974246d1d7d21a8e163559642485 (patch) | |
tree | 2488441544ab16f8e08d0955d323019e96ed3d4f /networking/inetd.c | |
parent | b03be7f5677b86acfe2f64b5a57e1f361e257f6c (diff) |
Modify bb_lookup_port to allow the protocol to be specified, allowing
/etc/services support for inetd, netcat and tftp.
Diffstat (limited to 'networking/inetd.c')
-rw-r--r-- | networking/inetd.c | 20 |
1 files changed, 7 insertions, 13 deletions
diff --git a/networking/inetd.c b/networking/inetd.c index d225527a9..24415fe7d 100644 --- a/networking/inetd.c +++ b/networking/inetd.c @@ -610,19 +610,13 @@ static void config(int signum) sep->se_ctrladdr_in.sin_family = AF_INET; sep->se_ctrladdr_size = sizeof sep->se_ctrladdr_in; { - u_short port = htons(atoi(sep->se_service)); - - if (!port) { - struct servent *sp; - sp = getservbyname(sep->se_service, - sep->se_proto); - if (sp == 0) { - syslog(LOG_ERR, - "%s/%s: unknown service", - sep->se_service, sep->se_proto); - continue; - } - port = sp->s_port; + u_short port = bb_lookup_port(sep->se_service, sep->se_proto, 0); + + if (port == 0) { + syslog(LOG_ERR, + "%s/%s: unknown service", + sep->se_service, sep->se_proto); + continue; } if (port != sep->se_ctrladdr_in.sin_port) { sep->se_ctrladdr_in.sin_port = port; |