Commit Graph

366 Commits

Author SHA1 Message Date
ume
1d4536a059 - kill strcpy
- port range check need to be done before htons.  from deraadt
- %d/%u audit
- correct bad practice in the code - it uses two changing variables
  to manage buffer (buf and buflen).  we eliminate buflen and use
  fixed point (ep) as the ending pointer.
- use snprintf, not sprintf
- pass correct name into q.name.  from lukem@netbsd
- sync comment

Obtained from:	KAME
MFC after:	1 week
2002-10-25 16:24:28 +00:00
ume
ba20c3c6e3 query ip6.arpa then ip6.int for IPv6 reverse lookup. follows RFC3152.
Obtained from:	KAME
MFC after:	1 week
2002-10-23 10:45:09 +00:00
ume
7e81d9c889 Put giant locks due to make getaddrinfo(), getnameinfo()
and getipnodeby*() thread-safe.
Our res_*() is not thread-safe.  So, we share lock between
getaddrinfo() and getipnodeby*().  Still, we cannot use
getaddrinfo() and getipnodeby*() in conjunction with other
functions which call res_*().

Requested by:	many people
2002-10-06 08:43:35 +00:00
ume
6448ec6d62 Allocate 64K recieve buffer for DNS responses.
Though res_query.c also defines and refers MAXPACKET, it is not
related to ansbuf.  So, I didn't touch res_query.c.
2002-10-03 17:25:33 +00:00
mike
86a758e51b Use the standardized CHAR_BIT constant instead of NBBY in userland. 2002-09-25 04:06:37 +00:00
nectar
d3b3a2b79b Add forgotten newlines in debug messages. 2002-09-19 11:36:47 +00:00
ume
c18a6ce242 Allocate 64K recieve buffer for DNS responses. 2002-09-16 13:19:47 +00:00
ume
9c29b64177 Allocate 64K recieve buffer for DNS responses.
KAME did the modification only to _dns_getaddrinfo().  However,
it is not sufficient, and res_queryN() should be modified, too.
So, I did same modification to res_queryN().

Obtained from:	KAME
2002-09-15 20:36:38 +00:00
nectar
b44001f0c3 Check for truncation in calls to res_send/res_query/res_search.
Fail when it is detected.
2002-09-15 16:51:09 +00:00
nectar
a0732e9360 Backout the increase of MAXPACKET from 1024 to 65536: it
broke pthreads.

Reported by:	mbr, tjr
2002-09-15 04:23:20 +00:00
ume
db96f2a540 Limit UDP payload size for EDNS0 to 0xffff, not use lower 16bit value.
Obtained from:	KAME
2002-09-14 17:28:40 +00:00
nectar
57c8809640 When using res_send/res_query/res_search, the caller must either
insure enough space is available for the response, or be prepared
to resize the buffer and retry as necessary.

Do the conservative thing and make sure enough space is available.

Reviewed by:	silence on freebsd-audit
2002-09-13 20:31:29 +00:00
tjr
cd5ca96599 Style: One space between "restrict" qualifier and "*". 2002-09-06 11:24:06 +00:00
charnier
4966efff7b Replace various spelling with FALLTHROUGH which is lint()able 2002-08-25 13:10:45 +00:00
jdp
5e4153d486 Fix a bug in __ivaliduser_sa() which caused some rsh/rlogin attempts
to fail needlessly if a reverse DNS lookup of the IP address didn't
come up with a hostname.  As a comment in the code clearly stated,
the "damn hostname" was looked up only for the purpose of netgroup
matching.  But if that lookup failed, the function bailed out
immediately even though in many cases netgroup matching would not
be used.

This change marks the hostname as unknown but continues.  Where
netgroup matching is performed, an unknown hostname is handled
conservatively.  I.e., for "+@netgroup" (accept) entries an unknown
hostname never matches, and for "-@netgroup" (reject) entries an
unknown hostname always matches.

In the lines affected (only), I also fixed a few bogus casts.  There
are others, and in fact this entire file would be a good candidate
for a cleanup sweep.

Reviewed by:	imp (wearing his flourescent yellow Security Team cap)
MFC after:	2 days
2002-08-24 17:37:42 +00:00
pirzyk
ee1c2cc721 Fixed getaddrinfo to honor sortlist in /etc/resolv.conf
PR:		bin/27939
Reviewed by:	ru, sheldonh (about a year ago)
Obtained from:	ume (via KAME, I think)
MFC after:	1 month
2002-08-21 19:57:53 +00:00
robert
fe770f50bf - Fix a bug that wrote one char behind the end of the
supplied buffer in case the size of it was equal to
   the number of characters the converted address consumed.
   The bug occurred when converting an AF_INET address.
 - Remove the SPRINTF macro and use sprintf instead.
 - Do not do string formatting using sprintf(3) and a
   temporary buffer which is copied when the supplied
   buffer provides enough space.  Instead, use snprintf(3)
   and the real destination buffer, thus avoid the copy.

Reported by:	Stefan Farfeleder <e0026813@stud3.tuwien.ac.at> (1)
PR:		misc/41289
2002-08-15 21:19:31 +00:00
robert
62a0b60a38 Put each function argument on its own line to keep lines shorter
than 80 columns.
2002-08-15 20:33:44 +00:00
robert
af770662f5 -Add the restrict required by IEEE Std 1003.1-2001 in form
of our __restrict macro to the prototypes and function
   definitions of inet_pton and inet_ntop.
 - Use ANSI-C function argument lists.
 - Adjust the prototypes in the manual page.
