(__ivaliduser): Allow '#' as comment character.

This commit is contained in:
Ulrich Drepper 1998-08-12 12:28:52 +00:00
parent cb46414e31
commit 9723adf323

View File

@ -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;