aboutsummaryrefslogtreecommitdiff
path: root/src/or/config.c
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2008-08-06 16:32:17 +0000
committerNick Mathewson <nickm@torproject.org>2008-08-06 16:32:17 +0000
commit635f3c8aeef717d03a86117dfa81944fb6788bca (patch)
treee9a99b885c3f828119398d92388f1e808cdd06a9 /src/or/config.c
parent2905291af2c3719bdd482e8c6f59ec983fe0e827 (diff)
downloadtor-635f3c8aeef717d03a86117dfa81944fb6788bca.tar.gz
tor-635f3c8aeef717d03a86117dfa81944fb6788bca.zip
r17664@tombo: nickm | 2008-08-06 12:32:09 -0400
Patch from Christopher Davis: open /dev/pf before dropping privileges. Fixes bug 782. Backport candidate. svn:r16450
Diffstat (limited to 'src/or/config.c')
-rw-r--r--src/or/config.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/or/config.c b/src/or/config.c
index 201a621e64..0edea45bd2 100644
--- a/src/or/config.c
+++ b/src/or/config.c
@@ -1059,6 +1059,16 @@ options_act_reversible(or_options_t *old_options, char **msg)
}
}
+#if defined(HAVE_NET_IF_H) && defined(HAVE_NET_PFVAR_H)
+ /* Open /dev/pf before dropping privileges. */
+ if (options->TransPort) {
+ if (get_pf_socket() < 0) {
+ *msg = tor_strdup("Unable to open /dev/pf for transparent proxy.");
+ goto rollback;
+ }
+ }
+#endif
+
/* Setuid/setgid as appropriate */
if (options->User || options->Group) {
/* XXXX021 We should only do this the first time through, not on