Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/usr.sbin/npf/npfd restrict permissions on log file



details:   https://anonhg.NetBSD.org/src/rev/bd2abbf55c6d
branches:  trunk
changeset: 820342:bd2abbf55c6d
user:      christos <christos%NetBSD.org@localhost>
date:      Sat Jan 07 16:36:54 2017 +0000

description:
restrict permissions on log file

diffstat:

 usr.sbin/npf/npfd/npfd_log.c |  7 +++++--
 1 files changed, 5 insertions(+), 2 deletions(-)

diffs (35 lines):

diff -r c62428bde02b -r bd2abbf55c6d usr.sbin/npf/npfd/npfd_log.c
--- a/usr.sbin/npf/npfd/npfd_log.c      Sat Jan 07 16:34:50 2017 +0000
+++ b/usr.sbin/npf/npfd/npfd_log.c      Sat Jan 07 16:36:54 2017 +0000
@@ -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 @@
 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 @@
                ctx->dumper = pcap_dump_open_append(ctx->pcap, ctx->path);
                break;
        }
+       (void)umask(omask);
 
        if (ctx->dumper == NULL) {
                if (die)



Home | Main Index | Thread Index | Old Index