1 |
commit: c72b59a9ebc037c22bbc10bf2e50543f3351cd23 |
2 |
Author: Lars Wendler <polynomial-c <AT> gentoo <DOT> org> |
3 |
AuthorDate: Thu Mar 29 08:00:16 2018 +0000 |
4 |
Commit: Lars Wendler <polynomial-c <AT> gentoo <DOT> org> |
5 |
CommitDate: Thu Mar 29 08:00:34 2018 +0000 |
6 |
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=c72b59a9 |
7 |
|
8 |
net-print/cups: Fixed compilation with USE="-pam". |
9 |
|
10 |
Closes: https://bugs.gentoo.org/651878 |
11 |
Package-Manager: Portage-2.3.26, Repoman-2.3.7 |
12 |
|
13 |
net-print/cups/cups-2.2.7.ebuild | 1 + |
14 |
net-print/cups/files/cups-2.3_rc1-no_pam.patch | 164 +++++++++++++++++++++++++ |
15 |
2 files changed, 165 insertions(+) |
16 |
|
17 |
diff --git a/net-print/cups/cups-2.2.7.ebuild b/net-print/cups/cups-2.2.7.ebuild |
18 |
index 873f91da5e3..23b3b6a01ce 100644 |
19 |
--- a/net-print/cups/cups-2.2.7.ebuild |
20 |
+++ b/net-print/cups/cups-2.2.7.ebuild |
21 |
@@ -84,6 +84,7 @@ PATCHES=( |
22 |
"${FILESDIR}/${PN}-1.4.4-nostrip.patch" |
23 |
"${FILESDIR}/${PN}-2.0.2-rename-systemd-service-files.patch" |
24 |
"${FILESDIR}/${PN}-2.0.1-xinetd-installation-fix.patch" |
25 |
+ "${FILESDIR}/${PN}-2.3_rc1-no_pam.patch" #651878 |
26 |
) |
27 |
|
28 |
MULTILIB_CHOST_TOOLS=( |
29 |
|
30 |
diff --git a/net-print/cups/files/cups-2.3_rc1-no_pam.patch b/net-print/cups/files/cups-2.3_rc1-no_pam.patch |
31 |
new file mode 100644 |
32 |
index 00000000000..17e69ab7b0a |
33 |
--- /dev/null |
34 |
+++ b/net-print/cups/files/cups-2.3_rc1-no_pam.patch |
35 |
@@ -0,0 +1,164 @@ |
36 |
+From 3cd7b5e053f8100da1ca8d8daf93976cca3516ef Mon Sep 17 00:00:00 2001 |
37 |
+From: Michael R Sweet <michael.r.sweet@×××××.com> |
38 |
+Date: Fri, 23 Feb 2018 13:21:56 -0500 |
39 |
+Subject: [PATCH] Fix builds without PAM (Issue #5253) |
40 |
+ |
41 |
+--- a/scheduler/auth.c |
42 |
++++ b/scheduler/auth.c |
43 |
+@@ -67,9 +68,6 @@ static int check_authref(cupsd_client_t *con, const char *right); |
44 |
+ static int compare_locations(cupsd_location_t *a, |
45 |
+ cupsd_location_t *b); |
46 |
+ static cupsd_authmask_t *copy_authmask(cupsd_authmask_t *am, void *data); |
47 |
+-#if !HAVE_LIBPAM |
48 |
+-static char *cups_crypt(const char *pw, const char *salt); |
49 |
+-#endif /* !HAVE_LIBPAM */ |
50 |
+ static void free_authmask(cupsd_authmask_t *am, void *data); |
51 |
+ #if HAVE_LIBPAM |
52 |
+ static int pam_func(int, const struct pam_message **, |
53 |
+@@ -690,14 +688,14 @@ cupsdAuthorize(cupsd_client_t *con) /* I - Client connection */ |
54 |
+ * client... |
55 |
+ */ |
56 |
+ |
57 |
+- pass = cups_crypt(password, pw->pw_passwd); |
58 |
++ pass = crypt(password, pw->pw_passwd); |
59 |
+ |
60 |
+ if (!pass || strcmp(pw->pw_passwd, pass)) |
61 |
+ { |
62 |
+ # ifdef HAVE_SHADOW_H |
63 |
+ if (spw) |
64 |
+ { |
65 |
+- pass = cups_crypt(password, spw->sp_pwdp); |
66 |
++ pass = crypt(password, spw->sp_pwdp); |
67 |
+ |
68 |
+ if (pass == NULL || strcmp(spw->sp_pwdp, pass)) |
69 |
+ { |
70 |
+@@ -1991,129 +1989,6 @@ copy_authmask(cupsd_authmask_t *mask, /* I - Existing auth mask */ |
71 |
+ } |
72 |
+ |
73 |
+ |
74 |
+-#if !HAVE_LIBPAM |
75 |
+-/* |
76 |
+- * 'cups_crypt()' - Encrypt the password using the DES or MD5 algorithms, |
77 |
+- * as needed. |
78 |
+- */ |
79 |
+- |
80 |
+-static char * /* O - Encrypted password */ |
81 |
+-cups_crypt(const char *pw, /* I - Password string */ |
82 |
+- const char *salt) /* I - Salt (key) string */ |
83 |
+-{ |
84 |
+- if (!strncmp(salt, "$1$", 3)) |
85 |
+- { |
86 |
+- /* |
87 |
+- * Use MD5 passwords without the benefit of PAM; this is for |
88 |
+- * Slackware Linux, and the algorithm was taken from the |
89 |
+- * old shadow-19990827/lib/md5crypt.c source code... :( |
90 |
+- */ |
91 |
+- |
92 |
+- int i; /* Looping var */ |
93 |
+- unsigned long n; /* Output number */ |
94 |
+- int pwlen; /* Length of password string */ |
95 |
+- const char *salt_end; /* End of "salt" data for MD5 */ |
96 |
+- char *ptr; /* Pointer into result string */ |
97 |
+- _cups_md5_state_t state; /* Primary MD5 state info */ |
98 |
+- _cups_md5_state_t state2; /* Secondary MD5 state info */ |
99 |
+- unsigned char digest[16]; /* MD5 digest result */ |
100 |
+- static char result[120]; /* Final password string */ |
101 |
+- |
102 |
+- |
103 |
+- /* |
104 |
+- * Get the salt data between dollar signs, e.g. $1$saltdata$md5. |
105 |
+- * Get a maximum of 8 characters of salt data after $1$... |
106 |
+- */ |
107 |
+- |
108 |
+- for (salt_end = salt + 3; *salt_end && (salt_end - salt) < 11; salt_end ++) |
109 |
+- if (*salt_end == '$') |
110 |
+- break; |
111 |
+- |
112 |
+- /* |
113 |
+- * Compute the MD5 sum we need... |
114 |
+- */ |
115 |
+- |
116 |
+- pwlen = strlen(pw); |
117 |
+- |
118 |
+- _cupsMD5Init(&state); |
119 |
+- _cupsMD5Append(&state, (unsigned char *)pw, pwlen); |
120 |
+- _cupsMD5Append(&state, (unsigned char *)salt, salt_end - salt); |
121 |
+- |
122 |
+- _cupsMD5Init(&state2); |
123 |
+- _cupsMD5Append(&state2, (unsigned char *)pw, pwlen); |
124 |
+- _cupsMD5Append(&state2, (unsigned char *)salt + 3, salt_end - salt - 3); |
125 |
+- _cupsMD5Append(&state2, (unsigned char *)pw, pwlen); |
126 |
+- _cupsMD5Finish(&state2, digest); |
127 |
+- |
128 |
+- for (i = pwlen; i > 0; i -= 16) |
129 |
+- _cupsMD5Append(&state, digest, i > 16 ? 16 : i); |
130 |
+- |
131 |
+- for (i = pwlen; i > 0; i >>= 1) |
132 |
+- _cupsMD5Append(&state, (unsigned char *)((i & 1) ? "" : pw), 1); |
133 |
+- |
134 |
+- _cupsMD5Finish(&state, digest); |
135 |
+- |
136 |
+- for (i = 0; i < 1000; i ++) |
137 |
+- { |
138 |
+- _cupsMD5Init(&state); |
139 |
+- |
140 |
+- if (i & 1) |
141 |
+- _cupsMD5Append(&state, (unsigned char *)pw, pwlen); |
142 |
+- else |
143 |
+- _cupsMD5Append(&state, digest, 16); |
144 |
+- |
145 |
+- if (i % 3) |
146 |
+- _cupsMD5Append(&state, (unsigned char *)salt + 3, salt_end - salt - 3); |
147 |
+- |
148 |
+- if (i % 7) |
149 |
+- _cupsMD5Append(&state, (unsigned char *)pw, pwlen); |
150 |
+- |
151 |
+- if (i & 1) |
152 |
+- _cupsMD5Append(&state, digest, 16); |
153 |
+- else |
154 |
+- _cupsMD5Append(&state, (unsigned char *)pw, pwlen); |
155 |
+- |
156 |
+- _cupsMD5Finish(&state, digest); |
157 |
+- } |
158 |
+- |
159 |
+- /* |
160 |
+- * Copy the final sum to the result string and return... |
161 |
+- */ |
162 |
+- |
163 |
+- memcpy(result, salt, (size_t)(salt_end - salt)); |
164 |
+- ptr = result + (salt_end - salt); |
165 |
+- *ptr++ = '$'; |
166 |
+- |
167 |
+- for (i = 0; i < 5; i ++, ptr += 4) |
168 |
+- { |
169 |
+- n = ((((unsigned)digest[i] << 8) | (unsigned)digest[i + 6]) << 8); |
170 |
+- |
171 |
+- if (i < 4) |
172 |
+- n |= (unsigned)digest[i + 12]; |
173 |
+- else |
174 |
+- n |= (unsigned)digest[5]; |
175 |
+- |
176 |
+- to64(ptr, n, 4); |
177 |
+- } |
178 |
+- |
179 |
+- to64(ptr, (unsigned)digest[11], 2); |
180 |
+- ptr += 2; |
181 |
+- *ptr = '\0'; |
182 |
+- |
183 |
+- return (result); |
184 |
+- } |
185 |
+- else |
186 |
+- { |
187 |
+- /* |
188 |
+- * Use the standard crypt() function... |
189 |
+- */ |
190 |
+- |
191 |
+- return (crypt(pw, salt)); |
192 |
+- } |
193 |
+-} |
194 |
+-#endif /* !HAVE_LIBPAM */ |
195 |
+- |
196 |
+- |
197 |
+ /* |
198 |
+ * 'free_authmask()' - Free function for auth masks. |
199 |
+ */ |