mirror of
git://sourceware.org/git/glibc.git
synced 2025-04-06 14:10:30 +08:00
(__ivaliduser): Allow '#' as comment character.
This commit is contained in:
parent
cb46414e31
commit
9723adf323
@ -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;
|
||||
|
Loading…
x
Reference in New Issue
Block a user