History log of /freebsd-10.1-release/usr.sbin/ypbind/
Revision Date Author Comments
(<<< Hide modified files)
(Show modified files >>>)
273188 16-Oct-2014 hrs

MFS r272855, 266846:

- Do not override sin6_scope_id in LLA when it is already set to non-zero.
This fixes destination list in output of netstat -r.
- Plug a memory leak.
- Add RTM_VERSION check.
- Fix a bug which can make sysctl() fail when -F is specified.
- Increase WID_IF_DEFAULT() from 6 to 8 (the default for AF_INET6) because
we have interfaces with longer names than 6 chars like epairN{a,b}.
- Style fixes.

MFS r272847:

- Add rwlock to struct dadq. A panic could occur when a large number of
addresses performed DAD at the same time.

MFS r272850:

- Replace Sun RPC license in TI-RPC library with a 3-clause BSD license,
with the explicit permission of Sun Microsystems in 2009.

- Replace Sun Industry Standards Source License for Sun RPC code with a
3-clause BSD license as specified by Oracle America, Inc. in 2010.
This license change was approved by Wim Coekaerts, Senior Vice
President, Linux and Virtualization at Oracle Corporation.

- Replace Sun RPC license with a 3-clause BSD license. This license change
was approved in 2010 by Wim Coekaerts, Senior Vice President, Linux and
Virtualization at Oracle Corporation.

- Replace Sun RPC license for TI-RPC library with a 3-clause BSD license,
with the explicit permission of Sun Microsystems in 2009.
The code in question in this file was copied from
lib/libc/rpc/pmap_getport.c.

MFS r272852,r272853:

- Add relative specification in expiration time.
- Add proto3 option for RTF_PROTO3.
- Use %lu for members of struct rt_metrics.
- Use long explicitly for the time difference.

MFS r272854:

- Return 0 if:

1. "-u N" specified, no -f, and mdN found,
2. no -u, "-f /pathname" specified, and mdN associated with
/pathname found,
3. "-u N" specified, "-f /pathname" specified, and both of them found,
4. "-l" specified and no -f,
5. "-l" specified, "-f /pathname" specified, and /pathname found.

otherwise return -1.

MFS r272856:

- Move configuration of IPv6 NDP flags to a point before handling ifconfig_IF.
This fixes a race that a non-IPv4 interface can get an EUI64 LLA even if it
has IFDISABLED nd6 flag at boot time.

MFS r272857:

- Cancel DAD for an ifa when the ifp has ND6_IFF_IFDISABLED as early as
possible and do not clear IN6_IFF_TENTATIVE. If IFDISABLED was accidentally
set after a DAD started, TENTATIVE could be cleared because no NA was
received due to IFDISABLED, and as a result it could prevent DAD when
manually clearing IFDISABLED after that.

MFS r272858:

- Fix an issue in range specification handling when a "-foo" is specified in
ifconfig_IF_aliasN.

MFS r272859:

- Fix EtherIP. TOS field must be initialized when the inner protocol is
PF_LINK, and multicast/broadcast flag should always be dropped because
the outer protocol uses unicast even when the inner address is not for
unicast. It had been broken since r236951 when gif_output() started to
use IFQ_HANDOFF().

MFS r272860:

- Recover sin6_scope_id of gateway addresses in riprecv() by using the
if_index where a RIP packet was received. This fixes a bug which
prevented gateway addresses in fe80::/64 from being added.

MFS r272861:

- Fix rc.d/gssd script to define the default values in a standard way.
- Use a parameter argument in jls(8) instead of doing grep.

MFS r272862, r272870:

- Restructure rc.d scripts for kerberos5 daemons.

MFS r272863:

- Return false status only when adding a route is failed. It could
erroneously return false due to an afexists() check loop in routing_start().

MFS r272864:

- Use ipv6_prefer when at least one ifconfig_IF_ipv6 is configured.

MFS r272865:

- Fix a bug which prevented mount.fstab parameter from being converted
when jail_JID_devfs_enable=NO.

MFS r272866:

- Fix header output when -P is specified and (ncpus - 1) != maxid.

MFS r272867:

- Fix a bug which could break extended attributes in a dump output.
This occurred when a file was >892kB long and had a large data (>1kB)
in the extended attributes.

