# Method Protocols.LDAP.client()->bind()

Method bind

  `int bind()`
  `int bind(string dn, string password)`
  `int bind(string dn, string password, int version)`

Description

  Authenticates connection to the direcory.

  First form uses default value previously entered in create.

  Second form uses value from parameters:

Parameter `dn`

  The distinguished name (DN) of an entry aginst which will be made authentication.

Parameter `password`

  Password used for authentication.

  Third form allows specify the version of LDAP protocol used by connection to the LDAP server.

Parameter `version`

  The desired protocol version (current `2` or `3`). Defaults to `3` if zero or left out.

Returns

  Returns `1` on success, `0` otherwise.

Note

  Only simple authentication type is implemented. So be warned clear text passwords are sent to the directory server.

Note

  The API change: the returning code was changed in Pike 7.3+ to follow his logic better.