summaryrefslogtreecommitdiffstats
path: root/usr.sbin/ypbind
diff options
context:
space:
mode:
authorhenning <henning@openbsd.org>2004-02-20 11:57:17 +0000
committerhenning <henning@openbsd.org>2004-02-20 11:57:17 +0000
commit3dd2b234997588b2baaf1d5bd124029bc604b94f (patch)
tree5b585a2f84e3e50871a5a7c45db8445fac5c8885 /usr.sbin/ypbind
parentMore small adjustments of log messages. (diff)
downloadwireguard-openbsd-3dd2b234997588b2baaf1d5bd124029bc604b94f.tar.xz
wireguard-openbsd-3dd2b234997588b2baaf1d5bd124029bc604b94f.zip
ypbin creates /var/yp/binding/<domainname>.<version> and /var/run/ypbind.lock
using open(2) with mode 0644 - however, these files _have_ to be world readable, and open's mode is subject to umask. do an explicit fchmod after open to set the mode to 0644 regardless of umask. ok maja@ deraadt@
Diffstat (limited to 'usr.sbin/ypbind')
-rw-r--r--usr.sbin/ypbind/ypbind.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/usr.sbin/ypbind/ypbind.c b/usr.sbin/ypbind/ypbind.c
index 7bc5079a609..f843dc2691e 100644
--- a/usr.sbin/ypbind/ypbind.c
+++ b/usr.sbin/ypbind/ypbind.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ypbind.c,v 1.51 2003/08/19 22:10:08 deraadt Exp $ */
+/* $OpenBSD: ypbind.c,v 1.52 2004/02/20 11:57:17 henning Exp $ */
/*
* Copyright (c) 1992, 1993, 1996, 1997, 1998 Theo de Raadt <deraadt@openbsd.org>
@@ -27,7 +27,7 @@
*/
#ifndef LINT
-static char rcsid[] = "$OpenBSD: ypbind.c,v 1.51 2003/08/19 22:10:08 deraadt Exp $";
+static char rcsid[] = "$OpenBSD: ypbind.c,v 1.52 2004/02/20 11:57:17 henning Exp $";
#endif
#include <sys/param.h>
@@ -393,6 +393,9 @@ main(int argc, char *argv[])
flock(lockfd, LOCK_SH);
#endif
+ if (fchmod(lockfd, 0644) == -1)
+ err(1, "fchmod");
+
(void)pmap_unset(YPBINDPROG, YPBINDVERS);
udptransp = svcudp_create(RPC_ANYSOCK);
@@ -1044,6 +1047,9 @@ rpc_received(char *dom, struct sockaddr_in *raddrp, int force)
flock(fd, LOCK_SH);
#endif
+ if (fchmod(fd, 0644) == -1)
+ err(1, "fchmod");
+
/*
* ok, if BINDINGDIR exists, and we can create the binding file,
* then write to it..