Lines 1-6
Link Here
|
1 |
--- src/main.c.orig 2011-08-16 12:14:34 UTC |
1 |
--- src/main.c.orig 2014-12-13 00:57:23 UTC |
2 |
+++ src/main.c |
2 |
+++ src/main.c |
3 |
@@ -407,12 +407,9 @@ main (int argc, char **argv) |
3 |
@@ -417,12 +417,9 @@ main (int argc, char **argv) |
4 |
exit (EX_OSERR); |
4 |
exit (EX_OSERR); |
5 |
} |
5 |
} |
6 |
|
6 |
|
Lines 10-25
Link Here
|
10 |
- else |
10 |
- else |
11 |
- log_message (LOG_WARNING, |
11 |
- log_message (LOG_WARNING, |
12 |
- "Not running as root, so not changing UID/GID."); |
12 |
- "Not running as root, so not changing UID/GID."); |
13 |
+ /*To get this to run correctly on FreeBSD, we must |
13 |
+ /* To get this to run correctly on FreeBSD, we must |
14 |
+ ceate the PID and log files before we drop privileges. |
14 |
+ create the PID and log files before we drop privileges. |
15 |
+ Other ideas are welcome */ |
15 |
+ Other ideas are welcome */ |
16 |
|
16 |
|
17 |
/* Create log file after we drop privileges */ |
17 |
/* Create log file after we drop privileges */ |
18 |
if (setup_logging ()) { |
18 |
if (setup_logging ()) { |
19 |
@@ -427,6 +424,13 @@ main (int argc, char **argv) |
19 |
@@ -438,6 +435,13 @@ main (int argc, char **argv) |
20 |
exit (EX_OSERR); |
|
|
21 |
} |
20 |
} |
22 |
} |
21 |
} |
|
|
22 |
|
23 |
+ /* Switch to a different user if we're running as root */ |
23 |
+ /* Switch to a different user if we're running as root */ |
24 |
+ if (geteuid () == 0) |
24 |
+ if (geteuid () == 0) |
25 |
+ change_user (argv[0]); |
25 |
+ change_user (argv[0]); |
Lines 27-32
Link Here
|
27 |
+ log_message (LOG_WARNING, |
27 |
+ log_message (LOG_WARNING, |
28 |
+ "Not running as root, so not changing UID/GID."); |
28 |
+ "Not running as root, so not changing UID/GID."); |
29 |
+ |
29 |
+ |
30 |
|
|
|
31 |
if (child_pool_create () < 0) { |
30 |
if (child_pool_create () < 0) { |
32 |
fprintf (stderr, |
31 |
fprintf (stderr, |
|
|
32 |
"%s: Could not create the pool of children.\n", |