summaryrefslogtreecommitdiffstats
path: root/usr.sbin/ypserv
diff options
context:
space:
mode:
authorschwarze <schwarze@openbsd.org>2010-01-20 23:20:28 +0000
committerschwarze <schwarze@openbsd.org>2010-01-20 23:20:28 +0000
commitc3ca05b304e77da948e203a4fea29c9d5888545d (patch)
tree66c31d3f16bc49ed12f1c0a1bc13b1d62737ee9f /usr.sbin/ypserv
parentOne \ too many in pfvar.h. From Daniel Dickman <didickman@gmail.com> (diff)
downloadwireguard-openbsd-c3ca05b304e77da948e203a4fea29c9d5888545d.tar.xz
wireguard-openbsd-c3ca05b304e77da948e203a4fea29c9d5888545d.zip
Make ypserv(8) reread its YP maps on SIGHUP
and use that in Makefile.yp(8) at the end of cd /var/yp; make all such that the new maps get used locally even when NOPUSH is set; fixing a quirk reported by ian@. While here, polish the yppush(8) manual and document a few related mini-bugs to be fixed later. feedback and ok ian@ and jmc@
Diffstat (limited to 'usr.sbin/ypserv')
-rw-r--r--usr.sbin/ypserv/ypinit/Makefile.yp3
-rw-r--r--usr.sbin/ypserv/ypinit/Makefile.yp.822
-rw-r--r--usr.sbin/ypserv/yppush/yppush.828
-rw-r--r--usr.sbin/ypserv/ypserv/ypserv.827
-rw-r--r--usr.sbin/ypserv/ypserv/ypserv.c4
5 files changed, 60 insertions, 24 deletions
diff --git a/usr.sbin/ypserv/ypinit/Makefile.yp b/usr.sbin/ypserv/ypinit/Makefile.yp
index 4afb72b1bc3..a46786c20f1 100644
--- a/usr.sbin/ypserv/ypinit/Makefile.yp
+++ b/usr.sbin/ypserv/ypinit/Makefile.yp
@@ -1,4 +1,4 @@
-# $OpenBSD: Makefile.yp,v 1.15 2009/12/20 13:08:40 schwarze Exp $
+# $OpenBSD: Makefile.yp,v 1.16 2010/01/20 23:20:28 schwarze Exp $
# ----------------------------------------------------------------------
# User-configurable settings; see Makefile.yp(8) for details.
@@ -24,6 +24,7 @@ MAXGID=32765
USEDNS=
all: passwd group hosts ethers networks rpc services protocols netid netgroup amd.home aliases
+ pkill -HUP ypserv
# ----------------------------------------------------------------------
# End of user-configurable settings; you may also add new targets, though.
diff --git a/usr.sbin/ypserv/ypinit/Makefile.yp.8 b/usr.sbin/ypserv/ypinit/Makefile.yp.8
index 632624468f3..f0695ec91e5 100644
--- a/usr.sbin/ypserv/ypinit/Makefile.yp.8
+++ b/usr.sbin/ypserv/ypinit/Makefile.yp.8
@@ -1,4 +1,4 @@
-.\" $OpenBSD: Makefile.yp.8,v 1.5 2009/12/20 17:10:58 jmc Exp $
+.\" $OpenBSD: Makefile.yp.8,v 1.6 2010/01/20 23:20:28 schwarze Exp $
.\"
.\" Copyright (c) 2008 Ingo Schwarze <schwarze@usta.de>
.\"
@@ -14,7 +14,7 @@
.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
.\"
-.Dd $Mdocdate: December 20 2009 $
+.Dd $Mdocdate: January 20 2010 $
.Dt MAKEFILE.YP 8
.Os
.Sh NAME
@@ -261,7 +261,9 @@ Generates the
map from the file
.Pa /etc/amd/amd.home .
.It Ic all
-Generates all of the above.
+Generates all of the above, and sends a hangup signal to
+.Xr ypserv 8
+such that it uses the new maps.
.El
.Pp
In order to keep additional custom YP maps up to date, the
@@ -289,3 +291,17 @@ Cookies controlling the operation of
.Xr ypinit 8 ,
.Xr yppush 8 ,
.Xr ypserv 8
+.Sh BUGS
+When
+.Dv NOPUSH
+is set and individual maps are regenerated (as opposed to
+.Ic all ) ,
+the hangup signal to
+.Xr ypserv 8
+must be sent manually, or the new maps won't be used.
+.Pp
+When
+.Dv NOPUSH
+is unset, maps are pushed to the master server on the local host too,
+slowing down
+.Nm .
diff --git a/usr.sbin/ypserv/yppush/yppush.8 b/usr.sbin/ypserv/yppush/yppush.8
index 7b2b82f83cf..7f6d62da32a 100644
--- a/usr.sbin/ypserv/yppush/yppush.8
+++ b/usr.sbin/ypserv/yppush/yppush.8
@@ -1,4 +1,4 @@
-.\" $OpenBSD: yppush.8,v 1.14 2008/10/22 20:31:20 jmc Exp $
+.\" $OpenBSD: yppush.8,v 1.15 2010/01/20 23:20:28 schwarze Exp $
.\"
.\" Copyright (c) 1995 Mats O Jansson <moj@stacken.kth.se>
.\" All rights reserved.
@@ -24,12 +24,12 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.Dd $Mdocdate: October 22 2008 $
+.Dd $Mdocdate: January 20 2010 $
.Dt YPPUSH 8
.Os
.Sh NAME
.Nm yppush
-.Nd force distribution of YP map
+.Nd force distribution of one YP map
.Sh SYNOPSIS
.Nm yppush
.Op Fl v
@@ -39,17 +39,24 @@
.\" .Op Fl t Ar timeout
.Ar mapname
.Sh DESCRIPTION
-.Nm yppush
-is used to distribute an YP map from a master server to any
-slave server in the domain.
-All servers of the domain are fetched from the YP map ypservers.
+The
+.Nm
+utility distributes one YP map from the master server to all
+slave servers in the domain.
+All servers of the domain are fetched from the YP map
+.Pa ypservers .
+Before starting distribution, the master server is told to reread its
+.Xr db(3)
+map files from disk.
.Pp
The options are as follows:
.Bl -tag -width Ds
.It Fl d Ar domainname
-Don't use default domain, use the specified domain.
+Don't use the default domain, use the specified domain.
.It Fl h Ar hostname
-Distribute map only to one host and not to the hosts in the ypserver map.
+Distribute the map only to one host and not to the hosts in the
+.Pa ypservers
+map.
.\" .It Fl p Ar paralleljobs
.\"Set the number of parallel transfers.
.\".It Fl t Ar timeout
@@ -64,3 +71,6 @@ Announce what the program is doing.
.Xr ypserv 8
.Sh AUTHORS
.An Mats O Jansson Aq moj@stacken.kth.se
+.Sh BUGS
+The map is also pushed from the master server to itself,
+which has no effect other than slowing down operation.
diff --git a/usr.sbin/ypserv/ypserv/ypserv.8 b/usr.sbin/ypserv/ypserv/ypserv.8
index 25e2462d43f..31442c53c10 100644
--- a/usr.sbin/ypserv/ypserv/ypserv.8
+++ b/usr.sbin/ypserv/ypserv/ypserv.8
@@ -1,4 +1,4 @@
-.\" $OpenBSD: ypserv.8,v 1.25 2008/10/22 20:31:20 jmc Exp $
+.\" $OpenBSD: ypserv.8,v 1.26 2010/01/20 23:20:28 schwarze Exp $
.\"
.\" Copyright (c) 1994 Mats O Jansson <moj@stacken.kth.se>
.\" All rights reserved.
@@ -24,7 +24,7 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.Dd $Mdocdate: October 22 2008 $
+.Dd $Mdocdate: January 20 2010 $
.Dt YPSERV 8
.Os
.Sh NAME
@@ -70,14 +70,6 @@ This file can have any name since it's given by the argument to
.Fl a
(use full path).
.Pp
-The file used can be reread by sending a
-.Dv SIGHUP
-to
-.Nm ypserv .
-The process PID
-can be found in the file
-.Pa /var/run/ypserv.pid .
-.Pp
If a host isn't secure all queries to the server will result in a YP_NODOM
result.
.Pp
@@ -95,6 +87,21 @@ exists), then
.Nm
will be automatically started at boot time.
.Pp
+On receipt of a hangup signal,
+.Dv SIGHUP ,
+.Nm
+will reopen the log file and reread its configuration,
+including both the
+.Xr db 3
+map files and the
+.Xr ypserv.acl 5
+or
+.Xr securenet 5
+configuration file.
+The process ID
+can be found in the file
+.Pa /var/run/ypserv.pid .
+.Pp
The options are as follows:
.Bl -tag -width Ds
.It Fl 1
diff --git a/usr.sbin/ypserv/ypserv/ypserv.c b/usr.sbin/ypserv/ypserv/ypserv.c
index bd17d318278..0f520456da6 100644
--- a/usr.sbin/ypserv/ypserv/ypserv.c
+++ b/usr.sbin/ypserv/ypserv/ypserv.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ypserv.c,v 1.36 2009/10/27 23:59:58 deraadt Exp $ */
+/* $OpenBSD: ypserv.c,v 1.37 2010/01/20 23:20:28 schwarze Exp $ */
/*
* Copyright (c) 1994 Mats O Jansson <moj@stacken.kth.se>
@@ -334,6 +334,8 @@ hup(void)
yplog("sig_hup: reread %s", YP_SECURENET_FILE);
(void)acl_securenet(YP_SECURENET_FILE);
}
+
+ ypdb_close_all();
}
static void