summaryrefslogtreecommitdiffstats
path: root/lib/libc/gen/getgrent.c (follow)
Commit message (Collapse)AuthorAgeFilesLines
* Teach sysconf(_SC_GETGR_R_SIZE_MAX) the correct size of a buffer for thesthen2011-04-251-2/+2
| | | | | | reentrant getgrent functions (getgrgid_r, getgrnam_r). seems reasonable to millert@, ok deraadt@
* Implement proper error handling for getgrent(3), getgrnam(3) and getgrgid(3).schwarze2009-12-191-27/+43
| | | | | | | | | | | | | | | | | | | 1) Distinguish normal end of data (like eof, YPERR_NOMORE, YPERR_KEY) from error conditions. 2) Save errno(2) and restore it in case of success, as suggested by deraadt@ and beck@. While this code is touched, * move the common code for the yp_first and yp_next calls after the respective if/else-block; note that free(data) is not needed in case of failure and that __ypcurrent = NULL does no harm after failing yp_first. * return 0, not NULL: the return value of grscan is int, not a pointer. This is the last part of the work done on getgrent.c during c2k9, heavily relying on the other improvements done at that time. This has been rotting in my tree far too long. "get it in" deraadt@; also lightly tested by simon@ some time ago
* Fix the handle locking in stdio to use flockfile/funlockfilekurt2009-11-091-2/+3
| | | | | | | | | | | | | internally when and where required. Macros in <stdio.h> are updated to automatically call the underlying functions when the process is threaded to obtain the necessary locking. A private mutex is added to protect __sglue, the internal list of FILE handles, and another to protect the one-time initialization. Some routines in libc that use getc() change to use getc_unlocked() as they're either protected by their own lock or aren't thread-safe routines anyway. committing on behalf of and okay guenther@ now that we have install media space available.
* Back out previous commit, as it caused too much growth for the installguenther2009-10-221-3/+2
| | | | media to fit
* Fix the handle locking in stdio to use flockfile/funlockfileguenther2009-10-211-2/+3
| | | | | | | | | | | | internally when and where required. Macros in <stdio.h> are updated to automatically call the underlying functions when the process is threaded to obtain the necessary locking. A private mutex is added to protect __sglue, the internal list of FILE handles, and another to protect the one-time initialization. Some routines in libc that use getc() change to use getc_unlocked() as they're either protected by their own lock or aren't thread-safe routines anyway. ok kurt@, earlier version tested by sthen@ and jj@
* de-spaghetti:schwarze2009-06-071-36/+20
| | | | | | | | | | If code is used from exactly one place, don't jump back dozens of lines to reach it, only to "goto" back where you came from. Instead, simply put the code where it belongs. Also fixes a regression that crept in in rev. 1.30: After clearing the variable __ypmode, don't try to make decisions based on its former value. As a bonus, garbage collect the grname variable and the _ypmode enum type. ok millert@
* No need to malloc, copy, have a single read access, and free right away.schwarze2009-06-071-18/+6
| | | | | | Thus, garbage collect one variable, one strdup, one free, two ifs, one else and a couple of assignments. No functional change. ok millert@
* The yp_bind(3) return code now distinguishes "YP not active" from "an errorschwarze2009-06-051-63/+60
| | | | | | | | | occurred". Based on this, decide to either bail or use the record as is. Prevents getgrnam(3) and friends from silently skipping YP records on system errors, for example when out of memory. Also, calling yp_get_default_domain once is enough. The first two switch cases are unchanged, just reindented. ok millert@
* When parsing a line stating with "+" or "-" in group(5),schwarze2009-06-051-62/+51
| | | | | | | | | check whether YP is active up front, not half-way through the parsing. This fixes the bug that group names starting with a dash (yuck!) were skipped when YP was not active, introduced in rev. 1.27. Besides, the code becomes easier to understand. The code inside the two switch cases is unchanged, just reindented. "looks good" millert@
* in case a handling a +groupname:*:: entry fails due to lack of memory,schwarze2009-06-041-2/+3
| | | | | do not just skip the entry, but report the error condition; ok millert@
* Take advantage of the surprise libc bump to bring inschwarze2009-06-031-2/+28
| | | | | | | | YP group(5) exclusion, i.e. support -groupname:*:: in /etc/group. Such groups will be excluded from later +:*::, in just the same was as it is already done for passwd(5). I have been running this since the autumn of 2008. Discussed with several (including deraadt@, millert@, jmc@).
* correct +name handling; schwarze@usta.dederaadt2008-08-251-6/+7
|
* create a private getpwent()-like interface which does not walk the YPderaadt2008-06-241-7/+18
| | | | | | | groups map but instead tells us that it is there. then use this interface in getgrouplist(), and do a single lookup against netid.byname instead to get all the groups associated with that user ok kurt, testing by many others
* Wrap some functions, labels, and variables in #ifdefs correspondingray2007-05-161-1/+3
| | | | | | | to #ifdefs where they are used. Found by lint by bret dot lambert at gmail. OK deraadt@.
* zap remaining rcsid.espie2005-08-081-4/+1
| | | | | | Kill old files that are no longer compiled. okay theo
* deregister (and deauto!). ok millert@ marco@otto2005-03-251-3/+3
|
* major bump to libc and libpthread to break the dependency of amarc2004-06-071-2/+1
| | | | | | particular implementation of libpthread for libc. libc no longer needs pthread.h to compile. OK millert@, brad@, tedu@
* ansify function definitions and zap some `register'jfb2004-05-181-38/+17
| | | | ok millert@
* Remove the advertising clause in the UCB license which Berkeleymillert2003-06-021-6/+2
| | | | rescinded 22 July 1999. Proofed by myself and Theo.
* add missing enumeration case to select to kill gcc warningavsm2003-05-011-1/+4
| | | | millert@ ok
* KNFderaadt2002-07-061-29/+32
|
* try to use strlcpy and snprintf more; ok variousderaadt2002-05-241-8/+10
|
* Part one of userland __P removal. Done with a simple regexp with some minor hand editing to make comments line up correctly. Another pass is forthcoming that handles the cases that could not be done automatically.millert2002-02-161-4/+4
|
* repair getgrgid_r() and getgrnam_r() as the standart says; from d@pvalchev2001-09-111-32/+83
|
* unlock, instead of re-lock. fixes PR#1408d2000-09-241-2/+2
|
* fix sizeof's when aliasing reentrant structures.d2000-01-081-2/+2
| | | | (this caused group name lookups to fail)
* use thread-specific storage for the members listd2000-01-061-5/+18
|
* Use strtol() and strtoul() instead of atoi(). This allows us to catchmillert1999-09-031-8/+18
| | | | errors reasonably and deal correctly with unsigned quantities.
* Add thread-safety to libc, so that libc_r will build (on i386 at least).d1998-11-201-35/+91
| | | | | | | | | | | | | All POSIX libc api now there (to P1003.1c/D10) (more md stuff is needed for other libc/arch/*) (setlogin is no longer a special syscall) Add -pthread option to gcc (that makes it use -lc_r and -D_POSIX_THREADS). Doc some re-entrant routines Add libc_r to intro(3) dig() uses some libc srcs and an extra -I was needed there. Add more md stuff to libc_r. Update includes for the pthreads api Update libc_r TODO
* gid_t is unsignedderaadt1997-12-191-2/+2
|
* Clean up some -Wall complaints.millert1997-07-091-2/+2
|
* sync with NetBSD, changes from PR#3114, Michael.Eriksson@era-t.ericsson.sedownsj1997-01-251-7/+42
|
* Add a couple of syscalls; bring more prototypes into scopetholo1996-09-151-1/+3
|
* Fix RCS idstholo1996-08-191-7/+1
| | | | Make sure everything uses {SYS,}LIBC_SCCS properly
* yp_prot.h lies -> use yp.h (from yp.x) instead, change lots of structurederaadt1996-04-241-1/+1
| | | | | | | | | accesses to match. change xdr_domainname() and some other functions to take "char **" instead of "char *", as rpcgen intended -- helps programs linking against rpcgen output of yp.x. yp_all() should not free it's return value. split xdryp.c and yplib.c into ~20 files so binaries like "csh" need not link in functions like yp_maplist(). NIS+'s YP emulation code lacks YPPROC_ORDER... attempt to deal nicely.
* Prototype internal functionstholo1996-03-251-3/+5
| | | | Do the right thing in presense of __STDC__
* initial import of NetBSD treederaadt1995-10-181-0/+313