cvs: php-src(PHP_5_2) /ext/standard crypt.c
| From: | Ilia Alshanetsky | Date: | Thu, 30 Nov 2006 15:59:53 +0000 |
| Subject: | cvs: php-src(PHP_5_2) /ext/standard crypt.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-41787@lists.php.net to get a copy of this message | ||
iliaa Thu Nov 30 15:59:53 2006 UTC
Modified files: (Branch: PHP_5_2)
/php-src/ext/standard crypt.c
Log:
Use reantrant crypt_r() whenever possible.
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/crypt.c?r1=1.62.2.1&r2=1.62.2.1.2.1&diff_format=u
Index: php-src/ext/standard/crypt.c
diff -u php-src/ext/standard/crypt.c:1.62.2.1 php-src/ext/standard/crypt.c:1.62.2.1.2.1
--- php-src/ext/standard/crypt.c:1.62.2.1 Sun Jan 1 12:50:14 2006
+++ php-src/ext/standard/crypt.c Thu Nov 30 15:59:53 2006
@@ -17,7 +17,7 @@
| Rasmus Lerdorf <rasmus@php.net> |
+----------------------------------------------------------------------+
*/
-/* $Id: crypt.c,v 1.62.2.1 2006/01/01 12:50:14 sniper Exp $ */
+/* $Id: crypt.c,v 1.62.2.1.2.1 2006/11/30 15:59:53 iliaa Exp $ */
#include <stdlib.h>
#include "php.h"
@@ -145,8 +145,15 @@
salt[2] = '\0';
#endif
}
-
- RETVAL_STRING(crypt(str, salt), 1);
+#ifdef HAVE_CRYPT_R
+ {
+ struct crypt_data buffer;
+ memset(&buffer, 0, sizeof(buffer));
+ RETURN_STRING(crypt_r(str, salt, &buffer));
+ }
+#else
+ RETURN_STRING(crypt(str, salt), 1);
+#endif
}
/* }}} */
#endif