sub openLDAPConnection ( ) { my ( $host, $port, $binddn, $password ) = @_; my ( $ld ); # Initialize LDAP Connection if (($ld = ldap_init($host,$port)) == -1 ) { return -1; } # Bind as $binddn, $password on the LDAP connection if ( ldap_simple_bind_s($ld,$binddn,$password) != LDAP_SUCCESS) { return -1; } return $ld; } # end of openLDAPConnection