<feed xmlns='http://www.w3.org/2005/Atom'>
<title>src/usr.sbin/ypbind, branch stable/2.1</title>
<subtitle>FreeBSD source tree</subtitle>
<id>https://cgit-dev.freebsd.org/src/atom?h=stable%2F2.1</id>
<link rel='self' href='https://cgit-dev.freebsd.org/src/atom?h=stable%2F2.1'/>
<link rel='alternate' type='text/html' href='https://cgit-dev.freebsd.org/src/'/>
<updated>1999-09-05T11:54:50Z</updated>
<entry>
<title>$Id$ -&gt; $FreeBSD$</title>
<updated>1999-09-05T11:54:50Z</updated>
<author>
<name>Peter Wemm</name>
<email>peter@FreeBSD.org</email>
</author>
<published>1999-09-05T11:54:50Z</published>
<link rel='alternate' type='text/html' href='https://cgit-dev.freebsd.org/src/commit/?id=f4f9ad419660ffb02915127d84cc0694bb12de79'/>
<id>urn:sha1:f4f9ad419660ffb02915127d84cc0694bb12de79</id>
<content type='text'>
</content>
</entry>
<entry>
<title>Backport extra sanity test from -current (watch out for obviously</title>
<updated>1997-04-10T14:40:59Z</updated>
<author>
<name>Bill Paul</name>
<email>wpaul@FreeBSD.org</email>
</author>
<published>1997-04-10T14:40:59Z</published>
<link rel='alternate' type='text/html' href='https://cgit-dev.freebsd.org/src/commit/?id=504cef64656777d863e2c0b6a853084b463e7eb3'/>
<id>urn:sha1:504cef64656777d863e2c0b6a853084b463e7eb3</id>
<content type='text'>
wrong domain names).
</content>
</entry>
<entry>
<title>Bring in a bunch of man page fixes from the HEAD</title>
<updated>1996-06-27T05:33:29Z</updated>
<author>
<name>Gary Palmer</name>
<email>gpalmer@FreeBSD.org</email>
</author>
<published>1996-06-27T05:33:29Z</published>
<link rel='alternate' type='text/html' href='https://cgit-dev.freebsd.org/src/commit/?id=a18f40d21f5054a5817e4fac2d4e89e4e28c8853'/>
<id>urn:sha1:a18f40d21f5054a5817e4fac2d4e89e4e28c8853</id>
<content type='text'>
</content>
</entry>
<entry>
<title>Brought in changes from main branch: various NIS fixes.</title>
<updated>1995-08-26T12:56:07Z</updated>
<author>
<name>David Greenman</name>
<email>dg@FreeBSD.org</email>
</author>
<published>1995-08-26T12:56:07Z</published>
<link rel='alternate' type='text/html' href='https://cgit-dev.freebsd.org/src/commit/?id=1848fa5e8078de2ccaf01e5859b72324a16fb494'/>
<id>urn:sha1:1848fa5e8078de2ccaf01e5859b72324a16fb494</id>
<content type='text'>
</content>
</entry>
<entry>
<title>Remove trailing whitespace.</title>
<updated>1995-05-30T03:57:47Z</updated>
<author>
<name>Rodney W. Grimes</name>
<email>rgrimes@FreeBSD.org</email>
</author>
<published>1995-05-30T03:57:47Z</published>
<link rel='alternate' type='text/html' href='https://cgit-dev.freebsd.org/src/commit/?id=709e8f9ae1d734c1a163c9b421df4b8153939ce7'/>
<id>urn:sha1:709e8f9ae1d734c1a163c9b421df4b8153939ce7</id>
<content type='text'>
</content>
</entry>
<entry>
<title>This is another bug fix that should have gone into my last commit. I</title>
<updated>1995-05-29T16:39:52Z</updated>
<author>
<name>Bill Paul</name>
<email>wpaul@FreeBSD.org</email>
</author>
<published>1995-05-29T16:39:52Z</published>
<link rel='alternate' type='text/html' href='https://cgit-dev.freebsd.org/src/commit/?id=236f9a3ab9b142e14b702ec5b89360d3840c82de'/>
<id>urn:sha1:236f9a3ab9b142e14b702ec5b89360d3840c82de</id>
<content type='text'>
actually had this done at one point and lost it somewhere along the
line. Again, this is an honest to gosh bug fix only: no functionality
is changed.

