2 * Copyright 1998-1999 The OpenLDAP Foundation, All Rights Reserved.
3 * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
6 * Copyright (c) 1993 Regents of the University of Michigan.
13 * BindRequest ::= SEQUENCE {
15 * name DistinguishedName, -- who
16 * authentication CHOICE {
17 * simple [0] OCTET STRING -- passwd
19 * krbv42ldap [1] OCTET STRING
20 * krbv42dsa [2] OCTET STRING
22 * sasl [3] SaslCredentials -- LDAPv3
26 * BindResponse ::= SEQUENCE {
27 * COMPONENTS OF LDAPResult,
28 * serverSaslCreds OCTET STRING OPTIONAL -- LDAPv3
37 #include <ac/socket.h>
38 #include <ac/string.h>
45 * ldap_simple_bind - bind to the ldap server (and X.500). The dn and
46 * password of the entry to which to bind are supplied. The message id
47 * of the request initiated is returned.
50 * ldap_simple_bind( ld, "cn=manager, o=university of michigan, c=us",
58 LDAP_CONST char *passwd )
64 Debug( LDAP_DEBUG_TRACE, "ldap_simple_bind\n", 0, 0, 0 );
67 assert( LDAP_VALID( ld ) );
69 if ( passwd != NULL ) {
70 cred.bv_val = (char *) passwd;
71 cred.bv_len = strlen( passwd );
77 rc = ldap_sasl_bind( ld, dn, LDAP_SASL_SIMPLE, &cred,
80 return rc == LDAP_SUCCESS ? msgid : -1;
84 * ldap_simple_bind - bind to the ldap server (and X.500) using simple
85 * authentication. The dn and password of the entry to which to bind are
86 * supplied. LDAP_SUCCESS is returned upon success, the ldap error code
90 * ldap_simple_bind_s( ld, "cn=manager, o=university of michigan, c=us",
95 ldap_simple_bind_s( LDAP *ld, LDAP_CONST char *dn, LDAP_CONST char *passwd )
99 Debug( LDAP_DEBUG_TRACE, "ldap_simple_bind_s\n", 0, 0, 0 );
101 if ( passwd != NULL ) {
102 cred.bv_val = (char *) passwd;
103 cred.bv_len = strlen( passwd );
109 return ldap_sasl_bind_s( ld, dn, LDAP_SASL_SIMPLE, &cred,