|
Lines 74-80
subtest "checkpw_ldap tests" => sub {
Link Here
|
| 74 |
|
74 |
|
| 75 |
## Connection fail tests |
75 |
## Connection fail tests |
| 76 |
$desired_connection_result = 'error'; |
76 |
$desired_connection_result = 'error'; |
| 77 |
warning_is { $ret = C4::Auth_with_ldap::checkpw_ldap( $dbh, 'hola', password => 'hey' ) } |
77 |
warning_is { $ret = C4::Auth_with_ldap::checkpw_ldap( 'hola', password => 'hey' ) } |
| 78 |
"LDAP connexion failed", |
78 |
"LDAP connexion failed", |
| 79 |
"checkpw_ldap prints correct warning if LDAP conexion fails"; |
79 |
"checkpw_ldap prints correct warning if LDAP conexion fails"; |
| 80 |
is( $ret, 0, "checkpw_ldap returns 0 if LDAP conexion fails"); |
80 |
is( $ret, 0, "checkpw_ldap returns 0 if LDAP conexion fails"); |
|
Lines 96-102
subtest "checkpw_ldap tests" => sub {
Link Here
|
| 96 |
|
96 |
|
| 97 |
|
97 |
|
| 98 |
warning_like { $ret = C4::Auth_with_ldap::checkpw_ldap( |
98 |
warning_like { $ret = C4::Auth_with_ldap::checkpw_ldap( |
| 99 |
$dbh, 'hola', password => 'hey' ) } |
99 |
'hola', password => 'hey' ) } |
| 100 |
qr/Anonymous LDAP bind failed: LDAP error #1: error_name/, |
100 |
qr/Anonymous LDAP bind failed: LDAP error #1: error_name/, |
| 101 |
"checkpw_ldap prints correct warning if LDAP anonymous bind fails"; |
101 |
"checkpw_ldap prints correct warning if LDAP anonymous bind fails"; |
| 102 |
is( $ret, 0, "checkpw_ldap returns 0 if LDAP anonymous bind fails"); |
102 |
is( $ret, 0, "checkpw_ldap returns 0 if LDAP anonymous bind fails"); |
|
Lines 108-121
subtest "checkpw_ldap tests" => sub {
Link Here
|
| 108 |
$desired_count_result = 0; # user auth problem |
108 |
$desired_count_result = 0; # user auth problem |
| 109 |
$non_anonymous_bind_result = 'success'; |
109 |
$non_anonymous_bind_result = 'success'; |
| 110 |
reload_ldap_module(); |
110 |
reload_ldap_module(); |
| 111 |
is ( C4::Auth_with_ldap::checkpw_ldap( $dbh, 'hola', password => 'hey' ), |
111 |
is ( C4::Auth_with_ldap::checkpw_ldap( 'hola', password => 'hey' ), |
| 112 |
0, "checkpw_ldap returns 0 if user lookup returns 0"); |
112 |
0, "checkpw_ldap returns 0 if user lookup returns 0"); |
| 113 |
|
113 |
|
| 114 |
$non_anonymous_bind_result = 'error'; |
114 |
$non_anonymous_bind_result = 'error'; |
| 115 |
reload_ldap_module(); |
115 |
reload_ldap_module(); |
| 116 |
|
116 |
|
| 117 |
warning_like { $ret = C4::Auth_with_ldap::checkpw_ldap( |
117 |
warning_like { $ret = C4::Auth_with_ldap::checkpw_ldap( |
| 118 |
$dbh, 'hola', password => 'hey' ) } |
118 |
'hola', password => 'hey' ) } |
| 119 |
qr/LDAP bind failed as kohauser hola: LDAP error #1: error_name/, |
119 |
qr/LDAP bind failed as kohauser hola: LDAP error #1: error_name/, |
| 120 |
"checkpw_ldap prints correct warning if LDAP bind fails"; |
120 |
"checkpw_ldap prints correct warning if LDAP bind fails"; |
| 121 |
is ( $ret, -1, "checkpw_ldap returns -1 LDAP bind fails for user (Bug 8148)"); |
121 |
is ( $ret, -1, "checkpw_ldap returns -1 LDAP bind fails for user (Bug 8148)"); |
|
Lines 130-136
subtest "checkpw_ldap tests" => sub {
Link Here
|
| 130 |
reload_ldap_module(); |
130 |
reload_ldap_module(); |
| 131 |
|
131 |
|
| 132 |
warning_like { $ret = C4::Auth_with_ldap::checkpw_ldap( |
132 |
warning_like { $ret = C4::Auth_with_ldap::checkpw_ldap( |
| 133 |
$dbh, 'hola', password => 'hey' ) } |
133 |
'hola', password => 'hey' ) } |
| 134 |
qr/LDAP bind failed as kohauser hola: LDAP error #1: error_name/, |
134 |
qr/LDAP bind failed as kohauser hola: LDAP error #1: error_name/, |
| 135 |
"checkpw_ldap prints correct warning if LDAP bind fails"; |
135 |
"checkpw_ldap prints correct warning if LDAP bind fails"; |
| 136 |
is ( $ret, 0, "checkpw_ldap returns 0 LDAP bind fails for user (Bug 12831)"); |
136 |
is ( $ret, 0, "checkpw_ldap returns 0 LDAP bind fails for user (Bug 12831)"); |
|
Lines 150-156
subtest "checkpw_ldap tests" => sub {
Link Here
|
| 150 |
reload_ldap_module(); |
150 |
reload_ldap_module(); |
| 151 |
|
151 |
|
| 152 |
warning_like { $ret = C4::Auth_with_ldap::checkpw_ldap( |
152 |
warning_like { $ret = C4::Auth_with_ldap::checkpw_ldap( |
| 153 |
$dbh, 'hola', password => 'hey' ) } |
153 |
'hola', password => 'hey' ) } |
| 154 |
qr/LDAP bind failed as ldapuser cn=Manager,dc=metavore,dc=com: LDAP error #1: error_name/, |
154 |
qr/LDAP bind failed as ldapuser cn=Manager,dc=metavore,dc=com: LDAP error #1: error_name/, |
| 155 |
"checkpw_ldap prints correct warning if LDAP bind fails"; |
155 |
"checkpw_ldap prints correct warning if LDAP bind fails"; |
| 156 |
is ( $ret, 0, "checkpw_ldap returns 0 if bind fails"); |
156 |
is ( $ret, 0, "checkpw_ldap returns 0 if bind fails"); |
|
Lines 162-168
subtest "checkpw_ldap tests" => sub {
Link Here
|
| 162 |
reload_ldap_module(); |
162 |
reload_ldap_module(); |
| 163 |
|
163 |
|
| 164 |
warning_like { $ret = C4::Auth_with_ldap::checkpw_ldap( |
164 |
warning_like { $ret = C4::Auth_with_ldap::checkpw_ldap( |
| 165 |
$dbh, 'hola', password => 'hey' ) } |
165 |
'hola', password => 'hey' ) } |
| 166 |
qr/LDAP Auth rejected : invalid password for user 'hola'. LDAP error #1: error_name/, |
166 |
qr/LDAP Auth rejected : invalid password for user 'hola'. LDAP error #1: error_name/, |
| 167 |
"checkpw_ldap prints correct warning if LDAP bind fails"; |
167 |
"checkpw_ldap prints correct warning if LDAP bind fails"; |
| 168 |
is ( $ret, -1, "checkpw_ldap returns -1 if bind fails (Bug 8148)"); |
168 |
is ( $ret, -1, "checkpw_ldap returns -1 if bind fails (Bug 8148)"); |
|
Lines 175-181
subtest "checkpw_ldap tests" => sub {
Link Here
|
| 175 |
reload_ldap_module(); |
175 |
reload_ldap_module(); |
| 176 |
|
176 |
|
| 177 |
warning_like { $ret = C4::Auth_with_ldap::checkpw_ldap( |
177 |
warning_like { $ret = C4::Auth_with_ldap::checkpw_ldap( |
| 178 |
$dbh, 'hola', password => 'hey' ) } |
178 |
'hola', password => 'hey' ) } |
| 179 |
qr/LDAP bind failed as ldapuser cn=Manager,dc=metavore,dc=com: LDAP error #1: error_name/, |
179 |
qr/LDAP bind failed as ldapuser cn=Manager,dc=metavore,dc=com: LDAP error #1: error_name/, |
| 180 |
"checkpw_ldap prints correct warning if LDAP bind fails"; |
180 |
"checkpw_ldap prints correct warning if LDAP bind fails"; |
| 181 |
is ( $ret, 0, "checkpw_ldap returns 0 if bind fails"); |
181 |
is ( $ret, 0, "checkpw_ldap returns 0 if bind fails"); |
|
Lines 187-193
subtest "checkpw_ldap tests" => sub {
Link Here
|
| 187 |
reload_ldap_module(); |
187 |
reload_ldap_module(); |
| 188 |
|
188 |
|
| 189 |
warning_like { $ret = C4::Auth_with_ldap::checkpw_ldap( |
189 |
warning_like { $ret = C4::Auth_with_ldap::checkpw_ldap( |
| 190 |
$dbh, 'hola', password => 'hey' ) } |
190 |
'hola', password => 'hey' ) } |
| 191 |
qr/LDAP Auth rejected : invalid password for user 'hola'. LDAP error #1: error_name/, |
191 |
qr/LDAP Auth rejected : invalid password for user 'hola'. LDAP error #1: error_name/, |
| 192 |
"checkpw_ldap prints correct warning if LDAP bind fails"; |
192 |
"checkpw_ldap prints correct warning if LDAP bind fails"; |
| 193 |
is ( $ret, -1, "checkpw_ldap returns -1 if bind fails (Bug 8148)"); |
193 |
is ( $ret, -1, "checkpw_ldap returns -1 if bind fails (Bug 8148)"); |
| 194 |
- |
|
|