Commit Graph

51 Commits

Author SHA1 Message Date
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
christos 920a51d98f avoid assignment of a read only location that lint does not pick, but gcc does. 1998-11-13 08:25:17 +00:00
christos 4310f9e0be delint 1998-11-12 16:38:49 +00:00
perry 98b9f211ee fix bcopy->memcpy with memcpy->memmove -- not strictly needed, but... 1998-08-26 00:38:39 +00:00
perry a843f0f8a5 bzero->memset, bcopy->memcpy, bcmp->memcmp 1998-08-10 02:43:08 +00:00
thorpej 43c06f3fa9 Fix a serious symbol collision problem introduced when pw_scan() was added
to libc.  Note, pw_scan() is NO LONGER exported from libc (it never should
have been, and we're just going to pretend like it never was).
1998-06-27 05:08:22 +00:00
lukem 9557a71026 * move pw_scan() from libutil to libc
* add support for YP "master.passwd.by*" (master.passwd in YP, including
  pw_passwd) and "passwd.adjunct.by*" (SunOS `secure' maps (?)), based
  on code in FreeBSD and partially from OpenBSD.
  this is only used if euid == 0.
  with this, the YP "passwd.by*" maps can have `*' in the pw_passwd field.
* use pw_scan() to parse YP "passwd.by*" and "master.passwd.by*" entries

XXX: i didn't test the "passwd.adjunct" support...
1998-06-08 03:17:59 +00:00
mrg c135ae8203 allow root to use pwd.db. 1998-02-10 03:56:33 +00:00
perry 08b0946f73 merge/update to lite-2 1998-02-02 02:41:17 +00:00
jtc 43fa6fe319 If port provides __weak_alias(), provide an Standard C and POSIX pure
identifier namespace by renaming non standard functions and variables
such that they have a leading underscore.  The library will use those
names internally.  Weak aliases are used to provide the original names
to the API.

This is only the first part of this change.  It is most of the functions
which are implemented in C for all NetBSD ports.  Subsequent changes are
to add the same support to the remaining C files, to assembly files, and
to the automagically generated assembly source used for system calls.
When all of the above is done, ports with weak alias support should add
a definition for __weak_alias to <sys/cdefs.h>.
1997-07-21 14:06:24 +00:00
christos 1adc5f2d31 Fix gcc warnings (unused variables, missing prototypes, etc.)
Fix RCSID's
1997-07-13 19:13:59 +00:00
lukem 76c3314d9b a valid uid/gid *ends* in \0 (i.e, barf if (*ep != '\0'), not if (*ep == '\0')) 1997-05-22 10:38:07 +00:00
lukem 50820e9b86 * parse gid with strtoul() instead of atoi(), and sanity check a) the parsed
value was just a number, b) it doesn't exceed GID_MAX
* convert gid to a string with %u not %d
* use [gu]id_t instead of int
1997-05-22 03:24:37 +00:00
lukem f442f20a30 * parse uid with strtoul() instead of atoi(), and sanity check a) the parsed
value was just a number, b) it doesn't exceed UID_MAX
* convert uid to a string with %u not %d
1997-05-22 03:14:42 +00:00
lukem 8041f4f4ab fix potential memory leaks: before calling yp_next(), reset key to NULL. if
an error occurred, and key != NULL, free(key).
1997-05-21 01:51:39 +00:00
lukem 1e601ecc2b * fix [lib/3580], by ensuring that the outdata arg to the yp_xxx()
calls is initialised to the null pointer so that the error condition
  doesn't fail by trying to free() memory that wasn't malloc()ed
* cleanup a bit; remove use of register, KNFify
1997-05-20 15:59:59 +00:00
mrg 9cd5492c02 - convert unsafe strcpy(), strcat() and sprintf() to the `n' versions.
- some KNF.
1997-01-23 14:01:45 +00:00
sommerfe f218af3428 Longer login name support: use MAXLOGNAME, not UT_NAMESIZE 1996-12-20 20:16:05 +00:00
phil e69d413643 Improvements to YP support from Jason Downs. 1995-07-28 05:43:01 +00:00
mycroft be21323869 Modify getpwent() to use __ypparse(). 1995-05-17 17:36:43 +00:00
cgd b585e843ca update from Lite, with local changes. fix Ids, etc. 1995-02-27 04:12:15 +00:00
deraadt 00f04ee544 __initdb() should only warn about spwd.db errors once, fix from
Cornelis van der Laan <nils@merlin.ims.uni-stuttgart.de>
1994-03-09 10:10:29 +00:00
deraadt 6401f7c13a speed up getpwnam/getpwuid for standard cases 1993-12-10 12:46:29 +00:00
jtc 71afdb430b Update source and manual pages to match X/Open 1170 specification.
Updated setpassent() to understand YP (a bug), and changed setpwent()
to simply be a call to setpassent(0) (to remove duplicated code).
1993-10-25 23:36:51 +00:00
jtc 92ba83edfc X/Open 1170 defines the return type of setpwent() to be void -- a trival
change since our setpwent() allways succeeded.
1993-10-25 22:21:36 +00:00
jtc 9c20f740a3 Declare rcsid strings so they are stored in text segment. 1993-08-26 00:43:03 +00:00
mycroft f23f94cb77 Add even more RCS frobs. 1993-07-30 08:21:41 +00:00
deraadt 9e0367ab04 fixed a yp-related bug found by Paul Kranenburg <pk@cs.few.eur.nl>:
endpwent was free'ing passwd line.
1993-07-24 18:28:32 +00:00
deraadt 3cbc24e4f9 I was horrified to find these had not been commited with the YP changes. 1993-05-04 05:10:45 +00:00
proven 38918af207 Opps, dbopen doesn't have an underscore. Fixed. 1993-04-21 04:26:21 +00:00
proven 2d21df758f Fixed these twon files to use db_open instead of hash_open. 1993-04-21 04:21:06 +00:00