Commit Graph

220 Commits

Author SHA1 Message Date
Jason Evans
9233c4d942 Simplify sytem call renaming. Instead of _foo() <-- _libc_foo <-- foo(),
just use _foo() <-- foo().  In the case of a libpthread that doesn't do
call conversion (such as linuxthreads and our upcoming libpthread), this
is adequate.  In the case of libc_r, we still need three names, which are
now _thread_sys_foo() <-- _foo() <-- foo().

Convert all internal libc usage of: aio_suspend(), close(), fsync(), msync(),
nanosleep(), open(), fcntl(), read(), and write() to _foo() instead of foo().

Remove all internal libc usage of: creat(), pause(), sleep(), system(),
tcdrain(), wait(), and waitpid().

Make thread cancellation fully POSIX-compliant.

Suggested by:	deischen
2000-01-27 23:07:25 +00:00
Yoshinobu Inoue
cee587ab27 Allow reverse lookup for loopback addr.
This is merge from recent KAME fix to be more compliant with RFC2553.

Obtained from: KAME project
2000-01-27 13:00:14 +00:00
Yoshinobu Inoue
ae42b66633 Removed 3rd arg from bindresvport_sa() call, because the 3rd arg have been
already removed.

Specified by: Philipp Mergenthaler <un1i@rz.uni-karlsruhe.de>
2000-01-26 14:13:41 +00:00
Yoshinobu Inoue
469bed11ef bindresvport related changes
-changed bindresvport2 to bindresvport_sa
 -merged the man into bindresvport.3

All discussion between Jean-Luc Richier <Jean-Luc.Richier@imag.fr>,
Theo de Raadt <deraadt@cvs.openbsd.org>, itojun, is reflected to
this code. (Actually Theo de Raadt write the code simultaneously as the
discussion change.)
2000-01-26 09:02:42 +00:00
Yoshinobu Inoue
00a8a57954 Fix getaddrinfo() behaviour to be more compliant with RFC2553. Patches are
obtained from itojun.
  -don't filter address families which are not supported by system at
   FQDN resolving.
  -don't do reverse lookup

I think I checked all lib and tools which use getaddrinfo() if
this change affect them.

Obtained from: KAME project
2000-01-26 08:37:29 +00:00
Yoshinobu Inoue
0cac72f42c several tcp apps IPv6 update
-inetd
 -rshd
 -rlogind
 -telnetd
 -rsh
 -rlogin

Reviewed by: freebsd-arch, cvs-committers
Obtained from: KAME project
2000-01-25 14:52:10 +00:00
Yoshinobu Inoue
42b4f28ebd libc rcmd update for IPv6.
A new function bindresvport2(), AF independent version of bindresvport()
is also added.

Reviewed by: sumikawa
Obtained from: KAME project
2000-01-13 15:09:48 +00:00
Yoshinobu Inoue
3d670abcc1 added IPv6 unspecified addr check for getipnodebyaddr. 2000-01-13 05:47:11 +00:00
Yoshinobu Inoue
3a0c1bfb5d added IPv4 mapped IPv6 addr consideration for getaddrinfo() reverse lookup case 2000-01-13 05:37:51 +00:00
Jason Evans
929273386f Add three-tier symbol naming in support of POSIX thread cancellation
points.  For library functions, the pattern is __sleep() <--
_libc_sleep() <-- sleep().  The arrows represent weak aliases.  For
system calls, the pattern is _read() <-- _libc_read() <-- read().
2000-01-12 09:23:48 +00:00
Bruce Evans
d1b50a3da8 Fixed missing include in synopsis.
Use long lines instead of lines split with backslash-newline in synopsis.
My synopsis checker doesn't understand backslash-newline.
2000-01-05 19:02:14 +00:00
Bruce Evans
6e79d3e367 Fixed missing include in synopsis. 2000-01-05 18:54:37 +00:00
Robert Watson
7ea38f3479 Suppress vast quantities of unneeded warnings spewed by libc's gethostbydns
on encountering a real-world SIG record during a lookup of another type.

