Annotation of embedaddon/php/ext/oci8/tests/password_2.phpt, revision 1.1
1.1 ! misho 1: --TEST--
! 2: oci_password_change() for persistent connections
! 3: --SKIPIF--
! 4: <?php
! 5: if (!extension_loaded('oci8')) die("skip no oci8 extension");
! 6: require(dirname(__FILE__)."/details.inc");
! 7: if (empty($dbase)) die ("skip requires database connection string be set");
! 8: if (strcasecmp($user, "system") && strcasecmp($user, "sys")) die("skip needs to be run as a DBA user");
! 9: if ($test_drcp) die("skip password change not supported in DRCP Mode");
! 10: ?>
! 11: --FILE--
! 12: <?php
! 13:
! 14: require(dirname(__FILE__)."/connect.inc");
! 15:
! 16: $stmtarray = array(
! 17: "drop user testuser cascade",
! 18: "create user testuser identified by testuserpwd",
! 19: "grant connect, create session to testuser"
! 20: );
! 21:
! 22: oci8_test_sql_execute($c, $stmtarray);
! 23:
! 24: // Connect (persistent) and change the password
! 25: $c1 = oci_pconnect("testuser", "testuserpwd", $dbase);
! 26: var_dump($c1);
! 27: $rn1 = (int)$c1;
! 28:
! 29: oci_password_change($c1, "testuser", "testuserpwd", "testuserpwd2");
! 30:
! 31: // Second connect should return a new resource because the hash string will be different from $c1
! 32: $c2 = oci_pconnect("testuser", "testuserpwd2", $dbase);
! 33: var_dump($c2);
! 34: $rn2 = (int)$c2;
! 35:
! 36: // Despite using the old password this connect should succeed and return the original resource
! 37: $c3 = oci_pconnect("testuser", "testuserpwd", $dbase);
! 38: var_dump($c3);
! 39: $rn3 = (int)$c3;
! 40:
! 41: // Connections should differ
! 42: if ($rn1 == $rn2) {
! 43: echo "First and second connections share a resource: Not OK\n";
! 44: var_dump($c1);
! 45: }
! 46: else {
! 47: echo "First and second connections are different: OK\n";
! 48: }
! 49:
! 50: // Connections should be the same
! 51: if ($rn1 == $rn3) {
! 52: echo "First and third connections share a resource: OK\n";
! 53: }
! 54: else {
! 55: echo "First and third connections are different: Not OK\n";
! 56: var_dump($c1);
! 57: var_dump($c2);
! 58: }
! 59:
! 60: echo "Done\n";
! 61:
! 62: ?>
! 63: --CLEAN--
! 64: <?php
! 65:
! 66: require(dirname(__FILE__)."/connect.inc");
! 67:
! 68: $stmtarray = array(
! 69: "drop user testuser cascade"
! 70: );
! 71:
! 72: oci8_test_sql_execute($c, $stmtarray);
! 73:
! 74: ?>
! 75: --EXPECTF--
! 76: resource(%d) of type (oci8 persistent connection)
! 77: resource(%d) of type (oci8 persistent connection)
! 78: resource(%d) of type (oci8 persistent connection)
! 79: First and second connections are different: OK
! 80: First and third connections share a resource: OK
! 81: Done
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>