MFS r272868, r272869:

- Make net.inet.ip.sourceroute, net.inet.ip.accept_sourceroute, and
net.inet.ip.process_options vnet-aware.

MFS r272871:

- Revert changes in r269180. It could cause -c N option to enter an
infinite loop if no reply packet is received.

MFS r272874:

- Resurrect set_rcvar() as a function to define a rc.conf variable.
It defines a variable and its default value in load_rc_config() just after
rc.conf is loaded. "rcvar" command shows the current and the default
values.

MFS r272960:

- Do not add late flag when file= is specified because it has a bad
side-effect. The specified file should exist before the fstab line.

Approved by: re (gjb)


/freebsd-10.1-release/etc/defaults/rc.conf
/freebsd-10.1-release/etc/network.subr
/freebsd-10.1-release/etc/rc.d/Makefile
/freebsd-10.1-release/etc/rc.d/SERVERS
/freebsd-10.1-release/etc/rc.d/gssd
/freebsd-10.1-release/etc/rc.d/ip6addrctl
/freebsd-10.1-release/etc/rc.d/ipropd_master
/freebsd-10.1-release/etc/rc.d/ipropd_slave
/freebsd-10.1-release/etc/rc.d/jail
/freebsd-10.1-release/etc/rc.d/kadmind
/freebsd-10.1-release/etc/rc.d/kdc
/freebsd-10.1-release/etc/rc.d/kerberos
/freebsd-10.1-release/etc/rc.d/kfd
/freebsd-10.1-release/etc/rc.d/kpasswdd
/freebsd-10.1-release/etc/rc.d/routing
/freebsd-10.1-release/etc/rc.subr
/freebsd-10.1-release/include/rpcsvc/bootparam_prot.x
/freebsd-10.1-release/include/rpcsvc/key_prot.x
/freebsd-10.1-release/include/rpcsvc/klm_prot.x
/freebsd-10.1-release/include/rpcsvc/mount.x
/freebsd-10.1-release/include/rpcsvc/nfs_prot.x
/freebsd-10.1-release/include/rpcsvc/nis.x
/freebsd-10.1-release/include/rpcsvc/nis_callback.x
/freebsd-10.1-release/include/rpcsvc/nis_object.x
/freebsd-10.1-release/include/rpcsvc/nis_tags.h
/freebsd-10.1-release/include/rpcsvc/rex.x
/freebsd-10.1-release/include/rpcsvc/rnusers.x
/freebsd-10.1-release/include/rpcsvc/rstat.x
/freebsd-10.1-release/include/rpcsvc/sm_inter.x
/freebsd-10.1-release/include/rpcsvc/spray.x
/freebsd-10.1-release/include/rpcsvc/yp.x
/freebsd-10.1-release/include/rpcsvc/yppasswd.x
/freebsd-10.1-release/lib/libc/rpc/LICENSE
/freebsd-10.1-release/lib/libc/xdr/xdr.c
/freebsd-10.1-release/lib/libc/xdr/xdr_array.c
/freebsd-10.1-release/lib/libc/xdr/xdr_float.c
/freebsd-10.1-release/lib/libc/xdr/xdr_mem.c
/freebsd-10.1-release/lib/libc/xdr/xdr_rec.c
/freebsd-10.1-release/lib/libc/xdr/xdr_reference.c
/freebsd-10.1-release/lib/libc/xdr/xdr_sizeof.c
/freebsd-10.1-release/lib/libc/xdr/xdr_stdio.c
/freebsd-10.1-release/sbin/dump/traverse.c
/freebsd-10.1-release/sbin/mdconfig/mdconfig.c
/freebsd-10.1-release/sbin/ping6/ping6.c
/freebsd-10.1-release/sbin/route/keywords
/freebsd-10.1-release/sbin/route/route.8
/freebsd-10.1-release/sbin/route/route.c
/freebsd-10.1-release/sbin/swapon/swapon.c
/freebsd-10.1-release/sys/netinet/in_gif.c
/freebsd-10.1-release/sys/netinet/ip_fastfwd.c
/freebsd-10.1-release/sys/netinet/ip_options.c
/freebsd-10.1-release/sys/netinet/ip_options.h
/freebsd-10.1-release/sys/netinet6/in6_gif.c
/freebsd-10.1-release/sys/netinet6/nd6_nbr.c
/freebsd-10.1-release/usr.bin/netstat/route.c
/freebsd-10.1-release/usr.bin/vmstat/vmstat.c
/freebsd-10.1-release/usr.sbin/route6d/route6d.c
yp_ping.c
272461 03-Oct-2014 gjb

