Back to index

php5  5.3.10
Functions | Variables
connect.inc File Reference

Go to the source code of this file.

Functions

 ldap_connect_and_bind ($host, $port, $user, $passwd, $protocol_version)
 insert_dummy_data ($link)
 remove_dummy_data ($link)

Variables

 $host = "localhost"
 $port = getenv("LDAP_TEST_PORT") ? getenv("LDAP_TEST_PORT") : 389
 $user = "cn=Manager,dc=my-domain,dc=com"
 $sasl_user = "Manager"
 $passwd = "secret"
 $protocol_version = getenv("LDAP_TEST_OPT_PROTOCOL_VERSION") ? getenv("LDAP_TEST_OPT_PROTOCOL_VERSION") : 3
 $skip_on_bind_failure = getenv("LDAP_TEST_SKIP_BIND_FAILURE") ? getenv("LDAP_TEST_SKIP_BIND_FAILURE") : true

Function Documentation

insert_dummy_data ( link)

Definition at line 23 of file connect.inc.

                                  {
       ldap_add($link, "dc=my-domain,dc=com", array(
               "objectClass"   => array(
                       "top",
                       "dcObject",
                       "organization"),
               "dc"                    => "my-domain",
               "o"                             => "my-domain",
       ));
       ldap_add($link, "cn=userA,dc=my-domain,dc=com", array(
               "objectclass" => "person",
               "cn" => "userA",
               "sn" => "testSN1",
               "userPassword" => "oops",
               "telephoneNumber" => "xx-xx-xx-xx-xx",
               "description" => "user A",
       ));
       ldap_add($link, "cn=userB,dc=my-domain,dc=com", array(
               "objectclass" => "person",
               "cn" => "userB",
               "sn" => "testSN2",
               "userPassword" => "oopsIDitItAgain",
               "description" => "user B",
       ));
       ldap_add($link, "cn=userC,cn=userB,dc=my-domain,dc=com", array(
               "objectclass" => "person",
               "cn" => "userC",
               "sn" => "testSN3",
               "userPassword" => "0r1g1na1 passw0rd",
       ));
}
ldap_connect_and_bind ( host,
port,
user,
passwd,
protocol_version 
)

Definition at line 16 of file connect.inc.

                                                                                {
       $link = ldap_connect($host, $port);
       ldap_set_option($link, LDAP_OPT_PROTOCOL_VERSION, $protocol_version);
       ldap_bind($link, $user, $passwd);
       return $link;
}
remove_dummy_data ( link)

Definition at line 55 of file connect.inc.

                                  {
       ldap_delete($link, "cn=userC,cn=userB,dc=my-domain,dc=com");
       ldap_delete($link, "cn=userA,dc=my-domain,dc=com");
       ldap_delete($link, "cn=userB,dc=my-domain,dc=com");
       ldap_delete($link, "dc=my-domain,dc=com");
}

Variable Documentation

$host = "localhost"

Definition at line 8 of file connect.inc.

$passwd = "secret"

Definition at line 12 of file connect.inc.

$port = getenv("LDAP_TEST_PORT") ? getenv("LDAP_TEST_PORT") : 389

Definition at line 9 of file connect.inc.

$protocol_version = getenv("LDAP_TEST_OPT_PROTOCOL_VERSION") ? getenv("LDAP_TEST_OPT_PROTOCOL_VERSION") : 3

Definition at line 13 of file connect.inc.

$sasl_user = "Manager"

Definition at line 11 of file connect.inc.

$skip_on_bind_failure = getenv("LDAP_TEST_SKIP_BIND_FAILURE") ? getenv("LDAP_TEST_SKIP_BIND_FAILURE") : true

Definition at line 14 of file connect.inc.

$user = "cn=Manager,dc=my-domain,dc=com"

Definition at line 10 of file connect.inc.