Commit Graph

220 Commits

Author SHA1 Message Date
Peter Wemm
df9c30afec Add an "officially undocumented" tweak for squid so that it can see the
TTL of DNS records that it looks up for it's resolver cache.

Obtained from: Endre Balint Nagy <bne@CareNet.hu>, via squid-1.1.x source.
1996-11-01 06:25:43 +00:00
Jordan K. Hubbard
a0735deb48 Bring back ns_* routines; we need them for ifconfig and route. 1996-10-16 19:38:51 +00:00
John Polstra
d3281e16c2 Fix an error in the description of "h_errno". Add "const" to a few
declarations to make them agree with the actual prototypes in <netdb.h>.
1996-10-08 22:30:08 +00:00
Paul Traina
beddb20c7a Skip results that have unexpected lengths 1996-10-01 03:45:06 +00:00
Peter Wemm
d4c31a75a3 pull this in to avoid fixing these twice 1996-08-30 22:16:46 +00:00
Peter Wemm
f991bb5181 Sigh, back out the last bright idea I had here about compiling the res_*
routines from contrib/bind directly.  There were too many problems,
including having to add -DUSE_OPTIONS_H to the entire libc source in
order for the contrib code to pick up it's options, and so on.

Instead, I've merged the changes, libc is now self contained again.
1996-08-30 21:13:42 +00:00
Peter Wemm
bc7413d0a3 back out last two changes, this caused the mandoc pages to be replaced by
man pages.  I'll fold in the real changes in a seperate commit.
1996-08-30 19:40:05 +00:00
Peter Wemm
a4c5661fb7 oops, brain-lapse caused undefined symbol 1996-08-30 00:26:49 +00:00
Peter Wemm
fdf4c7af04 The last commit failed part-way through, re-add the generated
resolver man pages.
1996-08-29 22:13:00 +00:00
Peter Wemm
d72ca8598d Revert change to build the reolver man pages on the fly, install the
machine-generated versions
1996-08-29 22:06:51 +00:00
Peter Wemm
5ce1c533c7 Merge in bind-4.9.4-P1 resolver... 1996-08-29 20:08:19 +00:00
Mike Pritchard
a2d402aa3c Update some more man pages to use the .Fx macro. 1996-08-21 22:10:36 +00:00
Julian Elischer
0f7d684755 Submitted by: John Birrell <cimaxp1!jb@werple.net.au>
Here are the diffs for libc_r to get it one step closer to P1003.1c
These make most of the thread/mutex/condvar structures opaque to the
user. There are three functions which have been renamed with _np
suffixes because they are extensions to P1003.1c (I did them for JAVA,
which needs to suspend/resume threads and also start threads suspended).

I've created a new header (pthread_np.h) for the non-POSIX stuff.

The egrep tags stuff in /usr/src/lib/libc_r/Makefile that I uncommented
doesn't work. I think its best to delete it. I don't think libc_r needs
tags anyway, 'cause most of the source is in libc which does have tags.

also:

Here's the first batch of man pages for the thread functions.
The diff to /usr/src/lib/libc_r/Makefile removes some stuff that was
inherited from /usr/src/lib/libc/Makefile that should only be done with
libc.

also:

I should have sent this diff with the pthread(3) man page.
It allows people to type

make -DWANT_LIBC_R world

to get libc_r built with the rest of the world. I put this in the
pthread(3) man page.  The default is still not to build libc_r.


also:
The diff attached adds a pthread(3) man page to /usr/src/share/man/man3.
The idea is that without libc_r installed, this man page will give people
enough info to know that they have to build libc_r.
1996-08-20 08:22:01 +00:00
Peter Wemm
ce70b6caf8 clear sockaddr_in's on stack before use
set sin_len
close one ftp port bounce attack
have rresvport() use bindresvport() rather than duplicate the code,
  rresvport() is a superset of bindresvport().

