Commit Graph

490 Commits

Author SHA1 Message Date
wpaul
77a782d587 Don't let setnetgrent() operate on a null or empty group name: it can
tickle a bug in ypserv and make a serious mess of things.
1995-03-23 22:21:16 +00:00
wpaul
ec2490897f Very important sanity checks: today I clobbered all four NIS servers on
my network because setnetgrent() was trying to do a lookup on group "".
It seems that an attempt to do a yp_match() (and possible yp_next())
on a null or empty key causes Sun's ypserv in SunOS 4.1.3 to exit
suddenly (and without warning). Our ypserv behaves badly in this
situation too, thoush it doesn't appear to crash. In any event, getpwent,
getnetgrent and yp_match() and yp_next() are now extra careful not to
accidentally pass on null or empty arguments.

Also made a small change to getpwent.c to allow +::::::::: wildcarding,
which I had disabled previously.
1995-03-23 22:18:00 +00:00
wpaul
0eb3db6023 Lots of fixes/improvements in the +user substitution handling:
- Have the +@netgroup/-@netgroup caches handle the +user/-user cases too.
- Clean up getpwent() to take advantage of the improved +user/-user handling.
1995-03-23 17:33:19 +00:00
wpaul
d76703731d Small cleanups:
- Prepend a '_' to a couple of things
- Make sure YP is enabled in _createcaches()
- Remove a couple of unused/uneeded variables from _createcaches()
1995-03-23 04:04:01 +00:00
wpaul
24d962fe5d Phew! Done at last: getpwent now understands +@netgroup/-@netgroup directives
in addition to the existing NIS substitutions. I may tweak this a bit in
the future, but the important stuff is all here.
1995-03-23 00:59:15 +00:00
wpaul
f414596f26 Use better/stronger/faster NIS lookup code: by using yp_match() instead of
the yp_first()/yp_next() combo, we let the database code in ypserv do some
of the work for us.
1995-03-21 19:47:12 +00:00
phk
58ee097062 msun becomes the default -lm the right way now. 1995-03-21 02:52:05 +00:00
wpaul
576eeae319 Reviewed by: Bill Paul <wpaul@freebsd.org>
Submitted by:	Sebastian Strollo <seb@erix.ericsson.se>

- In /usr/src/lib/libc/yp/yplib.c, function yp_first when clnt_call
fails with (r != RPC_SUCCESS) ysd->dom_vers should be set to 0! This
ensures that /var/yp/bindings/dom.vers will be read again on retry.
What happens now is that when our server is down and someone tries to
use yp they will continue to try until kingdom come. So:
        if(r != RPC_SUCCESS) {
                clnt_perror(ysd->dom_client, "yp_first: clnt_call");
                ysd->dom_vers = -1;
                               ^^^^ change to 0
                goto again;
        }
1995-03-21 00:48:55 +00:00
rgrimes
c32009c986 Comment out declaration of kvm_uread until it can be fixed correctly. 1995-03-20 16:35:11 +00:00
rgrimes
7b174519a7 Change u_long to unsigned long to be consistent. 1995-03-20 16:17:50 +00:00
wpaul
48d35b4b93 At last! Modified __ivaliduser() to do the same kind of user/host validation
that everyone else does: you can now use +host/-host, +user,-user and
+@netgroup/-@netgroup in /etc/hosts.equiv, /.rhosts, /etc/hosts.lpd and
~/.rhosts. Previously, __ivaliduser would only do host/user matches,
which was lame. This affects all the r-commands, lpd, and any other
program/service that uses ruserok().

An example of the usefullness of this feature would be a hosts.equiv
file that looks like this:

+@equiv-hosts

Since the netgroup database can now be accessed via NIS, this lets you
set up client machines once and then never have to worry about them
again: all hosts.equiv changes can now be done through NIS. Once I
finish with getpwent.c, we'll be able to do similar wacky things
with login authentication too. (Our password field substitution
will finally be on par with everyone else's, and I'll finally be
able to fully integrate my FreeBSD machine into my network without
having to worry about the grad students sneaking into it when I'm
not looking. :)

Danger Will Robinson! I tested this thing every which way I could, but
Murphy's Law applies! If anybody spots a potential security problem with
the way my matching algorithm works, tell me immediately! I don't want
crackers snickering and calling me names behind my back. :)
1995-03-20 07:29:55 +00:00
wpaul
cb596fe111 Whoops: expanding netgroups that reference multiple netgroups doesn't
work because parse_netgrp() doesn't recurse properly. Fixed by
changing