PR:		bin/7352
Reviewed by:	peter, eivind
1999-12-28 07:21:08 +00:00
Yoshinobu Inoue
9b59fde4e0 Small bug fix and improvements
(1)added error check of if_nameindex() return value at getaddrinfo().
  (2)print out more detailed information when getaddrinfo() error value
     is EAI_SYSTEM.(in this case system error num is kept in errno)

(1) is Discovered by: jinmei@kame.net in KAME environment.
1999-12-28 05:37:39 +00:00
Yoshinobu Inoue
7d56d3747c Getaddrinfo(), getnameinfo(), and etc support in libc/net.
Several udp and raw apps IPv6 support.

Reviewed by: freebsd-arch, cvs-committers
Obtained from: KAME project
1999-12-28 02:37:14 +00:00
Peter Wemm
0ba6f08f0a Make this compile with -Wall -Werror 1999-12-27 08:40:40 +00:00
Bruce Evans
6785844d79 Fixed missing includes in synopsis. 1999-12-23 16:38:51 +00:00
Yoshinobu Inoue
05a244b407 KAME 4th patch
IPv6 specific library functions addition.
(getnameinfo(), getaddrinfo(), and IPv6 transport support is not yet)

Reviewed by: freebsd-arch, cvs-committers
Obtained from: KAME project
1999-12-16 18:32:01 +00:00
Andrey A. Chernov
deee919e7e Add unsigned char cast to isalpha 1999-11-04 05:01:28 +00:00
Andrey A. Chernov
fbc8d502c5 Add unsigned char cast to is[x]digit 1999-11-04 04:52:34 +00:00
Andrey A. Chernov
3fb85bff81 unsigned char cast to ctype macros 1999-11-04 04:35:33 +00:00
Andrey A. Chernov
9ea99d349b Add unsigned char cast to ctype macros arg 1999-11-04 04:30:44 +00:00
Brian Feldman
433a027b0e Fix a really lame buglet which broke with IPs of 34
(ERANGE...)
1999-11-03 04:18:34 +00:00
Brian Feldman
8308463eba Allow whitespace termination. Internal use of /etc/resolv.conf relies
on this, and who knows what else would, too...
1999-10-31 04:43:55 +00:00
Brian Feldman
28585846d6 This is the new inet_addr/inet_aton with proper error checking. This
should close all outstanding PRs on incorrect inet_aton behavior, and
since it has a decent parsing routine, doesn't allow some hysterically
working behavior.

PR:		13628
Submitted by:	Adrian Chadd <adrian@FreeBSD.org>
1999-10-31 04:07:56 +00:00
Peter Wemm
1ce6e9e1c5 Back out my backout, it was already posix compliant. Any new fields are
required to be "announced" by a new bit in sa_flags to indicate the
program is aware of and has taken care of them.  eg: SA_SIGINFO means
the program has used the sa_siginfo field (versus sa_handler).
1999-09-28 16:58:46 +00:00
Peter Wemm
cde8d55a02 Fix previous commit. The standards specifically say: "The structure
sigaction, used to describe an action to be taken, is defined in the
header <signal.h> to include at least the following members:"
                             ^^^^^^^^
A sigaction defined on stack with essentially random contents may have
just about anything underneath fields that the program doesn't know about.
It is not safe to delete the bzero.
1999-09-28 15:40:17 +00:00
Marcel Moolenaar
06ceca4d89 Explicitly use sigemptyset to clear a sigset_t. Explicit
initialization of sa_flags allows us to lose the bzero.
1999-09-28 13:26:11 +00:00
Alexey Zelkin
aec5b6f6af Fix typo
PR:		docs/13814
Submitted by:	Alex Vasylenko <lxv@mix.nest.org>
1999-09-19 17:57:35 +00:00
Peter Wemm
7f3dea244c $Id$ -> $FreeBSD$ 1999-08-28 00:22:10 +00:00
Nik Clayton
fbc400a67a Add $Id$, to make it simpler for members of the translation teams to
track.

The $Id$ line is normally at the bottom of the main comment block in the
man page, separated from the rest of the manpage by an empty comment,
like so;

     .\"    $Id$
     .\"

