diff options
author | brian <brian@FreeBSD.org> | 1999-06-08 20:11:53 +0000 |
---|---|---|
committer | brian <brian@FreeBSD.org> | 1999-06-08 20:11:53 +0000 |
commit | 9ba53ba0dd584dd97151aab88c60e87cc4776f61 (patch) | |
tree | 6428f95d0388275b788b646667756d9ad41170dc /usr.sbin/ppp | |
parent | 024e4a4a7ec29c151e7c6aa0cf7047eb5e9035aa (diff) | |
download | FreeBSD-src-9ba53ba0dd584dd97151aab88c60e87cc4776f61.zip FreeBSD-src-9ba53ba0dd584dd97151aab88c60e87cc4776f61.tar.gz |
Don't drop the last character from lines in ppp.secret unless it's '\n'.
Diffstat (limited to 'usr.sbin/ppp')
-rw-r--r-- | usr.sbin/ppp/auth.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/usr.sbin/ppp/auth.c b/usr.sbin/ppp/auth.c index 9cd0292..ff9d42a 100644 --- a/usr.sbin/ppp/auth.c +++ b/usr.sbin/ppp/auth.c @@ -17,7 +17,7 @@ * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. * - * $Id: auth.c,v 1.43 1999/03/31 14:21:44 brian Exp $ + * $Id: auth.c,v 1.44 1999/05/08 11:06:06 brian Exp $ * * TODO: * o Implement check against with registered IP addresses. @@ -247,7 +247,7 @@ auth_GetSecret(struct bundle *bundle, const char *name, int len, FILE *fp; int n; char *vector[5]; - static char buff[LINE_LEN]; + static char buff[LINE_LEN]; /* vector[] will point here when returned */ fp = OpenSecret(SECRETFILE); if (fp == NULL) @@ -256,7 +256,9 @@ auth_GetSecret(struct bundle *bundle, const char *name, int len, while (fgets(buff, sizeof buff, fp)) { if (buff[0] == '#') continue; - buff[strlen(buff) - 1] = 0; + n = strlen(buff) - 1; + if (buff[n] == '\n') + buff[n] = '\0'; /* Trim the '\n' */ memset(vector, '\0', sizeof vector); n = MakeArgs(buff, vector, VECSIZE(vector)); if (n < 2) |