summaryrefslogtreecommitdiffstats
path: root/lib/libc/gen
Commit message (Collapse)AuthorAgeFilesLines
* Fix _listmatch() so that it doesn't fall off the end of the list string.wpaul1995-08-081-6/+5
|
* Just when you thought it was safe...wpaul1995-08-071-13/+188
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - getnetgrent.c: address some NIS compatibility problems. We really need to use the netgroup.byuser and netgroup.byhost maps to speed up innetgr() when using NIS. Also, change the NIS interaction in the following way: If /etc/netgroup does not exist or is empty (or contains only the NIS '+' token), we now use NIS exclusively. This lets us use the 'reverse netgroup' maps and is more or less the behavior of other platforms. If /etc/netgroup exists and contains local netgroup data (but no '+'). we use only lthe local stuff and ignore NIS. If /etc/netgroup exists and contains both local data and the '+', we use the local data nd the netgroup map as a single combined database (which, unfortunately, can be slow when the netgroup database is large). This is what we have been doing up until now. Head off a potential NULL pointer dereference in the old innetgr() matching code. Also fix the way the NIS netgroup map is incorporated into things: adding the '+' is supposed to make it seem as though the netgroup database is 'inserted' wherever the '+' is placed. We didn't quite do it that way before. (The NetBSD people apparently use a real, honest-to-gosh, netgroup.db database that works just like the password database. This is actually a neat idea since netgroups is the sort of thing that can really benefit from having multi-key search capability, particularly since reverse lookups require more than a trivial amount of processing. Should we do something like this too?) - netgroup.5: document all this stuff. - rcmd.c: some sleuthing with some test programs linked with my own version of innetgr() has revealed that SunOS always passes the NIS domain name to innetgr() in the 'domain' argument. We might as well do the same (if YP is defined). - ether_addr.c: also fix the NIS interaction so that placing the '+' token in the /etc/ethers file makes it seem like the NIS ethers data is 'inserted' at that point. (Chances are nobody will notice the effect of this change, which is just te way I like it. :)
* Don't depend on bogusly-installed <tzfile.h>.wollman1995-08-051-1/+1
|
* Null terminate all strings returned by the dummy uname() routine,mpp1995-07-312-18/+26
| | | | | | | and make sure that the version string is somewhat sane. This closes out PR#462. Reviewed by: Bruce Evans
* Fix the synopsis of signal() again. Now it is uglier but correct.bde1995-07-161-2/+2
| | | | | (Declarations of signal that don't use typedefs can't be formatted in the standard man page form.)
* Do the same sanity checking in _pw_breakout_yp() that we do inwpaul1995-06-261-16/+19
| | | | | | | _gr_breakout_yp(): if we encounter a NULL pointer generated as the result of a badly formatted NIS passwd entry (e.g. missing fields), we punt and return an error code, thereby silently skipping the bad entry.
* Fix for a potential problem reported by a user I bumped into on IRCwpaul1995-06-261-9/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | last night: _gr_breakout_yp() doesn't check for badly formatted NIS group entries. For example, a bogus entry like this: bootp::user1,user2,user3 will lead to a null pointer dereference and a SEGV (note that the GID field is missing -- this results in one of the strsep(&result, ":") returning NULL). The symtpom of this problem is programs dumping core left and right the moment you add a + entry to /etc/group. Note that while this is similar to an earlier bug, it's caused by a different set of circumstances. The fix is to check for the NULL pointers and have _gr_breakout_yp() punt and return a failure code if it catches one. This is more or less the behavior of SunOS: if a bad NIS group entry is encountered, it's silently ignored. I don't think our standard (non-NIS) group parsing code behaves the same way. It doesn't crash though, so I'm citing the 'it ain't broken, don't fix it' rule and leaving it alone. I'll probably have to add similar checks to _pw_breakout_yp() in getpwent.c to ward off the same problems. It's rare that bad NIS map entries like this occur, but we should handle them gracefully when they do.
* Fixes for PR #508 and #509 ('botched 'Bad netgroup' error message' andwpaul1995-06-231-7/+43
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 'cycle in netgroup check too greedy'). PR #508 is apparently due to an inconsistency in the way the 4.4BSD netgroup code deals with bad netgroups. When 4.4BSD code encounters a badly formed netgroup entry (e.g. (somehost,-somedomain), which, because of the missing comma between the '-' and 'somedomain,' has only 2 fields instead of 3), it generates an error message and then bails out without doing any more processing on the netgroup containing the bad entry. Conversely, every other *NIX in the world that usees netgroups just tries to parse the entry as best it can and then silently continues on its way. The result is that two bad things happen: 1) we ignore other valid entries within the netgroup containing the bogus entry, which prevents us from interoperating with other systems that don't behave this way, and 2) by printing an error to stderr from inside libc, we hose certain programs, in this case rlogind. In the problem report, Bill Fenner noted that the 'B' from 'Bad' was missing, and that rlogind exited immediately after generating the error. The missing 'B' is apparently not caused by any problem in getnetgrent.c; more likely it's getting swallowed up by rlogind somehow, and the error message itself causes rlogind to become confused. I was able to duplicate this problem and discovered that running a simple test program on my FreeBSD system resulted in a properly formatted (if confusing) error, whereas triggering the error by trying to rlogin to the machine yielded the missing 'B' problem. Anyway, the fixes for this are as follows: - The error message has been reformatted so that it prints out more useful information (e.g. Bad entry (somehost,-somedomain) in netgroup "foo"). We check for NULL entries so that we don't print '(null)' anymore too. :) - Rearranged things in parse_netgrp() so that we make a best guess at what bad entries are supposed to look like and then continue processing instead of bailing out. - Even though the error message has been cleaned up, it's wrapped inside a #ifdef DEBUG. This way we match the behavior of other systems. Since we now handle the error condition better anyway, this error message becomes less important. PR #507 is another case of inconsistency. The code that handles duplicate/circular netgroup entries isn't really 'too greedy; -- it's just too noisy. If you have a netgroup containing duplicate entries, the code actually does the right thing, but it also generates an error message. As with the 'Bad netgroup' message, spewing this out from inside libc can also hose certain programs (like rlogind). Again, no other system generates an error message in this case. The only change here is to hide the error message inside an #ifdef DEBUG. Like the other message, it's largely superfluous since the code handles the condition correctly. Note that PR #510 (+@netgroup host matching in /etc/hosts.equiv) is still being investigated. I haven't been able to duplicate it myself, and I strongly suspect it to be a configuration problem of some kind. However, I'm leaving all three PRs open until I get 510 resolved just for the sake of paranoia.
* Don't cast void functions to void.hsu1995-06-204-7/+7
| | | | Obtained from: NetBSD commit by jtc on June 16, 1995.
* Make _havemaster() use yp_first() (again) instead of yp_order() towpaul1995-06-171-2/+6
| | | | | ward off possible NIS+ evil. (I might be overly paranoid with this, but it doesn't hurt, so...)
* Merge RELENG_2_0_5 into HEADrgrimes1995-06-111-0/+9
|
* Remove trailing whitespace.rgrimes1995-05-3025-124/+124
|
* Remove trailing whitespace.rgrimes1995-05-301-1/+1
|
* Parse ^? now, our termcap use it and some termcaps from otherache1995-05-141-1/+5
| | | | systems use it too
* Fix bracket error for LogMaskache1995-05-021-1/+1
| | | | Submitted by: Ruslan Belkin <rus@home2.UA.net>
* Added function and man page for ftok(3), used in conjunction withjoerg1995-05-012-0/+135
| | | | | | | the so-called "System V IPC". Submitted by: jbeukema@HK.Super.Net (John Beukema) Obtained from: Th. Lockert <tholo@sigmasoft.com>, via NetBSD
* Small fix for the following problems:wpaul1995-04-291-2/+10
| | | | | | | | | | | | | - If you take the wheel entry out of /etc/group and turn on NIS, the '+:*::' line is incorrectly flagged as the entry for wheel (the empty gid section is translated to 0), hence getgrgid() returns '+' as the name of the group instead of 'wheel.' - Using just '+:' as the 'turn on NIS' switch in /etc/group makes getgrgid() dump core because of a null pointer dereference. (Last time I was in here, I foolishly assumed that fixing the core dump problems with getgrnam() and getgrent() would fix getgrgid() too. Silly me.)
* in _freecaches(): strdup() allocates us memory -- remember to free it.wpaul1995-04-221-10/+18
|
* Fix bugs in opendir():bde1995-04-211-9/+23
| | | | | | | - it succeeded on non-directories (see POSIX 5.1.2.4). - it hung on (non-open) named pipes. - it leaked memory if the second malloc() failed. - it didn't preserve errno across errors in close().
* Head off potential core dump in _havemaster() (we don't need to free anywpaul1995-04-151-4/+1
| | | | memory here: the underlying YP routines handle this one for us).
* Better conformance to SunOS behavior: if we can't match a user to onewpaul1995-04-141-2/+8
| | | | | | | | of the plus or minus lists at all, reject him. This lets you create a +@netgroup list of users that you want to admit and reject everybody else. If you end your +@netgroup list with the wildcard line (+:::::::::) then you'll have a +@netgroup list that remaps the specified people but leaves people not in any netgroup unaffected.
* Add err_set_file() and err_set_exit() functions to make it possible forwollman1995-04-132-18/+64
| | | | | programs which use err(3) to work nicely in a wider range of environments (e.g., dialog).
* Add missing header referenceache1995-04-091-0/+1
|
* The man page setmode(3) declares `void setmode' when it should bejoerg1995-04-051-1/+1
| | | | | | declared `void *setmode'. Submitted by: kargl@troutmask.apl.washington.edu
* getpwent.c: fix problem with emacs dumping core when NIS is enabled. Alsowpaul1995-04-043-21/+34
| | | | | | | | add #includes for YP headers when compiling with -DYP to avoid some implicit declarations. getgrent.c & getnetgrent.c: add some #includes to avoid implicit declarations of YP functions.
* Clear IGNPAR in cfmakeraw() instead of set it.ache1995-03-291-2/+2
|
* Use yp_order() instead of yp_first() in _havemaster() to check for thewpaul1995-03-271-7/+7
| | | | | presence of the master.passwd.byname map, and remember to free the returned order value before exiting.
* scandir(3) didn't transfer d_type, and d_ino is called d_fileno now.phk1995-03-251-1/+2
|
* Add calls to endgrent() and endnetgrent() to the end of _createcaches().wpaul1995-03-251-0/+2
|
* Make sanity checks saner: don't let setnetgrent() or innetgr() swallowwpaul1995-03-241-2/+8
| | | | any bogus arguments.
* Change strtok() to strsep(), using strtok() can cause memory corruptionache1995-03-241-16/+29
| | | | if user program use it too in the same time.
* Yikes! Fix stupid mistake I made in last commit that made getpwent() ignorewpaul1995-03-241-9/+12
| | | | | local password entries when YP was enabled. (How the heck did that get by me!?)
* As per Justin T. Gibbs's request, agument the +@netgroup/-@netgroupwpaul1995-03-241-36/+72
| | | | | | | | | | | | | remapping mechanism in the following manner: if given an entry +@foo and there is no netgroup named 'foo,' try searching for a regular user group called 'foo' and build the cache using the members of group 'foo' instead. If both a netgroup 'foo' and a user group 'foo' exist, the 'foo' netgroup takes precedence, since we're primarily interested in netgroup matching anyway. This allows access control schemes based on ordinary user groups (which are also available via NIS) rather than netgroups, since netgroups on some systems are limited in really brain-damaged ways.
* Don't let setnetgrent() operate on a null or empty group name: it canwpaul1995-03-231-0/+4
| | | | tickle a bug in ypserv and make a serious mess of things.
* Very important sanity checks: today I clobbered all four NIS servers onwpaul1995-03-231-6/+8
| | | | | | | | | | | | | 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.
* Lots of fixes/improvements in the +user substitution handling:wpaul1995-03-231-52/+39
| | | | | - Have the +@netgroup/-@netgroup caches handle the +user/-user cases too. - Clean up getpwent() to take advantage of the improved +user/-user handling.
* Small cleanups:wpaul1995-03-231-39/+44
| | | | | | - Prepend a '_' to a couple of things - Make sure YP is enabled in _createcaches() - Remove a couple of unused/uneeded variables from _createcaches()
* Phew! Done at last: getpwent now understands +@netgroup/-@netgroup directiveswpaul1995-03-231-9/+212
| | | | | in addition to the existing NIS substitutions. I may tweak this a bit in the future, but the important stuff is all here.
* Use better/stronger/faster NIS lookup code: by using yp_match() instead ofwpaul1995-03-211-44/+14
| | | | | the yp_first()/yp_next() combo, we let the database code in ypserv do some of the work for us.
* Whoops: expanding netgroups that reference multiple netgroups doesn'twpaul1995-03-191-1/+1
| | | | | | | | | | | | | | | 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.)
* Two major changes:wpaul1995-03-191-4/+71
| | | | | | | | | | | | | | - 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).
* Fix 'putting +: in /etc/group causes many programs to dump core' bugwpaul1995-03-181-1/+11
| | | | | | | | | 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.
* stdio.h --> unistd.hache1995-03-091-1/+1
|
* Explain the full story, and make it understandable too.phk1995-02-251-2/+7
|
* fix the synopsis to showphk1995-02-241-5/+1
| | | | | | | | | | | | | | void | *signal(int sig, void (*func)(int)) instead of | void | *signal(sig, func()) | | void | (*func)()
* Add missing #include <time.h> with time() prototypeache1995-02-241-0/+1
|
* Bruce pointed out, that a misleading warning would be issuedse1995-02-171-1/+1
| | | | | | | 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 ...
* Protect against duplicate gids in group list (as could be these1995-02-171-2/+5
| | | | result of being a member of some group in both /etc/group and YP).
* Backed out Keith Bostic's getcwd/$PWD hack. It is causing things to breakdg1995-02-072-31/+6
| | | | all over the place.
* Document the getenv(PWD) feature.phk1995-02-051-1/+7
|
OpenPOWER on IntegriCloud