1. Merged ARG_INFO patch (Felipe)

2. Allow an empty username/password to be passed so Oracle can do
non-password based authentication, i.e. "External Authentication".
http://news.php.net/php.internals/37545

[DOC]

A new OCI_CRED_EXT flag can be passed as the "session_mode" parameter
to oci_connect(), oci_new_connect() and oci_pconnect().

  $c1 = oci_connect("/", "", $db, null, OCI_CRED_EXT);

This tells Oracle to do external or OS authentication, if configured
in the database.

OCI_CRED_EXT can only be used with username of "/" and a empty
password.  Oci8.privileged_connection may be On or Off.

The new flag may be combined with the existing OCI_SYSOPER or
OCI_SYSDBA modes (note: oci8.privileged_connection needs to be On for
OCI_SYSDBA and OCI_SYSOPER mode), e.g.:

  $c1 = oci_connect("/", "", $db, null, OCI_CRED_EXT+OCI_SYSOPER);
This commit is contained in:
Christopher Jones 2008-07-16 22:14:03 +00:00
parent 895066687d
commit 336d8c5bd8
7 changed files with 2282 additions and 168 deletions

View file

@ -104,20 +104,416 @@ ZEND_GET_MODULE(oci8)
#endif /* COMPILE_DL */ #endif /* COMPILE_DL */
/* }}} */ /* }}} */
#ifdef ZEND_ENGINE_2 /* {{{ arginfo */
ZEND_BEGIN_ARG_INFO(oci_second_arg_force_ref, 0) static
ZEND_ARG_PASS_INFO(0) ZEND_BEGIN_ARG_INFO_EX(arginfo_oci_define_by_name, 0, 0, 3)
ZEND_ARG_PASS_INFO(1) ZEND_ARG_INFO(0, statement_resource)
ZEND_ARG_INFO(0, column_name)
ZEND_ARG_INFO(1, variable)
ZEND_ARG_INFO(0, type)
ZEND_END_ARG_INFO() ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_INFO(oci_third_arg_force_ref, 0)
ZEND_ARG_PASS_INFO(0) static
ZEND_ARG_PASS_INFO(0) ZEND_BEGIN_ARG_INFO_EX(arginfo_oci_bind_by_name, 0, 0, 3)
ZEND_ARG_PASS_INFO(1) ZEND_ARG_INFO(0, statement_resource)
ZEND_ARG_INFO(0, column_name)
ZEND_ARG_INFO(1, variable)
ZEND_ARG_INFO(0, maximum_length)
ZEND_ARG_INFO(0, type)
ZEND_END_ARG_INFO() ZEND_END_ARG_INFO()
#else
static unsigned char oci_second_arg_force_ref[] = { 2, BYREF_NONE, BYREF_FORCE }; static
static unsigned char oci_third_arg_force_ref[] = { 3, BYREF_NONE, BYREF_NONE, BYREF_FORCE }; ZEND_BEGIN_ARG_INFO_EX(arginfo_oci_bind_array_by_name, 0, 0, 4)
#endif ZEND_ARG_INFO(0, statement_resource)
ZEND_ARG_INFO(0, column_name)
ZEND_ARG_INFO(1, variable)
ZEND_ARG_INFO(0, maximum_array_length)
ZEND_ARG_INFO(0, maximum_item_length)
ZEND_ARG_INFO(0, type)
ZEND_END_ARG_INFO()
static
ZEND_BEGIN_ARG_INFO_EX(arginfo_oci_free_descriptor, 0, 0, 1)
ZEND_ARG_INFO(0, lob_descriptor)
ZEND_END_ARG_INFO()
static
ZEND_BEGIN_ARG_INFO_EX(arginfo_oci_lob_save, 0, 0, 2)
ZEND_ARG_INFO(0, lob_descriptor)
ZEND_ARG_INFO(0, data)
ZEND_ARG_INFO(0, offset)
ZEND_END_ARG_INFO()
static
ZEND_BEGIN_ARG_INFO_EX(arginfo_oci_lob_import, 0, 0, 2)
ZEND_ARG_INFO(0, lob_descriptor)
ZEND_ARG_INFO(0, filename)
ZEND_END_ARG_INFO()
static
ZEND_BEGIN_ARG_INFO_EX(arginfo_oci_lob_load, 0, 0, 1)
ZEND_ARG_INFO(0, lob_descriptor)
ZEND_END_ARG_INFO()
static
ZEND_BEGIN_ARG_INFO_EX(arginfo_oci_lob_read, 0, 0, 2)
ZEND_ARG_INFO(0, lob_descriptor)
ZEND_ARG_INFO(0, length)
ZEND_END_ARG_INFO()
static
ZEND_BEGIN_ARG_INFO_EX(arginfo_oci_lob_eof, 0, 0, 1)
ZEND_ARG_INFO(0, lob_descriptor)
ZEND_END_ARG_INFO()
static
ZEND_BEGIN_ARG_INFO_EX(arginfo_oci_lob_tell, 0, 0, 1)
ZEND_ARG_INFO(0, lob_descriptor)
ZEND_END_ARG_INFO()
static
ZEND_BEGIN_ARG_INFO_EX(arginfo_oci_lob_rewind, 0, 0, 1)
ZEND_ARG_INFO(0, lob_descriptor)
ZEND_END_ARG_INFO()
static
ZEND_BEGIN_ARG_INFO_EX(arginfo_oci_lob_seek, 0, 0, 2)
ZEND_ARG_INFO(0, lob_descriptor)
ZEND_ARG_INFO(0, offset)
ZEND_ARG_INFO(0, whence)
ZEND_END_ARG_INFO()
static
ZEND_BEGIN_ARG_INFO_EX(arginfo_oci_lob_size, 0, 0, 1)
ZEND_ARG_INFO(0, lob_descriptor)
ZEND_END_ARG_INFO()
static
ZEND_BEGIN_ARG_INFO_EX(arginfo_oci_lob_write, 0, 0, 2)
ZEND_ARG_INFO(0, lob_descriptor)
ZEND_ARG_INFO(0, string)
ZEND_ARG_INFO(0, length)
ZEND_END_ARG_INFO()
static
ZEND_BEGIN_ARG_INFO_EX(arginfo_oci_lob_append, 0, 0, 2)
ZEND_ARG_INFO(0, lob_descriptor_to)
ZEND_ARG_INFO(0, lob_descriptor_from)
ZEND_END_ARG_INFO()
static
ZEND_BEGIN_ARG_INFO_EX(arginfo_oci_lob_truncate, 0, 0, 1)
ZEND_ARG_INFO(0, lob_descriptor)
ZEND_ARG_INFO(0, length)
ZEND_END_ARG_INFO()
static
ZEND_BEGIN_ARG_INFO_EX(arginfo_oci_lob_erase, 0, 0, 1)
ZEND_ARG_INFO(0, lob_descriptor)
ZEND_ARG_INFO(0, offset)
ZEND_ARG_INFO(0, length)
ZEND_END_ARG_INFO()
static
ZEND_BEGIN_ARG_INFO_EX(arginfo_oci_lob_flush, 0, 0, 1)
ZEND_ARG_INFO(0, lob_descriptor)
ZEND_ARG_INFO(0, flag)
ZEND_END_ARG_INFO()
static
ZEND_BEGIN_ARG_INFO_EX(arginfo_ocisetbufferinglob, 0, 0, 2)
ZEND_ARG_INFO(0, lob_descriptor)
ZEND_ARG_INFO(0, flag)
ZEND_END_ARG_INFO()
static
ZEND_BEGIN_ARG_INFO_EX(arginfo_ocigetbufferinglob, 0, 0, 1)
ZEND_ARG_INFO(0, lob_descriptor)
ZEND_END_ARG_INFO()
static
ZEND_BEGIN_ARG_INFO_EX(arginfo_oci_lob_copy, 0, 0, 2)
ZEND_ARG_INFO(0, lob_descriptor_to)
ZEND_ARG_INFO(0, lob_descriptor_from)
ZEND_ARG_INFO(0, length)
ZEND_END_ARG_INFO()
static
ZEND_BEGIN_ARG_INFO_EX(arginfo_oci_lob_is_equal, 0, 0, 2)
ZEND_ARG_INFO(0, lob_descriptor)
ZEND_ARG_INFO(0, lob_descriptor)
ZEND_END_ARG_INFO()
static
ZEND_BEGIN_ARG_INFO_EX(arginfo_oci_lob_export, 0, 0, 2)
ZEND_ARG_INFO(0, lob_descriptor)
ZEND_ARG_INFO(0, filename)
ZEND_ARG_INFO(0, start)
ZEND_ARG_INFO(0, length)
ZEND_END_ARG_INFO()
static
ZEND_BEGIN_ARG_INFO_EX(arginfo_oci_new_descriptor, 0, 0, 1)
ZEND_ARG_INFO(0, connection_resource)
ZEND_ARG_INFO(0, type)
ZEND_END_ARG_INFO()
static
ZEND_BEGIN_ARG_INFO_EX(arginfo_oci_rollback, 0, 0, 1)
ZEND_ARG_INFO(0, connection_resource)
ZEND_END_ARG_INFO()
static
ZEND_BEGIN_ARG_INFO_EX(arginfo_oci_commit, 0, 0, 1)
ZEND_ARG_INFO(0, connection_resource)
ZEND_END_ARG_INFO()
static
ZEND_BEGIN_ARG_INFO_EX(arginfo_oci_field_name, 0, 0, 2)
ZEND_ARG_INFO(0, statement_resource)
ZEND_ARG_INFO(0, column_number)
ZEND_END_ARG_INFO()
static
ZEND_BEGIN_ARG_INFO_EX(arginfo_oci_field_size, 0, 0, 2)
ZEND_ARG_INFO(0, statement_resource)
ZEND_ARG_INFO(0, column_number_or_name)
ZEND_END_ARG_INFO()
static
ZEND_BEGIN_ARG_INFO_EX(arginfo_oci_field_scale, 0, 0, 2)
ZEND_ARG_INFO(0, statement_resource)
ZEND_ARG_INFO(0, column_number)
ZEND_END_ARG_INFO()
static
ZEND_BEGIN_ARG_INFO_EX(arginfo_oci_field_precision, 0, 0, 2)
ZEND_ARG_INFO(0, statement_resource)
ZEND_ARG_INFO(0, column_number)
ZEND_END_ARG_INFO()
static
ZEND_BEGIN_ARG_INFO_EX(arginfo_oci_field_type, 0, 0, 2)
ZEND_ARG_INFO(0, statement_resource)
ZEND_ARG_INFO(0, column_number)
ZEND_END_ARG_INFO()
static
ZEND_BEGIN_ARG_INFO_EX(arginfo_oci_field_type_raw, 0, 0, 2)
ZEND_ARG_INFO(0, statement_resource)
ZEND_ARG_INFO(0, column_number)
ZEND_END_ARG_INFO()
static
ZEND_BEGIN_ARG_INFO_EX(arginfo_oci_field_is_null, 0, 0, 2)
ZEND_ARG_INFO(0, statement_resource)
ZEND_ARG_INFO(0, column_number_or_name)
ZEND_END_ARG_INFO()
static
ZEND_BEGIN_ARG_INFO_EX(arginfo_oci_internal_debug, 0, 0, 1)
ZEND_ARG_INFO(0, mode)
ZEND_END_ARG_INFO()
static
ZEND_BEGIN_ARG_INFO_EX(arginfo_oci_execute, 0, 0, 1)
ZEND_ARG_INFO(0, statement_resource)
ZEND_ARG_INFO(0, mode)
ZEND_END_ARG_INFO()
static
ZEND_BEGIN_ARG_INFO_EX(arginfo_oci_cancel, 0, 0, 1)
ZEND_ARG_INFO(0, statement_resource)
ZEND_END_ARG_INFO()
static
ZEND_BEGIN_ARG_INFO_EX(arginfo_oci_fetch, 0, 0, 1)
ZEND_ARG_INFO(0, statement_resource)
ZEND_END_ARG_INFO()
static
ZEND_BEGIN_ARG_INFO_EX(arginfo_ocifetchinto, 0, 0, 2)
ZEND_ARG_INFO(0, statement_resource)
ZEND_ARG_INFO(1, result)
ZEND_ARG_INFO(0, mode)
ZEND_END_ARG_INFO()
static
ZEND_BEGIN_ARG_INFO_EX(arginfo_oci_fetch_all, 0, 0, 2)
ZEND_ARG_INFO(0, statement_resource)
ZEND_ARG_INFO(1, output)
ZEND_ARG_INFO(0, skip)
ZEND_ARG_INFO(0, maximum_rows)
ZEND_ARG_INFO(0, flags)
ZEND_END_ARG_INFO()
static
ZEND_BEGIN_ARG_INFO_EX(arginfo_oci_fetch_object, 0, 0, 1)
ZEND_ARG_INFO(0, statement_resource)
ZEND_END_ARG_INFO()
static
ZEND_BEGIN_ARG_INFO_EX(arginfo_oci_fetch_row, 0, 0, 1)
ZEND_ARG_INFO(0, statement_resource)
ZEND_END_ARG_INFO()
static
ZEND_BEGIN_ARG_INFO_EX(arginfo_oci_fetch_assoc, 0, 0, 1)
ZEND_ARG_INFO(0, statement_resource)
ZEND_END_ARG_INFO()
static
ZEND_BEGIN_ARG_INFO_EX(arginfo_oci_fetch_array, 0, 0, 1)
ZEND_ARG_INFO(0, statement_resource)
ZEND_ARG_INFO(0, mode)
ZEND_END_ARG_INFO()
static
ZEND_BEGIN_ARG_INFO_EX(arginfo_oci_free_statement, 0, 0, 1)
ZEND_ARG_INFO(0, statement_resource)
ZEND_END_ARG_INFO()
static
ZEND_BEGIN_ARG_INFO_EX(arginfo_oci_close, 0, 0, 1)
ZEND_ARG_INFO(0, connection_resource)
ZEND_END_ARG_INFO()
static
ZEND_BEGIN_ARG_INFO_EX(arginfo_oci_new_connect, 0, 0, 2)
ZEND_ARG_INFO(0, username)
ZEND_ARG_INFO(0, password)
ZEND_ARG_INFO(0, connection_string)
ZEND_ARG_INFO(0, character_set)
ZEND_ARG_INFO(0, session_mode)
ZEND_END_ARG_INFO()
static
ZEND_BEGIN_ARG_INFO_EX(arginfo_oci_connect, 0, 0, 2)
ZEND_ARG_INFO(0, username)
ZEND_ARG_INFO(0, password)
ZEND_ARG_INFO(0, connection_string)
ZEND_ARG_INFO(0, character_set)
ZEND_ARG_INFO(0, session_mode)
ZEND_END_ARG_INFO()
static
ZEND_BEGIN_ARG_INFO_EX(arginfo_oci_pconnect, 0, 0, 2)
ZEND_ARG_INFO(0, username)
ZEND_ARG_INFO(0, password)
ZEND_ARG_INFO(0, connection_string)
ZEND_ARG_INFO(0, character_set)
ZEND_ARG_INFO(0, session_mode)
ZEND_END_ARG_INFO()
static
ZEND_BEGIN_ARG_INFO_EX(arginfo_oci_error, 0, 0, 0)
ZEND_ARG_INFO(0, connection_or_statement_resource)
ZEND_END_ARG_INFO()
static
ZEND_BEGIN_ARG_INFO_EX(arginfo_oci_num_fields, 0, 0, 1)
ZEND_ARG_INFO(0, statement_resource)
ZEND_END_ARG_INFO()
static
ZEND_BEGIN_ARG_INFO_EX(arginfo_oci_parse, 0, 0, 2)
ZEND_ARG_INFO(0, connection_resource)
ZEND_ARG_INFO(0, sql_text)
ZEND_END_ARG_INFO()
static
ZEND_BEGIN_ARG_INFO_EX(arginfo_oci_set_prefetch, 0, 0, 2)
ZEND_ARG_INFO(0, statement_resource)
ZEND_ARG_INFO(0, number_of_rows)
ZEND_END_ARG_INFO()
static
ZEND_BEGIN_ARG_INFO_EX(arginfo_oci_password_change, 0, 0, 4)
ZEND_ARG_INFO(0, connection_resource_or_connection_string)
ZEND_ARG_INFO(0, username)
ZEND_ARG_INFO(0, old_password)
ZEND_ARG_INFO(0, new_password)
ZEND_END_ARG_INFO()
static
ZEND_BEGIN_ARG_INFO_EX(arginfo_oci_new_cursor, 0, 0, 1)
ZEND_ARG_INFO(0, connection_resource)
ZEND_END_ARG_INFO()
static
ZEND_BEGIN_ARG_INFO_EX(arginfo_oci_result, 0, 0, 2)
ZEND_ARG_INFO(0, statement_resource)
ZEND_ARG_INFO(0, column_number_or_name)
ZEND_END_ARG_INFO()
static
ZEND_BEGIN_ARG_INFO_EX(arginfo_oci_server_version, 0, 0, 1)
ZEND_ARG_INFO(0, connection_resource)
ZEND_END_ARG_INFO()
static
ZEND_BEGIN_ARG_INFO_EX(arginfo_oci_statement_type, 0, 0, 1)
ZEND_ARG_INFO(0, statement_resource)
ZEND_END_ARG_INFO()
static
ZEND_BEGIN_ARG_INFO_EX(arginfo_oci_num_rows, 0, 0, 1)
ZEND_ARG_INFO(0, statement_resource)
ZEND_END_ARG_INFO()
static
ZEND_BEGIN_ARG_INFO_EX(arginfo_oci_free_collection, 0, 0, 1)
ZEND_ARG_INFO(0, collection)
ZEND_END_ARG_INFO()
static
ZEND_BEGIN_ARG_INFO_EX(arginfo_oci_collection_append, 0, 0, )
ZEND_ARG_INFO(0, collection)
ZEND_ARG_INFO(0, value)
ZEND_END_ARG_INFO()
static
ZEND_BEGIN_ARG_INFO_EX(arginfo_oci_collection_element_get, 0, 0, 2)
ZEND_ARG_INFO(0, collection)
ZEND_ARG_INFO(0, index)
ZEND_END_ARG_INFO()
static
ZEND_BEGIN_ARG_INFO_EX(arginfo_oci_collection_assign, 0, 0, 2)
ZEND_ARG_INFO(0, collection_to)
ZEND_ARG_INFO(0, collection_from)
ZEND_END_ARG_INFO()
static
ZEND_BEGIN_ARG_INFO_EX(arginfo_oci_collection_element_assign, 0, 0, 3)
ZEND_ARG_INFO(0, collection)
ZEND_ARG_INFO(0, index)
ZEND_ARG_INFO(0, value)
ZEND_END_ARG_INFO()
static
ZEND_BEGIN_ARG_INFO_EX(arginfo_oci_collection_size, 0, 0, 1)
ZEND_ARG_INFO(0, collection)
ZEND_END_ARG_INFO()
static
ZEND_BEGIN_ARG_INFO_EX(arginfo_oci_collection_max, 0, 0, 1)
ZEND_ARG_INFO(0, collection)
ZEND_END_ARG_INFO()
static
ZEND_BEGIN_ARG_INFO_EX(arginfo_oci_collection_trim, 0, 0, 2)
ZEND_ARG_INFO(0, collection)
ZEND_ARG_INFO(0, num)
ZEND_END_ARG_INFO()
static
ZEND_BEGIN_ARG_INFO_EX(arginfo_oci_new_collection, 0, 0, 2)
ZEND_ARG_INFO(0, connection_resource)
ZEND_ARG_INFO(0, type_name)
ZEND_ARG_INFO(0, schema_name)
ZEND_END_ARG_INFO()
/* }}} */
/* {{{ extension function prototypes /* {{{ extension function prototypes
*/ */
@ -195,122 +591,123 @@ PHP_FUNCTION(oci_collection_trim);
/* {{{ extension definition structures /* {{{ extension definition structures
*/ */
static const zend_function_entry php_oci_functions[] = { static const
PHP_FE(oci_define_by_name, oci_third_arg_force_ref) zend_function_entry php_oci_functions[] = {
PHP_FE(oci_bind_by_name, oci_third_arg_force_ref) PHP_FE(oci_define_by_name, arginfo_oci_define_by_name)
PHP_FE(oci_bind_array_by_name, oci_third_arg_force_ref) PHP_FE(oci_bind_by_name, arginfo_oci_bind_by_name)
PHP_FE(oci_field_is_null, NULL) PHP_FE(oci_bind_array_by_name, arginfo_oci_bind_array_by_name)
PHP_FE(oci_field_name, NULL) PHP_FE(oci_field_is_null, arginfo_oci_field_is_null)
PHP_FE(oci_field_size, NULL) PHP_FE(oci_field_name, arginfo_oci_field_name)
PHP_FE(oci_field_scale, NULL) PHP_FE(oci_field_size, arginfo_oci_field_size)
PHP_FE(oci_field_precision, NULL) PHP_FE(oci_field_scale, arginfo_oci_field_scale)
PHP_FE(oci_field_type, NULL) PHP_FE(oci_field_precision, arginfo_oci_field_precision)
PHP_FE(oci_field_type_raw, NULL) PHP_FE(oci_field_type, arginfo_oci_field_type)
PHP_FE(oci_execute, NULL) PHP_FE(oci_field_type_raw, arginfo_oci_field_type_raw)
PHP_FE(oci_cancel, NULL) PHP_FE(oci_execute, arginfo_oci_execute)
PHP_FE(oci_fetch, NULL) PHP_FE(oci_cancel, arginfo_oci_cancel)
PHP_FE(oci_fetch_object, NULL) PHP_FE(oci_fetch, arginfo_oci_fetch)
PHP_FE(oci_fetch_row, NULL) PHP_FE(oci_fetch_object, arginfo_oci_fetch_object)
PHP_FE(oci_fetch_assoc, NULL) PHP_FE(oci_fetch_row, arginfo_oci_fetch_row)
PHP_FE(oci_fetch_array, NULL) PHP_FE(oci_fetch_assoc, arginfo_oci_fetch_assoc)
PHP_FE(ocifetchinto, oci_second_arg_force_ref) PHP_FE(oci_fetch_array, arginfo_oci_fetch_array)
PHP_FE(oci_fetch_all, oci_second_arg_force_ref) PHP_FE(ocifetchinto, arginfo_ocifetchinto)
PHP_FE(oci_free_statement, NULL) PHP_FE(oci_fetch_all, arginfo_oci_fetch_all)
PHP_FE(oci_internal_debug, NULL) PHP_FE(oci_free_statement, arginfo_oci_free_statement)
PHP_FE(oci_num_fields, NULL) PHP_FE(oci_internal_debug, arginfo_oci_internal_debug)
PHP_FE(oci_parse, NULL) PHP_FE(oci_num_fields, arginfo_oci_num_fields)
PHP_FE(oci_new_cursor, NULL) PHP_FE(oci_parse, arginfo_oci_parse)
PHP_FE(oci_result, NULL) PHP_FE(oci_new_cursor, arginfo_oci_new_cursor)
PHP_FE(oci_server_version, NULL) PHP_FE(oci_result, arginfo_oci_result)
PHP_FE(oci_statement_type, NULL) PHP_FE(oci_server_version, arginfo_oci_server_version)
PHP_FE(oci_num_rows, NULL) PHP_FE(oci_statement_type, arginfo_oci_statement_type)
PHP_FE(oci_close, NULL) PHP_FE(oci_num_rows, arginfo_oci_num_rows)
PHP_FE(oci_connect, NULL) PHP_FE(oci_close, arginfo_oci_close)
PHP_FE(oci_new_connect, NULL) PHP_FE(oci_connect, arginfo_oci_connect)
PHP_FE(oci_pconnect, NULL) PHP_FE(oci_new_connect, arginfo_oci_new_connect)
PHP_FE(oci_error, NULL) PHP_FE(oci_pconnect, arginfo_oci_pconnect)
PHP_FE(oci_free_descriptor, NULL) PHP_FE(oci_error, arginfo_oci_error)
PHP_FE(oci_lob_save, NULL) PHP_FE(oci_free_descriptor, arginfo_oci_free_descriptor)
PHP_FE(oci_lob_import, NULL) PHP_FE(oci_lob_save, arginfo_oci_lob_save)
PHP_FE(oci_lob_size, NULL) PHP_FE(oci_lob_import, arginfo_oci_lob_import)
PHP_FE(oci_lob_load, NULL) PHP_FE(oci_lob_size, arginfo_oci_lob_size)
PHP_FE(oci_lob_read, NULL) PHP_FE(oci_lob_load, arginfo_oci_lob_load)
PHP_FE(oci_lob_eof, NULL) PHP_FE(oci_lob_read, arginfo_oci_lob_read)
PHP_FE(oci_lob_tell, NULL) PHP_FE(oci_lob_eof, arginfo_oci_lob_eof)
PHP_FE(oci_lob_truncate, NULL) PHP_FE(oci_lob_tell, arginfo_oci_lob_tell)
PHP_FE(oci_lob_erase, NULL) PHP_FE(oci_lob_truncate, arginfo_oci_lob_truncate)
PHP_FE(oci_lob_flush, NULL) PHP_FE(oci_lob_erase, arginfo_oci_lob_erase)
PHP_FE(ocisetbufferinglob, NULL) PHP_FE(oci_lob_flush, arginfo_oci_lob_flush)
PHP_FE(ocigetbufferinglob, NULL) PHP_FE(ocisetbufferinglob, arginfo_ocisetbufferinglob)
PHP_FE(oci_lob_is_equal, NULL) PHP_FE(ocigetbufferinglob, arginfo_ocigetbufferinglob)
PHP_FE(oci_lob_rewind, NULL) PHP_FE(oci_lob_is_equal, arginfo_oci_lob_is_equal)
PHP_FE(oci_lob_write, NULL) PHP_FE(oci_lob_rewind, arginfo_oci_lob_rewind)
PHP_FE(oci_lob_append, NULL) PHP_FE(oci_lob_write, arginfo_oci_lob_write)
PHP_FE(oci_lob_copy, NULL) PHP_FE(oci_lob_append, arginfo_oci_lob_append)
PHP_FE(oci_lob_export, NULL) PHP_FE(oci_lob_copy, arginfo_oci_lob_copy)
PHP_FE(oci_lob_seek, NULL) PHP_FE(oci_lob_export, arginfo_oci_lob_export)
PHP_FE(oci_commit, NULL) PHP_FE(oci_lob_seek, arginfo_oci_lob_seek)
PHP_FE(oci_rollback, NULL) PHP_FE(oci_commit, arginfo_oci_commit)
PHP_FE(oci_new_descriptor, NULL) PHP_FE(oci_rollback, arginfo_oci_rollback)
PHP_FE(oci_set_prefetch, NULL) PHP_FE(oci_new_descriptor, arginfo_oci_new_descriptor)
PHP_FE(oci_password_change, NULL) PHP_FE(oci_set_prefetch, arginfo_oci_set_prefetch)
PHP_FE(oci_free_collection, NULL) PHP_FE(oci_password_change, arginfo_oci_password_change)
PHP_FE(oci_collection_append, NULL) PHP_FE(oci_free_collection, arginfo_oci_free_collection)
PHP_FE(oci_collection_element_get, NULL) PHP_FE(oci_collection_append, arginfo_oci_collection_append)
PHP_FE(oci_collection_element_assign, NULL) PHP_FE(oci_collection_element_get, arginfo_oci_collection_element_get)
PHP_FE(oci_collection_assign, NULL) PHP_FE(oci_collection_element_assign, arginfo_oci_collection_element_assign)
PHP_FE(oci_collection_size, NULL) PHP_FE(oci_collection_assign, arginfo_oci_collection_assign)
PHP_FE(oci_collection_max, NULL) PHP_FE(oci_collection_size, arginfo_oci_collection_size)
PHP_FE(oci_collection_trim, NULL) PHP_FE(oci_collection_max, arginfo_oci_collection_max)
PHP_FE(oci_new_collection, NULL) PHP_FE(oci_collection_trim, arginfo_oci_collection_trim)
PHP_FE(oci_new_collection, arginfo_oci_new_collection)
PHP_FALIAS(oci_free_cursor, oci_free_statement, NULL) PHP_FALIAS(oci_free_cursor, oci_free_statement, arginfo_oci_free_statement)
PHP_FALIAS(ocifreecursor, oci_free_statement, NULL) PHP_FALIAS(ocifreecursor, oci_free_statement, arginfo_oci_free_statement)
PHP_FALIAS(ocibindbyname, oci_bind_by_name, oci_third_arg_force_ref) PHP_FALIAS(ocibindbyname, oci_bind_by_name, arginfo_oci_bind_by_name)
PHP_FALIAS(ocidefinebyname, oci_define_by_name, oci_third_arg_force_ref) PHP_FALIAS(ocidefinebyname, oci_define_by_name, arginfo_oci_define_by_name)
PHP_FALIAS(ocicolumnisnull, oci_field_is_null, NULL) PHP_FALIAS(ocicolumnisnull, oci_field_is_null, arginfo_oci_field_is_null)
PHP_FALIAS(ocicolumnname, oci_field_name, NULL) PHP_FALIAS(ocicolumnname, oci_field_name, arginfo_oci_field_name)
PHP_FALIAS(ocicolumnsize, oci_field_size, NULL) PHP_FALIAS(ocicolumnsize, oci_field_size, arginfo_oci_field_size)
PHP_FALIAS(ocicolumnscale, oci_field_scale, NULL) PHP_FALIAS(ocicolumnscale, oci_field_scale, arginfo_oci_field_scale)
PHP_FALIAS(ocicolumnprecision, oci_field_precision, NULL) PHP_FALIAS(ocicolumnprecision, oci_field_precision, arginfo_oci_field_precision)
PHP_FALIAS(ocicolumntype, oci_field_type, NULL) PHP_FALIAS(ocicolumntype, oci_field_type, arginfo_oci_field_type)
PHP_FALIAS(ocicolumntyperaw, oci_field_type_raw, NULL) PHP_FALIAS(ocicolumntyperaw, oci_field_type_raw, arginfo_oci_field_type_raw)
PHP_FALIAS(ociexecute, oci_execute, NULL) PHP_FALIAS(ociexecute, oci_execute, arginfo_oci_execute)
PHP_FALIAS(ocicancel, oci_cancel, NULL) PHP_FALIAS(ocicancel, oci_cancel, arginfo_oci_cancel)
PHP_FALIAS(ocifetch, oci_fetch, NULL) PHP_FALIAS(ocifetch, oci_fetch, arginfo_oci_fetch)
PHP_FALIAS(ocifetchstatement, oci_fetch_all, oci_second_arg_force_ref) PHP_FALIAS(ocifetchstatement, oci_fetch_all, arginfo_oci_fetch_all)
PHP_FALIAS(ocifreestatement, oci_free_statement, NULL) PHP_FALIAS(ocifreestatement, oci_free_statement, arginfo_oci_free_statement)
PHP_FALIAS(ociinternaldebug, oci_internal_debug, NULL) PHP_FALIAS(ociinternaldebug, oci_internal_debug, arginfo_oci_internal_debug)
PHP_FALIAS(ocinumcols, oci_num_fields, NULL) PHP_FALIAS(ocinumcols, oci_num_fields, arginfo_oci_num_fields)
PHP_FALIAS(ociparse, oci_parse, NULL) PHP_FALIAS(ociparse, oci_parse, arginfo_oci_parse)
PHP_FALIAS(ocinewcursor, oci_new_cursor, NULL) PHP_FALIAS(ocinewcursor, oci_new_cursor, arginfo_oci_new_cursor)
PHP_FALIAS(ociresult, oci_result, NULL) PHP_FALIAS(ociresult, oci_result, arginfo_oci_result)
PHP_FALIAS(ociserverversion, oci_server_version, NULL) PHP_FALIAS(ociserverversion, oci_server_version, arginfo_oci_server_version)
PHP_FALIAS(ocistatementtype, oci_statement_type, NULL) PHP_FALIAS(ocistatementtype, oci_statement_type, arginfo_oci_statement_type)
PHP_FALIAS(ocirowcount, oci_num_rows, NULL) PHP_FALIAS(ocirowcount, oci_num_rows, arginfo_oci_num_rows)
PHP_FALIAS(ocilogoff, oci_close, NULL) PHP_FALIAS(ocilogoff, oci_close, arginfo_oci_close)
PHP_FALIAS(ocilogon, oci_connect, NULL) PHP_FALIAS(ocilogon, oci_connect, arginfo_oci_connect)
PHP_FALIAS(ocinlogon, oci_new_connect, NULL) PHP_FALIAS(ocinlogon, oci_new_connect, arginfo_oci_new_connect)
PHP_FALIAS(ociplogon, oci_pconnect, NULL) PHP_FALIAS(ociplogon, oci_pconnect, arginfo_oci_pconnect)
PHP_FALIAS(ocierror, oci_error, NULL) PHP_FALIAS(ocierror, oci_error, arginfo_oci_error)
PHP_FALIAS(ocifreedesc, oci_free_descriptor, NULL) PHP_FALIAS(ocifreedesc, oci_free_descriptor, arginfo_oci_free_descriptor)
PHP_FALIAS(ocisavelob, oci_lob_save, NULL) PHP_FALIAS(ocisavelob, oci_lob_save, arginfo_oci_lob_save)
PHP_FALIAS(ocisavelobfile, oci_lob_import, NULL) PHP_FALIAS(ocisavelobfile, oci_lob_import, arginfo_oci_lob_import)
PHP_FALIAS(ociwritelobtofile, oci_lob_export, NULL) PHP_FALIAS(ociwritelobtofile, oci_lob_export, arginfo_oci_lob_export)
PHP_FALIAS(ociloadlob, oci_lob_load, NULL) PHP_FALIAS(ociloadlob, oci_lob_load, arginfo_oci_lob_load)
PHP_FALIAS(ocicommit, oci_commit, NULL) PHP_FALIAS(ocicommit, oci_commit, arginfo_oci_commit)
PHP_FALIAS(ocirollback, oci_rollback, NULL) PHP_FALIAS(ocirollback, oci_rollback, arginfo_oci_rollback)
PHP_FALIAS(ocinewdescriptor, oci_new_descriptor, NULL) PHP_FALIAS(ocinewdescriptor, oci_new_descriptor, arginfo_oci_new_descriptor)
PHP_FALIAS(ocisetprefetch, oci_set_prefetch, NULL) PHP_FALIAS(ocisetprefetch, oci_set_prefetch, arginfo_oci_set_prefetch)
PHP_FALIAS(ocipasswordchange, oci_password_change, NULL) PHP_FALIAS(ocipasswordchange, oci_password_change, arginfo_oci_password_change)
PHP_FALIAS(ocifreecollection, oci_free_collection, NULL) PHP_FALIAS(ocifreecollection, oci_free_collection, arginfo_oci_free_collection)
PHP_FALIAS(ocinewcollection, oci_new_collection, NULL) PHP_FALIAS(ocinewcollection, oci_new_collection, arginfo_oci_new_collection)
PHP_FALIAS(ocicollappend, oci_collection_append, NULL) PHP_FALIAS(ocicollappend, oci_collection_append, arginfo_oci_collection_append)
PHP_FALIAS(ocicollgetelem, oci_collection_element_get, NULL) PHP_FALIAS(ocicollgetelem, oci_collection_element_get, arginfo_oci_collection_element_get)
PHP_FALIAS(ocicollassignelem, oci_collection_element_assign, NULL) PHP_FALIAS(ocicollassignelem, oci_collection_element_assign, arginfo_oci_collection_element_assign)
PHP_FALIAS(ocicollsize, oci_collection_size, NULL) PHP_FALIAS(ocicollsize, oci_collection_size, arginfo_oci_collection_size)
PHP_FALIAS(ocicollmax, oci_collection_max, NULL) PHP_FALIAS(ocicollmax, oci_collection_max, arginfo_oci_collection_max)
PHP_FALIAS(ocicolltrim, oci_collection_trim, NULL) PHP_FALIAS(ocicolltrim, oci_collection_trim, arginfo_oci_collection_trim)
{NULL,NULL,NULL} {NULL,NULL,NULL}
}; };
@ -494,6 +891,7 @@ PHP_MINIT_FUNCTION(oci)
REGISTER_LONG_CONSTANT("OCI_DEFAULT",OCI_DEFAULT, CONST_CS | CONST_PERSISTENT); REGISTER_LONG_CONSTANT("OCI_DEFAULT",OCI_DEFAULT, CONST_CS | CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("OCI_SYSOPER",OCI_SYSOPER, CONST_CS | CONST_PERSISTENT); REGISTER_LONG_CONSTANT("OCI_SYSOPER",OCI_SYSOPER, CONST_CS | CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("OCI_SYSDBA",OCI_SYSDBA, CONST_CS | CONST_PERSISTENT); REGISTER_LONG_CONSTANT("OCI_SYSDBA",OCI_SYSDBA, CONST_CS | CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("OCI_CRED_EXT",PHP_OCI_CRED_EXT, CONST_CS | CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("OCI_DESCRIBE_ONLY",OCI_DESCRIBE_ONLY, CONST_CS | CONST_PERSISTENT); REGISTER_LONG_CONSTANT("OCI_DESCRIBE_ONLY",OCI_DESCRIBE_ONLY, CONST_CS | CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("OCI_COMMIT_ON_SUCCESS",OCI_COMMIT_ON_SUCCESS, CONST_CS | CONST_PERSISTENT); REGISTER_LONG_CONSTANT("OCI_COMMIT_ON_SUCCESS",OCI_COMMIT_ON_SUCCESS, CONST_CS | CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("OCI_EXACT_FETCH",OCI_EXACT_FETCH, CONST_CS | CONST_PERSISTENT); REGISTER_LONG_CONSTANT("OCI_EXACT_FETCH",OCI_EXACT_FETCH, CONST_CS | CONST_PERSISTENT);
@ -1074,31 +1472,46 @@ php_oci_connection *php_oci_do_connect_ex(zstr username, int username_len, zstr
ub2 charsetid = 0; ub2 charsetid = 0;
ub2 charsetid_nls_lang = 0; ub2 charsetid_nls_lang = 0;
switch (session_mode) { if (session_mode & ~(OCI_SYSOPER | OCI_SYSDBA | PHP_OCI_CRED_EXT)) {
case OCI_DEFAULT: php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid session mode specified (%ld)", session_mode);
break;
case OCI_SYSOPER:
case OCI_SYSDBA:
if (!OCI_G(privileged_connect)) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Privileged connect is disabled. Enable oci8.privileged_connect to be able to connect as SYSOPER or SYSDBA");
return NULL; return NULL;
} }
if (session_mode & (OCI_SYSOPER | OCI_SYSDBA | PHP_OCI_CRED_EXT)) {
if ((session_mode & OCI_SYSOPER) && (session_mode & OCI_SYSDBA)) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "OCI_SYSDBA and OCI_SYSOPER cannot be used together");
return NULL;
}
if (session_mode & PHP_OCI_CRED_EXT) {
#ifdef PHP_WIN32
/* Disable external authentication on Windows as Impersonation is not yet handled.
* TODO: Re-enable this once OCI provides capability
*/
php_error_docref(NULL TSRMLS_CC, E_WARNING, "External Authentication is not supported on Windows");
return NULL;
#endif
if (username_len != 1 || username.s[0] != '/' || password_len != 0) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "OCI_CRED_EXT can only be used with a username of \"/\" and a NULL password");
return NULL;
}
}
if (session_mode & (OCI_SYSOPER | OCI_SYSDBA)) {
/* Increase security by not caching privileged oci_pconnect() connections. The /* Increase security by not caching privileged oci_pconnect() connections. The
* connection becomes equivalent to oci_connect() or oci_new_connect(). * connection becomes equivalent to oci_connect() or oci_new_connect().
*/ */
persistent = 0; persistent = 0;
break; if (!OCI_G(privileged_connect)) {
default: php_error_docref(NULL TSRMLS_CC, E_WARNING, "Privileged connect is disabled. Enable oci8.privileged_connect to be able to connect as SYSOPER or SYSDBA");
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid session mode specified (%ld)", session_mode);
return NULL; return NULL;
break; }
}
} }
/* We cannot use the new session create logic (OCISessionGet from client-side session pool) when /* We cannot use the new session create logic (OCISessionGet from
* privileged connect or password change is attempted. TODO: Remove this once OCI provides * client-side session pool) when privileged connect or password
* capability * change is attempted or OCI_CRED_EXT mode is specified. TODO:
* Remove this once OCI provides capability
*/ */
if ((session_mode == OCI_SYSOPER) || (session_mode == OCI_SYSDBA) || (new_password_len)) { if ((session_mode & (OCI_SYSOPER | OCI_SYSDBA | PHP_OCI_CRED_EXT)) || (new_password_len)) {
use_spool = 0; use_spool = 0;
} else if (UG(unicode)) { } else if (UG(unicode)) {
/* Pre 10.1 session pool does not support unicode - bypass pool */ /* Pre 10.1 session pool does not support unicode - bypass pool */
@ -2253,22 +2666,17 @@ static int php_oci_old_create_session(php_oci_connection *connection, zstr dbnam
} /* }}} */ } /* }}} */
} else { } else {
/* start the session {{{ */ /* start the session {{{ */
switch (session_mode) { ub4 cred_type = OCI_CRED_RDBMS;
case OCI_DEFAULT:
/* statement caching is suported only in Oracle 9+ */ if (session_mode & PHP_OCI_CRED_EXT) {
PHP_OCI_CALL_RETURN(OCI_G(errcode), OCISessionBegin, (connection->svc, OCI_G(err), connection->session, (ub4) OCI_CRED_RDBMS, (ub4) OCI_STMT_CACHE)); cred_type = OCI_CRED_EXT;
break; session_mode ^= PHP_OCI_CRED_EXT;
case OCI_SYSDBA:
case OCI_SYSOPER:
default:
if (username_len == 1 && username.s[0] == '/' && password_len == 0) {
PHP_OCI_CALL_RETURN(OCI_G(errcode), OCISessionBegin, (connection->svc, OCI_G(err), connection->session, (ub4) OCI_CRED_EXT, (ub4) session_mode));
} else {
PHP_OCI_CALL_RETURN(OCI_G(errcode), OCISessionBegin, (connection->svc, OCI_G(err), connection->session, (ub4) OCI_CRED_RDBMS, (ub4) session_mode));
}
break;
} }
session_mode |= OCI_STMT_CACHE;
PHP_OCI_CALL_RETURN(OCI_G(errcode), OCISessionBegin, (connection->svc, OCI_G(err), connection->session, (ub4) cred_type, (ub4) session_mode));
if (OCI_G(errcode) != OCI_SUCCESS) { if (OCI_G(errcode) != OCI_SUCCESS) {
php_oci_error(OCI_G(err), OCI_G(errcode) TSRMLS_CC); php_oci_error(OCI_G(err), OCI_G(errcode) TSRMLS_CC);
/* OCISessionBegin returns OCI_SUCCESS_WITH_INFO when /* OCISessionBegin returns OCI_SUCCESS_WITH_INFO when

View file

@ -73,24 +73,34 @@ extern zend_class_entry *oci_coll_class_entry_ptr;
#define PHP_OCI_MAX_NAME_LEN 64 #define PHP_OCI_MAX_NAME_LEN 64
#define PHP_OCI_MAX_DATA_SIZE INT_MAX #define PHP_OCI_MAX_DATA_SIZE INT_MAX
#define PHP_OCI_PIECE_SIZE (64*1024)-1 #define PHP_OCI_PIECE_SIZE ((64*1024)-1)
#define PHP_OCI_LOB_BUFFER_SIZE 1048576l /* 1Mb seems to be the most reasonable buffer size for LOB reading */ #define PHP_OCI_LOB_BUFFER_SIZE 1048576l /* 1Mb seems to be the most reasonable buffer size for LOB reading */
#define PHP_OCI_ASSOC 1<<0 #define PHP_OCI_ASSOC (1<<0)
#define PHP_OCI_NUM 1<<1 #define PHP_OCI_NUM (1<<1)
#define PHP_OCI_BOTH (PHP_OCI_ASSOC|PHP_OCI_NUM) #define PHP_OCI_BOTH (PHP_OCI_ASSOC|PHP_OCI_NUM)
#define PHP_OCI_RETURN_NULLS 1<<2 #define PHP_OCI_RETURN_NULLS (1<<2)
#define PHP_OCI_RETURN_LOBS 1<<3 #define PHP_OCI_RETURN_LOBS (1<<3)
#define PHP_OCI_FETCHSTATEMENT_BY_COLUMN 1<<4 #define PHP_OCI_FETCHSTATEMENT_BY_COLUMN (1<<4)
#define PHP_OCI_FETCHSTATEMENT_BY_ROW 1<<5 #define PHP_OCI_FETCHSTATEMENT_BY_ROW (1<<5)
#define PHP_OCI_FETCHSTATEMENT_BY (PHP_OCI_FETCHSTATEMENT_BY_COLUMN | PHP_OCI_FETCHSTATEMENT_BY_ROW) #define PHP_OCI_FETCHSTATEMENT_BY (PHP_OCI_FETCHSTATEMENT_BY_COLUMN | PHP_OCI_FETCHSTATEMENT_BY_ROW)
#define PHP_OCI_LOB_BUFFER_DISABLED 0 #define PHP_OCI_LOB_BUFFER_DISABLED 0
#define PHP_OCI_LOB_BUFFER_ENABLED 1 #define PHP_OCI_LOB_BUFFER_ENABLED 1
#define PHP_OCI_LOB_BUFFER_USED 2 #define PHP_OCI_LOB_BUFFER_USED 2
/* The mode parameter for oci_connect() is overloaded and accepts both
* privilege and external authentication flags OR'd together.
* PHP_OCI_CRED_EXT must be distinct from the OCI_xxx privilege
* values.
*/
#define PHP_OCI_CRED_EXT (1<<31)
#if ((PHP_OCI_CRED_EXT == OCI_DEFAULT) || (PHP_OCI_CRED_EXT & (OCI_SYSOPER | OCI_SYSDBA)))
#error Invalid value for PHP_OCI_CRED_EXT
#endif
/* }}} */ /* }}} */
typedef enum { typedef enum {

View file

@ -0,0 +1,196 @@
--TEST--
Test External Authentication errors with oci_connect
--SKIPIF--
<?php
if (!extension_loaded('oci8')) die ("skip no oci8 extension");
if (substr(PHP_OS, 0, 3) == 'WIN') die("skip feature not available on Windows platforms");
?>
--INI--
oci8.privileged_connect=1
--FILE--
<?php
// Run Test
echo "Test 1\n";
$c = oci_connect('/', 'notemtpy', 'anything', null, OCI_CRED_EXT);
if (!$c) {
$m = oci_error();
var_dump($m);
}
var_dump($c);
echo "Test 2\n";
$c = oci_connect('notemtpy', 'notemtpy', 'anything', null, OCI_CRED_EXT);
if (!$c) {
$m = oci_error();
var_dump($m);
}
var_dump($c);
echo "Test 3\n";
$c = oci_connect('notemtpy', '', 'anything', null, OCI_CRED_EXT);
if (!$c) {
$m = oci_error();
var_dump($m);
}
var_dump($c);
echo "Test 4\n";
$c = oci_connect('a', 'b', 'c', null, OCI_SYSDBA+OCI_SYSOPER);
if (!$c) {
$m = oci_error();
var_dump($m);
}
var_dump($c);
echo "Test 5\n";
$c = oci_connect('a', 'b', 'c', null, OCI_SYSDBA+OCI_SYSOPER+OCI_CRED_EXT);
if (!$c) {
$m = oci_error();
var_dump($m);
}
var_dump($c);
echo "Test 6\n";
$c = oci_connect('', '', 'anything', null, OCI_CRED_EXT);
if (!$c) {
$m = oci_error();
var_dump($m);
}
var_dump($c);
echo "Test 7\n";
$c = oci_connect('/', '', 'anything', null, OCI_CRED_EXT);
if (!$c) {
$m = oci_error();
var_dump($m);
}
var_dump($c);
echo "Test 8\n";
$c = oci_connect('/', null, 'anything', null, OCI_CRED_EXT);
if (!$c) {
$m = oci_error();
var_dump($m);
}
var_dump($c);
echo "Test 9\n";
$c = oci_connect('/', '', 'c', null, OCI_SYSDBA+OCI_CRED_EXT);
if (!$c) {
$m = oci_error();
var_dump($m);
}
var_dump($c);
echo "Test 10\n";
$c = oci_connect('/', '', 'c', null, OCI_SYSOPER+OCI_CRED_EXT);
if (!$c) {
$m = oci_error();
var_dump($m);
}
var_dump($c);
?>
===DONE===
<?php exit(0); ?>
--EXPECTF--
Test 1
Warning: oci_connect(): OCI_CRED_EXT can only be used with a username of "/" and a NULL password in %s on line %d
bool(false)
bool(false)
Test 2
Warning: oci_connect(): OCI_CRED_EXT can only be used with a username of "/" and a NULL password in %s on line %d
bool(false)
bool(false)
Test 3
Warning: oci_connect(): OCI_CRED_EXT can only be used with a username of "/" and a NULL password in %s on line %d
bool(false)
bool(false)
Test 4
Warning: oci_connect(): OCI_SYSDBA and OCI_SYSOPER cannot be used together in %s on line %d
bool(false)
bool(false)
Test 5
Warning: oci_connect(): OCI_SYSDBA and OCI_SYSOPER cannot be used together in %s on line %d
bool(false)
bool(false)
Test 6
Warning: oci_connect(): OCI_CRED_EXT can only be used with a username of "/" and a NULL password in %s on line %d
bool(false)
bool(false)
Test 7
Warning: oci_connect(): ORA-12154: TNS:could not resolve the connect identifier specified in %s on line %d
array(4) {
[u"code"]=>
int(12154)
[u"message"]=>
unicode(65) "ORA-12154: %s"
[u"offset"]=>
int(0)
[u"sqltext"]=>
unicode(0) ""
}
bool(false)
Test 8
Warning: oci_connect(): ORA-12154: TNS:could not resolve the connect identifier specified in %s on line %d
array(4) {
[u"code"]=>
int(12154)
[u"message"]=>
unicode(65) "ORA-12154: %s"
[u"offset"]=>
int(0)
[u"sqltext"]=>
unicode(0) ""
}
bool(false)
Test 9
Warning: oci_connect(): ORA-12154: TNS:could not resolve the connect identifier specified in %s on line %d
array(4) {
[u"code"]=>
int(12154)
[u"message"]=>
unicode(65) "ORA-12154: %s"
[u"offset"]=>
int(0)
[u"sqltext"]=>
unicode(0) ""
}
bool(false)
Test 10
Warning: oci_connect(): ORA-12154: TNS:could not resolve the connect identifier specified in %s on line %d
array(4) {
[u"code"]=>
int(12154)
[u"message"]=>
unicode(65) "ORA-12154: %s"
[u"offset"]=>
int(0)
[u"sqltext"]=>
unicode(0) ""
}
bool(false)
===DONE===

View file

@ -0,0 +1,196 @@
--TEST--
Test External Authentication errors with oci_new_connect
--SKIPIF--
<?php
if (!extension_loaded('oci8')) die ("skip no oci8 extension");
if (substr(PHP_OS, 0, 3) == 'WIN') die("skip feature not available on Windows platforms");
?>
--INI--
oci8.privileged_connect=1
--FILE--
<?php
// Run Test
echo "Test 1\n";
$c = oci_new_connect('/', 'notemtpy', 'anything', null, OCI_CRED_EXT);
if (!$c) {
$m = oci_error();
var_dump($m);
}
var_dump($c);
echo "Test 2\n";
$c = oci_new_connect('notemtpy', 'notemtpy', 'anything', null, OCI_CRED_EXT);
if (!$c) {
$m = oci_error();
var_dump($m);
}
var_dump($c);
echo "Test 3\n";
$c = oci_new_connect('notemtpy', '', 'anything', null, OCI_CRED_EXT);
if (!$c) {
$m = oci_error();
var_dump($m);
}
var_dump($c);
echo "Test 4\n";
$c = oci_new_connect('a', 'b', 'c', null, OCI_SYSDBA+OCI_SYSOPER);
if (!$c) {
$m = oci_error();
var_dump($m);
}
var_dump($c);
echo "Test 5\n";
$c = oci_new_connect('a', 'b', 'c', null, OCI_SYSDBA+OCI_SYSOPER+OCI_CRED_EXT);
if (!$c) {
$m = oci_error();
var_dump($m);
}
var_dump($c);
echo "Test 6\n";
$c = oci_new_connect('', '', 'anything', null, OCI_CRED_EXT);
if (!$c) {
$m = oci_error();
var_dump($m);
}
var_dump($c);
echo "Test 7\n";
$c = oci_new_connect('/', '', 'anything', null, OCI_CRED_EXT);
if (!$c) {
$m = oci_error();
var_dump($m);
}
var_dump($c);
echo "Test 8\n";
$c = oci_new_connect('/', null, 'anything', null, OCI_CRED_EXT);
if (!$c) {
$m = oci_error();
var_dump($m);
}
var_dump($c);
echo "Test 9\n";
$c = oci_new_connect('/', '', 'c', null, OCI_SYSDBA+OCI_CRED_EXT);
if (!$c) {
$m = oci_error();
var_dump($m);
}
var_dump($c);
echo "Test 10\n";
$c = oci_new_connect('/', '', 'c', null, OCI_SYSOPER+OCI_CRED_EXT);
if (!$c) {
$m = oci_error();
var_dump($m);
}
var_dump($c);
?>
===DONE===
<?php exit(0); ?>
--EXPECTF--
Test 1
Warning: oci_new_connect(): OCI_CRED_EXT can only be used with a username of "/" and a NULL password in %s on line %d
bool(false)
bool(false)
Test 2
Warning: oci_new_connect(): OCI_CRED_EXT can only be used with a username of "/" and a NULL password in %s on line %d
bool(false)
bool(false)
Test 3
Warning: oci_new_connect(): OCI_CRED_EXT can only be used with a username of "/" and a NULL password in %s on line %d
bool(false)
bool(false)
Test 4
Warning: oci_new_connect(): OCI_SYSDBA and OCI_SYSOPER cannot be used together in %s on line %d
bool(false)
bool(false)
Test 5
Warning: oci_new_connect(): OCI_SYSDBA and OCI_SYSOPER cannot be used together in %s on line %d
bool(false)
bool(false)
Test 6
Warning: oci_new_connect(): OCI_CRED_EXT can only be used with a username of "/" and a NULL password in %s on line %d
bool(false)
bool(false)
Test 7
Warning: oci_new_connect(): ORA-12154: TNS:could not resolve the connect identifier specified in %s on line %d
array(4) {
[u"code"]=>
int(12154)
[u"message"]=>
unicode(65) "ORA-12154: %s"
[u"offset"]=>
int(0)
[u"sqltext"]=>
unicode(0) ""
}
bool(false)
Test 8
Warning: oci_new_connect(): ORA-12154: TNS:could not resolve the connect identifier specified in %s on line %d
array(4) {
[u"code"]=>
int(12154)
[u"message"]=>
unicode(65) "ORA-12154: %s"
[u"offset"]=>
int(0)
[u"sqltext"]=>
unicode(0) ""
}
bool(false)
Test 9
Warning: oci_new_connect(): ORA-12154: TNS:could not resolve the connect identifier specified in %s on line %d
array(4) {
[u"code"]=>
int(12154)
[u"message"]=>
unicode(65) "ORA-12154: %s"
[u"offset"]=>
int(0)
[u"sqltext"]=>
unicode(0) ""
}
bool(false)
Test 10
Warning: oci_new_connect(): ORA-12154: TNS:could not resolve the connect identifier specified in %s on line %d
array(4) {
[u"code"]=>
int(12154)
[u"message"]=>
unicode(65) "ORA-12154: %s"
[u"offset"]=>
int(0)
[u"sqltext"]=>
unicode(0) ""
}
bool(false)
===DONE===

View file

@ -0,0 +1,196 @@
--TEST--
Test External Authentication errors with oci_pconnect
--SKIPIF--
<?php
if (!extension_loaded('oci8')) die ("skip no oci8 extension");
if (substr(PHP_OS, 0, 3) == 'WIN') die("skip feature not available on Windows platforms");
?>
--INI--
oci8.privileged_connect=1
--FILE--
<?php
// Run Test
echo "Test 1\n";
$c = oci_pconnect('/', 'notemtpy', 'anything', null, OCI_CRED_EXT);
if (!$c) {
$m = oci_error();
var_dump($m);
}
var_dump($c);
echo "Test 2\n";
$c = oci_pconnect('notemtpy', 'notemtpy', 'anything', null, OCI_CRED_EXT);
if (!$c) {
$m = oci_error();
var_dump($m);
}
var_dump($c);
echo "Test 3\n";
$c = oci_pconnect('notemtpy', '', 'anything', null, OCI_CRED_EXT);
if (!$c) {
$m = oci_error();
var_dump($m);
}
var_dump($c);
echo "Test 4\n";
$c = oci_pconnect('a', 'b', 'c', null, OCI_SYSDBA+OCI_SYSOPER);
if (!$c) {
$m = oci_error();
var_dump($m);
}
var_dump($c);
echo "Test 5\n";
$c = oci_pconnect('a', 'b', 'c', null, OCI_SYSDBA+OCI_SYSOPER+OCI_CRED_EXT);
if (!$c) {
$m = oci_error();
var_dump($m);
}
var_dump($c);
echo "Test 6\n";
$c = oci_pconnect('', '', 'anything', null, OCI_CRED_EXT);
if (!$c) {
$m = oci_error();
var_dump($m);
}
var_dump($c);
echo "Test 7\n";
$c = oci_pconnect('/', '', 'anything', null, OCI_CRED_EXT);
if (!$c) {
$m = oci_error();
var_dump($m);
}
var_dump($c);
echo "Test 8\n";
$c = oci_pconnect('/', null, 'anything', null, OCI_CRED_EXT);
if (!$c) {
$m = oci_error();
var_dump($m);
}
var_dump($c);
echo "Test 9\n";
$c = oci_pconnect('/', '', 'c', null, OCI_SYSDBA+OCI_CRED_EXT);
if (!$c) {
$m = oci_error();
var_dump($m);
}
var_dump($c);
echo "Test 10\n";
$c = oci_pconnect('/', '', 'c', null, OCI_SYSOPER+OCI_CRED_EXT);
if (!$c) {
$m = oci_error();
var_dump($m);
}
var_dump($c);
?>
===DONE===
<?php exit(0); ?>
--EXPECTF--
Test 1
Warning: oci_pconnect(): OCI_CRED_EXT can only be used with a username of "/" and a NULL password in %s on line %d
bool(false)
bool(false)
Test 2
Warning: oci_pconnect(): OCI_CRED_EXT can only be used with a username of "/" and a NULL password in %s on line %d
bool(false)
bool(false)
Test 3
Warning: oci_pconnect(): OCI_CRED_EXT can only be used with a username of "/" and a NULL password in %s on line %d
bool(false)
bool(false)
Test 4
Warning: oci_pconnect(): OCI_SYSDBA and OCI_SYSOPER cannot be used together in %s on line %d
bool(false)
bool(false)
Test 5
Warning: oci_pconnect(): OCI_SYSDBA and OCI_SYSOPER cannot be used together in %s on line %d
bool(false)
bool(false)
Test 6
Warning: oci_pconnect(): OCI_CRED_EXT can only be used with a username of "/" and a NULL password in %s on line %d
bool(false)
bool(false)
Test 7
Warning: oci_pconnect(): ORA-12154: TNS:could not resolve the connect identifier specified in %s on line %d
array(4) {
[u"code"]=>
int(12154)
[u"message"]=>
unicode(65) "ORA-12154: %s"
[u"offset"]=>
int(0)
[u"sqltext"]=>
unicode(0) ""
}
bool(false)
Test 8
Warning: oci_pconnect(): ORA-12154: TNS:could not resolve the connect identifier specified in %s on line %d
array(4) {
[u"code"]=>
int(12154)
[u"message"]=>
unicode(65) "ORA-12154: %s"
[u"offset"]=>
int(0)
[u"sqltext"]=>
unicode(0) ""
}
bool(false)
Test 9
Warning: oci_pconnect(): ORA-12154: TNS:could not resolve the connect identifier specified in %s on line %d
array(4) {
[u"code"]=>
int(12154)
[u"message"]=>
unicode(65) "ORA-12154: %s"
[u"offset"]=>
int(0)
[u"sqltext"]=>
unicode(0) ""
}
bool(false)
Test 10
Warning: oci_pconnect(): ORA-12154: TNS:could not resolve the connect identifier specified in %s on line %d
array(4) {
[u"code"]=>
int(12154)
[u"message"]=>
unicode(65) "ORA-12154: %s"
[u"offset"]=>
int(0)
[u"sqltext"]=>
unicode(0) ""
}
bool(false)
===DONE===

View file

@ -0,0 +1,56 @@
--TEST--
Test External Authentication errors on Windows
--SKIPIF--
<?php
if (!extension_loaded('oci8')) die ("skip no oci8 extension");
if (substr(PHP_OS, 0, 3) != 'WIN') die("skip this test is for Windows platforms only");
?>
--FILE--
<?php
// Run Test
echo "Test 1\n";
$c = oci_connect('/', '', 'anything', null, OCI_CRED_EXT);
if (!$c) {
$m = oci_error();
var_dump($m);
}
var_dump($c);
echo "Test 2\n";
$c = oci_new_connect('/', '', 'anything', null, OCI_CRED_EXT);
if (!$c) {
$m = oci_error();
var_dump($m);
}
var_dump($c);
echo "Test 3\n";
$c = oci_pconnect('/', '', 'anything', null, OCI_CRED_EXT);
if (!$c) {
$m = oci_error();
var_dump($m);
}
var_dump($c);
?>
===DONE===
<?php exit(0); ?>
--EXPECTF--
Test 1
Warning: oci_connect(): External Authentication is not supported on Windows in %s on line %d
bool(false)
bool(false)
Test 2
Warning: oci_new_connect(): External Authentication is not supported on Windows in %s on line %d
bool(false)
bool(false)
Test 3
Warning: oci_pconnect(): External Authentication is not supported on Windows in %s on line %d
bool(false)
bool(false)
===DONE===

File diff suppressed because it is too large Load diff