Lines Matching refs:ld

38 static int simple_bind_nolock( LDAP *ld, const char *dn, const char *passwd,
40 static int simple_bindifnot_s( LDAP *ld, const char *dn, const char *passwd );
54 ldap_simple_bind( LDAP *ld, const char *dn, const char *passwd ) in ldap_simple_bind() argument
60 if ( !NSLDAPI_VALID_LDAP_POINTER( ld )) { in ldap_simple_bind()
64 rc = simple_bind_nolock( ld, dn, passwd, 1 ); in ldap_simple_bind()
71 simple_bind_nolock( LDAP *ld, const char *dn, const char *passwd, in simple_bind_nolock() argument
89 LDAP_MUTEX_LOCK( ld, LDAP_MSGID_LOCK ); in simple_bind_nolock()
90 msgid = ++ld->ld_msgid; in simple_bind_nolock()
91 LDAP_MUTEX_UNLOCK( ld, LDAP_MSGID_LOCK ); in simple_bind_nolock()
98 if ( ld->ld_cache_on && ld->ld_cache_bind != NULL ) { in simple_bind_nolock()
104 LDAP_MUTEX_LOCK( ld, LDAP_CACHE_LOCK ); in simple_bind_nolock()
105 rc = (ld->ld_cache_bind)( ld, msgid, LDAP_REQ_BIND, dn, &bv, in simple_bind_nolock()
107 LDAP_MUTEX_UNLOCK( ld, LDAP_CACHE_LOCK ); in simple_bind_nolock()
115 if (( rc = nsldapi_alloc_ber_with_options( ld, &ber )) in simple_bind_nolock()
122 NSLDAPI_LDAP_VERSION( ld ), dn, LDAP_AUTH_SIMPLE, passwd ) == -1 ) { in simple_bind_nolock()
123 LDAP_SET_LDERRNO( ld, LDAP_ENCODING_ERROR, NULL, NULL ); in simple_bind_nolock()
128 if ( nsldapi_put_controls( ld, NULL, 1, ber ) != LDAP_SUCCESS ) { in simple_bind_nolock()
134 return( nsldapi_send_initial_request( ld, msgid, LDAP_REQ_BIND, in simple_bind_nolock()
151 ldap_simple_bind_s( LDAP *ld, const char *dn, const char *passwd ) in ldap_simple_bind_s() argument
158 if ( NSLDAPI_VALID_LDAP_POINTER( ld ) && in ldap_simple_bind_s()
159 ( ld->ld_options & LDAP_BITOPT_RECONNECT ) != 0 ) { in ldap_simple_bind_s()
160 return( simple_bindifnot_s( ld, dn, passwd )); in ldap_simple_bind_s()
163 if ( (msgid = ldap_simple_bind( ld, dn, passwd )) == -1 ) in ldap_simple_bind_s()
164 return( LDAP_GET_LDERRNO( ld, NULL, NULL ) ); in ldap_simple_bind_s()
166 if ( ldap_result( ld, msgid, 1, (struct timeval *) 0, &result ) == -1 ) in ldap_simple_bind_s()
167 return( LDAP_GET_LDERRNO( ld, NULL, NULL ) ); in ldap_simple_bind_s()
169 return( ldap_result2error( ld, result, 1 ) ); in ldap_simple_bind_s()
180 simple_bindifnot_s( LDAP *ld, const char *dn, const char *passwd ) in simple_bindifnot_s() argument
188 if ( !NSLDAPI_VALID_LDAP_POINTER( ld )) { in simple_bindifnot_s()
199 if ( NULL != ( binddn = nsldapi_get_binddn( ld )) in simple_bindifnot_s()
202 LDAP_SET_LDERRNO( ld, rc, NULL, NULL ); in simple_bindifnot_s()
214 LDAP_MUTEX_LOCK( ld, LDAP_CONN_LOCK ); in simple_bindifnot_s()
215 if ( NULL != ld->ld_defconn ) { in simple_bindifnot_s()
216 if ( LDAP_CONNST_DEAD == ld->ld_defconn->lconn_status ) { in simple_bindifnot_s()
217 nsldapi_free_connection( ld, ld->ld_defconn, NULL, NULL, 1, 0 ); in simple_bindifnot_s()
218 ld->ld_defconn = NULL; in simple_bindifnot_s()
219 } else if ( ld->ld_defconn->lconn_binddn != NULL ) { in simple_bindifnot_s()
220 NSLDAPI_FREE( ld->ld_defconn->lconn_binddn ); in simple_bindifnot_s()
221 ld->ld_defconn->lconn_binddn = NULL; in simple_bindifnot_s()
222 ld->ld_defconn->lconn_bound = 0; in simple_bindifnot_s()
225 LDAP_MUTEX_UNLOCK( ld, LDAP_CONN_LOCK ); in simple_bindifnot_s()
234 LDAP_MUTEX_LOCK( ld, LDAP_RESULT_LOCK ); in simple_bindifnot_s()
235 if ( (msgid = simple_bind_nolock( ld, dn, passwd, 0 )) == -1 ) { in simple_bindifnot_s()
236 rc = LDAP_GET_LDERRNO( ld, NULL, NULL ); in simple_bindifnot_s()
251 if ( nsldapi_result_nolock( ld, msgid, 1, 0, (struct timeval *) 0, in simple_bindifnot_s()
253 rc = LDAP_GET_LDERRNO( ld, NULL, NULL ); in simple_bindifnot_s()
257 rc = ldap_result2error( ld, result, 1 ); in simple_bindifnot_s()
260 LDAP_MUTEX_UNLOCK( ld, LDAP_RESULT_LOCK ); in simple_bindifnot_s()