Commit Graph

81 Commits

Author SHA1 Message Date
dholland 8df67510ff Revert previous temporary measure and fix the assertion properly instead. 2012-09-08 15:15:06 +00:00
dholland 9af1ccf1bf Disable bogus _DIAGASSERT. 2012-09-07 04:50:35 +00:00
christos 4a263fd8ca PR/46279: Dr. W. Stukenbrock: Off-by-one in buffer length check and make sure
that the password fits in the supplied buffer.
2012-03-29 14:43:58 +00:00
christos 2ad3ddd659 PR?40728: W. Stukenbrock: Fix various issues with NIS-netgroups in users
and groups.
2012-03-29 13:05:10 +00:00
drochner ebfe3c0a28 remove some stray __weak_aliases, where the target functions were
__RENAMEd due to the time_t/dev_t type changes, which caused bogus
references to compat functions
now a libc built with BUILDCOLD is usable
2010-03-23 20:28:58 +00:00
christos 461a86f9bd merge christos-time_t 2009-01-11 02:45:45 +00:00
martin ce099b4099 Remove clause 3 and 4 from TNF licenses 2008-04-28 20:22:51 +00:00
christos 3ab861054c make this compile with DIAGNOSTIC 2007-02-03 16:22:48 +00:00
christos ce2c90c7c1 fix incomplete initializers 2006-10-15 16:14:46 +00:00
ginsbach f5439cd0a6 Fix YP lookup latency reported by Stephen M. Jones on tech-net. This is a
performance regression between 2.0 and 3.0.  The passwd compat method was
incorrectly querying the NIS server with yp_first()/yp_next() rather than
using yp_match() with the correct key.
2006-06-29 21:16:04 +00:00
christos 28929e2bc3 Coverity CID 708: Remove dead code. 2006-03-19 03:05:57 +00:00
lukem e82ae39d67 Cosmetic tweak previous; IMHO we don't need the XXX comment in this
case, since I prefer to NULL initialize variables in this situation.
2005-06-05 01:15:29 +00:00
he 0d43148fcf Add an initialization to appease -Wuninitialized. Apparently the
sparc64 compiler gets this wrong.
2005-06-04 22:14:00 +00:00
lukem 443af068fa getpw{ent,nam,uid}_r():
Return 0 "entry not found" and errno for other failures.
("entry not found" still sets *result to NULL).

Various backends:
don't set the retval to errno (or modify errno) for NS_NOTFOUND.