If the immediately preceding comment is a @(#) format ID marker than the
the $Id$ will line up underneath it with no intervening blank lines.
Otherwise, an additional blank line is inserted.

Approved by:            bde
1999-07-12 20:50:10 +00:00
Dmitrij Tejblum
141894af60 Ensure that host_addr (which is returned in struct hostent::h_addr_list[0])
is aligned so that pointer to it can be safely casted to struct in_addr *.
1999-06-07 16:30:27 +00:00
Peter Wemm
f05a568074 Change an internal variable from "class" to "ns_class" for C++'s benefit.
Apparently BIND-8.2.1 uses ns_class.

Submitted by: John Plevyak <jplevyak@inktomi.com>
1999-06-04 22:38:27 +00:00
Guy Helmer
42b47d96f0 Mention that getservbyport requires its port parameter to be in
network byte order.

PR:		docs/9376
1999-03-02 02:34:23 +00:00
Alexander Langer
43d1df332e Removed occurrences of consecutive repeated words (such as "the the"). 1999-02-12 02:12:08 +00:00
Andrew Gallatin
f0f3d5af23 gethostbyname2() was broken for lookups via NIS on FreeBSD/alpha
due to _gethostbynis() setting h.h_length to sizeof(u_long), which
works out to 8 on alphas.  And 8!= NS_INADDRSZ.
1999-01-25 03:26:45 +00:00
Doug Rabson
e0ce825e94 64bit portability fixes.
Submitted by: Andrew Gallatin <gallatin@cs.duke.edu>
1998-10-05 18:35:04 +00:00
Warner Losh
b8a328fc74 o use strncpy safely
o Only allow options and domain name to be set when we aren't running
  setuid.

Obtained from: OpenBSD
1998-09-14 21:13:06 +00:00
John Polstra
cb690d1f0b Implement the weak aliases for private entry points in the inet_*
and res_* modules in a way that works for ELF.  I moved the aliases
out of res_stubs.c and into the individual modules where the entry
points are defined.  Weak aliases don't work in ELF unless that is
the case.  (Actually, I'm surprised it worked for a.out.)

This should fix the undefined "inet_addr" and related symbols in
various applications that fail to include <arpa/inet.h> or
<resolv.h> as they are supposed to do.
1998-09-02 00:53:17 +00:00
Bruce Evans
90afb6a523 Fixed bitrot in prototypes in synopsis. 1998-08-03 17:52:27 +00:00
Bruce Evans
a7f8e53079 Fixed printf format errors. 1998-06-30 17:30:22 +00:00
Peter Wemm
02a93d74e0 Don't compile in the use of poll() when building libc_r. This isn't
so much a "fix", rather a bandaid to buy time to fix it properly
within the thread engine.
1998-06-14 11:25:46 +00:00
Peter Wemm
14b93edab3 Update the resolver parts to bind-8.1.2 level. I have not touched the
getXXXXbyYYYY() interfaces yet.

Obtained from: diff relative to bind-8.1.2 sources
1998-06-11 09:03:02 +00:00
Joseph Koshy
9c727d2ca9 Spelling corrections.
PR: 6868
Submitted by: Josh Gilliam <josh@quick.net>
1998-06-06 05:50:53 +00:00
Peter Wemm
9e39714518 Resolve some unexpected differences when comparing with the 2.2 version.
One bug was relatively harmless (select's timeout had an uninitialized
tv_usec), the other I'm not so sure.. (neglected to catch select returns
less than zero).  Both of these were irrelevant on kernels with poll().
1998-05-02 15:51:54 +00:00
Peter Wemm
c8d2fd6da8 Update libc dns code to 4.9.7-T1B level. This involved chopping out large
chunks of res_comp.c and replacing it with chunks of bind-8.1.1's resolver
code.  (There are no interface changes though)
The other parts are better bounds checking related.
1998-05-02 13:11:02 +00:00
Bruce Evans
c7091c3117 (Ab)use .Vt instead of .Fd for a variable declaration. 1998-03-23 13:05:07 +00:00
Philippe Charnier
a5941fc2aa .Sh AUTHOR -> .Sh AUTHORS. Use .An/.Aq 1998-03-19 07:34:22 +00:00
John Birrell
0107877e04 Change MACHINE references to MACHINE_ARCH. 1998-02-20 08:23:55 +00:00
John Birrell
4439d165b7 Add #include <string.h> to get prototypes. 1998-02-20 08:13:51 +00:00
Bruce Evans
c7b367098d Fixed #includes in the synopsis and in an example. <sys/socket.h>
isn't a prerequisite, since it isn't required for the prototypes
and isn't always needed to call the functions (the address family
might be a variable).
1998-01-20 11:03:15 +00:00
Warner Losh
3c8e19e155 handle long usernames more carefully
Reviewed by:	guido
Obtained from:	OpenBSD (Theo de Raadt)
1998-01-07 00:28:36 +00:00
Alexander Langer
3b7c07b1f2 Removed unnecessary initialization of hp in gethostbyaddr_r. 1997-12-25 04:21:08 +00:00
Bruce Evans
b966cc2394 Sorted lists. 1997-10-21 08:41:15 +00:00
Bruce Evans
2bc3b4d735 Removed the subdirectory paths from the definitions of MAN[1-9]. They
were a workaround for limitations in bsd.man.mk that were fixed about
2 years ago.
1997-10-15 16:16:41 +00:00
Peter Wemm
9e06e6da51 Some adjustments for the resolver use of poll(). For some reason I thought
an unimplemented syscall returned ENOSYS, rather than EINVAL.  I have run
statically linked code with this wrapper and it does appear to work fine
on 2.2-stable which doesn't have poll().  ktrace shows the poll syscall fail
once and the fallback to select() working.
1997-09-16 06:03:54 +00:00
Peter Wemm
535db1806c Call poll(2) from within the resolver but adapt to older kernels without it
if necessary.  This removes the need to malloc large fd_set's for selecting
on high fd's (larger than FD_SETSIZE at libc compile time).

