freebsd-skq/lib/libc
Bill Paul a230877213 Make _yp_dobind() a litle smarter:
Now that we preserve RPC handles instead of rebuilding them each time
a ypcln function is called, we have to be careful about keeping our sockets
in a sane state. It's possible that the caller may call a ypclnt
function, and then decide to close all its file descriptors. This would
also close the socket descriptor held by the yplib code. Worse, it
could re-open the same descriptor number for its own use. If it then calls
another ypclnt function, the subsequent RPC will fail because the socket
will either be gone or replaced with Something Completely Different. The
yplib code will recover by rebinding, but it doing so it may wreck the
descriptor which now belongs to the caller.

To fix this, _yp_dobind() needs to label the descriptor somehow so
that it can test it later to make sure it hasn't been altered between
ypclnt calls. It does this by binding the socket, thus associating a port
number with it. It then saves this port number in the dom_local_port member
of the dom_binding structure for the given domain. When _yp_dobind() is
called again (which it is at the start of each ypclnt function), it checks
to see if the domain is already bound, and if it is, it does a getsockname()
on the socket and compares the port number to the one it saved. If the
getsockname() fails, or the port number doesn't match, it abandons the
socket and sets up a new client handle.

This still incurs some syscall overhead, which is what I was trying to
avoid, but it's still not as bad as before.
1996-06-01 05:08:31 +00:00
..
amd64 Fix a bug caused by the collision of a local assembler label with another 1996-05-11 13:28:11 +00:00
compat-43 Added missing section numbers to a bunch of .Xr macros, or 1996-03-27 20:49:07 +00:00
db Close PR#218. Don't reference non-existant dbm(3) and ndbm(3) manual 1996-03-03 08:53:05 +00:00
gen add manpage links: 1996-05-29 00:57:19 +00:00
gmon Add support to enable libc to be compiled in ELF format. (#ifdef __ELF__) 1996-05-05 07:56:21 +00:00
i386 Fix a bug caused by the collision of a local assembler label with another 1996-05-11 13:28:11 +00:00
locale Fixed longstanding namespace convolution involving rune_t vs wchar_t. 1996-05-01 00:40:10 +00:00
net Improve NIS performace of getservbyname() and getservbyport(). Both these 1996-06-01 04:40:42 +00:00
nls Fixed docs/521. 1996-02-09 12:25:08 +00:00
quad Added prototypes. 1995-12-26 13:25:13 +00:00
regex 8bit clean fixes 1996-03-25 14:34:26 +00:00
rpc Work around a bug in the Sun rpc code. This fixes a problem where 1996-03-17 20:12:53 +00:00
stdio Fix bogus MLINKS line from vasprintf change. 1996-05-29 05:00:12 +00:00
stdlib Fixed various problems: typos, grammer, missing include files 1996-05-23 01:05:25 +00:00
stdtime Removed false copyrights... 1996-05-27 06:54:03 +00:00
string `mv'' -> `mv -f'' 1996-05-07 23:19:49 +00:00
sys Use ld -O insted of ld -o + mv. 1996-05-28 16:24:53 +00:00
xdr Minor cleanup of the rpc man pages to silence manck. 1996-02-12 00:02:42 +00:00
yp Make _yp_dobind() a litle smarter: 1996-06-01 05:08:31 +00:00
Makefile Remove support for OSI networking in user-land (#ifdef OSI aor CCITT) 1996-02-06 20:36:15 +00:00