Per discussion with Klaus Klein.
2005-04-19 02:49:00 +00:00
christos 184974e05a PR/29849, PR/29850: Add getpwent_r and getgrent_r 2005-04-02 04:53:53 +00:00
lukem 6596888aee Restore getpwent() behaviour prior to rev 1.57; skip dodgy NIS & DNS entries
rather than failing with NS_UNAVAIL when encountering them.
Fixes PR 29272 by Antoine Reilles.
2005-02-28 00:40:05 +00:00
lukem c873ad0d2e Use the common __nsdefaultFOO rather than private defaultFOO duplicates. 2004-11-10 12:57:32 +00:00
lukem 663b3e58e0 Use _GETPW_R_SIZE_MAX from <limits.h> rather than defining a private version. 2004-11-10 04:11:34 +00:00
lukem 103626c6a0 default to "compat" not "files" 2004-11-01 08:21:34 +00:00
lukem c49e808721 #include "reentrant.h" instead of <threadlib.h> 2004-10-29 06:32:08 +00:00
lukem a48f586379 Protect access to all public functions via a mutex as some of the backends are
not reentrant (such as compat, because it uses the non reentrant getnetgrent(3)
to implement `+@netgrp' & `-@netgrp').
2004-10-24 14:46:23 +00:00
lukem b7fcf76aa6 Fix MKYP=no MKHESIOD=no build.
Rename an internal function to a more appropriate name.
2004-10-11 09:42:06 +00:00
lukem dd9512e81e Ensure that _nis_start(&state) has been called before using PASSWD_BYNAME()
or PASSWD_BYUID(), otherwise state.maptype won't be correct and the wrong
map may be selected (e.g., "passwd.by*" instead of "master.passwd.by*").

Set _PASSWORD_NOWARN in flags to __pw_scan(), so libc won't display parse
errors to stderr.  (This was the behaviour before my recent rototill.)

Fixes PR 27168 from Markus W Kilbinger.
2004-10-07 06:11:24 +00:00
lukem 0a87664e7c Use PASSWD_BYxxx(state) macros instead of "passwd.byxxx" to refer to
the NIS "passwd.by*" maps.
Fixes problem with "passwd_compat: nis" noted by Matthias Scheler.
2004-10-05 12:09:23 +00:00
lukem 45a7a69275 Overhaul the use of nsdispatch(3) by public APIs so that the back-end
methods use va_list in a manner that is directly related to the public API.
This makes it much easier to write dynamic nsswitch backends for getpwent(3).
Per my proposal on tech-userlevel.

Implement getpwgid_r() and getpwnam_r() APIs per the POSIX 1003.1, 2004 Ed.
These aren't fully reentrant or threadsafe yet, because the compat stuff
currently uses non-reentrant data sources (getnetgrent(3), getpwent(3)),
and there is probably some locking to be improved in the backends.
This will be fixed in the near future.
We also need to add _SC_GETPW_R_SIZE_MAX to sysconf(3).

Fix the compat `+' prototype override so getpwnam(3) and getpwuid(3) DTRT.

Improve the description of pw_class and pw_gecos.
2004-10-05 04:45:54 +00:00
lukem 18239b5b77 Fix compile problem if -UYP -DHESIOD.
Noted on current-users by Srinivasa Kanduru.
2003-11-26 00:48:59 +00:00
agc 9f1aac5bb3 Move Jason Downs's code from a 4-clause to a 3-clause licence by
removing the advertising clause.  Diffs provided in PR 22410 by Joel
Baker, confirmed to the board by Jason Downs.

With additional thanks to Jason Thorpe.
2003-10-13 15:36:33 +00:00
agc eb7c1594f1 Move UCB-licensed code from 4-clause to 3-clause licence.
Patches provided by Joel Baker in PR 22280, verified by myself.
2003-08-07 16:42:00 +00:00
itojun 9134efabd0 use strlcpy where it is more appropriate. 2002-11-17 01:51:24 +00:00
thorpej 045cceecae Fix signed/unsigned comparison warnings. 2002-11-11 17:13:59 +00:00
wiz 077b67effa __STDC__ is always defined on NetBSD. 2002-05-26 14:03:19 +00:00
groo 50d2b6a96f botched strncpy -> strlcpy
from xs@kittenz.org
2002-04-16 19:08:43 +00:00
mycroft 83f70e9b51 Just return an error if we try to look up a user name that's too long, rather
than trying to truncate.  The previous truncation code actually set key.size
too large and caused a (non-exploitable) core dump inside DB.
2002-02-12 18:58:04 +00:00
enami 32554376a3 Reset allocated buffer size to 0 on allocation failure. 2000-10-03 03:22:26 +00:00
simonb cac9995776 Fix potential buffer overflow processing long password database entries.
Inspired by similar OpenBSD change.
2000-10-02 19:25:32 +00:00
mycroft 605490369c Delint.
Remove trailing ; from uses of __weak_alias().  The macro inserts this if
needed.
2000-01-22 22:19:07 +00:00
lukem b48252f365 * use _DIAGASSERT() to check pointer arguments against NULL and file
descriptors against -1 (as appropriate).
* add actual checks which to detect stuff that would trigger_DIAGASSERT(),
  and attempt to return a sane error condition.
* knf some code
* remove some `register' decls.

the first two items result in the addition of code similar to the
following in various functions:

		_DIAGASSERT(path != NULL)
	#ifdef _DIAGNOSTIC
		if (path == NULL) {
			errno = EFAULT;
			return (-1);
		}
	#endif
1999-09-16 11:44:54 +00:00
ross c36a5f5190 Unconditionalize `rval' declaration referenced in usr.bin/chpass/ via .PATH 1999-04-27 06:08:58 +00:00
lukem df8debb219 change dns_getpw() to skip dodgy entries when doing getpwent(), rather
than returning NS_UNAVAIL. this means that a -ve uid entry in hesiod
doesn't stop getpwent() in its tracks. it also brings it in line with
how nis_getpw() works as well in this situation.
problem tracked down (with much pain & suffereing) by simonb.

XXX: we currently have no support for -ve uids, and this is painful in
XXX: hetrogenous environment... (this -ve check is enforced in __pwscan())
1999-04-26 04:01:32 +00:00
lukem a8743ef778 change getpwent() backends so that a flag (per source) is set once the
source has been exhausted. this allows getpwent() across multiple
sources (e.g, ``passwd: files nis'') to work correctly. the flags are
reset in setpassent()/endpwent().

this fixes a bug noted in [lib/7449] by thorpej, and tracked down to
getpwent() as being the culprit by simonb.
1999-04-25 07:54:01 +00:00
lukem 73e9ef01be specifically include stdarg/varargs.h 1999-04-18 02:04:04 +00:00
lukem 7f1c203c11 always compile in support for `compat' backends (even if !YP & !HESIOD),
and make it the responsibility of the backends to fallback to `files'
if !YP & !HESIOD. fixes chsh problem noted by billc@netbsd.org.
1999-01-26 01:08:06 +00:00
lukem 147dea105a convert from hes_*() -> hesiod_*() 1999-01-25 01:09:34 +00:00
mycroft 4171e335d6 Use the right map for Hesiod lookups by uid. 1999-01-21 12:42:06 +00:00
christos 23ab75d421 - remove unneeded casts
- remove unreachable code
- delint
1999-01-20 13:12:07 +00:00
lukem b247a8eceb * `passwd' defaults to `compat', and `passwd_compat' defaults to `nis'
* constify ns_dtab defs
1999-01-19 08:30:46 +00:00
lukem 27323a9339 * maximum limit of names is MAXLOGNAME not UT_NAMESIZE. fixes [bin/6847] from
scott ellis.
* convert to new nsdispatch(3)
1999-01-19 08:04:27 +00:00
lukem a360857d48 * fix _compat_getpw so that it returns _local_getpw(...) if there
isn't a `+' token in the files database.
  (this bug probably crept in when a merge to current occurred)
* ensure that the _bad_getpw callbacks in __getpwcompat have an
  argument for error reporting.
1999-01-18 00:59:10 +00:00
lukem f016dbdf41 fix some uid casts 1999-01-16 14:42:54 +00:00
lukem 0eb8645e3a pull nsswitch up to main branch 1999-01-16 07:47:18 +00:00