2002-08-14 20:40:35 +00:00
ru
6d9dd3b557 mdoc(7) police: laundry. 2002-08-09 11:15:49 +00:00
mux
08d325ca81 Remove an #include <syslog.h>. It's already included conditionally
above, as it should be.

Submitted by:	Olivier Houchard <cognet@ci0.org>
2002-08-02 11:58:48 +00:00
ume
4b45c00ba2 sysctl(NET_RT_IFLIST) up to several (currently 5) times.
This will make the behavior robuster if many addresses are added
after the size estimation of storage at the first sysctl.

Reviewed by:	JINMEI Tatuya <jinmei@isl.rdc.toshiba.co.jp>
MFC after:	1 week
2002-07-25 08:08:30 +00:00
ume
11795efea7 - ntohs() returns unsigned value.
- use strlcpy.
- snprintf can return negative value, so cope with it.
- tweak interface index on interface locals (ff01::/16).
- removed unused macros.
- removed a macro that uses only once (in a trivial context).
- explicitly say goodbye to ENI_xxx.
- constify struct afd.

Obtained from:	KAME
MFC after:	1 week
2002-07-24 18:58:32 +00:00
ume
c95ccb75f4 Use BSDi derived if_nametoindex(), if_indextoname(), if_nameindex()
and if_freenameindex().

Obtained from:	KAME
MFC after:	2 weeks
2002-07-15 19:58:56 +00:00
robert
4c9a1c63b4 Fix syntax error which occurred when LIBC_SCCS was defined. 2002-07-07 11:28:28 +00:00
ume
ddbac8e311 Make NI_WITHSCOPEID a default (always on), to synchronize
with recent 2553bis.

Obtained from:	KAME
MFC after:	3 weeks
2002-07-02 11:05:31 +00:00
imp
c8f207f89f Remove two lines that were cvs merged that shouldn't have been. This
fixes the build.

Reported by: dillon.
2002-06-26 18:03:31 +00:00
imp
de4e8e7ae4 Remove two stray lines that snuck in the cvs merge 2002-06-26 14:18:36 +00:00
nectar
a5964e51a5 Initialize a pointer that was left uninitialized with the previous
commit.
2002-06-26 08:48:34 +00:00
imp
8df35cae59 Include more robust checking of end of buffer that more completely
plugs the hole.
2002-06-26 08:18:05 +00:00
imp
d36b92c7bb Don't allow buffer overflow here either. 2002-06-26 06:31:06 +00:00
imp
3eb1b04697 Fix a minor last, minute issue that came in after I committed.
Noticed by: nectar
2002-06-26 06:23:22 +00:00
imp
2bbf857de4 Avoid remote buffer overflow on hostbuf[].
Submitted by: joost Pol <joost@pine.nl>
2002-06-26 06:04:46 +00:00
sheldonh
5607249aab Correct FreeBSD release of first appearance in the HISTORY section
(5.0 -> 4.6).
2002-06-06 10:51:25 +00:00
alfred
1ee311b26d Assume __STDC__, remove non-__STDC__ code.
Submitted by: keramida
2002-05-28 17:03:12 +00:00
mike
759ec3782f Document that <netinet/in.h> can also provide prototypes. Change
wording related to standards conformance.
2002-05-11 23:22:54 +00:00
suz
553226e8e1 just merged cosmetic changes from KAME to ease sync between KAME and FreeBSD.
(based on freebsd4-snap-20020128)

Reviewed by:	ume
MFC after:	1 week
2002-04-19 04:46:24 +00:00
ume
31dc2e2cc4 Add awareness of an IPv6.
MFC after:	1 week
2002-04-15 18:45:20 +00:00
nectar
1f91e94116 Quoting log message for OpenBSD rev 1.7:
``Tack on MagniComp (BSD) license since this originally came from rdist.''

Obtained from:	OpenBSD
2002-04-15 12:46:07 +00:00
ru
b2401764d7 Fix style of ether_ntoa(). 2002-04-08 07:51:10 +00:00
ru
c711dcdf85 Polish previous revision. 2002-04-06 09:54:17 +00:00
dillon
930f8eb170 Fix ether_ntoa() to generate the %02x format people expect, instead of %x,
for the ethernet address.

MFC after:	1 day
2002-04-06 05:21:57 +00:00
ume
121ff2ebbe When _kevent() returns with errno = EINTR and timeout is not
exceeded, it should be falldown to next_ns.

MFC after:	1 week
2002-04-01 16:09:45 +00:00
obrien
b1189e8930 Fix the style of the SCM ID's.
I believe have made all of libc .h's as consistent as possible.
2002-03-22 23:42:05 +00:00
obrien
d90536e35b Fix the style of the SCM ID's.
I believe have made all of libc .c's as consistent as possible.
2002-03-22 21:53:29 +00:00
obrien
e2881f49cc Remove multi-line __P() usage. 2002-03-22 09:22:15 +00:00
obrien
3b73ce2319 Remove __P() usage. 2002-03-21 22:49:10 +00:00
obrien
1196344bb3 Remove 'register' keyword. 2002-03-21 18:49:23 +00:00
obrien
fee9a30a85 Remove trailing characters from #endif.
Actually this #endif is not needed, so remove leading characters also.
2002-03-15 09:58:45 +00:00
eric
ad9d9dfa1a Add a carriage return to each function declaration, and make use of ID tag
macros.

MFC after:	1 day
2002-03-06 03:26:11 +00:00