<feed xmlns='http://www.w3.org/2005/Atom'>
<title>src/lib/libc/yp, branch release/2.2.2</title>
<subtitle>FreeBSD source tree</subtitle>
<link rel='alternate' type='text/html' href='http://cgit.freebsd.org/src/'/>
<entry>
<title>Merge from -current: sanity checks on domain names.</title>
<updated>1997-04-10T20:29:35+00:00</updated>
<author>
<name>Bill Paul</name>
<email>wpaul@FreeBSD.org</email>
</author>
<published>1997-04-10T20:29:35+00:00</published>
<link rel='alternate' type='text/html' href='http://cgit.freebsd.org/src/commit/?id=7aca2d6d19a411b7a9e34bc17f1f15c84d9e2927'/>
<id>7aca2d6d19a411b7a9e34bc17f1f15c84d9e2927</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>&gt;Date: Fri, 20 Dec 1996 11:46:33 -0800</title>
<updated>1996-12-21T18:17:42+00:00</updated>
<author>
<name>Bill Paul</name>
<email>wpaul@FreeBSD.org</email>
</author>
<published>1996-12-21T18:17:42+00:00</published>
<link rel='alternate' type='text/html' href='http://cgit.freebsd.org/src/commit/?id=d6aae7044589437c5f8c691b064102c9f5df3854'/>
<id>d6aae7044589437c5f8c691b064102c9f5df3854</id>
<content type='text'>
&gt;Message-ID: &lt;18736.851111193@time.cdrom.com&gt;
&gt;From: "Jordan K. Hubbard" &lt;jkh@time.cdrom.com&gt;
&gt;Status: O

&gt;Permission granted!

&gt;&gt; wpaul       96/12/20 11:41:16
&gt;&gt;
&gt;&gt;   Modified:    lib/libc/yp  yplib.c
&gt;&gt;   Log:
&gt;&gt;   Fix for bug noticed by Christoph Kukulies.
[file descriptors getting host by _yp_dobind()]
&gt;&gt;   This is basically a one-liner. Once I confirm that it fixes Christoph's
&gt;&gt;   problem, I'd like permission to put it in the 2.2-RELENG branch.

Target confirmed destroyed.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
&gt;Message-ID: &lt;18736.851111193@time.cdrom.com&gt;
&gt;From: "Jordan K. Hubbard" &lt;jkh@time.cdrom.com&gt;
&gt;Status: O

&gt;Permission granted!

&gt;&gt; wpaul       96/12/20 11:41:16
&gt;&gt;
&gt;&gt;   Modified:    lib/libc/yp  yplib.c
&gt;&gt;   Log:
&gt;&gt;   Fix for bug noticed by Christoph Kukulies.
[file descriptors getting host by _yp_dobind()]
&gt;&gt;   This is basically a one-liner. Once I confirm that it fixes Christoph's
&gt;&gt;   problem, I'd like permission to put it in the 2.2-RELENG branch.

Target confirmed destroyed.
</pre>
</div>
</content>
</entry>
<entry>
<title>Merge the fix from rev 1.25: sanity checks etc.</title>
<updated>1996-11-08T23:21:17+00:00</updated>
<author>
<name>Joerg Wunsch</name>
<email>joerg@FreeBSD.org</email>
</author>
<published>1996-11-08T23:21:17+00:00</published>
<link rel='alternate' type='text/html' href='http://cgit.freebsd.org/src/commit/?id=f85d01574b0e1f732a090922199da874b4f65955'/>
<id>f85d01574b0e1f732a090922199da874b4f65955</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>In _yp_dobind(), if we find ourselves required to contact the local ypbind</title>
<updated>1996-07-13T20:23:13+00:00</updated>
<author>
<name>Bill Paul</name>
<email>wpaul@FreeBSD.org</email>
</author>
<published>1996-07-13T20:23:13+00:00</published>
<link rel='alternate' type='text/html' href='http://cgit.freebsd.org/src/commit/?id=56d18eda29576ebcb8962f98cd852e4ce501892d'/>
<id>56d18eda29576ebcb8962f98cd852e4ce501892d</id>
<content type='text'>
directly in order to obtain binding information, check that the local
ypbind is using a reserved port and return YPERR_YPBIND if it isn't.
We should not trust any ypbind running on a port &gt;= IPPORT_RESERVED;
it may have been started by a malicious user hoping to trick us into
talking to a bogus ypserv.

Note that we do not check the ypserv port returned to us from ypbind.
It is assumed that ypbind has already done a reserved port test (or not,
depending on whether or not it was started with -s); if we trust the
authenticity of the local ypbind, we should also trust its judgement.

Obtained from: OpenBSD
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
directly in order to obtain binding information, check that the local
ypbind is using a reserved port and return YPERR_YPBIND if it isn't.
We should not trust any ypbind running on a port &gt;= IPPORT_RESERVED;
it may have been started by a malicious user hoping to trick us into
talking to a bogus ypserv.

