#include "php_oci8.h"
#include "php_oci8_int.h"
+#include "zend_hash.h"
ZEND_DECLARE_MODULE_GLOBALS(oci)
static PHP_GINIT_FUNCTION(oci);
smart_str_appendl_ex(&hashed_details, "oci8___", sizeof("oci8___") - 1, 0);
smart_str_appendl_ex(&hashed_details, username, username_len, 0);
smart_str_appendl_ex(&hashed_details, "__", sizeof("__") - 1, 0);
+ if (password_len) {
+ ulong password_hash;
+ password_hash = zend_inline_hash_func(password, password_len);
+ smart_str_append_unsigned_ex(&hashed_details, password_hash, 0);
+ }
+ smart_str_appendl_ex(&hashed_details, "__", sizeof("__") - 1, 0);
+
if (dbname) {
smart_str_appendl_ex(&hashed_details, dbname, dbname_len, 0);
}
}
if (!exclusive && !new_password) {
-
+ zend_bool found = 0;
+
if (persistent && zend_hash_find(&EG(persistent_list), hashed_details.c, hashed_details.len+1, (void **) &le) == SUCCESS) {
+ found = 1;
/* found */
if (le->type == le_pconnection) {
connection = (php_oci_connection *)le->ptr;
}
}
else if (!persistent && zend_hash_find(&EG(regular_list), hashed_details.c, hashed_details.len+1, (void **) &le) == SUCCESS) {
+ found = 1;
if (le->type == le_index_ptr) {
int type;
long link;
connection = NULL;
goto open;
}
- }
- else {
+ } else if (found) {
/* found something, but it's not a connection, delete it */
if (persistent) {
zend_hash_del(&EG(persistent_list), hashed_details.c, hashed_details.len+1);