sixd Mon Aug 6 20:32:55 2007 UTC
Modified files: (Branch: PHP_5_2)
/php-src/ext/oci8 oci8.c php_oci8_int.h
Log:
MFH: oci8: flush persistent connection after password change
http://cvs.php.net/viewvc.cgi/php-src/ext/oci8/oci8.c?r1=1.269.2.16.2.36&r2=1.269.2.16.2.37&diff_format=u
Index: php-src/ext/oci8/oci8.c
diff -u php-src/ext/oci8/oci8.c:1.269.2.16.2.36
php-src/ext/oci8/oci8.c:1.269.2.16.2.37
--- php-src/ext/oci8/oci8.c:1.269.2.16.2.36 Thu Aug 2 22:39:54 2007
+++ php-src/ext/oci8/oci8.c Mon Aug 6 20:32:54 2007
@@ -26,7 +26,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: oci8.c,v 1.269.2.16.2.36 2007/08/02 22:39:54 sixd Exp $ */
+/* $Id: oci8.c,v 1.269.2.16.2.37 2007/08/06 20:32:54 sixd Exp $ */
/* TODO
*
* file://localhost/www/docs/oci10/ociaahan.htm#423823 - implement lob_empty()
with OCI_ATTR_LOBEMPTY
@@ -674,7 +674,7 @@
php_info_print_table_start();
php_info_print_table_row(2, "OCI8 Support", "enabled");
php_info_print_table_row(2, "Version", "1.2.3");
- php_info_print_table_row(2, "Revision", "$Revision: 1.269.2.16.2.36 $");
+ php_info_print_table_row(2, "Revision", "$Revision: 1.269.2.16.2.37 $");
snprintf(buf, sizeof(buf), "%ld", OCI_G(num_persistent));
php_info_print_table_row(2, "Active Persistent Connections", buf);
@@ -1203,6 +1203,9 @@
/* -1 means "Off" */
connection->next_ping = 0;
}
+
+ /* mark password as unchanged by PHP during the duration of the
database session */
+ connection->passwd_changed = 0;
smart_str_free_ex(&hashed_details, 0);
@@ -1399,7 +1402,7 @@
/* mark it as open */
connection->is_open = 1;
-
+
/* add to the appropriate hash */
if (connection->is_persistent) {
new_le.ptr = connection;
@@ -1571,6 +1574,7 @@
PHP_OCI_HANDLE_ERROR(connection, connection->errcode);
return 1;
}
+ connection->passwd_changed = 1;
return 0;
} /* }}} */
@@ -1790,7 +1794,7 @@
if (connection->used_this_request) {
if ((PG(connection_status) & PHP_CONNECTION_TIMEOUT) ||
OCI_G(in_call)) {
- return 1;
+ return ZEND_HASH_APPLY_REMOVE;
}
if (connection->descriptors) {
@@ -1803,6 +1807,18 @@
php_oci_connection_rollback(connection
TSRMLS_CC);
}
+ /* If oci_password_change() changed the password of a
+ * persistent connection, close the connection and
remove
+ * it from the persistent connection cache. This means
+ * subsequent scripts will be prevented from being able
to
+ * present the old (now invalid) password to a usable
+ * connection to the database; they must use the new
+ * password.
+ */
+ if (connection->passwd_changed) {
+ return ZEND_HASH_APPLY_REMOVE;
+ }
+
if (OCI_G(persistent_timeout) > 0) {
connection->idle_expiry = timestamp +
OCI_G(persistent_timeout);
}
@@ -1815,14 +1831,15 @@
}
connection->used_this_request = 0;
+
} else if (OCI_G(persistent_timeout) != -1) {
if (connection->idle_expiry < timestamp) {
/* connection has timed out */
- return 1;
+ return ZEND_HASH_APPLY_REMOVE;
}
}
}
- return 0;
+ return ZEND_HASH_APPLY_KEEP;
} /* }}} */
#ifdef ZTS
http://cvs.php.net/viewvc.cgi/php-src/ext/oci8/php_oci8_int.h?r1=1.11.2.6.2.20&r2=1.11.2.6.2.21&diff_format=u
Index: php-src/ext/oci8/php_oci8_int.h
diff -u php-src/ext/oci8/php_oci8_int.h:1.11.2.6.2.20
php-src/ext/oci8/php_oci8_int.h:1.11.2.6.2.21
--- php-src/ext/oci8/php_oci8_int.h:1.11.2.6.2.20 Tue Jul 31 19:21:08 2007
+++ php-src/ext/oci8/php_oci8_int.h Mon Aug 6 20:32:55 2007
@@ -25,7 +25,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: php_oci8_int.h,v 1.11.2.6.2.20 2007/07/31 19:21:08 tony2001 Exp $ */
+/* $Id: php_oci8_int.h,v 1.11.2.6.2.21 2007/08/06 20:32:55 sixd Exp $ */
#if HAVE_OCI8
# ifndef PHP_OCI8_INT_H
@@ -112,6 +112,7 @@
unsigned is_persistent:1; /* self-descriptive */
unsigned used_this_request:1; /* helps to determine if we should reset
connection's next ping time and check its timeout */
unsigned needs_commit:1; /* helps to determine if we should
rollback this connection on close/shutdown */
+ unsigned passwd_changed:1; /* helps determine if a persistent
connection hash should be invalidated after a password change */
int rsrc_id; /* resource ID */
time_t idle_expiry; /* time when the connection
will be considered as expired */
time_t next_ping; /* time of the next ping */
--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php