The syscall adaptive stuff only happens on the very first call.  SIGSYS
is masked, and if the call to poll fails with ENOSYS, then we use select
for the life of the program.  If poll does not fail with ENOSYS, then we
always use poll and skip the once-off signal masking gunk.

This may be overkill, but it saved my neck a few times while working on
multiple different sets of kernel sources, some with poll, some without.
1997-09-14 09:44:34 +00:00
Brian Somers
a367bd9e25 Add "options no_tld_query" to resolv.conf.
Mention the capability in resolver(5).
Mention that RES_OPTIONS can be used in resolver(5).
Discussed with: -hackers
1997-09-01 01:19:23 +00:00
Peter Wemm
65b3003d2d kill the undead 1997-07-13 14:26:00 +00:00
Bruce Evans
362c392f0b This commit was generated by cvs2svn to compensate for changes in r27180,
which included commits to RCS files with non-trunk default branches.
1997-07-03 03:28:27 +00:00
Bruce Evans
5500fdcd4f Import Lite2's src/lib, except for non-i386 machine-dependent directories,
libc/db, libc/gen/crypt.* and libtelnet.  All affected files except 3
unimportant ones have already left the vendor branch.
1997-07-03 03:28:27 +00:00
Peter Wemm
1e7aa4e938 replace the OpenBSD fd_set sizing code with something more efficient.
Only call malloc() if the fd is too big for the compiled in fd_set size,
and don't use calloc either.  This should reduce the impact of conflicts
with private malloc implementations etc.  When using the fd_set on the
stack, only zero what is needed rather than all 1024 bits like FD_ZERO did.
1997-06-28 04:19:52 +00:00
Peter Wemm
d2346017f0 Dynamically size fd_set in select rather than fail if too many files
are open.
Obtained from: OpenBSD; by deraadt and dm
1997-06-27 13:00:51 +00:00
Peter Wemm
fa0913efdb compensate for res_send <-> __res_send changes 1997-06-27 08:35:13 +00:00
Peter Wemm
6c5aff806e Merge in bind-4.9.6 resolver changes. Note that they resolve the
overflow problem differently.
1997-06-27 08:22:03 +00:00
Philippe Charnier
577b61c645 Typo. 1997-06-18 06:26:13 +00:00
Andrey A. Chernov
a14d48e67b Add MAXHOSTNAMELEN check
Obtained from: OpenBSD
1997-06-13 19:21:54 +00:00
John Birrell
870039320f Changed all paths to be relative to src/lib instead of src/lib/libc
so that all these makefiles can be used to build libc_r too.

