diff options
| author | Brian Somers <brian@FreeBSD.org> | 1997-07-12 19:22:34 +0000 |
|---|---|---|
| committer | Brian Somers <brian@FreeBSD.org> | 1997-07-12 19:22:34 +0000 |
| commit | 7cc60a74785483046c07b9924e91353d5cc2ddd5 (patch) | |
| tree | dee880bfafbd1062aba51895e83e990be966f3f2 | |
| parent | d228e65cdc906980e47e8860a318a15924db3c8d (diff) | |
Notes
| -rw-r--r-- | usr.sbin/ppp/command.c | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/usr.sbin/ppp/command.c b/usr.sbin/ppp/command.c index 1fbe8b378f20..21589474f5fa 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; } |