Note that we do not check the ypserv port returned to us from ypbind.
It is assumed that ypbind has already done a reserved port test (or not,
depending on whether or not it was started with -s); if we trust the
authenticity of the local ypbind, we should also trust its judgement.

Obtained from: OpenBSD
</pre>
</div>
</content>
</entry>
<entry>
<title>General -Wall warning cleanup, part I.</title>
<updated>1996-07-12T18:57:58+00:00</updated>
<author>
<name>Jordan K. Hubbard</name>
<email>jkh@FreeBSD.org</email>
</author>
<published>1996-07-12T18:57:58+00:00</published>
<link rel='alternate' type='text/html' href='http://cgit.freebsd.org/src/commit/?id=51295a4d3e4c551df85249433c490208dc7fd23d'/>
<id>51295a4d3e4c551df85249433c490208dc7fd23d</id>
<content type='text'>
Submitted-By: Kent Vander Velden &lt;graphix@iastate.edu&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Submitted-By: Kent Vander Velden &lt;graphix@iastate.edu&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>Code clean up:</title>
<updated>1996-06-04T17:35:15+00:00</updated>
<author>
<name>James Raynard</name>
<email>jraynard@FreeBSD.org</email>
</author>
<published>1996-06-04T17:35:15+00:00</published>
<link rel='alternate' type='text/html' href='http://cgit.freebsd.org/src/commit/?id=ccbcef60f5398d103aa40055a030cf684bdb85d6'/>
<id>ccbcef60f5398d103aa40055a030cf684bdb85d6</id>
<content type='text'>
Changed type of pid from int to pid_t. (Missed one!)
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Changed type of pid from int to pid_t. (Missed one!)
</pre>
</div>
</content>
</entry>
<entry>
<title>Code clean up:</title>
<updated>1996-06-03T13:19:10+00:00</updated>
<author>
<name>James Raynard</name>
<email>jraynard@FreeBSD.org</email>
</author>
<published>1996-06-03T13:19:10+00:00</published>
<link rel='alternate' type='text/html' href='http://cgit.freebsd.org/src/commit/?id=e75ad74a88dcf0421f3a87655ac8395b76aaa291'/>
<id>e75ad74a88dcf0421f3a87655ac8395b76aaa291</id>
<content type='text'>
Changed type of pid from int to pid_t.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Changed type of pid from int to pid_t.
</pre>
</div>
</content>
</entry>
<entry>
<title>Code clean up:</title>
<updated>1996-06-03T13:16:53+00:00</updated>
<author>
<name>James Raynard</name>
<email>jraynard@FreeBSD.org</email>
</author>
<published>1996-06-03T13:16:53+00:00</published>
<link rel='alternate' type='text/html' href='http://cgit.freebsd.org/src/commit/?id=0eb3435311bb0cdbebf9618ceca97d1cf6d737e1'/>
<id>0eb3435311bb0cdbebf9618ceca97d1cf6d737e1</id>
<content type='text'>
Added missing headers for system functions.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Added missing headers for system functions.
</pre>
</div>
</content>
</entry>
<entry>
<title>Make _yp_dobind() a litle smarter:</title>
<updated>1996-06-01T05:08:31+00:00</updated>
<author>
<name>Bill Paul</name>
<email>wpaul@FreeBSD.org</email>
</author>
<published>1996-06-01T05:08:31+00:00</published>
<link rel='alternate' type='text/html' href='http://cgit.freebsd.org/src/commit/?id=a230877213de04795c58907240b3a581b29fcfc9'/>
<id>a230877213de04795c58907240b3a581b29fcfc9</id>
<content type='text'>
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.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
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.
</pre>
</div>
</content>
</entry>
<entry>
<title>- Patch around amd core dump problem: don't allow yp_unbind() or _yp_unbind()</title>
<updated>1996-05-16T18:01:17+00:00</updated>
<author>
<name>Bill Paul</name>
<email>wpaul@FreeBSD.org</email>
</author>
<published>1996-05-16T18:01:17+00:00</published>
<link rel='alternate' type='text/html' href='http://cgit.freebsd.org/src/commit/?id=2694f9b9a885c2cc25125ec3b3b3bfbdd6afa4f6'/>
<id>2694f9b9a885c2cc25125ec3b3b3bfbdd6afa4f6</id>
<content type='text'>
  to call clnt_destroy() on a potentially NULL RPC handle. Somebody should
  bang on this a bit to make sure the problem is really gone; I seem to
  have difficulty reproducing it. Patch provided by Peter Wemm and
  slightly tweaked by me.

- Don't call _yp_unbind() in individual ypclnt functions unless we encounter
  an RPC error while making a clnt_call().
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
  to call clnt_destroy() on a potentially NULL RPC handle. Somebody should
  bang on this a bit to make sure the problem is really gone; I seem to
  have difficulty reproducing it. Patch provided by Peter Wemm and
  slightly tweaked by me.

- Don't call _yp_unbind() in individual ypclnt functions unless we encounter
  an RPC error while making a clnt_call().
</pre>
</div>
</content>
</entry>
</feed>
