CVS update: php3/functions
| From: | rasmus | Date: | Tue, 22 Sep 1998 18:17:41 +0000 |
| Subject: | CVS update: php3/functions | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-1412@lists.php.net to get a copy of this message | ||
Date: Tuesday September 22, 1998 @ 14:17
Author: rasmus
Update of /repository/php3/functions
In directory asf:/export/home/rasmus/php3/functions
Modified Files:
crypt.c ldap.c
Log Message:
Fix a missed ulong change and make random() call in crypt salt generation
abide by the same configure rules as the generic random call.
Index: php3/functions/crypt.c
diff -c php3/functions/crypt.c:1.38 php3/functions/crypt.c:1.39
*** php3/functions/crypt.c:1.38 Tue Sep 22 01:40:40 1998
--- php3/functions/crypt.c Tue Sep 22 14:17:40 1998
***************
*** 28,34 ****
| Rasmus Lerdorf <rasmus@lerdorf.on.ca> |
+----------------------------------------------------------------------+
*/
! /* $Id: crypt.c,v 1.38 1998/09/22 05:40:40 rasmus Exp $ */
#include "php.h"
#include "internal_functions.h"
--- 28,35 ----
| Rasmus Lerdorf <rasmus@lerdorf.on.ca> |
+----------------------------------------------------------------------+
*/
! /* $Id: crypt.c,v 1.39 1998/09/22 18:17:40 rasmus Exp $ */
! #include <stdlib.h>
#include "php.h"
#include "internal_functions.h"
***************
*** 91,96 ****
--- 92,107 ----
#define PHP3_MAX_SALT_LEN 17
#endif
+ #ifdef HAVE_LRAND48
+ #define PHP3_CRYPT_RAND lrand48()
+ #else
+ #ifdef HAVE_RANDOM
+ #define PHP3_CRYPT_RAND random()
+ #else
+ #define PHP3_CRYPT_RAND rand()
+ #endif
+ #endif
+
static unsigned char itoa64[] =
"./0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
static void php3i_to64(char *s, long v, int n) {
***************
*** 100,106 ****
}
}
-
void php3_crypt(INTERNAL_FUNCTION_PARAMETERS)
{
char salt[PHP3_MAX_SALT_LEN];
--- 111,116 ----
***************
*** 129,144 ****
/* The automatic salt generation only covers standard DES and md5-crypt */
if(!*salt) {
! srand(time(0) * getpid());
#ifdef PHP3_STD_DES_CRYPT
! php3i_to64(&salt[0], random(), 2);
salt[2] = '\0';
#else
#if PHP3_MD5_CRYPT
strcpy(salt, "$1$");
! to64(&salt[3], random(), 4);
! to64(&salt[7], random(), 4);
strcpy(&salt[11], "$");
#endif
#endif
--- 139,162 ----
/* The automatic salt generation only covers standard DES and md5-crypt */
if(!*salt) {
! #ifdef HAVE_SRAND48
! srand48((unsigned int) time(0) * getpid());
! #else
! #ifdef HAVE_SRANDOM
! srandom((unsigned int) time(0) * getpid());
! #else
! srand((unsigned int) time(0) * getpid());
! #endif
! #endif
#ifdef PHP3_STD_DES_CRYPT
! php3i_to64(&salt[0], PHP3_CRYPT_RAND, 2);
salt[2] = '\0';
#else
#if PHP3_MD5_CRYPT
strcpy(salt, "$1$");
! to64(&salt[3], PHP3_CRYPT_RAND, 4);
! to64(&salt[7], PHP3_CRYPT_RAND, 4);
strcpy(&salt[11], "$");
#endif
#endif
Index: php3/functions/ldap.c
diff -c php3/functions/ldap.c:1.56 php3/functions/ldap.c:1.57
*** php3/functions/ldap.c:1.56 Sun Aug 30 22:15:32 1998
--- php3/functions/ldap.c Tue Sep 22 14:17:40 1998
***************
*** 29,35 ****
*/
! /* $Id: ldap.c,v 1.56 1998/08/31 02:15:32 rasmus Exp $ */
#define IS_EXT_MODULE
#if !PHP_31 && defined(THREAD_SAFE)
#undef THREAD_SAFE
--- 29,35 ----
*/
! /* $Id: ldap.c,v 1.57 1998/09/22 18:17:40 rasmus Exp $ */
#define IS_EXT_MODULE
#if !PHP_31 && defined(THREAD_SAFE)
#undef THREAD_SAFE
***************
*** 304,310 ****
php3_printf("<table>"
"<tr><td>Total links:</td><td>%d/%s</td></tr>\n"
! "<tr><td>RCS Version:</td><td>$Id: ldap.c,v 1.56 1998/08/31
02:15:32 rasmus Exp $</td></tr>\n"
#if HAVE_NSLDAP
"<tr><td>SDK Version:</td><td>%f</td></tr>"
"<tr><td>Highest LDAP Protocol
Supported:</td><td>%f</td></tr>"
--- 304,310 ----
php3_printf("<table>"
"<tr><td>Total links:</td><td>%d/%s</td></tr>\n"
! "<tr><td>RCS Version:</td><td>$Id: ldap.c,v 1.57 1998/09/22
18:17:40 rasmus Exp $</td></tr>\n"
#if HAVE_NSLDAP
"<tr><td>SDK Version:</td><td>%f</td></tr>"
"<tr><td>Highest LDAP Protocol
Supported:</td><td>%f</td></tr>"
***************
*** 1102,1108 ****
LDAPMod **ldap_mods;
int i, j, num_attribs, num_values;
char *attribute;
! int index;
if (ARG_COUNT(ht) != 3 || getParameters(ht, 3, &link, &dn, &entry) == FAILURE) {
WRONG_PARAM_COUNT;
--- 1102,1108 ----
LDAPMod **ldap_mods;
int i, j, num_attribs, num_values;
char *attribute;
! ulong index;
if (ARG_COUNT(ht) != 3 || getParameters(ht, 3, &link, &dn, &entry) == FAILURE) {
WRONG_PARAM_COUNT;
--
PHP Development Mailing List http://www.php.net/
To unsubscribe send an empty message to php-dev-unsubscribe@lists.php.net
For help: php-dev-help@lists.php.net