3 * Copyright 2000-2015 The OpenLDAP Foundation, All Rights Reserved.
4 * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
11 #include "LDAPDeleteRequest.h"
12 #include "LDAPException.h"
13 #include "LDAPMessageQueue.h"
14 #include "LDAPResult.h"
18 LDAPDeleteRequest::LDAPDeleteRequest( const LDAPDeleteRequest& req) :
20 DEBUG(LDAP_DEBUG_CONSTRUCT,
21 "LDAPDeleteRequest::LDAPDeleteRequest(&)" << endl);
25 LDAPDeleteRequest::LDAPDeleteRequest(const string& dn,
26 LDAPAsynConnection *connect, const LDAPConstraints *cons,
27 bool isReferral, const LDAPRequest* parent)
28 : LDAPRequest(connect, cons, isReferral, parent) {
29 DEBUG(LDAP_DEBUG_CONSTRUCT,
30 "LDAPDeleteRequest::LDAPDeleteRequest()" << endl);
31 DEBUG(LDAP_DEBUG_CONSTRUCT | LDAP_DEBUG_PARAMETER, " dn:" << dn << endl);
32 m_requestType=LDAPRequest::DELETE;
36 LDAPDeleteRequest::~LDAPDeleteRequest(){
37 DEBUG(LDAP_DEBUG_DESTROY,
38 "LDAPDeleteRequest::~LDAPDeleteRequest()" << endl);
41 LDAPMessageQueue* LDAPDeleteRequest::sendRequest(){
42 DEBUG(LDAP_DEBUG_TRACE, "LDAPDeleteRequest::sendRequest()" << endl);
44 LDAPControl** tmpSrvCtrls=m_cons->getSrvCtrlsArray();
45 LDAPControl** tmpClCtrls=m_cons->getClCtrlsArray();
46 int err=ldap_delete_ext(m_connection->getSessionHandle(),m_dn.c_str(),
47 tmpSrvCtrls, tmpClCtrls ,&msgID);
48 LDAPControlSet::freeLDAPControlArray(tmpSrvCtrls);
49 LDAPControlSet::freeLDAPControlArray(tmpClCtrls);
50 if(err != LDAP_SUCCESS){
51 throw LDAPException(err);
54 return new LDAPMessageQueue(this);
58 LDAPRequest* LDAPDeleteRequest::followReferral(LDAPMsg* refs){
59 DEBUG(LDAP_DEBUG_TRACE, "LDAPDeleteRequest::followReferral()" << endl);
60 LDAPUrlList::const_iterator usedUrl;
61 LDAPUrlList urls= ((LDAPResult*)refs)->getReferralUrls();
62 LDAPAsynConnection* con=0;
64 con = getConnection()->referralConnect(urls,usedUrl,m_cons);
65 }catch (LDAPException e){
70 return new LDAPDeleteRequest(m_dn, con, m_cons, true, this);