From: Ulrich Drepper Date: Wed, 12 Aug 1998 12:28:52 +0000 (+0000) Subject: (__ivaliduser): Allow '#' as comment character. X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=9723adf323aae15d049eced1f212eac47eb9cb4b;p=thirdparty%2Fglibc.git (__ivaliduser): Allow '#' as comment character. --- diff --git a/inet/rcmd.c b/inet/rcmd.c index a5f79f41aeb..f15282c6e1d 100644 --- a/inet/rcmd.c +++ b/inet/rcmd.c @@ -426,11 +426,18 @@ __ivaliduser(hostf, raddr, luser, ruser) register char *user, *p; int ch; char *buf = NULL; + char *cp; size_t bufsize = 0; ssize_t nread; while ((nread = __getline (&buf, &bufsize, hostf)) > 0) { buf[bufsize - 1] = '\0'; /* Make sure it's terminated. */ + /* Because the file format does not know any form of quoting we + can search forward for the next '#' character and if found + make it terminating the line. */ + cp = strchr (buf, '#'); + if (cp != NULL) + *cp = '\0'; p = buf; while (*p != '\n' && *p != ' ' && *p != '\t' && *p != '\0') { *p = isupper(*p) ? tolower(*p) : *p;