Copy stable/10@r272459 to releng/10.1 as part of
the 10.1-RELEASE process.

Approved by: re (implicit)
Sponsored by: The FreeBSD Foundation


256281 10-Oct-2013 gjb

Copy head (r256279) to stable/10 as part of the 10.0-RELEASE cycle.

Approved by: re (implicit)
Sponsored by: The FreeBSD Foundation


226690 24-Oct-2011 glebius

Protect NIS client with madvise(2) since this daemon is required
for succesful authentication of users.


213611 08-Oct-2010 markm

Don't let the "available"/"not available" logs flap quite so badly. In the
case of a multi-interfaced host, sub-second flapping can fill up the logs
too quickly. This fixes that.


211936 28-Aug-2010 brucec

Fix incorrect usage of 'assure' and 'insure'.

Approved by: rrs (mentor)


201390 02-Jan-2010 ed

The last big commit: let usr.sbin/ use WARNS=6 by default.


183038 15-Sep-2008 dfr

Don't rely on private RPC data structures when there is a perfectly good
public API.


141846 13-Feb-2005 ru

Expand *n't contractions.


136620 17-Oct-2004 stefanf

Remove definition of struct dom_binding, it's non-standard C code and
unnecessary since src/include/rpcsvc/ypclnt.h's revision 1.10.


133249 07-Aug-2004 imp

Per letter dated July 22, 1999 remove 3rd clause of Berkeley derived software
(with permission of addtional copyright holders where appropriate)


131500 02-Jul-2004 ru

Mechanically kill hard sentence breaks.


115851 04-Jun-2003 ceri

Correct a spelling error.


114601 03-May-2003 obrien

Use __FBSDID over rcsid[]. Protect copyright[] where needed.


103428 16-Sep-2002 fenner

xids are u_int32_ts, which are not necessarily the same size as time_ts or
unsigned longs. This fixes "ypbind -S ... -m" on sparc64.


99968 14-Jul-2002 charnier

The .Nm utility


95658 28-Apr-2002 des

Spell void * as void * rather than caddr_t. This is complicated by the
fact that caddr_t is often misspelled as char *.

Sponsored by: DARPA, NAI Labs


90868 18-Feb-2002 mike

o Move NTOHL() and associated macros into <sys/param.h>. These are
deprecated in favor of the POSIX-defined lowercase variants.
o Change all occurrences of NTOHL() and associated marcros in the
source tree to use the lowercase function variants.
o Add missing license bits to sparc64's <machine/endian.h>.
Approved by: jake
o Clean up <machine/endian.h> files.
o Remove unused __uint16_swap_uint32() from i386's <machine/endian.h>.
o Remove prototypes for non-existent bswapXX() functions.
o Include <machine/endian.h> in <arpa/inet.h> to define the
POSIX-required ntohl() family of functions.
o Do similar things to expose the ntohl() family in libstand, <netinet/in.h>,
and <sys/param.h>.
o Prepend underscores to the ntohl() family to help deal with
complexities associated with having MD (asm and inline) versions, and
having to prevent exposure of these functions in other headers that
happen to make use of endian-specific defines.
o Create weak aliases to the canonical function name to help deal with
third-party software forgetting to include an appropriate header.
o Remove some now unneeded pollution from <sys/types.h>.
o Add missing <arpa/inet.h> includes in userland.

Tested on: alpha, i386
Reviewed by: bde, jake, tmm


90298 06-Feb-2002 des

ANSIfy and remove some dead code.

Sponsored by: DARPA, NAI Labs


90297 06-Feb-2002 des

Apply the following mechanical transformations in preparation for
ansification and constification:

