HardenedBSD/usr.sbin/ypserv
Bill Paul 5fe4681564 Fix for memory leak: specify NULL as openinfo parameter when calling
dbopen() to open an NIS map.

Testing with very large maps (e.g. a sample password database with 31,000+
entries) has shown that ypserv will leak memory (ps shows RSS and VSZ
growing to 4000 pages or more) when performing repeated yp_next()s or
a yp_all(). The problem with yp_all() is not immediately obvious since
the ypproc_all service is handled in a child process which exits once
the transfer is finished, but with repeated yp_next()s (like what you
get when you use getpwent() to scroll through the password database),
the parent ypserv grows to enormous size and never shrinks again.

It seems this is related to the HASHINFO parameters I used in yp_dblookup.c,
which I actually stole from pwd_mkdb. Calling dbopen() with the default
parameters (specifying openinfo as NULL) fixes the problem.

I still need to see how this impacts the other NIS tools. I'm also
considering changing from hash to btree databases: the hash database
method doesn't support R_CURSOR, which means yp_next_record() has to
do a lot of ugly work in order to reach an arbitrary location in the
database.
1996-04-11 20:54:15 +00:00
..
Makefile A few small tweaks related to ypxfr: 1995-12-23 21:35:35 +00:00
Makefile.yp Makefile.yp: 1996-02-04 05:39:35 +00:00
mknetid
yp_access.c sense of 'mask' was reversed in default case of no securenets file. 1996-02-29 18:29:24 +00:00
yp_dblookup.c Fix for memory leak: specify NULL as openinfo parameter when calling 1996-04-11 20:54:15 +00:00
yp_dnslookup.c
yp_error.c Change private version of verr() to __verr() and make it static to 1996-01-26 18:20:56 +00:00
yp_extern.h Add real securenets support. By default, ypserv now uses /var/yp/securenets 1996-02-24 22:01:48 +00:00
yp_main.c Add support for NIS v1 client procedures. The following procedures 1996-02-26 02:34:27 +00:00
yp_server.c Initialize a few more 'result' members in a few places (both in the v2 1996-03-01 03:49:47 +00:00
ypserv.8 Correct some man page cross references and file location references. 1996-04-07 00:06:21 +00:00