- After a child broadcaster process dies or is killed, set its dom_pipe_fds
descriptors to -1 so that the 'READFD &gt; 0' test in the select() loop
does the right thing.

Since descriptor values can be re-used, failure to do this can lead
to a situation where a descriptor for an RPC socket can be mistaken for
a pipe. If this happens, RPC sockets could be incorrectly handed off to
handle_children(), which would then clear the descriptor from the select()
descriptor mask and prevent svc_getreqset() from handling them. The end
result would be that some RPC events would go unserviced. Curiously,
the failures only happen intermittently.
</content>
</entry>
<entry>
<title>Reviewed by:	rgrimes, jkh and davidg (sort of)</title>
<updated>1995-05-26T05:28:00Z</updated>
<author>
<name>Bill Paul</name>
<email>wpaul@FreeBSD.org</email>
</author>
<published>1995-05-26T05:28:00Z</published>
<link rel='alternate' type='text/html' href='https://cgit-dev.freebsd.org/src/commit/?id=a7acf629b6a1a575e81968be19b9226790d246f9'/>
<id>urn:sha1:a7acf629b6a1a575e81968be19b9226790d246f9</id>
<content type='text'>
Rod, Jordan and David have more or less given me the OK on this
with the understanding that it doesn't change any functionality.
It doesn't: these are bug fixes only. No other part of the system
should be affected. Of course, since I'm the only one working on
NIS, you'll just have to take my word on it. :)

Fixes for the following annoyingly subtle bugs:

- ypbindproc_setdom_2 is supposed to be declared void *, not boot_t *,
and it fails to correctly signal failures back to the ypset(8) command:
we need to call one of the svcerr_*() functions (in this case,
svcerr_noprog() seems a logical choice -- we're really cheating
a bit here because nothing else quite fits) to tell ypset that the
attempt to set the binding for a domain failed. If we don't do this,
failed ypset attempts either appear (incorrectly) to succeed, or
they time out.

- The lock handling for child processes isn't quite right. The
child broadcaster processes have to release all locks on the
binding files and the ypbind.lock file.

- The parent ypbind process will SEGV if you do the following:

-- start ypbind with the -ypset or -ypsetme flag
-- type 'ypwhich -d random_unserved_domain'
-- type 'ypset -d random_unserved_domain anyhost'
-- type 'ypwhich -d random_unserved_domain' again
-- wait about 60 seconds

What happens is this: the ypwhich command causes ypbind to fork a
broadcaster process that searches for a server for random_unserved_domain.
If you then use ypset to force a binding while this process is still alive,
the state flags that tell the ypbind parent process that the child
is running will be cleared. The second ypwhich command then causes
a *second* child process to be forked for random_unserved_domain,
which is verbotten. When the first broadcaster exits and tells the
parent that it wasn't able to find a server for the domain, the parent
clobbers the entry for random_unserved_domain. Then the second broadcaster
exits and the same thing happens, only trying to clobber the entry
twice causes a SEGV.

The fix for this is a slight change in program structure: since we
can't have more than one broadcaster for a given domain at a time,
we save the pipe descriptors and pid for the child broadcaster in members
of the _dom_binding struct for the domain. (As a side effect, we
can get rid of the global child_fds variable.) So when rpc_received()
finds that it's been asked to do a ypset for a domain for which a
broadcaster process exists, it sends a SIGINT to the child to kill it
and closes the pipe to the now-dead child. This keeps everything in sync
and insures that we don't leak file descriptors.

- ping() should be using YPPROC_DOMAIN rather than YPPROC_DOMAIN_NONACK
when it does its clnt_call() to the server.

- Removed the check for client_handle == NULL in ping() and make
client_handle local to ping instead of a member of the _dom_binding
struct. This fixes another potential ypset problem: using ypset to
force a binding to a machine that has an NIS server but which *doesn't*
support the domain we're after can result in permanently bogus bindings.

