diff -r 800b9e4af034 pecl-compat/src/zend_resource.h --- a/pecl-compat/src/zend_resource.h Tue Dec 29 12:39:05 2020 +0100 +++ b/pecl-compat/src/zend_resource.h Tue Dec 29 12:43:21 2020 +0100 @@ -54,7 +54,7 @@ * * @param zv The IS_RESOURCE zval to delete. */ -static void compat_zend_delete_resource(const zval *zv TSRMLS_DC); +static void compat_zend_delete_resource(const zval *zv ); /** * Fetches the resource. @@ -68,7 +68,7 @@ * @return A void pointer to the resource, which needs to be typecast, or NULL * on error. */ -static void *compat_zend_fetch_resource(zval *zv, const char *rsrc_type_name, int rsrc_type TSRMLS_DC); +static void *compat_zend_fetch_resource(zval *zv, const char *rsrc_type_name, int rsrc_type ); /** * Registers a new resource. @@ -77,12 +77,12 @@ * @param ptr A void pointer to the resource. * @param rsrc_type The resource type ID. */ -static void compat_zend_register_resource(zval *zv, void *ptr, int rsrc_type TSRMLS_DC); +static void compat_zend_register_resource(zval *zv, void *ptr, int rsrc_type ); #ifdef PHP_7 /*============================================================================*/ -static void compat_zend_delete_resource(const zval *zv TSRMLS_DC) +static void compat_zend_delete_resource(const zval *zv ) { if (IS_RESOURCE != Z_TYPE_P(zv)) { return; @@ -91,7 +91,7 @@ zend_list_close(Z_RES_P(zv)); } -static void *compat_zend_fetch_resource(zval *zv, const char *rsrc_type_name, int rsrc_type TSRMLS_DC) +static void *compat_zend_fetch_resource(zval *zv, const char *rsrc_type_name, int rsrc_type ) { if (IS_RESOURCE != Z_TYPE_P(zv)) { return NULL; @@ -100,7 +100,7 @@ return zend_fetch_resource(Z_RES_P(zv), rsrc_type_name, rsrc_type); } -static void compat_zend_register_resource(zval *zv, void *ptr, int rsrc_type TSRMLS_DC) +static void compat_zend_register_resource(zval *zv, void *ptr, int rsrc_type ) { ZVAL_RES(zv, zend_register_resource(ptr, rsrc_type)); } @@ -111,7 +111,7 @@ /* Used for destructors. */ typedef zend_rsrc_list_entry zend_resource; -static void compat_zend_delete_resource(const zval *zv TSRMLS_DC) +static void compat_zend_delete_resource(const zval *zv ) { if (IS_RESOURCE != Z_TYPE_P(zv)) { return; @@ -120,16 +120,16 @@ zend_list_delete(Z_LVAL_P(zv)); } -static void *compat_zend_fetch_resource(zval *zv, const char *rsrc_type_name, int rsrc_type TSRMLS_DC) +static void *compat_zend_fetch_resource(zval *zv, const char *rsrc_type_name, int rsrc_type ) { #if ZEND_MODULE_API_NO >= 20100412 - return zend_fetch_resource(&zv TSRMLS_CC, -1, rsrc_type_name, NULL, 1, rsrc_type); + return zend_fetch_resource(&zv , -1, rsrc_type_name, NULL, 1, rsrc_type); #else - return zend_fetch_resource(&zv TSRMLS_CC, -1, (char *)rsrc_type_name, NULL, 1, rsrc_type); + return zend_fetch_resource(&zv , -1, (char *)rsrc_type_name, NULL, 1, rsrc_type); #endif } -static void compat_zend_register_resource(zval *zv, void *ptr, int rsrc_type TSRMLS_DC) +static void compat_zend_register_resource(zval *zv, void *ptr, int rsrc_type ) { ZEND_REGISTER_RESOURCE(zv, ptr, rsrc_type); } diff -r 800b9e4af034 radius.c --- a/radius.c Tue Dec 29 12:39:05 2020 +0100 +++ b/radius.c Tue Dec 29 12:43:21 2020 +0100 @@ -2,30 +2,30 @@ Copyright (c) 2003, Michael Bretterklieber <michael@bretterklieber.com> All rights reserved. -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: -1. Redistributions of source code must retain the above copyright +1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. -2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the +2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. -3. The names of the authors may not be used to endorse or promote products +3. The names of the authors may not be used to endorse or promote products derived from this software without specific prior written permission. -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND -ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. -IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, -INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY -OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. +IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, +INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -This code cannot simply be copied and put under the GNU Public License or +This code cannot simply be copied and put under the GNU Public License or any other GPL-like (LGPL, GPL2) License. $Id$ @@ -51,12 +51,12 @@ #include "pecl-compat/compat.h" -void _radius_close(zend_resource *res TSRMLS_DC); +void _radius_close(zend_resource *res ); static int _init_options(struct rad_attr_options *out, int options, int tag); #define RADIUS_FETCH_RESOURCE(radh, zv) \ - radh = (struct rad_handle *)compat_zend_fetch_resource(zv, "rad_handle", le_radius TSRMLS_CC); \ + radh = (struct rad_handle *)compat_zend_fetch_resource(zv, "rad_handle", le_radius ); \ if (!radh) { \ RETURN_FALSE; \ } @@ -99,8 +99,8 @@ PHP_FE(radius_salt_encrypt_attr, NULL) PHP_FE(radius_request_authenticator, NULL) PHP_FE(radius_server_secret, NULL) - PHP_FE(radius_demangle, NULL) - PHP_FE(radius_demangle_mppe_key, NULL) + PHP_FE(radius_demangle, NULL) + PHP_FE(radius_demangle_mppe_key, NULL) {NULL, NULL, NULL} /* Must be the last line in radius_functions[] */ }; /* }}} */ @@ -135,7 +135,7 @@ { le_radius = zend_register_list_destructors_ex(_radius_close, NULL, "rad_handle", module_number); #include "radius_init_const.h" - REGISTER_LONG_CONSTANT("RADIUS_MPPE_KEY_LEN", MPPE_KEY_LEN, CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("RADIUS_MPPE_KEY_LEN", MPPE_KEY_LEN, CONST_PERSISTENT); return SUCCESS; } /* }}} */ @@ -165,7 +165,7 @@ struct rad_handle *radh = rad_auth_open(); if (radh != NULL) { - compat_zend_register_resource(return_value, radh, le_radius TSRMLS_CC); + compat_zend_register_resource(return_value, radh, le_radius ); } else { RETURN_FALSE; } @@ -178,7 +178,7 @@ struct rad_handle *radh = rad_acct_open(); if (radh != NULL) { - compat_zend_register_resource(return_value, radh, le_radius TSRMLS_CC); + compat_zend_register_resource(return_value, radh, le_radius ); } else { RETURN_FALSE; } @@ -191,13 +191,13 @@ struct rad_handle *radh; zval *z_radh; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r", &z_radh) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() , "r", &z_radh) == FAILURE) { return; } /* Fetch the resource to verify it. */ RADIUS_FETCH_RESOURCE(radh, z_radh); - compat_zend_delete_resource(z_radh TSRMLS_CC); + compat_zend_delete_resource(z_radh ); RETURN_TRUE; } /* }}} */ @@ -209,7 +209,7 @@ struct rad_handle *radh; zval *z_radh; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r", &z_radh) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() , "r", &z_radh) == FAILURE) { return; } @@ -227,7 +227,7 @@ struct rad_handle *radh; zval *z_radh; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rs", &z_radh, &filename, &filename_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() , "rs", &z_radh, &filename, &filename_len) == FAILURE) { return; } @@ -250,7 +250,7 @@ struct rad_handle *radh; zval *z_radh; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rslsll", &z_radh, + if (zend_parse_parameters(ZEND_NUM_ARGS() , "rslsll", &z_radh, &hostname, &hostname_len, &port, &secret, &secret_len, @@ -275,7 +275,7 @@ struct rad_handle *radh; zval *z_radh; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rl", &z_radh, &code) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() , "rl", &z_radh, &code) == FAILURE) { return; } @@ -299,7 +299,7 @@ struct rad_handle *radh; zval *z_radh; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rls|ll", &z_radh, &type, &str, &str_len, &options, &tag) + if (zend_parse_parameters(ZEND_NUM_ARGS() , "rls|ll", &z_radh, &type, &str, &str_len, &options, &tag) == FAILURE) { return; } @@ -324,7 +324,7 @@ struct rad_handle *radh; zval *z_radh; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rll|ll", &z_radh, &type, &val, &options, &tag) + if (zend_parse_parameters(ZEND_NUM_ARGS() , "rll|ll", &z_radh, &type, &val, &options, &tag) == FAILURE) { return; } @@ -351,7 +351,7 @@ struct rad_handle *radh; zval *z_radh; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rls|ll", &z_radh, &type, &data, &len, &options, &tag) + if (zend_parse_parameters(ZEND_NUM_ARGS() , "rls|ll", &z_radh, &type, &data, &len, &options, &tag) == FAILURE) { return; } @@ -380,7 +380,7 @@ zval *z_radh; struct in_addr intern_addr; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rls|ll", &z_radh, &type, &addr, &addrlen, &options, &tag) + if (zend_parse_parameters(ZEND_NUM_ARGS() , "rls|ll", &z_radh, &type, &addr, &addrlen, &options, &tag) == FAILURE) { return; } @@ -412,7 +412,7 @@ struct rad_handle *radh; zval *z_radh; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rlls|ll", &z_radh, &vendor, &type, &str, &str_len, &options, &tag) + if (zend_parse_parameters(ZEND_NUM_ARGS() , "rlls|ll", &z_radh, &vendor, &type, &str, &str_len, &options, &tag) == FAILURE) { return; } @@ -437,7 +437,7 @@ struct rad_handle *radh; zval *z_radh; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rlll|ll", &z_radh, &vendor, &type, &val, &options, &tag) + if (zend_parse_parameters(ZEND_NUM_ARGS() , "rlll|ll", &z_radh, &vendor, &type, &val, &options, &tag) == FAILURE) { return; } @@ -464,7 +464,7 @@ struct rad_handle *radh; zval *z_radh; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rlls|ll", &z_radh, &vendor, &type, + if (zend_parse_parameters(ZEND_NUM_ARGS() , "rlls|ll", &z_radh, &vendor, &type, &data, &len, &options, &tag) == FAILURE) { return; } @@ -492,7 +492,7 @@ zval *z_radh; struct in_addr intern_addr; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rlls|ll", &z_radh, &vendor, + if (zend_parse_parameters(ZEND_NUM_ARGS() , "rlls|ll", &z_radh, &vendor, &type, &addr, &addrlen, &options, &tag) == FAILURE) { return; } @@ -521,7 +521,7 @@ zval *z_radh; int res; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r", &z_radh) + if (zend_parse_parameters(ZEND_NUM_ARGS() , "r", &z_radh) == FAILURE) { return; } @@ -546,7 +546,7 @@ size_t len; zval *z_radh; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r", &z_radh) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() , "r", &z_radh) == FAILURE) { return; } @@ -574,7 +574,7 @@ const char *attr; COMPAT_ARG_SIZE_T len; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &attr, &len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() , "s", &attr, &len) == FAILURE) { return; } @@ -595,7 +595,7 @@ const char *attr; COMPAT_ARG_SIZE_T len; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &attr, &len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() , "s", &attr, &len) == FAILURE) { return; } @@ -617,7 +617,7 @@ unsigned char type; size_t data_len; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &raw, &len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() , "s", &raw, &len) == FAILURE) { return; } @@ -642,7 +642,7 @@ COMPAT_ARG_SIZE_T len; struct in_addr addr; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &data, &len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() , "s", &data, &len) == FAILURE) { return; } @@ -659,7 +659,7 @@ COMPAT_ARG_SIZE_T len; int val; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &data, &len) + if (zend_parse_parameters(ZEND_NUM_ARGS() , "s", &data, &len) == FAILURE) { return; } @@ -676,7 +676,7 @@ char *val; COMPAT_ARG_SIZE_T len; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &data, &len) + if (zend_parse_parameters(ZEND_NUM_ARGS() , "s", &data, &len) == FAILURE) { return; } @@ -698,7 +698,7 @@ struct rad_salted_value salted; zval *z_radh; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rs", &z_radh, &data, &len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() , "rs", &z_radh, &data, &len) == FAILURE) { return; } @@ -724,7 +724,7 @@ char buf[LEN_AUTH]; zval *z_radh; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r", &z_radh) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() , "r", &z_radh) == FAILURE) { return; } @@ -746,7 +746,7 @@ struct rad_handle *radh; zval *z_radh; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r", &z_radh) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() , "r", &z_radh) == FAILURE) { return; } @@ -771,7 +771,7 @@ COMPAT_ARG_SIZE_T len; int res; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rs", &z_radh, &mangled, &len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() , "rs", &z_radh, &mangled, &len) == FAILURE) { return; } @@ -802,7 +802,7 @@ COMPAT_ARG_SIZE_T len; int res; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rs", &z_radh, &mangled, &len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() , "rs", &z_radh, &mangled, &len) == FAILURE) { return; } @@ -844,7 +844,7 @@ /* }}} */ /* {{{ _radius_close() */ -void _radius_close(zend_resource *res TSRMLS_DC) +void _radius_close(zend_resource *res ) { struct rad_handle *radh = (struct rad_handle *)res->ptr; rad_close(radh); diff -r 800b9e4af034 radlib.c --- a/radlib.c Tue Dec 29 12:39:05 2020 +0100 +++ b/radlib.c Tue Dec 29 12:43:21 2020 +0100 @@ -248,7 +248,7 @@ generr(h, "Attribute too long"); goto end; } - + if (h->req_len + full_len > MSGSIZE) { generr(h, "Maximum message length exceeded"); goto end; @@ -581,13 +581,13 @@ /* Create a random authenticator */ for (i = 0; i < LEN_AUTH; i += 2) { long r; - TSRMLS_FETCH(); - r = php_rand(TSRMLS_C); +// TSRMLS_FETCH(); + r = php_rand(); h->request[POS_AUTH+i] = (unsigned char) r; h->request[POS_AUTH+i+1] = (unsigned char) (r >> 8); } h->req_len = POS_ATTRS; - h->request_created = 1; + h->request_created = 1; clear_password(h); return 0; } @@ -749,11 +749,11 @@ h = (struct rad_handle *)malloc(sizeof(struct rad_handle)); if (h != NULL) { - TSRMLS_FETCH(); - php_srand(time(NULL) * getpid() * (unsigned long) (php_combined_lcg(TSRMLS_C) * 10000.0) TSRMLS_CC); + //TSRMLS_FETCH(); + php_srand(time(NULL) * getpid() * (unsigned long) (php_combined_lcg() * 10000.0) ); h->fd = -1; h->num_servers = 0; - h->ident = php_rand(TSRMLS_C); + h->ident = php_rand(); h->errmsg[0] = '\0'; memset(h->request, 0, sizeof h->request); h->req_len = 0; @@ -762,7 +762,7 @@ h->pass_pos = 0; h->chap_pass = 0; h->type = RADIUS_AUTH; - h->request_created = 0; + h->request_created = 0; h->resp_len = 0; h->srv = 0; } @@ -1003,7 +1003,7 @@ int res = -1; struct rad_salted_value *salted = NULL; size_t va_len = len + 6; - + if (!h->request_created) { generr(h, "Please call rad_create_request()"); return -1; @@ -1112,7 +1112,7 @@ } int -rad_demangle(struct rad_handle *h, const void *mangled, size_t mlen, u_char *demangled) +rad_demangle(struct rad_handle *h, const void *mangled, size_t mlen, u_char *demangled) { char R[LEN_AUTH]; const char *S; @@ -1208,7 +1208,7 @@ MD5Update(&Context, C, 16); MD5Final(b, &Context); } - + C += 16; } @@ -1218,12 +1218,12 @@ */ *len = *P; if (*len > mlen - 1) { - generr(h, "Mangled data seems to be garbage %d %d", *len, mlen-1); + generr(h, "Mangled data seems to be garbage %d %d", *len, mlen-1); return -1; } if (*len > MPPE_KEY_LEN) { - generr(h, "Key to long (%d) for me max. %d", *len, MPPE_KEY_LEN); + generr(h, "Key to long (%d) for me max. %d", *len, MPPE_KEY_LEN); return -1; } @@ -1242,7 +1242,7 @@ php_uint32 random; size_t salted_len; const char *secret; - TSRMLS_FETCH(); + //TSRMLS_FETCH(); if (len == 0) { out->len = 0; @@ -1289,7 +1289,7 @@ } /* Generate a random number to use as the salt. */ - random = php_rand(TSRMLS_C); + random = php_rand(); /* The RFC requires that the high bit of the salt be 1. Otherwise, * let's set up the header. */