if (parse_netgrp(spos))
	return(1);
to

if (parse_netgrp(spos))
	continue;

inside parse_netgrp(). (Lucky for me I happen to have a fairly complex
'live' netgroup database to test this stuff with.)
1995-03-19 22:19:52 +00:00
nate
a57e4a521e Separated out the _putchar & __cputchar() routines so that programs such
as tn3270 can replace _putchar(0 with their own routine and still keep
using the __cputchar() routine used by all of the other curses routines.

Reviewed by:	"Andrey A. Chernov, Black Mage" <ache@astral.msk.su>
1995-03-19 21:47:51 +00:00
joerg
af609f7535 libkvm exports kvm_uread(), so do declare it in the header file.
Got apparent by Philippe's -Wall patch for /usr/bin.
1995-03-19 13:36:49 +00:00
joerg
d2c55744e4 Cast the offset of one call to lseek() to off_t, as it's already done
in all other places here.

This is a hack, the interface should be changed to use off_t's
everywhere around, but this will require to update all the programs
that happen to use libkvm.
1995-03-19 13:33:05 +00:00
phk
c1f6e1c619 add a couple of missing #include lines 1995-03-19 07:00:52 +00:00
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
rgrimes
33aef88532 Remove private mkdir for /usr/include/ss, no handled by mtree. 1995-03-18 08:34:42 +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
wpaul
d92cb48248 Repeat after me kids: "I will not try to install files into a directory
when I'm not sure whether or not that directory exists."

Today I discovered that rebuilding /usr/include completely from scratch
doesn't work, because the libss Makefile tries to install headers into
/usr/include/ss, which 'make includes' does not create. The result is that
the libss Makefile plants the header files in /usr/include as individual
files called 'ss,' with the second one overwriting the first, and the
third one overwriting the second. So instead of a directory called
/usr/include/ss, you end up with just one file called /usr/include/ss with
only the last header file in it. Check out /usr/include/ss on freefall
and you'll see what I mean.

I've modified the beforeinstall target in the libss Makefile to check
for the presence of the ${DESTDIR}/usr/include/lbss directory and to
create it if it isn't already there. Hopefully I did it right.
1995-03-15 01:33:05 +00:00
ache
1b91eb6f54 Fix wbkgdset macro
Submitted by: Andreas Wetzel <mickey@deadline.snafu.de>
1995-03-13 19:02:04 +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
644d3b582f Fix suspended vipw hangs
Obtained from: NetBSD
1995-03-09 21:53:12 +00:00
ache
75e8048c23 stdio.h --> unistd.h 1995-03-09 17:45:23 +00:00
bde
056d7133a8 Obtained from: NetBSD
Remove common sources from ${SRCS} when they are replaced by arch-specific
sources.
1995-03-08 01:41:40 +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
nate
112ef6e028 If we are going to set the OBJS target, don't add to the old target. This
caused the RPC libraries to contain two versions of the same file.
1995-03-04 17:39:24 +00:00
ache
09b78a5269 Solve conflict between two global force variables 1995-03-03 02:34:14 +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
paul
d381c0681f Pull old lex.l out of attic and update to new one. 1995-03-01 08:25:40 +00:00
paul
e5372aca25 Completely rewrite libforms so everything is done at runtime rather
than at compile time.

Should have same functionality as old libforms but with new mechanism.

Lots of new features that use the new mechanism are still to be added.
1995-03-01 08:19:06 +00:00
jkh
4d71750d42 Additions from Thomas Graichen to mention each functions' floating point
counterpart.
Submitted by:	Thomas Graichen <graichen@sirius.physik.fu-berlin.de>
1995-03-01 05:06:48 +00:00
bde
a43c038744 Fix previous fix to agree with the man page - don't report errors in
kvm_open() if errstr is NULL.
1995-02-25 16:44:01 +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
cbb4f63628 Clean a bunch of -Wall warnings. 1995-02-24 08:51:34 +00:00
phk
5ca4449181 Remove some unused variables and fix two blatant core dump triggers. 1995-02-24 08:15:27 +00:00
phk
a96d1683ee Remove an unused variable. 1995-02-24 07:51:13 +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
d70484c276 Fix typo: pcap.h.h 1995-02-23 18:47:06 +00:00
phk
9bf4b628ff Quench a warning and fix some duplicity by using the official strerror
routine, instead of rolling our own.
1995-02-23 06:55:14 +00:00
olah
f0c34d41d1 Fix bogus Makefile which resulted in incompatible shared and static
libs.

Reviewed by:	Michael Reifenberger <root@rz-wb.fh-sw.de>,
		roberto@blaise.ibp.fr (Ollivier ROBERT)
1995-02-21 10:46:34 +00:00
phk
361ca08e0d Speed md5 up around 30% by shorting out a couple of cumbersome
memcpy equivalent functions.
1995-02-21 06:01:49 +00:00
nate
45d8ca0c0f Make libcompat a static only library.
Since functions will come and go from libcompat as they are deprecated
it makes no sense to build a shared library out of it as it will change.

Based on freedback from Terry and Jonas on the mailing lists.
1995-02-20 18:19:50 +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
ache
76d019c170 Add missing lib_window.c to SRCS 1995-02-13 17:23:18 +00:00
phk
56d22b3beb Fix broken makefile. 1995-02-12 02:35:35 +00:00
jkh
87505148a9 Support for >32 PTYs.
Submitted by:	Heikki Suonsivu <hsu@cs.hut.fi>
1995-02-09 11:11:01 +00:00
jkh
a23ae9f606 Install the header files. 1995-02-09 08:00:20 +00:00
bde
1676ed0440 CLEANFILES was missing a few files. 1995-02-08 21:11:39 +00:00
bde
0279eb2145 Add libpcap. I don't know what it is doing in the tree, but it has
settled for too long.  Compiling it gives 142 lines of compiler
warnings.  Perhaps the dirt will be fixed if it is visible.
1995-02-08 20:46:53 +00:00
jkh
66c6af057e Add two parts of Mark's/Gary's dlopen() changes that I missed before. 1995-02-08 17:56:27 +00:00
jkh
dcc217c4ac Support for more Sun compatible dlopen() and friends. Also added proper error
handling.
Reviewed by:    gj
Submitted by:   Mark Diekhans <markd@grizzly.com>
1995-02-07 13:27:29 +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
paul
0305d2ddc1 Implemented height field for text fields so they can now be more than
one line long.

Fixed a bug in the input field with cursor positioning at the end of
the field.

Make the print_status function available to apps so they can print
status messages.

Updated the example for the new fib parser.
1995-02-01 04:06:37 +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
paul
98c415953e Add all the necessary bits to use color if the terminal allows it.
You can now specify separate attributes for selected/not selected
cases individually for each field and also an attr for the form as
a whole so you can now have colored backgrounds for the form and
different coloured fields etc.

Update the example.

Change the copyright to a BSD style one.
1995-01-30 02:41:29 +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
dufault
a6910ddd5a Clean up handling of unspecified names. Clarify man page. 1995-01-26 23:48:41 +00:00
paul
3d46fa5ebf Truncate any default inputs to the input width.
Update the example so it works properly.
1995-01-25 08:26:17 +00:00
paul
f30e38dd6d New example that uses the new forms language. 1995-01-25 03:34:48 +00:00
paul
dad15ae4bd Update libforms to agree with new fib. 1995-01-25 03:33:43 +00:00
dufault
74e95725c7 Remove "va_start" macro. 1995-01-25 00:33:50 +00:00
ache
e5e62aa35e CFLAGS: = --> += 1995-01-24 22:09:46 +00:00
paul
d28e5686e3 Changed the example to use the forms spec file. 1995-01-24 13:29:30 +00:00
paul
d0f75ce585 Changed the example to use the forms spec file.
Made a couple of variable name changes.
1995-01-24 13:27:46 +00:00
dufault
860d93251e added libscsi 1995-01-24 12:10:42 +00:00
dufault
9cc843332f This commit was generated by cvs2svn to compensate for changes in r5847,
which included commits to RCS files with non-trunk default branches.
1995-01-24 12:10:11 +00:00
dufault
42806a94ee SCSI library layered on SCIOCOMMAND 1995-01-24 12:10:11 +00:00
jkh
daee3a2d40 Eliminate a bogus tab. 1995-01-24 00:13:56 +00:00
wollman
a18673ce5c Don't call _doprnt, which doesn't exist; use vfprintf. 1995-01-23 22:53:12 +00:00
wollman
77c139fd98 Make Jordan happy:
1) Link against object directory version of libcom_err.so.
2) Don't try to install ss_err.h if we haven't made it yet.  It's not
   on the critical path for `make world' at this point.
1995-01-23 18:56:40 +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
7bf1ad06a8 Fix from Rod so that std_rqs.c can get rebuilt properly when
doing a make world.
1995-01-21 23:30:31 +00:00