2 * Copyright 2000, OpenLDAP Foundation, All Rights Reserved.
3 * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
10 #include "LDAPBindRequest.h"
11 #include "LDAPException.h"
13 LDAPBindRequest::LDAPBindRequest(const LDAPBindRequest& req) :
15 DEBUG(LDAP_DEBUG_TRACE,
16 "LDAPBindRequest::LDAPBindRequest(LDAPBindRequest&)" << endl);
19 LDAPBindRequest::LDAPBindRequest(const char *dn, const char *passwd,
20 const LDAPAsynConnection *connect, const LDAPConstraints *cons,
21 bool isReferral=false) : LDAPRequest(connect, cons, isReferral){
22 DEBUG(LDAP_DEBUG_TRACE,"LDAPBindRequest::LDAPBindRequest()" << endl);
23 DEBUG(LDAP_DEBUG_PARAMETER, " dn:" << dn << endl
24 << " passwd:" << passwd << endl);
26 m_cred = ber_bvstr(passwd);
27 m_mech = LDAP_SASL_SIMPLE;
30 LDAPBindRequest::~LDAPBindRequest(){
31 DEBUG(LDAP_DEBUG_TRACE,"LDAPBindRequest::~LDAPBindRequest()" << endl);
37 LDAPMessageQueue* LDAPBindRequest::sendRequest(){
38 DEBUG(LDAP_DEBUG_TRACE,"LDAPBindRequest::sendRequest()" << endl);
40 int err=ldap_sasl_bind(m_connection->getSessionHandle(),m_dn,
41 m_mech, m_cred, m_cons->getSrvCtrlsArray(),
42 m_cons->getClCtrlsArray(),&msgID);
43 if(err != LDAP_SUCCESS){
45 throw LDAPException(err);
48 return new LDAPMessageQueue(this);
52 LDAPRequest* LDAPBindRequest::followReferral(LDAPUrlList *urls){
53 DEBUG(LDAP_DEBUG_TRACE,"LDAPBindRequest::followReferral()" << endl);