Obtained from: OpenBSD / Jason Downs / Theo de Raadt, minor tweaks by me.
1996-08-12 14:14:09 +00:00
Jordan K. Hubbard
51295a4d3e General -Wall warning cleanup, part I.
Submitted-By: Kent Vander Velden <graphix@iastate.edu>
1996-07-12 18:57:58 +00:00
Garrett Wollman
5900c00709 Add RCS Id and fix date. 1996-06-17 20:12:53 +00:00
Garrett Wollman
010b7c6c74 Cross-reference addr2ascii(3). 1996-06-17 20:11:12 +00:00
Garrett Wollman
276ea05394 Correct date and add $Id$ to reflect previous modification. 1996-06-17 20:04:06 +00:00
Garrett Wollman
538e87685f Cross-reference addr2ascii(3) and inlcude a note about how those
functions are preferred but are not widely available as yet.
1996-06-17 20:01:05 +00:00
Garrett Wollman
724ad64676 It would help if I actually added the source code for these routines. 1996-06-13 20:45:42 +00:00
Garrett Wollman
ffd1512db6 Add an independent implementation of addr2ascii(3) and ascii2addr(3)
following the API of the INRIA IPv6 implementation.
1996-06-13 20:45:05 +00:00
Bill Paul
217ae63218 Improve NIS performace of getservbyname() and getservbyport(). Both these
functions are implimented as wrappers around getservent(), which means it's
up to getservent() to do all the work. The NIS support in getservent()
only allows it to scan through the services.byname map one entry at a
time until it finds the requested service name/port. This can be painfully
slow due to the overhead involved (lots and lots of successive RPCs).

To fix this, we allow getservbyname() and getservbyport() to signal
getservent() that if NIS is turned on (there's a '+' in /etc/services),
the usual yp_first()/yp_next() linear search should be abandoned and
yp_match() used instead. This causes getservent() to immediately
locate the requested entry instead of wasting time groping through the
whole map.

The downside is that this trick is accomplished by exporting a couple of
pointers from getservent.c which getservbyname.c and getservbyport.c can
preset in order to tell getservent() what to do. If all three functions
were in the same source module, then the extra cruft could be delcared
static to avoid poluting the global symbol space. Maybe they should be
combined anyway. For now I've settled on prepending lots of underscores.
1996-06-01 04:40:42 +00:00
Peter Wemm
3ccd4a12e8 Use the setsockopt for IP_PORTRANGE to cause rresvport() to allocate a
privileged port within a single bind(), rather than looping through
attempts to bind over and over again over progressively lower ports.

This should speed up rlogin/rsh etc, and will probably cure some of the
strange rlogin hangs that have been reported in the past where rresvport()
managed to bind() to a port address that it shouldn't have.
1996-05-31 04:00:21 +00:00
Mike Pritchard
e40f3f85d4 Do not install the now unsupported netns and netiso
related man pages.  Comment out cross references to those man
pages from other man pages.
1996-04-08 05:15:09 +00:00
Mike Pritchard
edf0e5b3f8 Correct some man page xrefs, and some other minor changes to bring some
man pages up to mdoc guidelines and fix some minor formatting glitches.
Also fixed a number of man pages to not abuse the .Xr macro to
display functions and path names and a lot of other junk.
1996-04-08 04:18:31 +00:00
Bill Paul
ff27d2a474 Fix other half of problem reported in PR #1079: _getnetbynisaddr() is
broken. The translation from network number to ASCII string was not
working correctly (you would sometimes get things like 0.244.0.0 instead
of 244.0.0).

Also copied results of yp_match() to a static buffer for consistency
with gethostbynis.c.

Note: _getnetbynisaddr() chops off trailing .0's, i.e. 244.0.0 is
truncated to 244. By contrast, getnetbyht.c code (for local /etc/networks
lookups) leaves the traling .0's in place. This means that the NIS
and local file lookups will match different things when looking up the
same network number. I'm not sure which is the correct behavior. (I
think the DNS lookup code tries all combinations -- should the NIS
and local host lookup routines do that too?)
1996-03-23 22:16:22 +00:00
Bill Paul
6daf17201b gethostbynis.c:
- Fix problem described in PR #1079: _gethostbynisaddr() doesn't
  work. Make it accept the same arguments as all the other
  gethostby*addr() functions and properly convert the supplied IP
  address into a text string so that yp_match() can find it in the
  hosts.byaddr map.

