privsep.c (67ecd4f3a477a0ca5b76a1694f89755df27a8679) | privsep.c (5ee7cd2107c8ffd1fe70115deabd6599dffb313b) |
---|---|
1/* $OpenBSD: privsep.c,v 1.16 2006/10/25 20:55:04 moritz Exp $ */ 2 3/* 4 * Copyright (c) 2003 Can Erkin Acar 5 * Copyright (c) 2003 Anil Madhavapeddy <anil@recoil.org> 6 * 7 * Permission to use, copy, modify, and distribute this software for any 8 * purpose with or without fee is hereby granted, provided that the above 9 * copyright notice and this permission notice appear in all copies. 10 * 11 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 12 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 13 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 14 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 15 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 16 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 17 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 18 */ | 1/* $OpenBSD: privsep.c,v 1.16 2006/10/25 20:55:04 moritz Exp $ */ 2 3/* 4 * Copyright (c) 2003 Can Erkin Acar 5 * Copyright (c) 2003 Anil Madhavapeddy <anil@recoil.org> 6 * 7 * Permission to use, copy, modify, and distribute this software for any 8 * purpose with or without fee is hereby granted, provided that the above 9 * copyright notice and this permission notice appear in all copies. 10 * 11 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 12 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 13 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 14 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 15 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 16 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 17 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 18 */ |
19 20#include <sys/cdefs.h> 21__FBSDID("$FreeBSD$"); 22 |
|
19#include <sys/types.h> 20#include <sys/time.h> 21#include <sys/socket.h> | 23#include <sys/types.h> 24#include <sys/time.h> 25#include <sys/socket.h> |
22#include <sys/ioctl.h> | |
23 24#include <net/if.h> 25#include <net/bpf.h> 26 27#include <err.h> 28#include <errno.h> 29#include <fcntl.h> 30#include <limits.h> | 26 27#include <net/if.h> 28#include <net/bpf.h> 29 30#include <err.h> 31#include <errno.h> 32#include <fcntl.h> 33#include <limits.h> |
34#ifndef __FreeBSD__ |
|
31#include <pcap.h> 32#include <pcap-int.h> | 35#include <pcap.h> 36#include <pcap-int.h> |
37#endif |
|
33#include <pwd.h> 34#include <signal.h> 35#include <stdio.h> 36#include <stdlib.h> 37#include <string.h> | 38#include <pwd.h> 39#include <signal.h> 40#include <stdio.h> 41#include <stdlib.h> 42#include <string.h> |
43#ifdef __FreeBSD__ 44/* XXX: pcap pollutes namespace with strlcpy if not present previously */ 45#include <pcap.h> 46#include <pcap-int.h> 47#endif |
|
38#include <syslog.h> 39#include <unistd.h> 40#include "pflogd.h" 41 42enum cmd_types { 43 PRIV_SET_SNAPLEN, /* set the snaplength */ 44 PRIV_MOVE_LOG, /* move logfile away */ 45 PRIV_OPEN_LOG /* open logfile for appending */ --- 18 unchanged lines hidden (view full) --- 64/* based on syslogd privsep */ 65int 66priv_init(void) 67{ 68 int i, fd, socks[2], cmd; 69 int snaplen, ret, olderrno; 70 struct passwd *pw; 71 | 48#include <syslog.h> 49#include <unistd.h> 50#include "pflogd.h" 51 52enum cmd_types { 53 PRIV_SET_SNAPLEN, /* set the snaplength */ 54 PRIV_MOVE_LOG, /* move logfile away */ 55 PRIV_OPEN_LOG /* open logfile for appending */ --- 18 unchanged lines hidden (view full) --- 74/* based on syslogd privsep */ 75int 76priv_init(void) 77{ 78 int i, fd, socks[2], cmd; 79 int snaplen, ret, olderrno; 80 struct passwd *pw; 81 |
82#ifdef __FreeBSD__ 83 for (i = 1; i < NSIG; i++) 84#else |
|
72 for (i = 1; i < _NSIG; i++) | 85 for (i = 1; i < _NSIG; i++) |
86#endif |
|
73 signal(i, SIG_DFL); 74 75 /* Create sockets */ 76 if (socketpair(AF_LOCAL, SOCK_STREAM, PF_UNSPEC, socks) == -1) 77 err(1, "socketpair() failed"); 78 79 pw = getpwnam("_pflogd"); 80 if (pw == NULL) --- 287 unchanged lines hidden --- | 87 signal(i, SIG_DFL); 88 89 /* Create sockets */ 90 if (socketpair(AF_LOCAL, SOCK_STREAM, PF_UNSPEC, socks) == -1) 91 err(1, "socketpair() failed"); 92 93 pw = getpwnam("_pflogd"); 94 if (pw == NULL) --- 287 unchanged lines hidden --- |