1 |
commit: f2f17d71f00dc1c922c208335b17f1d39abe7518 |
2 |
Author: Brian Evans <grknight <AT> gentoo <DOT> org> |
3 |
AuthorDate: Fri Mar 3 19:28:43 2017 +0000 |
4 |
Commit: Brian Evans <grknight <AT> gentoo <DOT> org> |
5 |
CommitDate: Fri Mar 3 19:29:25 2017 +0000 |
6 |
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=f2f17d71 |
7 |
|
8 |
dev-php/pecl-crack: Revbump with patch for PHP 7 |
9 |
|
10 |
Package-Manager: Portage-2.3.4, Repoman-2.3.2 |
11 |
|
12 |
dev-php/pecl-crack/files/0.4-php7.patch | 356 ++++++++++++++++++++++++++++ |
13 |
dev-php/pecl-crack/pecl-crack-0.4-r6.ebuild | 26 ++ |
14 |
2 files changed, 382 insertions(+) |
15 |
|
16 |
diff --git a/dev-php/pecl-crack/files/0.4-php7.patch b/dev-php/pecl-crack/files/0.4-php7.patch |
17 |
new file mode 100644 |
18 |
index 00000000000..5a00c912181 |
19 |
--- /dev/null |
20 |
+++ b/dev-php/pecl-crack/files/0.4-php7.patch |
21 |
@@ -0,0 +1,356 @@ |
22 |
+--- a/crack.c 2016-12-19 16:04:09.244782234 -0500 |
23 |
++++ b/crack.c 2016-12-20 09:20:11.903140742 -0500 |
24 |
+@@ -36,13 +36,31 @@ |
25 |
+ /* True global resources - no need for thread safety here */ |
26 |
+ static int le_crack; |
27 |
+ |
28 |
++ZEND_BEGIN_ARG_INFO_EX(crack_opendict_args, 0, ZEND_RETURN_VALUE, 1) |
29 |
++ ZEND_ARG_INFO(0, dictionary) |
30 |
++ZEND_END_ARG_INFO() |
31 |
++ |
32 |
++ZEND_BEGIN_ARG_INFO_EX(crack_closedict_args, 0, ZEND_RETURN_VALUE, 0) |
33 |
++ ZEND_ARG_INFO(0, dictionary) |
34 |
++ZEND_END_ARG_INFO() |
35 |
++ |
36 |
++ZEND_BEGIN_ARG_INFO_EX(crack_check_args, 0, ZEND_RETURN_VALUE, 1) |
37 |
++ ZEND_ARG_INFO(0, password) |
38 |
++ ZEND_ARG_INFO(0, username) |
39 |
++ ZEND_ARG_INFO(0, gecos) |
40 |
++ ZEND_ARG_INFO(0, dictionary) |
41 |
++ZEND_END_ARG_INFO() |
42 |
++ |
43 |
++ZEND_BEGIN_ARG_INFO_EX(crack_getlastmessage_args, 0, ZEND_RETURN_VALUE, 0) |
44 |
++ZEND_END_ARG_INFO() |
45 |
++ |
46 |
+ /* {{{ crack_functions[] |
47 |
+ */ |
48 |
+ zend_function_entry crack_functions[] = { |
49 |
+- PHP_FE(crack_opendict, NULL) |
50 |
+- PHP_FE(crack_closedict, NULL) |
51 |
+- PHP_FE(crack_check, NULL) |
52 |
+- PHP_FE(crack_getlastmessage, NULL) |
53 |
++ ZEND_FE(crack_opendict, crack_opendict_args) |
54 |
++ ZEND_FE(crack_closedict, crack_closedict_args) |
55 |
++ ZEND_FE(crack_check, crack_check_args) |
56 |
++ ZEND_FE(crack_getlastmessage, crack_getlastmessage_args) |
57 |
+ {NULL, NULL, NULL} |
58 |
+ }; |
59 |
+ /* }}} */ |
60 |
+@@ -55,7 +73,7 @@ |
61 |
+ #endif |
62 |
+ "crack", |
63 |
+ crack_functions, |
64 |
+- PHP_MINIT(crack), |
65 |
++ PHP_MINIT(crack), |
66 |
+ PHP_MSHUTDOWN(crack), |
67 |
+ PHP_RINIT(crack), |
68 |
+ PHP_RSHUTDOWN(crack), |
69 |
+@@ -84,7 +102,11 @@ |
70 |
+ static void php_crack_init_globals(zend_crack_globals *crack_globals) |
71 |
+ { |
72 |
+ crack_globals->last_message = NULL; |
73 |
++#if PHP_VERSION_ID >= 70000 |
74 |
++ crack_globals->default_dict = NULL; |
75 |
++#else |
76 |
+ crack_globals->default_dict = -1; |
77 |
++#endif |
78 |
+ } |
79 |
+ /* }}} */ |
80 |
+ |
81 |
+@@ -95,7 +117,7 @@ |
82 |
+ char *filename; |
83 |
+ int filename_len; |
84 |
+ int result = SUCCESS; |
85 |
+- |
86 |
++ |
87 |
+ #if PHP_VERSION_ID < 50400 |
88 |
+ if (PG(safe_mode)) { |
89 |
+ filename_len = strlen(path) + 10; |
90 |
+@@ -103,7 +125,7 @@ |
91 |
+ if (NULL == filename) { |
92 |
+ return FAILURE; |
93 |
+ } |
94 |
+- |
95 |
++ |
96 |
+ memset(filename, '\0', filename_len); |
97 |
+ strcpy(filename, path); |
98 |
+ strcat(filename, ".pwd"); |
99 |
+@@ -111,7 +133,7 @@ |
100 |
+ efree(filename); |
101 |
+ return FAILURE; |
102 |
+ } |
103 |
+- |
104 |
++ |
105 |
+ memset(filename, '\0', filename_len); |
106 |
+ strcpy(filename, path); |
107 |
+ strcat(filename, ".pwi"); |
108 |
+@@ -119,7 +141,7 @@ |
109 |
+ efree(filename); |
110 |
+ return FAILURE; |
111 |
+ } |
112 |
+- |
113 |
++ |
114 |
+ memset(filename, '\0', filename_len); |
115 |
+ strcpy(filename, path); |
116 |
+ strcat(filename, ".hwm"); |
117 |
+@@ -129,39 +151,64 @@ |
118 |
+ } |
119 |
+ } |
120 |
+ #endif |
121 |
+- |
122 |
++ |
123 |
+ if (php_check_open_basedir(path TSRMLS_CC)) { |
124 |
+ return FAILURE; |
125 |
+ } |
126 |
+- |
127 |
++ |
128 |
+ return SUCCESS; |
129 |
+ } |
130 |
+ /* }}} */ |
131 |
+ |
132 |
+ /* {{{ php_crack_set_default_dict |
133 |
+ */ |
134 |
++#if PHP_VERSION_ID >= 70000 |
135 |
++static void php_crack_set_default_dict(zend_resource *id) |
136 |
++{ |
137 |
++ if (CRACKG(default_dict) != NULL) { |
138 |
++ zend_list_close(CRACKG(default_dict)); |
139 |
++ } |
140 |
++ |
141 |
++ CRACKG(default_dict) = id; |
142 |
++ id->gc.refcount++; |
143 |
++} |
144 |
++#else |
145 |
+ static void php_crack_set_default_dict(int id TSRMLS_DC) |
146 |
+ { |
147 |
+ if (CRACKG(default_dict) != -1) { |
148 |
+ zend_list_delete(CRACKG(default_dict)); |
149 |
+ } |
150 |
+- |
151 |
++ |
152 |
+ CRACKG(default_dict) = id; |
153 |
+ zend_list_addref(id); |
154 |
+ } |
155 |
++#endif |
156 |
+ /* }}} */ |
157 |
+ |
158 |
+ /* {{{ php_crack_get_default_dict |
159 |
+ */ |
160 |
++#if PHP_VERSION_ID >= 70000 |
161 |
++static zend_resource * php_crack_get_default_dict(INTERNAL_FUNCTION_PARAMETERS) |
162 |
++#else |
163 |
+ static int php_crack_get_default_dict(INTERNAL_FUNCTION_PARAMETERS) |
164 |
++#endif |
165 |
+ { |
166 |
++#if PHP_VERSION_ID >= 70000 |
167 |
++ if ((NULL == CRACKG(default_dict)) && (NULL != CRACKG(default_dictionary))) { |
168 |
++#else |
169 |
+ if ((-1 == CRACKG(default_dict)) && (NULL != CRACKG(default_dictionary))) { |
170 |
++#endif |
171 |
+ CRACKLIB_PWDICT *pwdict; |
172 |
+ printf("trying to open: %s\n", CRACKG(default_dictionary)); |
173 |
+ pwdict = cracklib_pw_open(CRACKG(default_dictionary), "r"); |
174 |
+ if (NULL != pwdict) { |
175 |
++#if PHP_VERSION_ID >= 70000 |
176 |
++ ZVAL_RES(return_value, zend_register_resource(pwdict, le_crack)); |
177 |
++ php_crack_set_default_dict(Z_RES_P(return_value)); |
178 |
++#else |
179 |
+ ZEND_REGISTER_RESOURCE(return_value, pwdict, le_crack); |
180 |
+ php_crack_set_default_dict(Z_LVAL_P(return_value) TSRMLS_CC); |
181 |
++#endif |
182 |
+ } |
183 |
+ } |
184 |
+ |
185 |
+@@ -171,7 +218,11 @@ |
186 |
+ |
187 |
+ /* {{{ php_crack_module_dtor |
188 |
+ */ |
189 |
++#if PHP_VERSION_ID >= 70000 |
190 |
++static void php_crack_module_dtor(zend_resource *rsrc) |
191 |
++#else |
192 |
+ static void php_crack_module_dtor(zend_rsrc_list_entry *rsrc TSRMLS_DC) |
193 |
++#endif |
194 |
+ { |
195 |
+ CRACKLIB_PWDICT *pwdict = (CRACKLIB_PWDICT *) rsrc->ptr; |
196 |
+ |
197 |
+@@ -191,7 +242,9 @@ |
198 |
+ |
199 |
+ REGISTER_INI_ENTRIES(); |
200 |
+ le_crack = zend_register_list_destructors_ex(php_crack_module_dtor, NULL, "crack dictionary", module_number); |
201 |
++#if PHP_VERSION_ID < 70000 |
202 |
+ Z_TYPE(crack_module_entry) = type; |
203 |
++#endif |
204 |
+ |
205 |
+ return SUCCESS; |
206 |
+ } |
207 |
+@@ -210,7 +263,11 @@ |
208 |
+ PHP_RINIT_FUNCTION(crack) |
209 |
+ { |
210 |
+ CRACKG(last_message) = NULL; |
211 |
++#if PHP_VERSION_ID >= 70000 |
212 |
++ CRACKG(default_dict) = NULL; |
213 |
++#else |
214 |
+ CRACKG(default_dict) = -1; |
215 |
++#endif |
216 |
+ |
217 |
+ return SUCCESS; |
218 |
+ } |
219 |
+@@ -245,7 +302,7 @@ |
220 |
+ PHP_FUNCTION(crack_opendict) |
221 |
+ { |
222 |
+ char *path; |
223 |
+- int path_len; |
224 |
++ size_t path_len; |
225 |
+ CRACKLIB_PWDICT *pwdict; |
226 |
+ |
227 |
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &path, &path_len) == FAILURE) { |
228 |
+@@ -265,9 +322,14 @@ |
229 |
+ #endif |
230 |
+ RETURN_FALSE; |
231 |
+ } |
232 |
+- |
233 |
++ |
234 |
++#if PHP_VERSION_ID >= 70000 |
235 |
++ RETURN_RES(zend_register_resource(pwdict, le_crack)); |
236 |
++ php_crack_set_default_dict(Z_RES_P(return_value)); |
237 |
++#else |
238 |
+ ZEND_REGISTER_RESOURCE(return_value, pwdict, le_crack); |
239 |
+ php_crack_set_default_dict(Z_LVAL_P(return_value) TSRMLS_CC); |
240 |
++#endif |
241 |
+ } |
242 |
+ /* }}} */ |
243 |
+ |
244 |
+@@ -276,7 +338,11 @@ |
245 |
+ PHP_FUNCTION(crack_closedict) |
246 |
+ { |
247 |
+ zval *dictionary = NULL; |
248 |
++#if PHP_VERSION_ID >= 70000 |
249 |
++ zend_resource *id; |
250 |
++#else |
251 |
+ int id = -1; |
252 |
++#endif |
253 |
+ CRACKLIB_PWDICT *pwdict; |
254 |
+ |
255 |
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|r", &dictionary)) { |
256 |
+@@ -285,7 +351,11 @@ |
257 |
+ |
258 |
+ if (NULL == dictionary) { |
259 |
+ id = php_crack_get_default_dict(INTERNAL_FUNCTION_PARAM_PASSTHRU); |
260 |
++#if PHP_VERSION_ID >= 70000 |
261 |
++ if (id == NULL) { |
262 |
++#else |
263 |
+ if (id == -1) { |
264 |
++#endif |
265 |
+ #if ZEND_MODULE_API_NO >= 20021010 |
266 |
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "Could not open default crack dicionary"); |
267 |
+ #else |
268 |
+@@ -294,8 +364,21 @@ |
269 |
+ RETURN_FALSE; |
270 |
+ } |
271 |
+ } |
272 |
++#if PHP_VERSION_ID >= 70000 |
273 |
++ if((pwdict = (CRACKLIB_PWDICT *)zend_fetch_resource(Z_RES_P(dictionary), "crack dictionary", le_crack)) == NULL) |
274 |
++ { |
275 |
++ RETURN_FALSE; |
276 |
++ } |
277 |
++ if (NULL == dictionary) { |
278 |
++ zend_list_close(CRACKG(default_dict)); |
279 |
++ CRACKG(default_dict) = NULL; |
280 |
++ } |
281 |
++ else { |
282 |
++ zend_list_close(Z_RES_P(dictionary)); |
283 |
++ } |
284 |
++#else |
285 |
+ ZEND_FETCH_RESOURCE(pwdict, CRACKLIB_PWDICT *, &dictionary, id, "crack dictionary", le_crack); |
286 |
+- |
287 |
++ |
288 |
+ if (NULL == dictionary) { |
289 |
+ zend_list_delete(CRACKG(default_dict)); |
290 |
+ CRACKG(default_dict) = -1; |
291 |
+@@ -303,7 +386,7 @@ |
292 |
+ else { |
293 |
+ zend_list_delete(Z_RESVAL_P(dictionary)); |
294 |
+ } |
295 |
+- |
296 |
++#endif |
297 |
+ RETURN_TRUE; |
298 |
+ } |
299 |
+ /* }}} */ |
300 |
+@@ -314,14 +397,18 @@ |
301 |
+ { |
302 |
+ zval *dictionary = NULL; |
303 |
+ char *password = NULL; |
304 |
+- int password_len; |
305 |
++ size_t password_len; |
306 |
+ char *username = NULL; |
307 |
+- int username_len; |
308 |
++ size_t username_len; |
309 |
+ char *gecos = NULL; |
310 |
+- int gecos_len; |
311 |
++ size_t gecos_len; |
312 |
+ char *message; |
313 |
+ CRACKLIB_PWDICT *pwdict; |
314 |
++#if PHP_VERSION_ID >= 70000 |
315 |
++ zend_resource *crack_res; |
316 |
++#else |
317 |
+ int id = -1; |
318 |
++#endif |
319 |
+ |
320 |
+ if (NULL != CRACKG(last_message)) { |
321 |
+ efree(CRACKG(last_message)); |
322 |
+@@ -335,6 +422,21 @@ |
323 |
+ } |
324 |
+ |
325 |
+ if (NULL == dictionary) { |
326 |
++#if PHP_VERSION_ID >= 70000 |
327 |
++ crack_res = php_crack_get_default_dict(INTERNAL_FUNCTION_PARAM_PASSTHRU); |
328 |
++ if (crack_res == NULL || crack_res->ptr == NULL) { |
329 |
++ php_error(E_WARNING, "Could not open default crack dicionary"); |
330 |
++ RETURN_FALSE; |
331 |
++ } |
332 |
++ |
333 |
++ } |
334 |
++ else { |
335 |
++ if((pwdict = (CRACKLIB_PWDICT *)zend_fetch_resource(Z_RES_P(dictionary), "crack dictionary", le_crack)) == NULL) { |
336 |
++ php_error(E_WARNING, "Could not open crack dicionary resource"); |
337 |
++ RETURN_FALSE; |
338 |
++ } |
339 |
++ } |
340 |
++#else |
341 |
+ id = php_crack_get_default_dict(INTERNAL_FUNCTION_PARAM_PASSTHRU); |
342 |
+ if (id == -1) { |
343 |
+ #if ZEND_MODULE_API_NO >= 20021010 |
344 |
+@@ -346,6 +448,7 @@ |
345 |
+ } |
346 |
+ } |
347 |
+ ZEND_FETCH_RESOURCE(pwdict, CRACKLIB_PWDICT *, &dictionary, id, "crack dictionary", le_crack); |
348 |
++#endif |
349 |
+ |
350 |
+ message = cracklib_fascist_look_ex(pwdict, password, username, gecos); |
351 |
+ |
352 |
+@@ -377,7 +480,11 @@ |
353 |
+ RETURN_FALSE; |
354 |
+ } |
355 |
+ |
356 |
++#if PHP_VERSION_ID >= 70000 |
357 |
++ RETURN_STRING(CRACKG(last_message)); |
358 |
++#else |
359 |
+ RETURN_STRING(CRACKG(last_message), 1); |
360 |
++#endif |
361 |
+ } |
362 |
+ /* }}} */ |
363 |
+ |
364 |
+--- a/php_crack.h 2005-09-21 05:00:06.000000000 -0400 |
365 |
++++ b/php_crack.h 2016-12-19 16:51:22.449321851 -0500 |
366 |
+@@ -52,7 +52,11 @@ |
367 |
+ ZEND_BEGIN_MODULE_GLOBALS(crack) |
368 |
+ char *default_dictionary; |
369 |
+ char *last_message; |
370 |
++#if PHP_VERSION_ID >= 70000 |
371 |
++ zend_resource *default_dict; |
372 |
++#else |
373 |
+ int default_dict; |
374 |
++#endif |
375 |
+ ZEND_END_MODULE_GLOBALS(crack) |
376 |
+ |
377 |
+ #ifdef ZTS |
378 |
|
379 |
diff --git a/dev-php/pecl-crack/pecl-crack-0.4-r6.ebuild b/dev-php/pecl-crack/pecl-crack-0.4-r6.ebuild |
380 |
new file mode 100644 |
381 |
index 00000000000..f7a9d30a87f |
382 |
--- /dev/null |
383 |
+++ b/dev-php/pecl-crack/pecl-crack-0.4-r6.ebuild |
384 |
@@ -0,0 +1,26 @@ |
385 |
+# Copyright 1999-2017 Gentoo Foundation |
386 |
+# Distributed under the terms of the GNU General Public License v2 |
387 |
+ |
388 |
+EAPI=6 |
389 |
+ |
390 |
+PHP_EXT_NAME="crack" |
391 |
+PHP_EXT_INI="yes" |
392 |
+PHP_EXT_ZENDEXT="no" |
393 |
+PHP_EXT_EXTRA_ECONF="" |
394 |
+DOCS=( EXPERIMENTAL ) |
395 |
+ |
396 |
+USE_PHP="php5-6 php7-0 php7-1" |
397 |
+ |
398 |
+inherit php-ext-pecl-r3 |
399 |
+ |
400 |
+KEYWORDS="~amd64 ~ppc ~ppc64 ~x86" |
401 |
+ |
402 |
+DESCRIPTION="PHP interface to the cracklib libraries" |
403 |
+LICENSE="PHP-3 CRACKLIB" |
404 |
+SLOT="0" |
405 |
+IUSE="" |
406 |
+# Patch for http://pecl.php.net/bugs/bug.php?id=5765 |
407 |
+PATCHES=( "${FILESDIR}/fix-php-5-4-support.patch" |
408 |
+"${FILESDIR}/fix-pecl-bug-5765.patch" |
409 |
+"${FILESDIR}/${PV}-php7.patch" |
410 |
+) |