- Also fix potential memory leak: copy the results of yp_match() to
  a static buffer and free the result (yp_match() returns dynamically
  allocated memory).

ether_addr.c:

- Since I was in the neighborhood, fix ether_ntohost() and
  ether_hostton() so that they don't bogusly for a free(result)
  when yp_match() fails.
1996-03-16 21:25:59 +00:00
Mike Pritchard
48194b7e82 Fix inet_network to not dump core if passed in an address
with more than 4 octets (e.g. 1.2.3.4.5).

Submitted by:	Amy Baron <amee@beer.org> via NetBSD-bugs
1996-02-17 21:11:36 +00:00
Mike Pritchard
e1f4e80c88 Fixed a bunch of man page cross references that were
in the main text of various man pages.

Thanks to Warner Losh for adding an option to manck to allow
it to scan the entire man page looking for bogus xrefs, instead
of just checking the SEE ALSO section.
1996-02-15 20:07:05 +00:00
Garrett Wollman
cbc17e711e XNS sort-of-support is no more. 1996-02-13 17:30:37 +00:00
Mike Pritchard
78b0b234eb Correct a bunch of man page cross references and generally
try and silence "manck".

ncurses, rpc, and some of the gnu stuff are still a big mess, however.
1996-02-11 22:38:05 +00:00
Mike Pritchard
c211e812bb Added some missing MLINKS for section 3 man pages.
Also corrected a few minor formatting errors, file location and cross
references in some of the section 3 man pages.