Added .if ${LIB} == "c" tests to restrict man page builds to libc
to avoid needlessly building them with libc_r too.

Split libc Makefile into Makefile and Makefile.inc to allow the
libc_r Makefile to include Makefile.inc too.
1997-05-03 03:50:06 +00:00
Bruce Evans
1eda21cbb6 Fixed #include and/or prototype bugs in synopsis. 1997-04-13 13:26:42 +00:00
Warner Losh
79d71652cf If we're running setuid/setguid then don't open the host alias file to
prevent information leakage.

Closes PR 2578

Submitted by:	Julian Assange
1997-03-24 06:11:44 +00:00
Bruce Evans
433671e348 Fixed missing #include of <sys/types.h> and wrong arg types in synopsis.
Reviewed by:	wollman
1997-03-19 19:41:20 +00:00
Bruce Evans
3ce29386aa Fixed missing function types in synopsis. 1997-03-19 00:32:42 +00:00
Peter Wemm
beb9f61579 Fix problem with FD_SET* overflow reporting.. Perror() didn't have enough
args, and errno hasn't actually been set so it probably doesn't make sense
to report it via strerror().

Pointed out by: bde
1997-03-12 11:10:54 +00:00
Peter Wemm
9547ea9f3a _res_close() -> res_close()
Pointed out by: bde
1997-03-12 11:02:00 +00:00
Guido van Rooij
1ab96f9344 Check for overflow of FD_SET 1997-03-10 19:32:46 +00:00
Mike Pritchard
6e11b43020 getnetbyaddr now takes an unsigned long as its first argument. 1997-02-28 06:28:53 +00:00
Warner Losh
2a62f02315 Buffer overflow from DNS name information which could cause root access
when called from lpd.

Reviewed by:	jkh, pst
Submitted by:	Oliver Friedrichs <oliver@secnet.com>
1997-02-26 06:12:34 +00:00
Peter Wemm
7e546392b5 Revert $FreeBSD$ to $Id$ 1997-02-22 15:12:41 +00:00
Warner Losh
5480d8d5c2 Fix PR2579: potential security hole in rcmd.c
Submitted by:	Julian Assange
1997-02-09 06:54:46 +00:00
Mike Pritchard
453196eb04 Update to reflect current include files. 1997-01-30 23:10:32 +00:00
Wolfram Schneider
75141cc987 Sort cross references. 1997-01-20 23:23:22 +00:00
Jordan K. Hubbard
1130b656e5 Make the long-awaited change from $Id$ to $FreeBSD$
This will make a number of things easier in the future, as well as (finally!)
avoiding the Id-smashing problem which has plagued developers for so long.

Boy, I'm glad we're not using sup anymore.  This update would have been
insane otherwise.
1997-01-14 07:20:47 +00:00
Andrey A. Chernov
07a7a2c487 Fix fake failures on the short names which looks like hexadecimal numbers
Submitted by: paul@vix.com
1997-01-08 13:06:14 +00:00
Andrey A. Chernov
64cf8d66e2 Disable isxdigit block until proper solution will be found
isxdigit(name[0]) gives false failures on short names which looks
like hexadecimal digits, f.e. "fade", "babe", "d133", etc.
1997-01-05 17:26:09 +00:00
Jordan K. Hubbard
b355f69744 Remove bogus weak reference. 1997-01-01 11:03:44 +00:00
Peter Wemm
8c675e8051 Tempt fate! 'cvs add' a file remotely which also exists in the Attic on
RELENG_2_2!

This is part#2 of the previous commit to src/lib/libc/net to contain the
potential damage.

This provides stubs so that binaries linked in 2.2 will run on 3.0
1996-12-30 13:25:38 +00:00
Peter Wemm
ca785773f6 Here goes.. Bring the 4.9.5-P1 resolver into -current. This has the
DNSSEC stuff, among other things.  There are also some renamed functions,
I've left out the res_stubs.c from this commit in case cvs bombs out..
1996-12-30 13:18:48 +00:00
Bill Paul
3951b8e32c Small yet significant tweaks/cleanups:
- getservent:
  o put _yp_check() proto under #ifdef YP where it belongs
  o local YP buffers should be YPMAXRECORD + 2 bytes long and should
    be NUL terminated after copying