s{\s+__P\((\(.*?\))\)}{$1}g;
s{\(\s+}{\(}g;
s{\s+\)}{\)}g;
s{\s+,}{,}g;
s{(\s+)(for|if|switch|while)\(}{$1$2 \(}g;
s{return ([^\(].*?);}{return ($1);}g;
s{([\w\)])([!=+/\*-]?=)([\w\(+-])}{$1 $2 $3}g;
s{\s+$}{\n};g

Also add $FreeBSD$ where needed.

MFC after: 1 week


89362 14-Jan-2002 ru

yp(4) -> yp(8).

PR: docs/30797


80029 20-Jul-2001 obrien

Perform a major cleanup of the usr.sbin Makefiles.
These are not perfectly in agreement with each other style-wise, but they
are orders of orders of magnitude more consistent style-wise than before.


79953 19-Jul-2001 dd

Increment `i' in case of -S so that its argument isn't treated as
another, unknown option.

Submitted by: Naoki Kobayashi <shibata@geo.titech.ac.jp> and
Harti Brandt <brandt@fokus.gmd.de>, respectively.
Pointy hat to: dd


79755 15-Jul-2001 dd

Remove whitespace at EOL.


79665 13-Jul-2001 dd

Whine if we discover an unknown option. This program doesn't use
getopt(3) (and can't be converted without breaking compatibility), and
it's very irritating to have it silently DTWT if one combines options
together (e.g., "-msS domain,server").


78737 24-Jun-2001 dd

Nuke unused variables.


78674 23-Jun-2001 ben

Don't dereference a pointer after freeing that pointer.

PR: 27990
Reviewed by: dd, phk
Tested by: dd
MFC after: 2 weeks


74880 27-Mar-2001 wpaul

Finally fix __yp_ping(). We can't use the old locally defined clntudp_call()
method anymore since the code inside the RPC library has changed too much.
Now that the clnt_dg module has the necessary code internally, we can yank
out the local method code and turn on the ASYNC hack with clnt_control().
This will make the -m flag work again.


74816 26-Mar-2001 ru

- Backout botched attempt to introduce MANSECT feature.
- MAN[1-9] -> MAN.


74532 20-Mar-2001 ru

Set the default manual section for usr.sbin/ to 8.


74462 19-Mar-2001 alfred

Bring in a hybrid of SunSoft's transport-independent RPC (TI-RPC) and
associated changes that had to happen to make this possible as well as
bugs fixed along the way.

Bring in required TLI library routines to support this.

Since we don't support TLI we've essentially copied what NetBSD
has done, adding a thin layer to emulate direct the TLI calls
into BSD socket calls.

This is mostly from Sun's tirpc release that was made in 1994,
however some fixes were backported from the 1999 release (supposedly
only made available after this porting effort was underway).

The submitter has agreed to continue on and bring us up to the
1999 release.

Several key features are introduced with this update:
Client calls are thread safe. (1999 code has server side thread
safe)
Updated, a more modern interface.

Many userland updates were done to bring the code up to par with
the recent RPC API.

There is an update to the pthreads library, a function
pthread_main_np() was added to emulate a function of Sun's threads
library.

While we're at it, bring in NetBSD's lockd, it's been far too
long of a wait.

New rpcbind(8) replaces portmap(8) (supporting communication over
an authenticated Unix-domain socket, and by default only allowing
set and unset requests over that channel). It's much more secure
than the old portmapper.

Umount(8), mountd(8), mount_nfs(8), nfsd(8) have also been upgraded
to support TI-RPC and to support IPV6.

Umount(8) is also fixed to unmount pathnames longer than 80 chars,
which are currently truncated by the Kernel statfs structure.

Submitted by: Martin Blapp <mb@imp.ch>
Manpage review: ru
Secure RPC implemented by: wpaul


72093 06-Feb-2001 asmodai

Fix typo: compatability -> compatibility.

Compatability is not an existing english word.


72091 06-Feb-2001 asmodai

Fix typo: seperate -> separate.

Seperate does not exist in the english language.


71898 01-Feb-2001 ru

mdoc(7) police: split punctuation characters + misc fixes.


57673 01-Mar-2000 sheldonh

Remove single-space hard sentence breaks. These degrade the quality
of the typeset output, tend to make diffs harder to read and provide
bad examples for new-comers to mdoc.


56492 23-Jan-2000 charnier

Remove invalid section name.


55206 29-Dec-1999 peter

Change #ifdef KERNEL to #ifdef _KERNEL in the public headers. "KERNEL"
is an application space macro and the applications are supposed to be free
to use it as they please (but cannot). This is consistant with the other
BSD's who made this change quite some time ago. More commits to come.


50479 28-Aug-1999 peter

$Id$ -> $FreeBSD$


45656 13-Apr-1999 simokawa

Use u_int32_t for sin_addr.s_addr rather than u_long to avoid
unaligned access on alpha.


43854 10-Feb-1999 wpaul

The ypbind_setdom_2 procedure returns NULL in the success case. This is
incorrect; returning NULL here means that the dispatcher won't send any
response back to the caller, which means the caller will sit there waiting
until it times out. I don't know how this ever worked before. The effect
is that using 'ypset foo' to get the local ypbind to change servers would
work, but would sit there hanging for a long time for no reason.


34809 23-Mar-1998 charnier

.Sh AUTHOR -> .Sh AUTHORS. Use .An/.Aq.


32631 19-Jan-1998 wpaul

Also fix ypbind to compile with ANSI-fied /usr/include/rpcsvc. One of
these days I really should rerwite this creature from the ground up.


30762 27-Oct-1997 charnier

Use err(3). Change `=' to `==' in two places, so that server not responding/
server ok is not displayed too often.
OKed by: Bill (wpaul).


30252 09-Oct-1997 wpaul

Fix bug in __yp_ping(): keep proper count of assigned request structures.
The test to see if a request struct had been assigned after looping
though the server list was bogus.

Submitted by: "Erik E. Rantapaa" <rantapaa@math.umn.edu>


26135 25-May-1997 wpaul

This commit adds support to ypbind(8) for binding to non-local servers.

The standard SunOS ypbind(8) (and, until now, the FreeBSD ypbind)
only selects servers based on whether or not they respond to clnt_broadcast().
Ypbind(8) broadcasts to the YPPROC_DOMAIN_NONACK procedure and waits
for answers; whichever server answers first is the one ypbind uses
for the local client binding.

This mechanism fails when binding across subnets is desired. In order
for a client on one subnet to bind to a server on another subnet, the
gateway(s) between the client and server must be configured to forward
broadcasts. If this is not possible, then a slave server must be
installed on the remote subnet. If this is also not possible, you
have to force the client to bind to the remote server with ypset(8).

Unfortunately, this last option is less than ideal. If the remote
server becomes unavailable, ypbind(8) will lose its binding and
revert to its broadcast-based search behavior. Even if there are
other servers available, or even if the original server comes back
up, ypbind(8) will not be able to create a new binding since all
the servers are on remote subnets where its broadcasts won't be heard.
If the administrator isn't around to run ypset(8) again, the system
is hosed.

In some Linux NIS implementations, there exists a yp.conf file where
you can explicitly specify a server address and avoid the use of
ypbind altogether. This is not desireable since it removes the
possibility of binding to an alternate server in the event that the
one specified in yp.conf crashes.

Some people have mentioned to me how they though the 'restricted mode'
operation (using the -S flag) could be used as a solution for this
problem since it allows one to specify a list of servers. In fact,
this is not the case: the -S flag just tells ypbind(8) that when it
listens for replies to its broadcasts, it should only honor them if
the replying hosts appear in the specified restricted list.

This behavior has now been changed. If you use the -m flag in conjunction
with the -S flag, ypbind(8) will use a 'many-cast' instead of a broadcast
for choosing a server. In many-cast mode, ypbind(8) will transmit directly
to the YPPROC_DOMAIN_NONACK procedure of all the servers specified in
the restricted mode list and then wait for a reply. As with the broadcast
method, whichever server from the list answers first is used for the
local binding. All other behavior is the same: ypbind(8) continues
to ping its bound server every 60 seconds to insure it's still alive
and will many-cast again if the server fails to respond. The code used
to achieve this is in yp_ping.c; it includes a couple of modified RPC
library routines.

Note that it is not possible to use this mechanism without using
the restricted list since we need to know the addresses of the available
NIS servers ahead of time in order to transmit to them.

Most-recently-requested by: Tom Samplonius


24945 15-Apr-1997 jmg

fix a few typos..

Closed PR#3265


24782 10-Apr-1997 wpaul

Avoid processing obviously bogus domain names in the YPBINDPROC_DOMAIN
and YPBINDPROC_SETDOM procedures.


22997 22-Feb-1997 peter

Revert $FreeBSD$ to $Id$


21880 20-Jan-1997 wosch

Sort cross references.


21673 14-Jan-1997 jkh

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.


21581 12-Jan-1997 wpaul

- Save parent pid and check current pid against it upon entry to
terminate(). This makes doubly sure we don't trip the SIGTERM handler
in a child process. Suggested by: phk.

- It's int main(argc, argv), not void main(argc, argv), gosh darn it.


21539 11-Jan-1997 wpaul

Correct two bugs:

- If a child receives a SIGTERM, it will call the terminate() function
and end up doing the shutdown procedurs that should really only be
done by the parent. Set the SIGTERM behavior back to SIG_DLT in the
child after fork()ing.

- If the parent fails to read data back from the child because the
child has exited, it will call rpc_received() with bogus tdata that
can cause the parent to SEGV. Make handle_children() detect this
condition correctly and handle it sanely.

*sigh* Another 2.2 candidate.


21096 30-Dec-1996 peter

Fix problem caused by new prototypes. Cast object to (caddr_t) as
expected.


18718 05-Oct-1996 wosch

delete doubled words, e.g.: "the the" -> "the"


14038 11-Feb-1996 mpp

Correct a bunch of man page cross references and generally
try and silence "manck".

ncurses, rpc, and some of the gnu stuff are still a big mess, however.


12862 15-Dec-1995 wpaul

More XDR routine cleanups. These three programs should be the only
ones that require this: the others call the yplib functions in libc.


9600 20-Jul-1995 wpaul

Add a -S option to ypbind that allows the following:

-S domainname,server1,server2,server3,...
The -S flag allows the system administrator to lock ypbind to a
particular domain and group of NIS servers. Up to ten servers can
be specified. There must not be any spaces between the commas in
the domain/server specification. This option is used to insure that
that the system binds only to one domain and only to one of the
specified servers, which is useful for systems that are both NIS
servers and NIS clients: it provides a way to restrict what ma-
chines the system can bind to without the need for specifying the
-ypset or -ypsetme options, which are often considered to be secu-
rity holes. The specified servers must have valid entries in the
local /etc/hosts file. IP addresses may be specified in place of
hostnames. If ypbind can't make sense ouf of the arguments, it will
ignore the -S flag and continue running normally.

Note that ypbind will consider the domainname specified with the -S
flag to be the system default domain.

(According to what Garrett showed me, OSF/1 actually only allows 4 servers
to be specified. Ten seemed to be a bit more reasonable to me.)

Suggested by: G. Wollman
Idea lifted from: OSF/1


9532 15-Jul-1995 wpaul

Some small signal handling tweaks: be sure to keep wait3()ing until all
children are reaped and make sure to block SIGCHLD delivery during handler
execution when installing SIGCHLD handler with sigaction().


8857 30-May-1995 rgrimes

Remove trailing whitespace.


8853 29-May-1995 wpaul

This is another bug fix that should have gone into my last commit. I
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 > 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.


8755 26-May-1995 wpaul

Reviewed by: rgrimes, jkh and davidg (sort of)

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.


8474 12-May-1995 wpaul

One for the road: create a ypbind.lock file under /var/run and try to lock
it. If we can't it means there's already a ypbind running and we should
abort.


8428 11-May-1995 wpaul

Ack! One slipped through the cracks: remember to return the correctly
filled-in result structure to the caller when a resource allocation
error is encountered in ypbindproc_domain_2.


8425 10-May-1995 wpaul

Performace improvements/simplifications/cleanups:

- 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... :)


8246 03-May-1995 wpaul

Cosmetic changes and paranoia checks:

ypbind.c:
Make fewer assumtions about the state of the dom_alive and dom_broadcasting
flags in roc_received().
Cosmetic changes and paranoia checks:

ypbind.c:
Make fewer assumtions about the state of the dom_alive and dom_broadcasting
flags in roc_received().

If select() fails, use syslog() to report the error rather than perror().

Check that all our malloc()s succeed. Report malloc() failure in
ypbindproc_setdom_2() to callers.

yplib.c:

Use #defined constants in ypbinderr_string() rather than hard-coded values.


8091 26-Apr-1995 wpaul

ypbind.c: Major overhaul.

- Moved to a more client-driven model. We aggressively attempt to keep
the default domain bound (as before) but we give up on non-default
domains if we lose contact with a server and fail to get a response
after one round of broadcasting. This helps drastically reduce the
amount of network bandwitdh that ypbind consumes: if a client references
the secondary domain at some later point, this will prod ypbind into
establishing a new binding anyway, so continuously broadcasting without
need is pointless.

Note that we still actively seek out a binding for our default domain
even if no client program has queried us yet. I'm not exactly sure if
this matches SunOS's behavior or not, but I decided to do it this way
since we can get into all sorts of trouble if our default domain comes
unbound. Even so, we're still much quieter than we used to be.

- Removed a bunch of no-longer pertinent comments and a couple of
chunks of #ifdef 0'ed code that no longer fit in to the new layout.

- Theo deRaadt must have become frustrated with the callback mechanism
in clnt_broadcast(), because he shamelessly stole the clnt_broadcast()
code right out of the RPC library and hacked it up to suit his needs.
(Comments and all! :)

I can understand why: clnt_broadcast() blocks while awaiting replies.
Changing this behavior requires surgery. However, you can work around
this: fork the broadcast into a child process and relay the results
back to the parent via a pipe. (Careful obervation has shown that the
SunOS ypbind forks children for broadcasting too, though I can only
guess what sort of interprocess communication it uses. pipe() seems to
do the job well enough.)

This may seem like the long way around, but it's not really that
hard to implement, and I'd prefer to use documented RPC library functions
wherever possible. We're careful to limit the number of simultaneous
broadcasters to avoid swamping the system (the current limit is 5).
Each clnt_broadcast() call only sends out a small number of packets
at increasing intervals. We're also careful not to spawn more than one
bradcaster for a given domain.

- Used clntudp_bufcreate() and clnt_call() to implement a ping()
function for directly querying a particular server so that we can
check if it's still alive. This lets me completely remove the old
bradcasting code and use actual RPC library calls instead, at the
cost of more than a few handfulls of torn-out hair. (Make no mistake
folks: I *HATE* RPC.) Currently, the ping interval is one minute.

- Fixed another potential 'nfds too big for select()' bug: use
_rpc_dtablesize() instead of getdtablesize().

- Quieted gcc -Wall a bit.

- Probably a bunch of other stuff that I've forgotten.

ypbind.8:

- Updated man page to reflect modifications.

ypwhich.c:

- Small mind-o fix from last time: decode error results from
ypbind correctly (*groan*)

yplib.c:

- same as above

- Change behavior of _yp_dobind() a little: if we get back a 'Domain
not bound' error for a given domain, retry a few times before giving
up and passing the error back to the caller. We have to sleep for a
few seconds between tries since the 'Domain not bound' error comes
back immediately (by repeatedly looping, we end up pounding on ypbind).
We retry at most 20 times at 5 second intervals. This gives us a full
minute to get a response. This seems to deviate a bit from SunOS
behavior -- it appears to wait forever -- but I don't like the idea
of perpetually hanging inside a library call.

Note that this should fix the problems some people have with bindings
not being established fast enough at boot time; sometimes amd is started
in /etc/rc after ypbind has run but before it gets a binding set up. The
automounter gets annoyed at this and tends to exit. By pausing ther YP
calls until a binding is ready, we avoid this situation.

- Another _yp_dobind() change: if we determine that our binding files
are unlocked or nonexistent, jump directly to code that pokes ypbind
into restablishing the binding. Again, if it fails, we'll time out
eventually and return.


7982 21-Apr-1995 wpaul

small NIS binding fixes:

ypbind.c: if a client program asks ypbind for the name of the server
for a particular domain, and there isn't a binding for that domain
available yet, ypbind needs to supply a status value along with its
failure message. Set yprespbody.ypbind_error before returning from
a ypbindproc_domain request.

yplib.c: properly handle the error status messages ypbind now has the
ability to send us. Add a ypbinderr_string() function to decode the
error values.

ypwhich.c: handle ypbind errors correctly: yperr_string() can't handle
ypbind_status messages -- use ypbinderr_string instead.


7864 15-Apr-1995 wpaul

In environments with multiple NIS servers (a master and several slaves)
one ypbind broadcast can yield several responses. This can lead to
some confusion: the syslog message from ypbind will indicate a rebinding
to the first server that responds, but we may subsequently change our
binding to another server when the other responses arrive. This results
in ypbind reporting 'server OK' to one address and ypwhich reporting a
binding to another.

The behavior of the rpc_received() function has been changed to prevent
this: subsequent responses received after a binding has already been
established are ignored. Rebinding gratuitously each time we get a
new response is silly anyway.

Also backed out the non-fix I made in my last ypbind commit. (Pass
me the extra large conical hat, please.)

(At some point I'm going to seriously re-work ypbind and the _yp_dobind()
library function to bring them in line with SunOS's documented behavior:
binding requests are supposed to be 'client-driven.' The _yp_dobind()
function should be responsible for retrying connections in response to
calls from client programs rather than having ypbind broadcasting
continously until a server responds. The current setup works okay in
normal operation, but we broadcast far too often than we should.)


7723 09-Apr-1995 wpaul

First crack at a man page for ypbind.


7580 02-Apr-1995 wpaul

Fix long standing bogosity in ypbind: if /var/yp/binding doesn't exist,
ypbind is supposed to create it but it doesn't. This is because when
it checks the return value for the attempted open() of
/var/yp/binding/DOMAIN.VERSION, it tests only for a value of -1. This
is bogus because open() doesn't return -1 in this case. Now it checks
for < 0 instead.

This should make life easier for many NIS-newbies who would otherwise
be left scratching their heads wondering why the NIS client stuff won't
work despite their best efforts. ("I set the domain name on my machine,
and /var/yp exists, but when I start ypbind and try a 'ypcat passwd,'
it says it can't bind to a server for this domain! Please help!")

*long, heavy sigh*


6732 26-Feb-1995 wpaul

Submitted by: Sebastian Strollo <seb@erix.eriksson.se>

Fixes to ypbind:

- Correctly report the fact that we've bound to a new server when
logging the 'server OK' message.

- Report 'server not responding' just once instead of every
5 seconds while searching for a new server. (Prevents overstuffing
the syslog.)

- Apply patch from Sebstian Strollo to implement '-s' (secure) flag.
ypbind will reject connections from servers that do not originate
from a reserved TCP port.

- Apply patch from Sebastian Strollo to detect when a YP server has
crashed and come back up on a different port number.


6478 16-Feb-1995 wpaul

ypbind jumbo patch :)

The existing ypbind exhibits some truly anti-social behavior. After
initially establishing a binding with an NIS server, the following events
take place:

- ypbind waits for 60 seconds before trying to broadcast a ping again
- after the 60 seconds expires, ypbind sends out broadcasts every 5 seconds
come hell or high water.

These broadcasts travel far and wide, even to NIS servers in other domains
which dutifully log the packets even though they don't respond to them.
This leads to lots of unnecessary traffic and bloated log files.

This behavior has been fixed/changed. Here's what happens now:

- We still broadcast every 5 seconds at startup, just like before.

- Once bound, we send out packets once every 60 seconds to the server
we're bound to AND NO ONE ELSE.

- If we fail to receive a reply from our server within FAIL_THRESHOLD
seconds, we assume our server has croaked and go back to broadcasting
everywhere every 5 seconds again until somebody answers. FAIL_THRESHOLD
is currently set to 20 seconds.

Other fixes/improvements:

- ypbind now logs 'server not responding' and 'server OK' messages where
appropriate.

Thanks to Thomas Graichen <graichen@omega.physik.fu-berlin.de> for
reporting the problem and guilt-tripping me into fixing it. :)


3033 23-Sep-1994 dg

Don't return the address of a stack variable.


1927 08-Aug-1994 wollman

Copying YP programs over from 1.1.5, with a slightly different directory
structure than before.