This shuts up a lot of the output from "manck" for section 3.
1996-02-09 00:45:45 +00:00
Garrett Wollman
0761cb293e Remove support for OSI networking in user-land (#ifdef OSI aor CCITT)
in preparation for its removal from the kernel source tree.  NB: because
a function was deleted, libc is now at version 3.0 (was 2.2 previously).
1996-02-06 20:36:15 +00:00
Mike Pritchard
a5ed710ccd Fix even more spelling errors in some more man pages. 1996-01-30 16:34:52 +00:00
Mike Pritchard
70520b51b9 Getpwent() and getservent() can wind up calling free() with
an invalid pointer if a call to yp_first() fails.  Closes PR # 964,
and possibly # 952.
1996-01-29 20:16:30 +00:00
Peter Wemm
4faad310d3 The last of the bind-4.9.3-REL resolver merges. 1996-01-13 09:03:58 +00:00
Peter Wemm
ab83cd2d54 Merge the 4.9.3-rel code into the res_* parts. The gethostXXXbyYYY
parts are not quite so simple..
1996-01-07 09:15:02 +00:00
Peter Wemm
25ae517921 This commit was generated by cvs2svn to compensate for changes in r13304,
which included commits to RCS files with non-trunk default branches.
1996-01-07 06:57:27 +00:00
Peter Wemm
ffa065a6d4 Part of bind-4.9.3-rel.. This is for my convenience and reference.
This import to the vendor branch changes no files...
1996-01-07 06:57:27 +00:00
Peter Wemm
6065a0be11 This commit was generated by cvs2svn to compensate for changes in r13122,
which included commits to RCS files with non-trunk default branches.
1995-12-30 19:02:48 +00:00
Bill Paul
215032be8c Add NIS support to getservent(3) functions (getservbyport() and getservbyname()
both call getservent() to do most of the work, so we only need to modify
this file to take care of everybody).

Note that there is only one NIS services map (services.byname) even
though there are getservbyname() and getservbyport() library functions.
1995-11-04 19:07:27 +00:00
Poul-Henning Kamp
fce61be7f5 As above. 1995-10-22 14:39:06 +00:00
Peter Wemm
613749bbf2 Remove the CFLAGS+=-I${CURDIR}/net that I previously added.
Since Bruce changed the #include <res_config.h> to #include "res_config.h"
this is no longer needed, and only makes the 'make' more verbose for
no real reason.
1995-08-21 17:50:01 +00:00
Bruce Evans
4fc61ca748 Define DEBUG as 1 instead of as nothing so that it doesn't conflict with
-DDEBUG in libresolv/Makefile.
1995-08-21 09:16:02 +00:00
Bruce Evans
e6507d611f Fix bogus include paths, some of which stopped libresolv from compiling. 1995-08-21 09:15:40 +00:00
Peter Wemm
e5ad4f8712 Update the resolver part of libc to bind-4.9.3-beta24 level (from beta9p1)
Note that this was done by selective patching from diffs, to not conflict
with the 4.4bsd base code..  This was *not* a trivial task..  I have been
testing this code (apart from cosmetic changes) in my libc for a while now.

Obtained from: Paul Vixie <paul@vix.com>
1995-08-20 20:03:06 +00:00
Bill Paul
97cb50947e Submitted by: Bill Fenner <fenner@parc.xerox.com>
Fix for PR #510. The original problem was that __ivaliduser() was
failing to grant access to a machine listed in a +@netgroup specified
in /etc/hosts.equiv, even though the host being checked was most
certainly in the +@netgroup.

The /etc/hosts.equiv file in question looked like this:

localhost
+@netgroup

The reason for the failure was had to do with gethostbyaddr(). Inside
the __ivaliduser() routine, we need to do a gethostbyaddr() in order
to get back the actual name of the host we're trying to validate since
we're only passed its IP address. The hostname returned by gethostbyaddr()
is later passed as an argument to innetgr(). The problem is that
__icheckhost() later does a gethostbyname() of its own, which clobbers
the buffer returned by gethostbyaddr().

The fix is just to copy the hostname into a private buffer and use
_that_ as the 'host' argument that gets passed to innetgr().

And here I was crawling all over the innetgr() code thinking the
problem was there. *sigh*
1995-08-14 23:52:49 +00:00
Bill Paul
1e890b056a Just when you thought it was safe...
- 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. :)
1995-08-07 03:42:14 +00:00
Peter Wemm
acc7e87c9b Slight adjustment to previous fix for __ivaliduser(). It was checking for
the comment before checking for long lines, so there was a possibility
that the wrap-around might be used as an exploitable hostname.
Reviewed by:
Submitted by:
Obtained from:
1995-07-16 17:03:58 +00:00
Joerg Wunsch
8f26c8ef60 Make ruserok() accept the #-starting comment lines we used to have
in our default /etc/hosts.equiv.

Closes PR #conf/620: Default /etc/hosts.equiv...
1995-07-16 10:12:32 +00:00
Joerg Wunsch
2c413cbe50 Fix the prototypes for getservby{name,port}().
Closes PR #docs/568: minor manpage bug

