Module Name:    src
Committed By:   christos
Date:           Sat Jan  7 16:36:54 UTC 2017

Modified Files:
        src/usr.sbin/npf/npfd: npfd_log.c

Log Message:
restrict permissions on log file


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/usr.sbin/npf/npfd/npfd_log.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.sbin/npf/npfd/npfd_log.c
diff -u src/usr.sbin/npf/npfd/npfd_log.c:1.6 src/usr.sbin/npf/npfd/npfd_log.c:1.7
--- src/usr.sbin/npf/npfd/npfd_log.c:1.6	Fri Jan  6 14:20:24 2017
+++ src/usr.sbin/npf/npfd/npfd_log.c	Sat Jan  7 11:36:54 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: npfd_log.c,v 1.6 2017/01/06 19:20:24 christos Exp $	*/
+/*	$NetBSD: npfd_log.c,v 1.7 2017/01/07 16:36:54 christos Exp $	*/
 
 /*-
  * Copyright (c) 2015 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__RCSID("$NetBSD: npfd_log.c,v 1.6 2017/01/06 19:20:24 christos Exp $");
+__RCSID("$NetBSD: npfd_log.c,v 1.7 2017/01/07 16:36:54 christos Exp $");
 
 #include <sys/types.h>
 #include <sys/param.h>
@@ -260,6 +260,8 @@ npfd_log_create(const char *filename, co
 bool
 npfd_log_reopen(npfd_log_t *ctx, bool die)
 {
+	mode_t omask = umask(077);
+
 	if (ctx->dumper)
 		pcap_dump_close(ctx->dumper);
 	/*
@@ -277,6 +279,7 @@ npfd_log_reopen(npfd_log_t *ctx, bool di
 		ctx->dumper = pcap_dump_open_append(ctx->pcap, ctx->path);
 		break;
 	}
+	(void)umask(omask);
 
 	if (ctx->dumper == NULL) {
 		if (die)

Reply via email to