Commit Graph

148 Commits

Author SHA1 Message Date
wpaul
42a3c01e4d Two major changes:
- Added support for reading netgroups from NIS/YP in addition to the
local /etc/netgroups file. (Note that SunOS and many other systems only
support reading netgroups via NIS, which is a bit odd.)

- Fix Evil Null Pointer Dereferences From Hell (tm) that caused
parse_netgrp() to SEGV when expanding netgroups that include
references to other netgroups. Funny how nobody else noticed this.

This is the first step in implimenting +@netgroup substitution in
getpwent.c and any other places that could use it and don't already
support it (which is probably everywhere).
1995-03-19 06:16:03 +00:00
ache
c7e4543129 Fix authunix_maxgrouplist test
Submitted by: Scott Hazen Mueller <scott@zorch.sf-bay.org>
1995-03-18 17:55:03 +00:00
wpaul
af3a4131b5 Fix 'putting +: in /etc/group causes many programs to dump core' bug
by heading off possible null pointer dereferences in grscan(). Also
change getgrnam() slightly to properly handle the change: if grscan()
returns an rval of 1 and leaves a '+' in the gr_name field and YP is
enabled, poll the YP group.byname map before giving up. This should
insure that we make every effort to find a match in the local and
YP group databases before bailing out.
1995-03-18 05:03:10 +00:00
bde
db2028940b Remove `|| flags & ALT == 0' which was an obscure no-op, not a
parenthesization/precedence bug.
1995-03-12 13:53:51 +00:00
bde
498e010b3a Obtained from: 1.1.5. Originally by jtc. Cosmetically changed for this
commit by bde.

Fix bugs in floating point formatting.  The 4.4lite version is similar
to revision 1.3 in old-cvs and is missing all of jtc's fixes in revision
1.4 in old-cvs.  Revision 1.2 in ncvs fixed one of the old bugs but
introduced at least one new one (for %.0e).

old-cvs log:
revision 1.4
date: 1993/11/04 19:38:22;  author: jtc;  state: Exp;  lines: +33 -20
My work from NetBSD to make printf() & friends ANSI C compliant.
Fixes several bugs in floating point formatting:
  1. Trailing zeros were being stripped with %e format.
  2. %g/%G formats incorrect.
  3. Lots of other nits.
1995-03-12 13:26:49 +00:00
ache
75e8048c23 stdio.h --> unistd.h 1995-03-09 17:45:23 +00:00
bde
54b7f88a16 Don't build swab.o here. It gets built in libc/i386/string. Previously
the copy built from here was overwritten by the other copy and the other
copy was put in library-building command lines twice.  ld now objects to
duplicated modules.
1995-03-07 04:19:11 +00:00
joerg
e8c06a9513 On snap 950210, format %s (print seconds from the epoch) is missing
from the code in strftime.c . This affects both the library code
and all the commands using it (e.g. date +%s).

Note that %s is not required by ANSI, but we've already got it in 1.1.5.1.

Suggested by: luigi@labinfo.iet.unipi.it (Luigi Rizzo)
1995-03-01 23:08:40 +00:00
bde
17a5fa641e Don't attempt to lstat() the POSIXLY invalid empty pathname.
realpath() still accepts "" as an arg and converts it to a canonical
pathname for the current directory.
1995-02-25 16:06:07 +00:00
phk
1b262ea352 Explain the full story, and make it understandable too. 1995-02-25 04:43:20 +00:00
phk
a219345607 fix the synopsis to show
|     void
|    *signal(int sig, void (*func)(int))

instead of

|     void
|     *signal(sig, func())
|
|     void
|     (*func)()
1995-02-24 07:35:49 +00:00
ache
18a5653682 Add missing #include <time.h> with time() prototype 1995-02-24 01:02:59 +00:00
ache
4fd94cf795 Minor optimization. 1995-02-18 11:36:33 +00:00
ache
91ff8e2365 Minor optimization 1995-02-18 01:42:02 +00:00
ache
b122bfda1b Copyrights cleanup 1995-02-18 01:39:00 +00:00
se
c8edfbda77 Bruce pointed out, that a misleading warning would be issued
in an (unlikely) border case (maxgroups==1 and the user is on
an /etc/group line for the same group and that group only ...).

Now this case is dealt with as before ...
1995-02-17 19:45:21 +00:00
se
ecb476bce3 Protect against duplicate gids in group list (as could be the
result of being a member of some group in both /etc/group and YP).
1995-02-17 17:36:09 +00:00
ache
c0479ff88e Don't pick _warn module now 1995-02-17 16:36:12 +00:00
ats
a40b30676a Correct the parameters for the fchown. The third was erroneously
specified as uid_t but should be gid_t.
1995-02-17 00:41:30 +00:00
ache
308515c3f8 Add 8bit collate stuff
Submitted by: alex@elvisti.kiev.ua
1995-02-16 17:01:11 +00:00
ache
472ef98cfb Add 8-bit collate stuff
Submitted by: alex@elvisti.kiev.ua
1995-02-16 04:24:39 +00:00
wollman
668541d9ec Document Transaction TCP extensions to generic system calls. 1995-02-15 22:53:04 +00:00
dg
82caf4596d Backed out Keith Bostic's getcwd/$PWD hack. It is causing things to break
all over the place.
1995-02-07 05:52:57 +00:00
phk
184bec765a Document the getenv(PWD) feature. 1995-02-05 18:14:38 +00:00
wpaul
30b1b88a7d Collapsed _masterpw_breakout_yp() and _pw_breakout_yp() into a
single function.
1995-02-05 02:12:49 +00:00
phk
d0412fbe28 A cute hack to speed up things by Keith: if getenv("PWD") is the same
inode as ".", then just return that.  I added a check so it must start with
a '/'.

Reviewed by:	phk
Submitted by:	bostic@cs.berkeley.edu (Keith Bostic)
1995-02-04 19:29:22 +00:00
bde
9c1563f3c3 Include <time.h> instead of <sys/time.h> to get CLK_TCK. Including
<sys/time.h> works because <sys/time.h> includes <time.h> if KERNEL
is not defined, but is ugly.
1995-02-03 22:28:34 +00:00
bde
dc81150269 Change CLK_TCK to CLOCKS_PER_SEC.
Add a missing apostrophe that suggests inverting the frequency to get
tick size.  It read better before because `CLK_TCK' suggests a tick
size although it is actually a frequency.
1995-02-03 22:09:56 +00:00
bde
479b8b6181 Change CLK_TCK to CLOCKS_PER_SEC. (CLK_TCK is a deprecated POSIX feature
and is not necessarily related to the ANSI CLOCKS_PER_SEC).