Submitted by:	Michael Smith (email address no longer valid)
1995-07-09 08:17:01 +00:00
Rodney W. Grimes
6c06b4e2aa Remove trailing whitespace. 1995-05-30 05:51:47 +00:00
Bill Paul
8b4709fa93 Add an ethers(3) man page. 1995-04-12 22:28:49 +00:00
Bill Paul
7680d1b004 Add ether_addr functions to libc. This seems to be the logical place
to put them. A man page is in the works.
1995-04-02 01:31:17 +00:00
Andrey A. Chernov
3330823cc3 Sicnce this code shares the same fragment as gethostnamaddr:
Change strtok() to strsep(), cause memory corruption for all
programs which use strtok() too in the same time.
Fix potential NULL reference, depends of /etc/hosts.conf format
Fix the bug when service name fetched always from beginning of the line,
not from parsed token.
1995-03-24 15:51:30 +00:00
Andrey A. Chernov
3d1513bdeb Change strtok() to strsep(), cause memory corruption for all
programs which use strtok() too in the same time.
Fix potential NULL reference, depends of /etc/hosts.conf format
Fix the bug when service name fetched always from beginning of the line,
not from parsed token.
1995-03-24 15:38:54 +00:00
Bill Paul
8538335f21 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
Garrett Wollman
40569757cc In _gethostbydnsaddr(), force RES_RECURSE into _res.options. This is
incredibly obnoxious, but also makes inverse mappings work when the local
resolver is in a cache-only configuration.  (Maybe this is actually
a bug in BIND?)
1994-12-01 22:25:38 +00:00
Rodney W. Grimes
3573df98f1 >Description:
While trying to figure out why rlogind wasn't working right for root,
	I noticed that man wouldn't come back with a man page for iruserok, but
	it would for ruserok.  Checking the lib/net directory's Makefile.inc
	file shows that the link to the rcmd man page just isn't getting
	created.
>How-To-Repeat:
	Do a 'man iruserok' and notihing will come back, where a 'man ruserok'
	will.

Submitted by:	Brian Moore <ziff@houdini.eecs.umich.edu>
Obtained from:	NetBSD-bugs mailing list
1994-10-27 16:33:49 +00:00
Garrett Wollman
f64c928f58 Use same configuration file, /etc/host.conf, for both gethost* and
getnet* configuration.  (It's highly unlikely that you'd want to do
something different, and network lookups aren't common enough to justify
their own configuration file.)
1994-09-26 22:45:10 +00:00
Garrett Wollman
6d59cf8ef2 Fixed YP networks map support. 1994-09-26 02:50:43 +00:00
Paul Traina
8bdba3f880 remove need for -DDEBUG from resolver code (conflict with db/hash) 1994-09-25 17:45:41 +00:00
Paul Traina
1363f04ce1 get* rework and new bind code 1994-09-25 02:12:49 +00:00
Paul Traina
af2c9cfd5b Make iso_addr's output conform to modern conventions for NSAP
representation.  Original code by pst but ported in as part of
enhancements to BIND 4.9.2 and returned to Vixie.
1994-09-22 19:31:29 +00:00
Geoff Rehmet
d1f32ba5df Based on fix from 1.1.5.1:
>From: jtk@atria.com (John T. Kohl)
in rcmd:
It calls select() with a hardcoded "number of file descriptors" argument
of 32, rather than computing it based on the sockets about which it
cares.

- Now we work out the nfds arg, and do some error checking
Submitted by:	Geoff.
1994-09-08 20:55:02 +00:00
Geoff Rehmet
1ea8221717 Fix gethostbyaddr():
call _getdnsbyaddr() instead of _getdnsbyname() ;-)
Submitted by:	Geoff
1994-08-28 13:33:10 +00:00
Garrett Wollman
d669ce372d Fixed typo. 1994-08-09 22:44:12 +00:00
Garrett Wollman
b42815434e Add (substantially re-written) support for /etc/host.conf, and reintegrated
1.1.5 support for YP, fixing a bug in 1.1.5 that prevented YP from ever
working reliably.  (I'm amazed that there were no bug reports.)

IWBRNI someone could write a host.conf(5) manual page.  Please look at
the code before doing so; this version is somewhat more flexible in the
format of its input.
1994-08-09 20:23:14 +00:00
Garrett Wollman
2ceb2ce9ee First crack at making libc work with the new make macros. It compiles on
my machine, and a simple static (genassym) and shared (sysctl) executable
both work.  Still to be done: RPCand YP merge.
1994-08-05 01:19:12 +00:00
Rodney W. Grimes
58f0484fa2 BSD 4.4 Lite Lib Sources 1994-05-27 05:00:24 +00:00