pwcache

2015-10-26 Thread Ted Unangst
Old bug in pwcache functions. Calling setpassent(1) to keep the passwd database open is a surprising abstraction violation for the caller of user_from_uid. Now it has a file descriptor it must close before exec by calling endpwent(), but this fact is not mentioned. (find is affected

Re: pwcache

2015-10-26 Thread Philip Guenther
On Mon, Oct 26, 2015 at 6:47 AM, Ted Unangst <t...@tedunangst.com> wrote: > Old bug in pwcache functions. Calling setpassent(1) to keep the passwd > database open is a surprising abstraction violation for the caller of > user_from_uid. Now it has a file descriptor it must cl

Re: pwcache

2015-10-26 Thread Todd C. Miller
On Mon, 26 Oct 2015 11:39:48 -0400, "Ted Unangst" wrote: > This improves the cache. Basically, it's kind of like four way > associative now, with LRU replacement. Also we can cache nameless > entries instead of going back to getpwuid every time. Shouldn't those memcpy() be memmove()? - todd

Re: pwcache

2015-10-26 Thread Ted Unangst
Todd C. Miller wrote: > On Mon, 26 Oct 2015 11:39:48 -0400, "Ted Unangst" wrote: > > > This improves the cache. Basically, it's kind of like four way > > associative now, with LRU replacement. Also we can cache nameless > > entries instead of going back to getpwuid every time. > > Shouldn't

Re: pwcache

2015-10-26 Thread Ted Unangst
Philip Guenther wrote: > On Mon, Oct 26, 2015 at 6:47 AM, Ted Unangst <t...@tedunangst.com> wrote: > > Old bug in pwcache functions. Calling setpassent(1) to keep the passwd > > database open is a surprising abstraction violation for the caller of > > user_from_uid. N

Re: pwcache

2015-10-26 Thread Todd C. Miller
On Mon, 26 Oct 2015 09:19:20 -0700, Philip Guenther wrote: > Ah, I missed fixing that before. How's this? Looks fine to me, though I wonder whether other systems leak the fd. - todd

Re: pwcache

2015-10-26 Thread Todd C. Miller
On Mon, 26 Oct 2015 12:07:33 -0400, "Ted Unangst" wrote: > Todd C. Miller wrote: > > On Mon, 26 Oct 2015 11:39:48 -0400, "Ted Unangst" wrote: > > > > > This improves the cache. Basically, it's kind of like four way > > > associative now, with LRU replacement. Also we can cache nameless > > >

Re: pwcache

2015-10-26 Thread Philip Guenther
On Mon, Oct 26, 2015 at 9:05 AM, Ted Unangst <t...@tedunangst.com> wrote: > Philip Guenther wrote: >> On Mon, Oct 26, 2015 at 6:47 AM, Ted Unangst <t...@tedunangst.com> wrote: >> > Old bug in pwcache functions. Calling setpassent(1) to keep the passwd >> > da