python/hypothesis: update to 6.121.0
[oi-userland.git] / components / network / proftpd / patches / 027.28398194.patch
blob377850337b4720d01a2787122bb9cf59f1577e6b
2 # This patch is the ProFTPD part of CR 28398194. The mod_solaris_priv.c
3 # makes the FTP session process privilege aware. As soon as
4 # solaris_priv_post_pass() calls setreuid() to make a process privilege
5 # aware, it sets 'session.disable_id_switching' to TRUE. Unfortunately
6 # it's not enough, because mod_auth_pam.c overrides .disable_id_switching to
7 # tell src/privs.c to operate as root. This is of course futile on Oracle
8 # Solaris and makes src/privs.c complain loudly. All details were submitted
9 # to upstream:
10 # https://github.com/proftpd/proftpd/pull/732
12 # The other part of the fix updates mod_solaris_priv.c to set
13 # he priv_aware flag as soon as a session process is privilege aware.
15 # If the pull request is accepted, we can kill this patch
16 # as soon as we get fixed proftpd from upstream. There is no ETA.
18 --- a/include/proftpd.h
19 +++ b/include/proftpd.h
20 @@ -97,6 +97,9 @@ typedef struct {
23 int disable_id_switching; /* Disable UID/GID switching */
24 +#ifdef SOLARIS2
25 + int priv_aware; /* process posses all privs it needs */
26 +#endif /* SOLARIS2 */
27 uid_t uid, ouid; /* Current and original UIDs */
28 gid_t gid; /* Current GID */
30 diff --git a/src/privs.c b/src/privs.c
31 index 8a86947d8..7f18af07b 100644
32 --- a/src/privs.c
33 +++ b/src/privs.c
34 @@ -185,7 +185,11 @@ int pr_privs_root(const char *file, int lineno) {
36 pr_signals_block();
38 +#ifdef SOLARIS2
39 + if (!session.disable_id_switching && !session.priv_aware) {
40 +#else
41 if (!session.disable_id_switching) {
42 +#endif
44 #if defined(HAVE_SETEUID)
45 if (seteuid(PR_ROOT_UID) < 0) {
46 @@ -247,7 +251,12 @@ int pr_privs_user(const char *file, int lineno) {
48 pr_signals_block();
50 +#ifdef SOLARIS2
51 + if (!session.disable_id_switching && !session.priv_aware) {
52 +#else
53 if (!session.disable_id_switching) {
54 +#endif
56 #if defined(HAVE_SETEUID)
57 if (seteuid(PR_ROOT_UID) < 0) {
58 int priority = (errno == EPERM ? PR_LOG_NOTICE : PR_LOG_ERR);
59 @@ -335,7 +344,12 @@ int pr_privs_relinquish(const char *file, int lineno) {
61 pr_signals_block();
63 +#ifdef SOLARIS2
64 + if (!session.disable_id_switching && !session.priv_aware) {
65 +#else
66 if (!session.disable_id_switching) {
67 +#endif
69 #if defined(HAVE_SETEUID)
70 if (geteuid() != PR_ROOT_UID) {
71 if (seteuid(PR_ROOT_UID) < 0) {