- gethostbynis:
  o local YP buffer should be YPMAXRECORD + 2 bytes long

- getnetbynis:
  o local YP buffer should be YPMAXRECORD + 2 bytes long and should
    be NUL terminated after copying

- ether_addr:
  o local YP buffers should be YPMAXRECORD + 2 bytes long and should
    be NUL terminated after copying (in this case it's BUFSIZ + 2 bytes,
    but it happens that BUFSIZ == YPMAXRECORD.

- gethostbydns:
  o nuke stray 'return(NULL)' in __dns_getanswer() (harmless but looks silly)

These are 2.2 candidates. I will wait a few days to make sure these don't
break anything and then, if there are no objections, move them to the 2.2
branch.
1996-12-27 18:21:07 +00:00
Bill Paul
f360d1effe Another one-liner: remember to NUL terminate local copy of NIS host
lookup results. Without this, doing multiple host/addr lookups in a
single process yeilds strange results (the buffer is static, and
garbage may be left behind from previous lookups).

I just noticed this in 2.2-BETA. Unless somebody threatens to chop my
hands off with an axe, I'm going to move this to the 2.2-RELENG branch
shortly.
1996-12-24 17:01:49 +00:00
Bill Paul
6b73680dcf Make the __dns_getanswer() wrapper work right. For the newer versions
of BIND, we need to tweak some things to that gethostanswer() knows
whether or not we're dealing with an IPv4 or IPv6 address. (This'll
teach me to use a 2.1.0 system for NIS development -- but it's so nice
and stable I just can't being myself to upgrade it. :)
1996-12-24 02:10:24 +00:00
Wolfram Schneider
13608f6661 comma typos 1996-12-23 23:09:55 +00:00
Bill Paul
ce8bac1e6d Add __dns_getanswer() hook to allow access to the gethostanswer()
functions from outside libc. (Needed for async DNS resolver in ypserv.)
1996-12-22 22:05:43 +00:00
Mike Pritchard
487990280d Correct some xrefs/mlinks. 1996-12-14 23:27:20 +00:00
Joerg Wunsch
b784c223ee Fix the fix.
Pointed out by:	wollman, bde
1996-12-13 13:31:12 +00:00
Joerg Wunsch
4d224b7f55 Fix an embarassing and rather obscure incarnation of an uninitialized
local variable use.

Found by:	actually using ascii2addr() :-/
1996-12-12 21:21:11 +00:00
Garrett Wollman
13629194a5 Get struct ether_addr directly from <net/ethernet.h> rather than pulling
in lots of unrelated junk from <net/if.h> and <net/if_ether.h>.  These
functions still aren't prototyped anywhere (but should be in
<net/ethernet.h>---got that, Bill?).
1996-12-10 17:19:11 +00:00
Jordan K. Hubbard
380577b434 I asked Bill Paul why _getnetbynis() was only being called with 2 parameters,
and he said:

	The 3rd agrument is new; looks like it was part of the upgrade to
	a new BIND with some IPv6 support. The third argument here should be
	AF_INET. In order for it to be anything else, I'd have to add new
	NIS functions to support IPv6 lookups. I don't even know what those
	look like yet.

So there ya go, add AF_INET as the 3rd argument to the call.

Submitted-by: wpaul
1996-12-06 00:12:31 +00:00
Jordan K. Hubbard
2696fe9c84 Remove more instances of passing arrays by address when they should
have simply been passed as arrays.  In some cases, casts had even
been added to remove the warnings generated by such misuse!  Aieee!
1996-12-05 18:46:19 +00:00
Jordan K. Hubbard
afb5b8ed4d Eliminate 3 more examples of gratutiously passing arrays by address.
Everyone please call ParaSoft today and say "I will buy 57 copies of
Insure++ tomorrow, but first I want a FreeBSD version." :-)
1996-12-05 18:41:35 +00:00
Peter Wemm
c293d821b3 Doc updates and cleanups made with the bind-4.9.4 update some time ago.
I thought I had committed these, but it seems not.
1996-11-01 06:29:00 +00:00