1 |
vapier 14/03/29 20:58:11 |
2 |
|
3 |
Added: oftpd-0.3.7-delay-root-check.patch |
4 |
Log: |
5 |
Delay root check until after processing the command line. |
6 |
|
7 |
(Portage version: 2.2.10/cvs/Linux x86_64, signed Manifest commit with key D2E96200) |
8 |
|
9 |
Revision Changes Path |
10 |
1.1 net-ftp/oftpd/files/oftpd-0.3.7-delay-root-check.patch |
11 |
|
12 |
file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/net-ftp/oftpd/files/oftpd-0.3.7-delay-root-check.patch?rev=1.1&view=markup |
13 |
plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/net-ftp/oftpd/files/oftpd-0.3.7-delay-root-check.patch?rev=1.1&content-type=text/plain |
14 |
|
15 |
Index: oftpd-0.3.7-delay-root-check.patch |
16 |
=================================================================== |
17 |
check for root after processing args so non-root can run --help |
18 |
|
19 |
--- a/src/oftpd.c |
20 |
+++ b/src/oftpd.c |
21 |
@@ -56,12 +56,6 @@ int main(int argc, char *argv[]) |
22 |
exe_name = argv[0]; |
23 |
} |
24 |
|
25 |
- /* verify we're running as root */ |
26 |
- if (geteuid() != 0) { |
27 |
- fprintf(stderr, "%s: program needs root permission to run\n", exe_name); |
28 |
- exit(1); |
29 |
- } |
30 |
- |
31 |
/* default command-line arguments */ |
32 |
port = FTP_PORT; |
33 |
user_ptr = NULL; |
34 |
@@ -187,6 +181,12 @@ int main(int argc, char *argv[]) |
35 |
exit(1); |
36 |
} |
37 |
|
38 |
+ /* verify we're running as root */ |
39 |
+ if (geteuid() != 0) { |
40 |
+ fprintf(stderr, "%s: program needs root permission to run\n", exe_name); |
41 |
+ exit(1); |
42 |
+ } |
43 |
+ |
44 |
/* become a daemon */ |
45 |
if (detach) { |
46 |
daemonize(); |