diff options
author | Henning Brauer <henning@cvs.openbsd.org> | 2004-02-20 11:57:18 +0000 |
---|---|---|
committer | Henning Brauer <henning@cvs.openbsd.org> | 2004-02-20 11:57:18 +0000 |
commit | 68b5e5122c17cb47aa69e3a3159de5c353a3793a (patch) | |
tree | d1252acc5822a2642d2dab655a3bc91a409b6b4c | |
parent | 94833ab9902453564f7d928ca1be696a6b1fef2e (diff) |
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@
-rw-r--r-- | usr.sbin/ypbind/ypbind.c | 10 |
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.. |