]>
Commit | Line | Data |
---|---|---|
2f98c754 AM |
1 | diff -ur pure-ftpd-1.0.21/pure-config/pure-config.h pure-ftpd-1.0.21.new/pure-config/pure-config.h |
2 | --- pure-ftpd-1.0.21/pure-config/pure-config.h 2005-06-18 12:39:55.000000000 +0200 | |
3 | +++ pure-ftpd-1.0.21.new/pure-config/pure-config.h 2009-02-03 15:00:10.358021471 +0100 | |
4 | @@ -82,6 +82,7 @@ | |
5 | { NULL, '\0', /* 'I' */ "MaxIdleTime", CFG_STR, (void*) &opt[I], 0 }, | |
6 | { NULL, '\0', /* 'k' */ "MaxDiskUsage", CFG_STR, (void*) &opt[I], 0 }, | |
7 | { NULL, '\0', /* 'a' */ "TrustedGID", CFG_STR, (void*) &opt[I], 0 }, | |
8 | +{ NULL, '\0', /* '2' */ "AdditionalGID", CFG_STR, (void*) &opt[I], 0 }, | |
9 | { NULL, '\0', /* 'c' */ "MaxClientsNumber", CFG_STR, (void*) &opt[I], 0 }, | |
10 | { NULL, '\0', /* 'C' */ "MaxClientsPerIP", CFG_STR, (void*) &opt[I], 0 }, | |
11 | { NULL, '\0', /* 'm' */ "MaxLoad", CFG_STR, (void*) &opt[I], 0 }, | |
12 | @@ -153,6 +154,7 @@ | |
13 | { "-I", "--maxidletime=" }, | |
14 | { "-k", "--maxdiskusage=" }, | |
15 | { "-a", "--trustedgid=" }, | |
16 | + { "-2", "--additionalgid=" }, | |
17 | { "-c", "--maxclientsnumber=" }, | |
18 | { "-C", "--maxclientsperip=" }, | |
19 | { "-m", "--maxload=" }, | |
20 | diff -ur pure-ftpd-1.0.21/src/ftpd.c pure-ftpd-1.0.21.new/src/ftpd.c | |
21 | --- pure-ftpd-1.0.21/src/ftpd.c 2009-02-03 15:37:58.538020766 +0100 | |
22 | +++ pure-ftpd-1.0.21.new/src/ftpd.c 2009-02-03 15:41:41.582021928 +0100 | |
23 | @@ -1104,7 +1104,10 @@ | |
24 | { | |
25 | #ifndef NON_ROOT_FTP | |
26 | # ifdef HAVE_SETGROUPS | |
27 | - if (setgroups(1U, &gid) != 0) { | |
28 | + gid_t gids[2]; | |
29 | + gids[0] = gid; | |
30 | + gids[1] = chroot_additionalgid; | |
31 | + if (setgroups(want_additionalgid ? 2L : 1L, gids) != 0) { | |
32 | return -1; | |
33 | } | |
34 | # else | |
35 | @@ -5078,6 +5081,19 @@ | |
36 | no_truncate = 1; | |
37 | break; | |
38 | } | |
39 | + case '2': { | |
40 | + const char *nptr; | |
41 | + char *endptr; | |
42 | + | |
43 | + nptr = optarg; | |
44 | + endptr = NULL; | |
45 | + chroot_additionalgid = strtoul(nptr, &endptr, 0); | |
46 | + if (!nptr || !*nptr || !endptr || *endptr) { | |
47 | + die(421, LOG_ERR, MSG_CONF_ERR ": " MSG_ILLEGAL_TRUSTED_GID " (XXX: additional): %s" , optarg); | |
48 | + } | |
49 | + want_additionalgid = 1; | |
50 | + break; | |
51 | + } | |
52 | case '4': { | |
53 | bypass_ipv6 = 1; | |
54 | break; | |
55 | diff -ur pure-ftpd-1.0.21/src/ftpd_p.h pure-ftpd-1.0.21.new/src/ftpd_p.h | |
56 | --- pure-ftpd-1.0.21/src/ftpd_p.h 2006-02-06 22:57:21.000000000 +0100 | |
57 | +++ pure-ftpd-1.0.21.new/src/ftpd_p.h 2009-02-03 15:35:47.946311240 +0100 | |
58 | @@ -60,7 +60,7 @@ | |
59 | }; | |
60 | ||
61 | static const char *GETOPT_OPTIONS = | |
62 | - "0146" | |
63 | + "012:46" | |
64 | #ifdef WITH_RFC2640 | |
65 | "8:9:" | |
66 | #endif | |
67 | @@ -112,6 +112,7 @@ | |
68 | static struct option long_options[] = { | |
69 | { "notruncate", 0, NULL, '0' }, | |
70 | { "logpid", 0, NULL, '1' }, | |
71 | + { "additionalgid", 1, NULL, '2' }, | |
72 | { "ipv4only", 0, NULL, '4' }, | |
73 | { "ipv6only", 0, NULL, '6' }, | |
74 | #ifdef WITH_RFC2640 | |
75 | diff -ur pure-ftpd-1.0.21/src/globals.h pure-ftpd-1.0.21.new/src/globals.h | |
76 | --- pure-ftpd-1.0.21/src/globals.h 2006-02-15 09:55:00.000000000 +0100 | |
77 | +++ pure-ftpd-1.0.21.new/src/globals.h 2009-02-03 15:13:13.234021509 +0100 | |
78 | @@ -37,6 +37,8 @@ | |
79 | GLOBAL0(signed char userchroot); /* don't chroot() by default for regular users */ | |
80 | GLOBAL0(signed char chrooted); /* if we already chroot()ed */ | |
81 | GLOBAL0(uid_t chroot_trustedgid); | |
82 | +GLOBAL(int want_additionalgid, 0); | |
83 | +GLOBAL0(gid_t chroot_additionalgid); | |
84 | GLOBAL0(signed char broken_client_compat); /* don't enable workarounds by default */ | |
85 | GLOBAL0(uid_t warez); /* don't guard against warez */ | |
86 | GLOBAL0(signed char debug); /* don't give debug output */ | |
87 | --- pure/configuration-file/pure-config.pl.in~ 2009-02-03 15:47:24.346020364 +0100 | |
88 | +++ pure/configuration-file/pure-config.pl.in 2009-02-03 15:48:34.678184463 +0100 | |
89 | @@ -64,6 +64,7 @@ | |
90 | my %numeric_switch_for = ( | |
91 | MaxIdleTime => "-I", | |
92 | MaxDiskUsage => "-k", | |
93 | + AdditionalGID => "-2", | |
94 | TrustedGID => "-a", | |
95 | MaxClientsNumber => "-c", | |
96 | MaxClientsPerIP => "-C", |