Parenthesize macro args.
1995-02-03 21:59:45 +00:00
bde
5859d904d1 Fix previous change to preserve const'ness. 1995-02-03 21:54:03 +00:00
wpaul
a3287587cb Fixed a rather serious bug that presents itself when FreeBSD is configured
as an NIS client. The pw_breakout_yp routines that are used to populate the
_pw_passwd structire only do anything if the bits in the pw_fields member
_pw_passwd are cleared. Unfortunately, we can get into a state where
pw_fields has garbage in it right before the YP lookup functions are
called, which causes the breakout functions to screw up in a big way.
Here's how to duplicate the problem:

- Configure FreeBSD as an NIS client
- Log in as a user who's password database records reside only in
  the NIS passwd maps.
- Type ps -aux

Result: your processes appear to be owned by 'root' or 'deamon.'
/bin/ls can exhibit the same problem.

The reason this happens:

- When ps(1) needs to match a username to a UID, it calls getpwuid().

- root is in the local password file, so getpwuid() calls  __hashpw()
  and __hashpw() populates the _pw_passwd struct, including the pw_fields
  member. This happens before NIS lookups take place because, by coincidence,
  ps(1) tends to display processes owned by root before it happens upon
  a proccess owned by you.

- When your UID comes up, __hashpw() fails to find your entry in the
  local password database, so it bails out, BUT THE BITS IN THE pw_fields
  STRUCTURE OF _pw_passwd ARE NEVER CLEARED AND STILL CONTAIN INFORMATION
  FROM THE PREVIOUS CALL TO __hash_pw()!!

- If we have NIS enabled, the NIS lookup functions are called.

- The pw_breakout_yp routines see that the pw_fields bits are set and
  decline to place the data retrieved from the NIS passwd maps into the
  _pw_passwd structure.

- getpwuid() returns the results of the last __hashpw() lookup instead
  of the valid NIS data.

- Hijinxs ensue when user_from_uid() caches this bogus information and
  starts handing out the wrong usernames.

AAAARRRRRRRRRGGGGGGHHHHHHHHHH!!!

*Please* don't tell me I'm the only person to have noticed this.

