PR libc/1827
Greg McGary
greg@mcgary.org
Tue Jul 25 14:45:00 GMT 2000
Mark Kettenis <kettenis@wins.uva.nl> writes:
> This report was very unclear. I asked for clarification, and got back
> some more junk, but got enough information out of it to find out what
> the problem is.
>
> Our netgroup parser doesn't strip off any whitespace from the
> netgroup parts, and therefore matching done against them might fail.
> Thus right now the netgroup
>
> ( foo , bar,foobar.net )
>
> gives host = " foo ", user = "bar " and domain = "foobar.net ".
> Attached is an *untested* patch to correct this. It would be great if
> anyone actually using netgroups could test this patch
>
>
> 2000-07-25 Mark Kettenis <kettenis@gnu.org>
>
> * nss/nss_files/files-netgrp.c (strip_whitespace): New function.
> (_nss_netgroup_parseline): Use strip_whitespace to strip off any
> leading and trailing spaces from host, user and domain name.
IMO, you should be using strsep or strtok_r to do this kind of
parsing, rather than rolling your own. These functions will handle
the whitespace stripping that you desire, provided that no whitespace
is permitted *within* the tokens...
Greg
More information about the Libc-hacker
mailing list