Skip to content

Commit 4ba5961

Browse files
committed
Add test case for improper persistent PW handling
1 parent 563cb03 commit 4ba5961

File tree

1 file changed

+31
-0
lines changed

1 file changed

+31
-0
lines changed
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
--TEST--
2+
IBM-DB2: db2_pconnect() - test persistent connection won't be reused with bad password
3+
--SKIPIF--
4+
<?php require_once('skipif.inc'); ?>
5+
--FILE--
6+
<?php
7+
8+
require_once('connection.inc');
9+
10+
/*
11+
* Use blatantly incorrect password, to make sure password is part of the
12+
* internal persistent connection hash.
13+
*/
14+
$conn1 = db2_pconnect($database, $user, $password);
15+
if ($conn1) {
16+
$conn2 = db2_pconnect($database, $user, "wrongbad");
17+
if ($conn2) {
18+
echo "A bad password was accepted.\n";
19+
db2_close($conn2);
20+
} else {
21+
echo "OK\n";
22+
}
23+
db2_close($conn1);
24+
}
25+
else {
26+
echo "Connection failed.\n";
27+
}
28+
29+
?>
30+
--EXPECT--
31+
OK

0 commit comments

Comments
 (0)