Commit Graph

84 Commits

Author SHA1 Message Date
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
b118202501 fix -Wsign-compare issues 2009-01-18 10:39:17 +00:00
christos
97dcde77bc - Compile in with debugging by default.
- General cleanup.
2007-07-07 22:33:57 +00:00
tron
886853e55b Ensure alignment of the structure used for RPC requests. This stop
"ypbind" from segfaulting under NetBSD-sparc64 when "ypwhich" is
used to display the current NIS server.
2006-10-05 09:18:11 +00:00
elad
c443814068 Fix misleading error message (from PR/32519). 2006-10-01 19:43:15 +00:00
mrg
0c37c63edc change (mostly) int to socklen_t. GCC 4 doesn't like that int and
socklen_t are different signness.
2006-05-09 20:18:05 +00:00
dsl
3cca093e74 Add (unsigned char) cast to ctype functions 2004-10-30 15:51:20 +00:00
jrf
190b2e4c51 Replaced strncpy with strlcpy. Thanks to Peter Postma who
pointed them our in PR #25762. Approved by christos@NetBSD.org.
2004-09-07 13:20:39 +00:00
jmmv
b635f565e7 Homogenize usage messages: make the 'usage' word all lowercase, as this seems
to be the most common practice in our tree.
2004-01-05 23:23:32 +00:00
agc
7db1d33cba Modify the licences of code written by Theo De Raadt from a 4-clause
to a 2-clause licence (retaining UCB clauses (1) and (2)), per PR
22409 from Joel Baker, approved by Theo de Raadt, and ratified by
myself - the only discrepancy being the handling of the original
clause 3 in src/usr.sbin/yppoll/yppoll.c.
2003-12-10 12:06:25 +00:00
bouyer
6f4c1c24ee Apply patch proposted to tech-userlevel on Sun, 12 Oct 2003:
Remove dom_server_port from struct _dom_binding. It's never initialised
and used in only one place, where dom_server_addr.sin_port was probably
intended.
2003-11-17 21:29:21 +00:00
bouyer
d2c13c7513 width needs to be updated before each loop, because svc_maxfd may have
changed.
2003-09-05 14:59:37 +00:00
wiz
7146bf3ca6 ANSIfy, remove __P(), unifdef __STDC__. 2002-07-06 21:44:40 +00:00
cgd
25bdbb661e convert to use getprogname() 2001-02-19 23:22:40 +00:00
lukem
27f625d619 use LOG_WARNING for warnings and LOG_ERR for fatal errors 2001-01-11 01:47:55 +00:00
cgd
8d81e0e116 __CONCAT does token pasting, not string concatnation. if something like:
__CONCAT("foo","bar");
actually works to concantate strings, it's because the preprocessor expands
it into "foo""bar" as separate strings, and then ANSI string concatenation
is performed on that.  It's more straightforward to just use ANSI string
concatenation directly, and newer GCCs complain (rightly) about misuse
of token pasting.
2000-12-20 01:34:39 +00:00
is
d8302e2d73 More format string cleanups by sommerfeld. 2000-10-11 20:23:46 +00:00
itojun
ba8e4a38dc use getifaddrs, to avoid complicated alignment constraint in SIOCGIFCONF.
(do we need to keep SIOCGIFCONF code in #ifdef?)
2000-04-11 11:36:47 +00:00
itojun
778af5ef23 avoid 64bit alignment issue with SIOCGIFCONF (packed struct access).
From: =?iso-8859-1?Q?G=F6ran_Bengtson?= <goeran@cdg.chalmers.se>
2000-02-20 14:31:28 +00:00
simonb
299578ebd5 Spell "privilege" correctly (correct spelling from Jonathan Stone). 1999-08-16 02:59:22 +00:00
thorpej
653c3855f5 Use pidfile(3). 1999-06-06 02:38:00 +00:00
kleink
b75d68301e <sys/fcntl.h> -> <fcntl.h> 1999-02-12 15:04:00 +00:00
bouyer
fe94b8f229 - Makes ypbind use syslog() (with LOG_DAEMON) instead of warn()/err().
Messages will still be printed to stderr if ypbind is started in debug mode.
- Don't exist if none of the servers listed in
  /var/yp/binding/<domainname>.ypservers are reacheable. It's a temporary
  failure that can be recovered from.
1998-08-21 09:39:04 +00:00
mrg
99b44231f5 minor KNF nits. 1998-07-13 12:01:03 +00:00
lukem
e8664c7183 revert; we can't break the existing ABI and API 1998-02-12 03:32:51 +00:00