Commit Graph

132 Commits

Author SHA1 Message Date
lukem c4b7a9e794 bsd.own.mk: rename GCC_NO_* to CC_WNO_*
Rename compiler-warning-disable variables from
	GCC_NO_warning
to
	CC_WNO_warning
where warning is the full warning name as used by the compiler.

GCC_NO_IMPLICIT_FALLTHRU is CC_WNO_IMPLICIT_FALLTHROUGH

Using the convention CC_compilerflag, where compilerflag
is based on the full compiler flag name.
2023-06-03 09:09:01 +00:00
andvar 2cf3f970af s/serivce/service/ in comments. 2022-04-11 20:57:37 +00:00
mrg de11d87641 introduce some common variables for use in GCC warning disables:
GCC_NO_FORMAT_TRUNCATION    -Wno-format-truncation (GCC 7/8)
GCC_NO_STRINGOP_TRUNCATION  -Wno-stringop-truncation (GCC 8)
GCC_NO_STRINGOP_OVERFLOW    -Wno-stringop-overflow (GCC 8)
GCC_NO_CAST_FUNCTION_TYPE   -Wno-cast-function-type (GCC 8)

use these to turn off warnings for most GCC-8 complaints.  many
of these are false positives, most of the real bugs are already
commited, or are yet to come.


we plan to introduce versions of (some?) of these that use the
"-Wno-error=" form, which still displays the warnings but does
not make it an error, and all of the above will be re-considered
as either being "fix me" (warning still displayed) or "warning
is wrong."
2019-10-13 07:28:04 +00:00
ginsbach 617ab226ea Initialize ypbind_resp before first possible error return condition. 2018-03-15 02:25:31 +00:00
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