This is the mail archive of the libc-hacker@sources.redhat.com mailing list for the glibc project.

Note that libc-hacker is a closed list. You may look at the archives of this list, but subscription and posting are not open.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: PR libc/1827


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

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]