--- radlib.c.orig 2016-02-15 15:11:50 UTC +++ radlib.c @@ -582,7 +582,7 @@ rad_create_request(struct rad_handle *h, int code) /* Create a random authenticator */ for (i = 0; i < LEN_AUTH; i += 2) { long r; - r = php_rand(); + r = (zend_long) php_mt_rand(); h->request[POS_AUTH+i] = (unsigned char) r; h->request[POS_AUTH+i+1] = (unsigned char) (r >> 8); } @@ -753,7 +753,7 @@ rad_auth_open(void) php_srand(time(NULL) * getpid() * (unsigned long) (php_combined_lcg(TSRMLS_C) * 10000.0) TSRMLS_CC); h->fd = -1; h->num_servers = 0; - h->ident = php_rand(); + h->ident = (zend_long) php_mt_rand(); h->errmsg[0] = '\0'; memset(h->request, 0, sizeof h->request); h->req_len = 0; @@ -1239,7 +1239,7 @@ int rad_salt_value(struct rad_handle *h, const char *i const char *in_pos; MD5_CTX md5; char *out_pos; - php_uint32 random; + uint32_t random; size_t salted_len; const char *secret; TSRMLS_FETCH(); @@ -1289,7 +1289,7 @@ int rad_salt_value(struct rad_handle *h, const char *i } /* Generate a random number to use as the salt. */ - random = php_rand(); + random = (zend_long) php_mt_rand(); /* The RFC requires that the high bit of the salt be 1. Otherwise, * let's set up the header. */ --- radlib_compat.h.orig 2016-02-15 15:11:50 UTC +++ radlib_compat.h @@ -39,7 +39,11 @@ any other GPL-like (LGPL, GPL2) License. #endif #include "php.h" +#if PHP_VERSION_ID >= 80400 +#include "ext/random/php_random.h" +#else #include "ext/standard/php_rand.h" +#endif #include "ext/standard/php_standard.h" #define MPPE_KEY_LEN 16