Fixed by having __hashpw() check the state of pw_fields just before
bailing out on a failed lookup and clearing away any leftover garbage.
What a fun way to spend an afternoon.
1995-02-03 01:09:35 +00:00
wpaul
1818a0c4e1 Fix for that last fix... pass the hat. :) 1995-02-01 20:09:00 +00:00
wpaul
58429fdc31 Small fix to _getyppass(): sometimes we can construct the wrong mapname
when looking for master.passwd.whatever.
1995-02-01 20:06:33 +00:00
wpaul
5902fd25c2 Some changes for YP password map handling:
- FreeBSD's NIS server can supply a master.passwd map, which has
  more fields in it than a standard passwd map, so we need a
  _master_pw_breakout() fuction.

- When doing passwd map lookups, look for master.passwd.* by attempting
  a _yp_first() on master.passwd.byname. If it exists, we're being served
  by a FreeBSD NIS server and we should use this map.

- If we aren't the superuser, retrieve only the standard passwd maps.
  If we're being served by a FreeBSD system, then the passwd map has
  no passwords in it, and it won't serve us the master.passwd map unless
  we're superuser anyway.

There's a small speed hit for the superuser inherent in the check for
the master.passwd map, but this lets us dynamically decide what to do
rather than rely on a non-standard config file somewhere. Since all
of this is bypassed for normal users, they shouldn't notice the
difference.
1995-01-31 10:04:18 +00:00
dg
7e03208067 Be sure to properly fail if there are not enough fields. Problem
reported by MARC Giannoni <marc@cmc.eng.comsat.com>, this fix is by me.
1995-01-27 22:30:03 +00:00
dfr
b5c6599aa4 Reclaim memory used for telldir cookies on closedir. 1995-01-27 13:51:18 +00:00
dg
29cbee93bc First round of changes to clean up the RCSID mess in libc:
1) Changed LIB_SCCS and SYSLIB_SCCS to LIB_RCS and SYSLIB_RCS.
2) Changed sccsid[] variables to rcsid[]
3) Moved all RCSID strings into .text
4) Converted all SCCSID's to RCS $Id$'s
5) Added missing $Id$'s after copyright.
1995-01-23 01:30:24 +00:00
dg
5fd45395cb Changed LIB_SCCS and SYSLIB_SCCS #defines to LIB_RCS and SYSLIB_RCS. 1995-01-23 01:22:08 +00:00
dg
756937c566 (Very) minor improvement from NetBSD/J.T.Conklin. 1995-01-22 22:03:45 +00:00
dg
bb1df6868c Added leaner and meaner swab() function by J.T. Conklin. 1995-01-22 21:36:15 +00:00
wollman
0420ea837c Fix unbalanced #endif introduced by yesterday's change. 1995-01-19 19:01:50 +00:00
dfr
d2ea3cadb3 Fix handling of 'e' format floating point so that it prints trailing zeros
correctly.
1995-01-19 12:05:53 +00:00
wollman
b877ace7ed Prevent sites from shooting themselves in the foot while enabling/disabling
YP by disallowing `+' entries as logins in all cases.  (This handles the
case of a `+' entry in the password file but YP not running, which should
never happen but is easy enough to check for so we'll apply some
prophylaxis.)
1995-01-17 23:17:38 +00:00
ats
f3f8bf3b16 Add the sys/types.h include to the necessary documented includes for the
getrusage call.
1994-12-31 18:50:57 +00:00
bde
672359307c fixunsdfsi.S:
Embalm.  Rewrite to do things much the same as gcc-2: use fistpq for speed
and elegance, and mishandle overflow consistently.  __fixunsdfsi() is no
longer called by gcc.
1994-12-27 13:37:38 +00:00
bde
e96890ff0b sigsetjmp.S:
Remove unnecessary .text statement.
1994-12-27 13:34:04 +00:00
bde
8f5b931dde Remove unnecessary .align statement. 1994-12-27 13:33:03 +00:00
bde
8d3ea78afb Fix a spelling error and add a comment about possible improvements. 1994-12-27 13:12:34 +00:00
bde
65d125f2c2 Fix the bug reported by Torbjorn Granlund <tege@cygnus.com>:
The documentation for mrand48 and lrand48 is mixed up.
mrand48 returns a full 32 bit number, while lrand48 only returns
31 bits.
1994-12-25 15:33:39 +00:00
guido
a02b6b3152 Add missing getdomainname manual page.
Reviewed by:
Submitted by:
Obtained from: 1.1.5.1 with a few modifictaions.
1994-12-18 14:06:39 +00:00