- the 'server OK' message prints the wrong IP address.
</content>
</entry>
<entry>
<title>One for the road: create a ypbind.lock file under /var/run and try to lock</title>
<updated>1995-05-12T16:52:58Z</updated>
<author>
<name>Bill Paul</name>
<email>wpaul@FreeBSD.org</email>
</author>
<published>1995-05-12T16:52:58Z</published>
<link rel='alternate' type='text/html' href='https://cgit-dev.freebsd.org/src/commit/?id=97f3a7e6e7b2315a17055166bc138340d6f70017'/>
<id>urn:sha1:97f3a7e6e7b2315a17055166bc138340d6f70017</id>
<content type='text'>
it. If we can't it means there's already a ypbind running and we should
abort.
</content>
</entry>
<entry>
<title>Ack! One slipped through the cracks: remember to return the correctly</title>
<updated>1995-05-11T00:16:54Z</updated>
<author>
<name>Bill Paul</name>
<email>wpaul@FreeBSD.org</email>
</author>
<published>1995-05-11T00:16:54Z</published>
<link rel='alternate' type='text/html' href='https://cgit-dev.freebsd.org/src/commit/?id=4d6e34053f568c21e842d099278ef0434528fe6e'/>
<id>urn:sha1:4d6e34053f568c21e842d099278ef0434528fe6e</id>
<content type='text'>
filled-in result structure to the caller when a resource allocation
error is encountered in ypbindproc_domain_2.
</content>
</entry>
<entry>
<title>Performace improvements/simplifications/cleanups:</title>
<updated>1995-05-10T23:02:41Z</updated>
<author>
<name>Bill Paul</name>
<email>wpaul@FreeBSD.org</email>
</author>
<published>1995-05-10T23:02:41Z</published>
<link rel='alternate' type='text/html' href='https://cgit-dev.freebsd.org/src/commit/?id=c904a246d26ffde849a50c5eba13fe84a755330c'/>
<id>urn:sha1:c904a246d26ffde849a50c5eba13fe84a755330c</id>
<content type='text'>
- Make the child process reaper signal-driven. (Previously, we called reaper()
  once a second each time we went through the select() loop. This was
  convenient, but inefficient.)

- Increase main select() timeout from 1 second to 60 seconds and use
  this as the ping timer instead of using timestamps in the _dom_binding
  structure. This nd the reaper() change noted above makes ypbind a little
  less CPU-intensive.

- Don't flag EINTR's from select() as errors since they will happen as a
  result of incoming SIGCHLD's interrupting select().

- Prevent possible resource hogging. Currently we malloc() memory
  each time a user process asks us to establish a binding for a domain,
  but we never free it. This could lead to serious memory leakage if a
  'clever' user did something like ask ypwhich to check the bindings
  for domains 0.0.0.0.0.0.0.0.0.0 through 9.9.9.9.9.9.9.9.9.9 inclusive.
  (This would also make a mess out of the /var/yp/binding directory.)

  We now avoid this silliness by a) limiting the maximum number of
  simultaneous bindings we can manage to 200, and b) free()ing _dom_binding
  structures of secondary domains whose servers have stopped responding.
  We unlink the /var/yp/binding/domain.vers files for the free()ed
  domains too.

  (This is safe to do since a client can prod us into reestablishing the
  binding, at which time we'll simply allocate a new _dom_binding structure
  for it.)

  We keep count of the total number of domains. If asked to
  allocate more than the maximum, we return an error. I have yet to hear
  of anybody needing 200 simultaneous NIS bindings, so this should be
  enough. (I chose the number 200 arbitrarily. It can be increased if need
  be.)

- Changed "server not responding"/"server OK" messages to display server
  IP addresses again since it looks spiffier.

- Use daemon() to daemonify ourselves,

- Added a SIGTERM handler that removes all binding files and unregisters
  the ypbind service from the portmapper when a SIGTERM in received.

- The comment 'blow away everything in BINDINGDIR' has no associated code.
  Give it some: clean out /var/yp/binding at startup (if it exists).

This completes my ypbind wishlist. Barring bug fixes, I shouldn't need to
go poking around in here anymore. (Of course, this means I can start
working on my ypserv whishlist now... :)
</content>
</entry>
</feed>
