Commit Graph

128 Commits

Author SHA1 Message Date
ginsbach 7333bec30e Make use of the defined YP errors when ypbind encounters one rather than
just returning an empty (successful) RPC result.

Don't exit when allocating memory for a new bound domain received via a RPC.
2017-08-09 01:56:42 +00:00
wiz 01869ca4d2 Remove workaround for ancient HTML generation code. 2017-07-03 21:28:48 +00:00
wiz 6880513a4a Add missing .El. From Henning Petersen in PR 49227. 2014-09-20 11:16:05 +00:00
wiz 88090ea395 Use more markup. 2014-06-15 07:24:32 +00:00
dholland 3c8bd4a957 Document exponential backoff behavior and SIGHUP support, plus a couple
other minor edits.
2014-06-15 01:37:48 +00:00
dholland d7edebe630 Log state transitions. 2014-06-10 17:19:48 +00:00
dholland 106e29fe05 Add a SIGHUP handler; upon SIGHUP do an extra nag_servers on any
domain that's in DEAD state. This lets you explicitly rescue ypbind
from its exponential backoff when you know the world's back up.
2014-06-10 17:19:36 +00:00
dholland f69eb308e3 Instead of using magic numbers in what looks like a boolean
(dom_alive), create a state enumeration (domainstates) and use it
instead.

Instead of three states (new, alive, and, effectively, 'troubled') go
to five: new, alive, pinging, lost, and dead.

Domains start in the NEW state. When we get a reply from a server, the
state goes to ALIVE. The state is set to PINGING when we ping the
server (once a minute normally) and if the ping times out, it goes to
LOST. If we stay lost for a minute, go to DEAD, and in DEAD, do
exponential backoff of nag_servers calls.

Getting rid of the broken logic attached to the 'troubled' state fixes
PR 15355 (ypbind defeats disk idle spindown) -- it will now only
rewrite the binding file when the binding changes.

Also, fix the HEURISTIC code so it doesn't trigger except in ALIVE
state. I think this was the source of a lot of the spamming behavior
seen in PR 32519, which is now fixed.

Might also fix PR 23135 (broadcast ypbind sometimes fails to find
servers).
2014-06-10 17:19:22 +00:00
dholland ff58b21755 Load up with comments. 2014-06-10 17:19:12 +00:00
dholland aed51c4afc Don't rake up the default domain until after processing arguments.
Processing arguments just sets flags -- may as well do it first, and
this way detection of silly errors isn't contingent on having things
fully configured and operating.
2014-06-10 17:19:00 +00:00
dholland af0d2ab5da While there are times it's appropriate to call a state variable
"evil", this isn't one of them. Since the logic involved is to wait
until the default domain binds before backgrounding, call the variable
"started" instead.
2014-06-10 17:18:45 +00:00
dholland acc6243e9f Factor out some rpc validation code. 2014-06-10 17:18:18 +00:00
dholland 4363781772 Don't store the default domain name in a global. While running we
really don't care which domain is the system's default domain.
2014-06-10 17:18:02 +00:00
plunky 87d4f6076b Apply casts to cases where xdrproc_t is expected but is not
strictly passed, for example because the second argument is
a different kind of pointer.
2011-08-30 17:06:20 +00:00
joerg dccf569e0e Use __dead. 2011-08-29 20:38:53 +00:00
dholland 0c53a1f2e4 Don't print uninitialized values off the stack, even as debug messages. 2011-05-25 04:59:22 +00:00
dholland ef192e52d5 When checking if /var/yp/binding/foo.ypservers exists, use the domain
name of the domain being checked instead of the default domain name. Duh.
Necessary for PR 43900.
2011-05-25 04:33:52 +00:00
dholland 8066ee6b9b Remove two entirely unused members of struct domain (previously struct
_dom_binding). I guess these were there because it was cutpasted at
some point from struct dom_binding in <rpcsvc/yp_prot.h>.
2011-05-24 07:02:08 +00:00
dholland cfb05cb343 Merge a couple more minor improvements from Wolfgang Stukenbrock's
patch in PR 43900.
2011-05-24 07:01:53 +00:00
dholland 9d84fe187a The FILE* kept open for /var/yp/binding/foo.ypservers needs to be
per-domain. Also, use the file for the domain we're servicing instead
of always the file for the default domain.

Partly from Wolfgang Stukenbrock's patch in PR 43900.
2011-05-24 07:01:40 +00:00
dholland 6f997d891d The been_ypset flag really needs to be per-domain also. Do that.
Partly from Wolfgang Stukenbrock's patch in PR 43900.
2011-05-24 07:01:24 +00:00
dholland bb36c8993e The ypbindmode really needs to be per-domain, so adjust accordingly.
Partly from Wolfgang Stukenbrock's patch in PR 43900.
2011-05-24 07:01:15 +00:00
dholland 0d20b396fd Allowing ypset is a global permission flag, not an operating mode like
broadcast vs. configured/direct. Don't conflate the logic. As I proposed
in PR 43900.
2011-05-24 07:00:34 +00:00
dholland e61f3e4872 Fix initialization of struct domain; initialize all fields in all
cases, merge duplicate code, make sure every domain gets an xid
assigned.

