summaryrefslogtreecommitdiffstats
path: root/usr.sbin
diff options
context:
space:
mode:
authorbrian <brian@FreeBSD.org>1997-07-12 19:22:34 +0000
committerbrian <brian@FreeBSD.org>1997-07-12 19:22:34 +0000
commitaa8643ed6cef49dd34a96a1fe0d74f4d82400a70 (patch)
tree06a62bd2e31fd4cd3bf5caf401742183586dda5b /usr.sbin
parenta6c3d5ca854ee3a57e3d5dd08770f6eb8b762b87 (diff)
downloadFreeBSD-src-aa8643ed6cef49dd34a96a1fe0d74f4d82400a70.zip
FreeBSD-src-aa8643ed6cef49dd34a96a1fe0d74f4d82400a70.tar.gz
Allow service names in "set server"
Diffstat (limited to 'usr.sbin')
-rw-r--r--usr.sbin/ppp/command.c18
1 files changed, 15 insertions, 3 deletions
diff --git a/usr.sbin/ppp/command.c b/usr.sbin/ppp/command.c
index 1fbe8b3..2158947 100644
--- a/usr.sbin/ppp/command.c
+++ b/usr.sbin/ppp/command.c
@@ -17,7 +17,7 @@
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*
- * $Id: command.c,v 1.64 1997/06/28 01:34:02 brian Exp $
+ * $Id: command.c,v 1.65 1997/06/30 03:03:29 brian Exp $
*
*/
#include <sys/types.h>
@@ -862,8 +862,20 @@ char **argv;
mask = m;
}
res = ServerLocalOpen(argv[0], mask);
- } else if (strspn(argv[0], "0123456789") == strlen(argv[0]))
- res = ServerTcpOpen(atoi(argv[0]));
+ } else {
+ int port;
+ if (strspn(argv[0], "0123456789") != strlen(argv[0])) {
+ struct servent *s;
+ if ((s = getservbyname(argv[0], "tcp")) == NULL) {
+ port = 0;
+ LogPrintf(LogWARN, "%s: Invalid port or service\n", argv[0]);
+ } else
+ port = ntohs(s->s_port);
+ } else
+ port = atoi(argv[0]);
+ if (port)
+ res = ServerTcpOpen(port);
+ }
return res;
}
OpenPOWER on IntegriCloud