Annotation of embedaddon/php/ext/ldap/tests/ldap_sasl_bind_error.phpt, revision 1.1
1.1 ! misho 1: --TEST--
! 2: ldap_sasl_bind() - Binding that should fail
! 3: --CREDITS--
! 4: Patrick Allaert <patrickallaert@php.net>
! 5: # Belgian PHP Testfest 2009
! 6: --SKIPIF--
! 7: <?php require_once('skipif.inc'); ?>
! 8: <?php require_once('skipifbindfailure.inc'); ?>
! 9: <?php if (!function_exists("ldap_sasl_bind")) die("skip LDAP extension not compiled with SASL support"); ?>
! 10: --FILE--
! 11: <?php
! 12: require "connect.inc";
! 13:
! 14: $link = ldap_connect($host, $port);
! 15: ldap_set_option($link, LDAP_OPT_PROTOCOL_VERSION, $protocol_version);
! 16:
! 17: // Invalid parameter count
! 18: var_dump(ldap_sasl_bind());
! 19:
! 20: // Invalid DN
! 21: var_dump(ldap_sasl_bind($link, "Invalid DN", $passwd, 'DIGEST-MD5', 'realm', $sasl_user));
! 22:
! 23: // Invalid user
! 24: var_dump(ldap_sasl_bind($link, null, "ThisIsNotCorrect$passwd", 'DIGEST-MD5', "realm", "invalid$sasl_user"));
! 25:
! 26: // Invalid password
! 27: var_dump(ldap_sasl_bind($link, null, "ThisIsNotCorrect$passwd", 'DIGEST-MD5', "realm", $sasl_user));
! 28:
! 29: var_dump(ldap_sasl_bind($link, null, $passwd, 'DIGEST-MD5', "realm", "Manager", "test"));
! 30:
! 31: // Invalid DN syntax
! 32: var_dump(ldap_sasl_bind($link, "unexistingProperty=weirdValue,$user", $passwd));
! 33: ?>
! 34: ===DONE===
! 35: --EXPECTF--
! 36: Warning: ldap_sasl_bind() expects at least 1 parameter, 0 given in %s on line %d
! 37: bool(false)
! 38:
! 39: Warning: ldap_sasl_bind(): Unable to bind to server: Invalid DN syntax in %s on line %d
! 40: bool(false)
! 41:
! 42: Warning: ldap_sasl_bind(): Unable to bind to server: Invalid credentials in %s on line %d
! 43: bool(false)
! 44:
! 45: Warning: ldap_sasl_bind(): Unable to bind to server: Invalid credentials in %s on line %d
! 46: bool(false)
! 47:
! 48: Warning: ldap_sasl_bind(): Unable to bind to server: Insufficient access in %s on line %d
! 49: bool(false)
! 50:
! 51: Warning: ldap_sasl_bind(): Unable to bind to server: Invalid DN syntax in %s on line %d
! 52: bool(false)
! 53: ===DONE===
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>