Partly from Wolfgang Stukenbrock's patch in PR 43900.
2011-05-24 07:00:07 +00:00
dholland fec4c9631a The name field of a domain should be dom->dom_name, not dom->dom_domain.
(This and the previous patch make the code far more readable.)
2011-05-24 06:59:53 +00:00
dholland 771940852d The default name for a "domain" variable should be "dom", not "ypdb".
Change them all, and make a couple other related adjustments.
2011-05-24 06:59:35 +00:00
dholland 006489acb9 ypbindlist -> domains 2011-05-24 06:59:07 +00:00
dholland c9b3b0763b xid2ypdb() -> domain_find() 2011-05-24 06:58:54 +00:00
dholland df3a50ea87 Rename struct _dom_binding -> struct domain. 2011-05-24 06:58:42 +00:00
dholland 1cb987c954 Move a bunch of messy sunrpc-related initialization stuff into its own
function instead of blatting it all into main().
2011-05-24 06:58:19 +00:00
dholland fe8f2f2d61 Assimilate the open/flock combination used several times into its own
function.
2011-05-24 06:58:07 +00:00
dholland 2b880b64f4 Fix up calls to yp_log. They cannot use %m, because if the -d option
is used the messages are sent via printf instead of syslog(3).

Also, make sure that none of the calls include a trailing newline and
issue a trailing newline in the -d case so they actually print properly.
(This was noted by Wolfgang Stukenbrock in PR 43900.)

And finally, fix some cases that could in some circumstances print
uninitialized errnos.
2011-05-24 06:57:55 +00:00
dholland 15569646a4 Abstract out some of the handling of the ypservers file. 2011-05-24 06:57:30 +00:00
dholland dfd8a41891 Check that the domain name is valid up front, instead of doing it
after opening sockets and registering services and whatnot.
2011-05-24 06:57:04 +00:00
dholland cb269e446a Remove now-unnecessary extra forward decls; sprinkle a little more static. 2011-05-24 06:56:48 +00:00
dholland 20f9d4037f Sort contents of file. 2011-05-24 06:56:16 +00:00
dholland 58a3e249b1 sort includes 2011-05-23 02:54:53 +00:00
dholland d2f44d281f Don't use _t as an identifier suffix meaning "variable containing a time". 2011-05-23 02:43:10 +00:00
dholland 86a03218b2 Introduce DPRINTF() macro, remove most #ifdef DEBUG usages.
No change to compiler output.
2011-05-23 02:36:35 +00:00
dholland 41741c3c2a u_int32_t -> uint32_t and similar 2011-05-23 02:06:41 +00:00
dholland 81f95bf6fa Don't cast return value of malloc 2011-03-30 05:24:05 +00:00
dholland b639c25325 use __printflike() 2011-03-30 05:20:59 +00:00
skrll 96092d9e00 Whitespace. 2009-11-06 15:41:58 +00:00
christos 225e9fc5c1 make this compile. 2009-11-06 15:36:55 +00:00
chuck 1f5ddb4eb6 in the case where ypbind is serving more than one domain (i.e.
not just the yp_get_default_domain() domain), we must remove
any old binding files from /var/yp/binding (BINDINGDIR) from
previous runs, or the non-yp_get_default_domain()'s will not
bind properly.   add a purge_bindingdir() function that basically
does "rm BINDINGDIR/*.[0-9]" at ypbind startup time.

example case of where this is an issue: bind a second (non-default)
domain.   ypbind will create and flock a /var/yp/binding/xxx.2
file for it.  stop and restart ypbind.  the old /var/yp/binding/xxx.2
file will remain from the previous run.   since it is not flock()'d
by the new instance of ypbind, libc functions like yp_master() will
fail without even bothering to talk to ypbind itself.   (and ypbind
is totally unaware of the old file...)
2009-11-05 19:34:06 +00:00
lukem d877c4c3c0 Enable WARNS=4 by default, except for:
cpuctl  dumplfs  hprop  ipf  iprop-log  kadmin  kcm  kdc  kdigest
	kimpersonate  kstash  ktutil  makefs  ndbootd  ntp  pppd  quot
	racoon  racoonctl  rtadvd  sntp  sup  tcpdchk  tcpdmatch  tcpdump
	traceroute  traceroute6  user  veriexecgen  wsmoused  zic
(Mostly third-party applications)
2009-04-22 15:23:01 +00:00
lukem b118202501 fix -Wsign-compare issues 2009-01-18 10:39:17 +00:00
martin 11a6dbe728 Convert TNF licenses to new 2 clause variant 2008-04-30 13:10:46 +00:00
martin ce099b4099 Remove clause 3 and 4 from TNF licenses 2008-04-28 20:22:51 +00:00
christos 97dcde77bc - Compile in with debugging by default.
- General cleanup.
2007-07-07 22:33:57 +00:00