Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • openldap/openldap
  • hyc/openldap
  • ryan/openldap
  • iboukris/openldap
  • ondra/openldap
  • sshanks-kx/openldap
  • blaggacao/openldap
  • pbrezina/openldap
  • quanah/openldap
  • dragos_h/openldap
  • lorenz/openldap
  • tsaarni/openldap
  • fei.ding/openldap
  • orent/openldap
  • arrowplum/openldap
  • barchiesi/openldap
  • jotik/openldap
  • hamano/openldap
  • ingovoss/openldap
  • henson/openldap
  • jlrine2/openldap
  • howeverAT/openldap
  • nivanova/openldap
  • orbea/openldap
  • rdubner/openldap
  • smckinney/openldap
  • jklowden/openldap
  • dpa-openldap/openldap
  • rouzier/openldap
  • orgads/openldap
  • ffontaine/openldap
  • jiaqingz/openldap
  • dcoutadeur/openldap
  • begeragus/openldap
  • pubellit/openldap
  • glandium/openldap
  • facboy/openldap
  • thesamesam/openldap
  • Johan/openldap
  • fkooman/openldap
  • gburd/openldap
  • h-homma/openldap
  • sgallagher/openldap
  • ahmed_zaki/openldap
  • gnoe/openldap
  • mid/openldap
  • clan/openldap
47 results
Show changes
Showing
with 2768 additions and 0 deletions
// $OpenLDAP$
/*
* Copyright 2000-2012 The OpenLDAP Foundation, All Rights Reserved.
* COPYING RESTRICTIONS APPLY, see COPYRIGHT file
*/
#ifndef LDAP_SEARCH_REQUEST_H
#define LDAP_SEARCH_REQUEST_H
#include <queue>
#include <LDAPRequest.h>
class LDAPSearchReference;
class LDAPReferral;
class LDAPUrl;
class LDAPSearchRequest : public LDAPRequest{
public :
LDAPSearchRequest(const LDAPSearchRequest& req);
LDAPSearchRequest(const std::string& base, int scope, const std::string& filter,
const StringList& attrs, bool attrsOnly,
LDAPAsynConnection *connect,
const LDAPConstraints* cons, bool isReferral=false,
const LDAPRequest* parent=0);
virtual ~LDAPSearchRequest();
virtual LDAPMessageQueue* sendRequest();
virtual LDAPRequest* followReferral(LDAPMsg* ref);
virtual bool equals(const LDAPRequest* req) const;
private :
std::string m_base;
int m_scope;
std::string m_filter;
StringList m_attrs;
bool m_attrsOnly;
//no default constructor
LDAPSearchRequest(){};
};
#endif //LDAP_SEARCH_REQUEST_H
// $OpenLDAP$
/*
* Copyright 2000-2012 The OpenLDAP Foundation, All Rights Reserved.
* COPYING RESTRICTIONS APPLY, see COPYRIGHT file
*/
#include <iostream>
#include "debug.h"
#include "LDAPSearchResult.h"
#include "LDAPRequest.h"
using namespace std;
LDAPSearchResult::LDAPSearchResult(const LDAPRequest *req,
LDAPMessage *msg) : LDAPMsg(msg){
DEBUG(LDAP_DEBUG_CONSTRUCT,
"LDAPSearchResult::LDAPSearchResult()" << endl);
entry = new LDAPEntry(req->getConnection(), msg);
//retrieve the controls here
LDAPControl** srvctrls=0;
int err = ldap_get_entry_controls(req->getConnection()->getSessionHandle(),
msg,&srvctrls);
if(err != LDAP_SUCCESS){
ldap_controls_free(srvctrls);
}else{
if (srvctrls){
m_srvControls = LDAPControlSet(srvctrls);
m_hasControls = true;
ldap_controls_free(srvctrls);
}else{
m_hasControls = false;
}
}
}
LDAPSearchResult::LDAPSearchResult(const LDAPSearchResult& res) :
LDAPMsg(res){
entry = new LDAPEntry(*(res.entry));
}
LDAPSearchResult::~LDAPSearchResult(){
DEBUG(LDAP_DEBUG_DESTROY,"LDAPSearchResult::~LDAPSearchResult()" << endl);
delete entry;
}
const LDAPEntry* LDAPSearchResult::getEntry() const{
DEBUG(LDAP_DEBUG_TRACE,"LDAPSearchResult::getEntry()" << endl);
return entry;
}
// $OpenLDAP$
/*
* Copyright 2000-2012 The OpenLDAP Foundation, All Rights Reserved.
* COPYING RESTRICTIONS APPLY, see COPYRIGHT file
*/
#ifndef LDAP_SEARCH_RESULT_H
#define LDAP_SEARCH_RESULT_H
#include <LDAPMessage.h>
#include <LDAPEntry.h>
class LDAPRequest;
/**
* This class is used to represent the result entries of a
* SEARCH-operation.
*/
class LDAPSearchResult : public LDAPMsg{
public:
/**
* Constructor that create an object from the C-API structures
*/
LDAPSearchResult(const LDAPRequest *req, LDAPMessage *msg);
/**
* Copy-Constructor
*/
LDAPSearchResult(const LDAPSearchResult& res);
/**
* The Destructor
*/
virtual ~LDAPSearchResult();
/**
* @returns The entry that has been sent with this result message.
*/
const LDAPEntry* getEntry() const;
private:
LDAPEntry *entry;
};
#endif //LDAP_SEARCH_RESULT_H
// $OpenLDAP$
/*
* Copyright 2000-2012 The OpenLDAP Foundation, All Rights Reserved.
* COPYING RESTRICTIONS APPLY, see COPYRIGHT file
*/
#include "LDAPException.h"
#include "LDAPSearchResult.h"
#include "LDAPResult.h"
#include "LDAPSearchResults.h"
LDAPSearchResults::LDAPSearchResults(){
entryPos = entryList.begin();
refPos = refList.begin();
}
LDAPResult* LDAPSearchResults::readMessageQueue(LDAPMessageQueue* msg){
if(msg != 0){
LDAPMsg* res=0;
for(;;){
try{
res = msg->getNext();
}catch (LDAPException e){
throw;
}
switch(res->getMessageType()){
case LDAPMsg::SEARCH_ENTRY :
entryList.addEntry(*((LDAPSearchResult*)res)->getEntry());
break;
case LDAPMsg::SEARCH_REFERENCE :
refList.addReference(*((LDAPSearchReference*)res));
break;
default:
entryPos=entryList.begin();
refPos=refList.begin();
return ((LDAPResult*) res);
}
delete res;
res=0;
}
}
return 0;
}
LDAPEntry* LDAPSearchResults::getNext(){
if( entryPos != entryList.end() ){
LDAPEntry* ret= new LDAPEntry(*entryPos);
entryPos++;
return ret;
}
if( refPos != refList.end() ){
LDAPUrlList urls= refPos->getUrls();
refPos++;
throw(LDAPReferralException(urls));
}
return 0;
}
// $OpenLDAP$
/*
* Copyright 2000-2012 The OpenLDAP Foundation, All Rights Reserved.
* COPYING RESTRICTIONS APPLY, see COPYRIGHT file
*/
#ifndef LDAP_SEARCH_RESULTS_H
#define LDAP_SEARCH_RESULTS_H
#include <LDAPEntry.h>
#include <LDAPEntryList.h>
#include <LDAPMessage.h>
#include <LDAPMessageQueue.h>
#include <LDAPReferenceList.h>
#include <LDAPSearchReference.h>
class LDAPResult;
/**
* The class stores the results of a synchronous SEARCH-Operation
*/
class LDAPSearchResults{
public:
/**
* Default-Constructor
*/
LDAPSearchResults();
/**
* For internal use only.
*
* This method reads Search result entries from a
* LDAPMessageQueue-object.
* @param msg The message queue to read
*/
LDAPResult* readMessageQueue(LDAPMessageQueue* msg);
/**
* The method is used by the client-application to read the
* result entries of the SEARCH-Operation. Every call of this
* method returns one entry. If all entries were read it return 0.
* @throws LDAPReferralException If a Search Reference was
* returned by the server
* @returns A LDAPEntry-object as a result of a SEARCH-Operation or
* 0 if no more entries are there to return.
*/
LDAPEntry* getNext();
private :
LDAPEntryList entryList;
LDAPReferenceList refList;
LDAPEntryList::const_iterator entryPos;
LDAPReferenceList::const_iterator refPos;
};
#endif //LDAP_SEARCH_RESULTS_H
// $OpenLDAP$
/*
* Copyright 2000-2012 The OpenLDAP Foundation, All Rights Reserved.
* COPYING RESTRICTIONS APPLY, see COPYRIGHT file
*/
#include "LDAPUrl.h"
#include <sstream>
#include <iomanip>
#include "debug.h"
using namespace std;
#define PCT_ENCFLAG_NONE 0x0000U
#define PCT_ENCFLAG_COMMA 0x0001U
#define PCT_ENCFLAG_SLASH 0x0002U
#define LDAP_DEFAULT_PORT 389
#define LDAPS_DEFAULT_PORT 636
LDAPUrl::LDAPUrl(const std::string &url)
{
DEBUG(LDAP_DEBUG_CONSTRUCT, "LDAPUrl::LDAPUrl()" << endl);
DEBUG(LDAP_DEBUG_CONSTRUCT | LDAP_DEBUG_PARAMETER,
" url:" << url << endl);
m_urlString = url;
m_Filter = "";
m_Scheme = "ldap";
m_Scope = 0;
m_Port = 0;
regenerate = false;
if (url != "") {
this->parseUrl();
}
}
LDAPUrl::~LDAPUrl()
{
DEBUG(LDAP_DEBUG_DESTROY, "LDAPUrl::~LDAPUrl()" << endl);
m_Attrs.clear();
}
int LDAPUrl::getPort() const
{
return m_Port;
}
void LDAPUrl::setPort(int port)
{
m_Port = port;
regenerate = true;
}
int LDAPUrl::getScope() const
{
return m_Scope;
}
void LDAPUrl::setScope( const std::string &scope )
{
if (scope == "base" || scope == "" ) {
m_Scope = 0;
} else if (scope == "one" ) {
m_Scope = 1;
} else if (scope == "sub" ) {
m_Scope = 2;
} else {
throw LDAPUrlException(LDAPUrlException::INVALID_SCOPE,
"Scope was:" + scope);
}
regenerate = true;
}
const string& LDAPUrl::getURLString() const
{
if (regenerate){
this->components2Url();
regenerate=false;
}
return m_urlString;
}
void LDAPUrl::setURLString( const std::string &url )
{
m_urlString = url;
if (url != "") {
this->parseUrl();
}
regenerate = false;
}
const string& LDAPUrl::getHost() const
{
return m_Host;
}
void LDAPUrl::setHost( const std::string &host )
{
m_Host = host;
regenerate = true;
}
const string& LDAPUrl::getDN() const
{
return m_DN;
}
void LDAPUrl::setDN( const std::string &dn )
{
m_DN = dn;
regenerate = true;
}
const string& LDAPUrl::getFilter() const
{
return m_Filter;
}
void LDAPUrl::setFilter( const std::string &filter )
{
m_Filter = filter;
regenerate = true;
}
const StringList& LDAPUrl::getAttrs() const
{
return m_Attrs;
}
void LDAPUrl::setAttrs( const StringList &attrs )
{
m_Attrs = attrs;
regenerate = true;
}
const StringList& LDAPUrl::getExtensions() const
{
return m_Extensions;
}
void LDAPUrl::setExtensions( const StringList &ext )
{
m_Extensions = ext;
regenerate = true;
}
const std::string& LDAPUrl::getScheme() const
{
return m_Scheme;
}
void LDAPUrl::setScheme( const std::string &scheme )
{
if (scheme == "ldap" || scheme == "ldaps" ||
scheme == "ldapi" || scheme == "cldap" )
{
m_Scheme = scheme;
regenerate = true;
} else {
throw LDAPUrlException(LDAPUrlException::INVALID_SCHEME,
"Unknown URL scheme: \"" + scheme + "\"");
}
}
void LDAPUrl::parseUrl()
{
DEBUG(LDAP_DEBUG_TRACE, "LDAPUrl::parseUrl()" << std::endl);
// reading Scheme
std::string::size_type pos = m_urlString.find(':');
std::string::size_type startpos = pos;
if (pos == std::string::npos) {
throw LDAPUrlException(LDAPUrlException::INVALID_URL,
"No colon found in URL");
}
std::string scheme = m_urlString.substr(0, pos);
DEBUG(LDAP_DEBUG_TRACE, " scheme is <" << scheme << ">" << std::endl);
if ( scheme == "ldap" ) {
m_Scheme = scheme;
} else if ( scheme == "ldaps" ) {
m_Scheme = scheme;
} else if ( scheme == "ldapi" ) {
m_Scheme = scheme;
} else if ( scheme == "cldap" ) {
m_Scheme = scheme;
} else {
throw LDAPUrlException(LDAPUrlException::INVALID_SCHEME,
"Unknown URL Scheme: \"" + scheme + "\"");
}
if ( m_urlString[pos+1] != '/' || m_urlString[pos+2] != '/' ) {
throw LDAPUrlException(LDAPUrlException::INVALID_URL);
} else {
startpos = pos + 3;
}
if ( m_urlString[startpos] == '/' ) {
// no hostname and port
startpos++;
} else {
std::string::size_type hostend, portstart=0;
pos = m_urlString.find('/', startpos);
// IPv6 Address?
if ( m_urlString[startpos] == '[' ) {
// skip
startpos++;
hostend = m_urlString.find(']', startpos);
if ( hostend == std::string::npos ){
throw LDAPUrlException(LDAPUrlException::INVALID_URL);
}
portstart = hostend + 1;
} else {
hostend = m_urlString.find(':', startpos);
if ( hostend == std::string::npos || portstart > pos ) {
hostend = pos;
}
portstart = hostend;
}
std::string host = m_urlString.substr(startpos, hostend - startpos);
DEBUG(LDAP_DEBUG_TRACE, " host: <" << host << ">" << std::endl);
percentDecode(host, m_Host);
if (portstart >= m_urlString.length() || portstart >= pos ) {
if ( m_Scheme == "ldap" || m_Scheme == "cldap" ) {
m_Port = LDAP_DEFAULT_PORT;
} else if ( m_Scheme == "ldaps" ) {
m_Port = LDAPS_DEFAULT_PORT;
}
} else {
std::string port = m_urlString.substr(portstart+1,
(pos == std::string::npos ? pos : pos-portstart-1) );
if ( port.length() > 0 ) {
std::istringstream i(port);
i >> m_Port;
if ( i.fail() ){
throw LDAPUrlException(LDAPUrlException::INVALID_PORT);
}
}
DEBUG(LDAP_DEBUG_TRACE, " Port: <" << m_Port << ">"
<< std::endl);
}
startpos = pos + 1;
}
int parserMode = base;
while ( pos != std::string::npos ) {
pos = m_urlString.find('?', startpos);
std::string actComponent = m_urlString.substr(startpos,
pos - startpos);
DEBUG(LDAP_DEBUG_TRACE, " ParserMode:" << parserMode << std::endl);
DEBUG(LDAP_DEBUG_TRACE, " ActComponent: <" << actComponent << ">"
<< std::endl);
std::string s_scope = "";
std::string s_ext = "";
switch(parserMode) {
case base :
percentDecode(actComponent, m_DN);
DEBUG(LDAP_DEBUG_TRACE, " BaseDN:" << m_DN << std::endl);
break;
case attrs :
DEBUG(LDAP_DEBUG_TRACE, " reading Attributes" << std::endl);
if (actComponent.length() != 0 ) {
string2list(actComponent,m_Attrs, true);
}
break;
case scope :
percentDecode(actComponent, s_scope);
if (s_scope == "base" || s_scope == "" ) {
m_Scope = 0;
} else if (s_scope == "one" ) {
m_Scope = 1;
} else if (s_scope == "sub" ) {
m_Scope = 2;
} else {
throw LDAPUrlException(LDAPUrlException::INVALID_SCOPE);
}
DEBUG(LDAP_DEBUG_TRACE, " Scope: <" << s_scope << ">"
<< std::endl);
break;
case filter :
percentDecode(actComponent, m_Filter);
DEBUG(LDAP_DEBUG_TRACE, " filter: <" << m_Filter << ">"
<< std::endl);
break;
case extensions :
DEBUG(LDAP_DEBUG_TRACE, " reading Extensions" << std::endl);
string2list(actComponent, m_Extensions, true);
break;
default :
DEBUG(LDAP_DEBUG_TRACE, " unknown state" << std::endl);
break;
}
startpos = pos + 1;
parserMode++;
}
}
void LDAPUrl::percentDecode(const std::string& src, std::string &out)
{
DEBUG(LDAP_DEBUG_TRACE, "LDAPUrl::percentDecode()" << std::endl);
std::string::size_type pos = 0;
std::string::size_type startpos = 0;
pos = src.find('%', startpos);
while ( pos != std::string::npos ) {
out += src.substr(startpos, pos - startpos);
std::string istr(src.substr(pos+1, 2));
std::istringstream i(istr);
i.setf(std::ios::hex, std::ios::basefield);
i.unsetf(std::ios::showbase);
int hex;
i >> hex;
if ( i.fail() ){
throw LDAPUrlException(LDAPUrlException::URL_DECODING_ERROR,
"Invalid percent encoding");
}
char j = hex;
out.push_back(j);
startpos = pos+3;
pos = src.find('%', startpos);
}
out += src.substr(startpos, pos - startpos);
}
void LDAPUrl::string2list(const std::string &src, StringList& sl,
bool percentDecode)
{
std::string::size_type comma_startpos = 0;
std::string::size_type comma_pos = 0;
std::string actItem;
while ( comma_pos != std::string::npos ) {
comma_pos = src.find(',', comma_startpos);
actItem = src.substr(comma_startpos, comma_pos - comma_startpos);
if (percentDecode){
std::string decoded;
this->percentDecode(actItem,decoded);
actItem = decoded;
}
sl.add(actItem);
comma_startpos = comma_pos + 1;
}
}
void LDAPUrl::components2Url() const
{
std::ostringstream url;
std::string encoded = "";
url << m_Scheme << "://";
// IPv6 ?
if ( m_Host.find( ':', 0 ) != std::string::npos ) {
url << "[" << this->percentEncode(m_Host, encoded) << "]";
} else {
url << this->percentEncode(m_Host, encoded, PCT_ENCFLAG_SLASH);
}
if ( m_Port != 0 ) {
url << ":" << m_Port;
}
url << "/";
encoded = "";
if ( m_DN != "" ) {
this->percentEncode( m_DN, encoded );
url << encoded;
}
string qm = "";
if ( ! m_Attrs.empty() ){
url << "?";
bool first = true;
for ( StringList::const_iterator i = m_Attrs.begin();
i != m_Attrs.end(); i++)
{
this->percentEncode( *i, encoded );
if ( ! first ) {
url << ",";
} else {
first = false;
}
url << encoded;
}
} else {
qm.append("?");
}
if ( m_Scope == 1 ) {
url << qm << "?one";
qm = "";
} else if ( m_Scope == 2 ) {
url << qm << "?sub";
qm = "";
} else {
qm.append("?");
}
if (m_Filter != "" ){
this->percentEncode( m_Filter, encoded );
url << qm << "?" << encoded;
qm = "";
} else {
qm.append("?");
}
if ( ! m_Extensions.empty() ){
url << qm << "?";
bool first = true;
for ( StringList::const_iterator i = m_Extensions.begin();
i != m_Extensions.end(); i++)
{
this->percentEncode( *i, encoded, 1);
if ( ! first ) {
url << ",";
} else {
first = false;
}
url << encoded;
}
}
m_urlString=url.str();
}
std::string& LDAPUrl::percentEncode( const std::string &src,
std::string &dest,
int flags) const
{
std::ostringstream o;
o.setf(std::ios::hex, std::ios::basefield);
o.setf(std::ios::uppercase);
o.unsetf(std::ios::showbase);
bool escape=false;
for ( std::string::const_iterator i = src.begin(); i != src.end(); i++ ){
switch(*i){
/* reserved */
case '?' :
escape = true;
break;
case ',' :
if ( flags & PCT_ENCFLAG_COMMA ) {
escape = true;
} else {
escape = false;
}
break;
case ':' :
case '/' :
if ( flags & PCT_ENCFLAG_SLASH ) {
escape = true;
} else {
escape = false;
}
break;
case '#' :
case '[' :
case ']' :
case '@' :
case '!' :
case '$' :
case '&' :
case '\'' :
case '(' :
case ')' :
case '*' :
case '+' :
case ';' :
case '=' :
/* unreserved */
case '-' :
case '.' :
case '_' :
case '~' :
escape = false;
break;
default :
if ( std::isalnum(*i) ) {
escape = false;
} else {
escape = true;
}
break;
}
if ( escape ) {
o << "%" << std::setw(2) << std::setfill('0') << (int)(unsigned char)*i ;
} else {
o.put(*i);
}
}
dest = o.str();
return dest;
}
const code2string_s LDAPUrlException::code2string[] = {
{ INVALID_SCHEME, "Invalid URL Scheme" },
{ INVALID_PORT, "Invalid Port in Url" },
{ INVALID_SCOPE, "Invalid Search Scope in Url" },
{ INVALID_URL, "Invalid LDAP Url" },
{ URL_DECODING_ERROR, "Url-decoding Error" },
{ 0, 0 }
};
LDAPUrlException::LDAPUrlException( int code, const std::string &msg) :
m_code(code), m_addMsg(msg) {}
int LDAPUrlException::getCode() const
{
return m_code;
}
const std::string LDAPUrlException::getAdditionalInfo() const
{
return m_addMsg;
}
const std::string LDAPUrlException::getErrorMessage() const
{
for ( int i = 0; code2string[i].string != 0; i++ ) {
if ( code2string[i].code == m_code ) {
return std::string(code2string[i].string);
}
}
return "";
}
// $OpenLDAP$
/*
* Copyright 2000-2012 The OpenLDAP Foundation, All Rights Reserved.
* COPYING RESTRICTIONS APPLY, see COPYRIGHT file
*/
#ifndef LDAP_URL_H
#define LDAP_URL_H
#include <StringList.h>
class LDAPUrlException;
/**
* This class is used to analyze and store LDAP-Urls as returned by a
* LDAP-Server as Referrals and Search References. LDAP-URLs are defined
* in RFC1959 and have the following format: <BR>
* <code>
* ldap://host:port/baseDN[?attr[?scope[?filter]]] <BR>
* </code>
*/
class LDAPUrl{
public :
/**
* Create a new object from a string that contains a LDAP-Url
* @param url The URL String
*/
LDAPUrl(const std::string &url="");
/**
* Destructor
*/
~LDAPUrl();
/**
* @return The part of the URL that is representing the network
* port
*/
int getPort() const;
/**
* Set the port value of the URL
* @param dn The port value
*/
void setPort(int port);
/**
* @return The scope part of the URL is returned.
*/
int getScope() const;
/**
* Set the Scope part of the URL
* @param scope The new scope
*/
void setScope(const std::string& scope);
/**
* @return The complete URL as a string
*/
const std::string& getURLString() const;
/**
* Set the URL member attribute
* @param url The URL String
*/
void setURLString(const std::string &url);
/**
* @return The hostname or IP-Address of the destination host.
*/
const std::string& getHost() const;
/**
* Set the Host part of the URL
* @param host The new host part
*/
void setHost( const std::string &host);
/**
* @return The Protocol Scheme of the URL.
*/
const std::string& getScheme() const;
/**
* Set the Protocol Scheme of the URL
* @param host The Protcol scheme. Allowed values are
* ldap,ldapi,ldaps and cldap
*/
void setScheme( const std::string &scheme );
/**
* @return The Base-DN part of the URL
*/
const std::string& getDN() const;
/**
* Set the DN part of the URL
* @param dn The new DN part
*/
void setDN( const std::string &dn);
/**
* @return The Filter part of the URL
*/
const std::string& getFilter() const;
/**
* Set the Filter part of the URL
* @param filter The new Filter
*/
void setFilter( const std::string &filter);
/**
* @return The List of attributes that was in the URL
*/
const StringList& getAttrs() const;
/**
* Set the Attributes part of the URL
* @param attrs StringList constaining the List of Attributes
*/
void setAttrs( const StringList &attrs);
void setExtensions( const StringList &ext);
const StringList& getExtensions() const;
/**
* Percent-decode a string
* @param src The string that is to be decoded
* @param dest The decoded result string
*/
void percentDecode( const std::string& src, std::string& dest );
/**
* Percent-encoded a string
* @param src The string that is to be encoded
* @param dest The encoded result string
* @param flags
*/
std::string& percentEncode( const std::string& src,
std::string& dest,
int flags=0 ) const;
protected :
/**
* Split the url string that is associated with this Object into
* it components. The compontens of the URL can be access via the
* get...() methods.
* (this function is mostly for internal use and gets called
* automatically whenever necessary)
*/
void parseUrl();
/**
* Generate an URL string from the components that were set with
* the various set...() methods
* (this function is mostly for internal use and gets called
* automatically whenever necessary)
*/
void components2Url() const;
void string2list(const std::string &src, StringList& sl,
bool percentDecode=false);
protected :
mutable bool regenerate;
int m_Port;
int m_Scope;
std::string m_Host;
std::string m_DN;
std::string m_Filter;
StringList m_Attrs;
StringList m_Extensions;
mutable std::string m_urlString;
std::string m_Scheme;
enum mode { base, attrs, scope, filter, extensions };
};
/// @cond
struct code2string_s {
int code;
const char* string;
};
/// @endcond
class LDAPUrlException {
public :
LDAPUrlException(int code, const std::string &msg="" );
int getCode() const;
const std::string getErrorMessage() const;
const std::string getAdditionalInfo() const;
static const int INVALID_SCHEME = 1;
static const int INVALID_PORT = 2;
static const int INVALID_SCOPE = 3;
static const int INVALID_URL = 4;
static const int URL_DECODING_ERROR = 5;
static const code2string_s code2string[];
private:
int m_code;
std::string m_addMsg;
};
#endif //LDAP_URL_H
// $OpenLDAP$
/*
* Copyright 2000-2012 The OpenLDAP Foundation, All Rights Reserved.
* COPYING RESTRICTIONS APPLY, see COPYRIGHT file
*/
#include "LDAPUrlList.h"
#include <assert.h>
#include "debug.h"
using namespace std;
LDAPUrlList::LDAPUrlList(){
DEBUG(LDAP_DEBUG_CONSTRUCT," LDAPUrlList::LDAPUrlList()" << endl);
m_urls=LDAPUrlList::ListType();
}
LDAPUrlList::LDAPUrlList(const LDAPUrlList& urls){
DEBUG(LDAP_DEBUG_CONSTRUCT," LDAPUrlList::LDAPUrlList(&)" << endl);
m_urls = urls.m_urls;
}
LDAPUrlList::LDAPUrlList(char** url){
DEBUG(LDAP_DEBUG_CONSTRUCT," LDAPUrlList::LDAPUrlList()" << endl);
char** i;
assert(url);
for(i = url; *i != 0; i++){
add(LDAPUrl(*i));
}
}
LDAPUrlList::~LDAPUrlList(){
DEBUG(LDAP_DEBUG_DESTROY," LDAPUrlList::~LDAPUrlList()" << endl);
m_urls.clear();
}
size_t LDAPUrlList::size() const{
return m_urls.size();
}
bool LDAPUrlList::empty() const{
return m_urls.empty();
}
LDAPUrlList::const_iterator LDAPUrlList::begin() const{
return m_urls.begin();
}
LDAPUrlList::const_iterator LDAPUrlList::end() const{
return m_urls.end();
}
void LDAPUrlList::add(const LDAPUrl& url){
m_urls.push_back(url);
}
// $OpenLDAP$
/*
* Copyright 2000-2012 The OpenLDAP Foundation, All Rights Reserved.
* COPYING RESTRICTIONS APPLY, see COPYRIGHT file
*/
#ifndef LDAP_URL_LIST_H
#define LDAP_URL_LIST_H
#include <list>
#include <LDAPUrl.h>
/**
* This container class is used to store multiple LDAPUrl-objects.
*/
class LDAPUrlList{
typedef std::list<LDAPUrl> ListType;
public:
typedef ListType::const_iterator const_iterator;
/**
* Constructs an empty list.
*/
LDAPUrlList();
/**
* Copy-constructor
*/
LDAPUrlList(const LDAPUrlList& urls);
/**
* For internal use only
*
* This constructor is used by the library internally to create a
* std::list of URLs from a array of C-strings that was return by
* the C-API
*/
LDAPUrlList(char** urls);
/**
* Destructor
*/
~LDAPUrlList();
/**
* @return The number of LDAPUrl-objects that are currently
* stored in this list.
*/
size_t size() const;
/**
* @return true if there are zero LDAPUrl-objects currently
* stored in this list.
*/
bool empty() const;
/**
* @return A iterator that points to the first element of the list.
*/
const_iterator begin() const;
/**
* @return A iterator that points to the element after the last
* element of the list.
*/
const_iterator end() const;
/**
* Adds one element to the end of the list.
* @param attr The attribute to add to the list.
*/
void add(const LDAPUrl& url);
private :
ListType m_urls;
};
#endif //LDAP_URL_LIST_H
// $OpenLDAP$
/*
* Copyright 2008-2012 The OpenLDAP Foundation, All Rights Reserved.
* COPYING RESTRICTIONS APPLY, see COPYRIGHT file
*/
#include "LdifReader.h"
#include "LDAPMessage.h"
#include "LDAPEntry.h"
#include "LDAPAttributeList.h"
#include "LDAPAttribute.h"
#include "LDAPUrl.h"
#include "debug.h"
#include <string>
#include <sstream>
#include <stdexcept>
#include <sasl/saslutil.h> // For base64 routines
typedef std::pair<std::string, std::string> stringpair;
LdifReader::LdifReader( std::istream &input )
: m_ldifstream(input), m_lineNumber(0)
{
DEBUG(LDAP_DEBUG_TRACE, "<> LdifReader::LdifReader()" << std::endl);
this->m_version = 0;
// read the first record to find out version and type of the LDIF
this->readNextRecord(true);
this->m_currentIsFirst = true;
}
int LdifReader::readNextRecord( bool first )
{
DEBUG(LDAP_DEBUG_TRACE, "-> LdifReader::readRecord()" << std::endl);
std::string line;
std::string type;
std::string value;
int numLine = 0;
int recordType = 0;
if ( (! first) && this->m_currentIsFirst == true )
{
this->m_currentIsFirst = false;
return m_curRecType;
}
m_currentRecord.clear();
while ( !this->getLdifLine(line) )
{
DEBUG(LDAP_DEBUG_TRACE, " Line: " << line << std::endl );
// skip comments and empty lines between entries
if ( line[0] == '#' || ( numLine == 0 && line.size() == 0 ) )
{
DEBUG(LDAP_DEBUG_TRACE, "skipping empty line or comment" << std::endl );
continue;
}
if ( line.size() == 0 )
{
// End of Entry
break;
}
this->splitLine(line, type, value);
if ( numLine == 0 )
{
if ( type == "version" )
{
std::istringstream valuestream(value);
valuestream >> this->m_version;
if ( this->m_version != 1 ) // there is no other Version than LDIFv1
{
std::ostringstream err;
err << "Line " << this->m_lineNumber
<< ": Unsuported LDIF Version";
throw( std::runtime_error(err.str()) );
}
continue;
}
if ( type == "dn" ) // Record should start with the DN ...
{
DEBUG(LDAP_DEBUG_TRACE, " Record DN:" << value << std::endl);
}
else if ( type == "include" ) // ... or it might be an "include" line
{
DEBUG(LDAP_DEBUG_TRACE, " Include directive: " << value << std::endl);
if ( this->m_version == 1 )
{
std::ostringstream err;
err << "Line " << this->m_lineNumber
<< ": \"include\" not allowed in LDIF version 1.";
throw( std::runtime_error(err.str()) );
}
else
{
std::ostringstream err;
err << "Line " << this->m_lineNumber
<< ": \"include\" not yet suppported.";
throw( std::runtime_error(err.str()) );
}
}
else
{
DEBUG(LDAP_DEBUG_TRACE, " Record doesn't start with a DN"
<< std::endl);
std::ostringstream err;
err << "Line " << this->m_lineNumber
<< ": LDIF record does not start with a DN.";
throw( std::runtime_error(err.str()) );
}
}
if ( numLine == 1 ) // might contain "changtype" to indicate a change request
{
if ( type == "changetype" )
{
if ( first )
{
this->m_ldifTypeRequest = true;
}
else if (! this->m_ldifTypeRequest )
{
// Change Request in Entry record LDIF, should we accept it?
std::ostringstream err;
err << "Line " << this->m_lineNumber
<< ": Change Request in an entry-only LDIF.";
throw( std::runtime_error(err.str()) );
}
if ( value == "modify" )
{
recordType = LDAPMsg::MODIFY_REQUEST;
}
else if ( value == "add" )
{
recordType = LDAPMsg::ADD_REQUEST;
}
else if ( value == "delete" )
{
recordType = LDAPMsg::DELETE_REQUEST;
}
else if ( value == "modrdn" )
{
recordType = LDAPMsg::MODRDN_REQUEST;
}
else
{
DEBUG(LDAP_DEBUG_TRACE, " Unknown change request <"
<< value << ">" << std::endl);
std::ostringstream err;
err << "Line " << this->m_lineNumber
<< ": Unknown changetype: \"" << value << "\".";
throw( std::runtime_error(err.str()) );
}
}
else
{
if ( first )
{
this->m_ldifTypeRequest = false;
}
else if (this->m_ldifTypeRequest )
{
// Entry record in Change record LDIF, should we accept
// it (e.g. as AddRequest)?
}
recordType = LDAPMsg::SEARCH_ENTRY;
}
}
m_currentRecord.push_back( stringpair(type, value) );
numLine++;
}
DEBUG(LDAP_DEBUG_TRACE, "<- LdifReader::readRecord() return: "
<< recordType << std::endl);
m_curRecType = recordType;
return recordType;
}
LDAPEntry LdifReader::getEntryRecord()
{
std::list<stringpair>::const_iterator i = m_currentRecord.begin();
if ( m_curRecType != LDAPMsg::SEARCH_ENTRY )
{
throw( std::runtime_error( "The LDIF record: '" + i->second +
"' is not a valid LDAP Entry" ));
}
LDAPEntry resEntry(i->second);
i++;
LDAPAttribute curAttr(i->first);
LDAPAttributeList *curAl = new LDAPAttributeList();
for ( ; i != m_currentRecord.end(); i++ )
{
if ( i->first == curAttr.getName() )
{
curAttr.addValue(i->second);
}
else
{
const LDAPAttribute* existing = curAl->getAttributeByName( i->first );
if ( existing )
{
// Attribute exists already (handle gracefully)
curAl->addAttribute( curAttr );
curAttr = LDAPAttribute( *existing );
curAttr.addValue(i->second);
curAl->delAttribute( i->first );
}
else
{
curAl->addAttribute( curAttr );
curAttr = LDAPAttribute( i->first, i->second );
}
}
}
curAl->addAttribute( curAttr );
resEntry.setAttributes( curAl );
return resEntry;
}
int LdifReader::getLdifLine(std::string &ldifline)
{
DEBUG(LDAP_DEBUG_TRACE, "-> LdifReader::getLdifLine()" << std::endl);
this->m_lineNumber++;
if ( ! getline(m_ldifstream, ldifline) )
{
return -1;
}
while ( m_ldifstream &&
(m_ldifstream.peek() == ' ' || m_ldifstream.peek() == '\t'))
{
std::string cat;
m_ldifstream.ignore();
getline(m_ldifstream, cat);
ldifline += cat;
this->m_lineNumber++;
}
DEBUG(LDAP_DEBUG_TRACE, "<- LdifReader::getLdifLine()" << std::endl);
return 0;
}
void LdifReader::splitLine(
const std::string& line,
std::string &type,
std::string &value) const
{
std::string::size_type pos = line.find(':');
if ( pos == std::string::npos )
{
DEBUG(LDAP_DEBUG_ANY, "Invalid LDIF line. No `:` separator"
<< std::endl );
std::ostringstream err;
err << "Line " << this->m_lineNumber << ": Invalid LDIF line. No `:` separator";
throw( std::runtime_error( err.str() ));
}
type = line.substr(0, pos);
if ( pos == line.size() )
{
// empty value
value = "";
return;
}
pos++;
char delim = line[pos];
if ( delim == ':' || delim == '<' )
{
pos++;
}
for( ; pos < line.size() && isspace(line[pos]); pos++ )
{ /* empty */ }
value = line.substr(pos);
if ( delim == ':' )
{
// Base64 encoded value
DEBUG(LDAP_DEBUG_TRACE, " base64 encoded value" << std::endl );
char outbuf[value.size()];
int rc = sasl_decode64(value.c_str(), value.size(),
outbuf, value.size(), NULL);
if( rc == SASL_OK )
{
value = std::string(outbuf);
}
else if ( rc == SASL_BADPROT )
{
value = "";
DEBUG( LDAP_DEBUG_TRACE, " invalid base64 content" << std::endl );
std::ostringstream err;
err << "Line " << this->m_lineNumber << ": Can't decode Base64 data";
throw( std::runtime_error( err.str() ));
}
else if ( rc == SASL_BUFOVER )
{
value = "";
DEBUG( LDAP_DEBUG_TRACE, " not enough space in output buffer"
<< std::endl );
std::ostringstream err;
err << "Line " << this->m_lineNumber
<< ": Can't decode Base64 data. Buffer too small";
throw( std::runtime_error( err.str() ));
}
}
else if ( delim == '<' )
{
// URL value
DEBUG(LDAP_DEBUG_TRACE, " url value" << std::endl );
std::ostringstream err;
err << "Line " << this->m_lineNumber
<< ": URLs are currently not supported";
throw( std::runtime_error( err.str() ));
}
else
{
// "normal" value
DEBUG(LDAP_DEBUG_TRACE, " string value" << std::endl );
}
DEBUG(LDAP_DEBUG_TRACE, " Type: <" << type << ">" << std::endl );
DEBUG(LDAP_DEBUG_TRACE, " Value: <" << value << ">" << std::endl );
return;
}
std::string LdifReader::readIncludeLine( const std::string& line ) const
{
std::string::size_type pos = sizeof("file:") - 1;
std::string scheme = line.substr( 0, pos );
std::string file;
// only file:// URLs supported currently
if ( scheme != "file:" )
{
DEBUG( LDAP_DEBUG_TRACE, "unsupported scheme: " << scheme
<< std::endl);
}
else if ( line[pos] == '/' )
{
if ( line[pos+1] == '/' )
{
pos += 2;
}
file = line.substr(pos, std::string::npos);
DEBUG( LDAP_DEBUG_TRACE, "target file: " << file << std::endl);
}
return file;
}
// $OpenLDAP$
/*
* Copyright 2008-2012 The OpenLDAP Foundation, All Rights Reserved.
* COPYING RESTRICTIONS APPLY, see COPYRIGHT file
*/
#ifndef LDIF_READER_H
#define LDIF_READER_H
#include <LDAPEntry.h>
#include <iosfwd>
#include <list>
typedef std::list< std::pair<std::string, std::string> > LdifRecord;
class LdifReader
{
public:
LdifReader( std::istream &input );
inline bool isEntryRecords() const
{
return !m_ldifTypeRequest;
}
inline bool isChangeRecords() const
{
return m_ldifTypeRequest;
}
inline int getVersion() const
{
return m_version;
}
LDAPEntry getEntryRecord();
int readNextRecord( bool first=false );
//LDAPRequest getChangeRecord();
private:
int getLdifLine(std::string &line);
void splitLine(const std::string& line,
std::string &type,
std::string &value ) const;
std::string readIncludeLine( const std::string &line) const;
std::istream &m_ldifstream;
LdifRecord m_currentRecord;
int m_version;
int m_curRecType;
int m_lineNumber;
bool m_ldifTypeRequest;
bool m_currentIsFirst;
};
#endif /* LDIF_READER_H */
// $OpenLDAP$
/*
* Copyright 2008-2012 The OpenLDAP Foundation, All Rights Reserved.
* COPYING RESTRICTIONS APPLY, see COPYRIGHT file
*/
#include "LdifWriter.h"
#include "StringList.h"
#include "LDAPAttribute.h"
#include "debug.h"
#include <sstream>
#include <stdexcept>
LdifWriter::LdifWriter( std::ostream& output, int version ) :
m_ldifstream(output), m_version(version), m_addSeparator(false)
{
if ( version )
{
if ( version == 1 )
{
m_ldifstream << "version: " << version << std::endl;
m_addSeparator = true;
} else {
std::ostringstream err;
err << "Unsuported LDIF Version";
throw( std::runtime_error(err.str()) );
}
}
}
void LdifWriter::writeRecord(const LDAPEntry& le)
{
std::ostringstream line;
if ( m_addSeparator )
{
m_ldifstream << std::endl;
} else {
m_addSeparator = true;
}
line << "dn: " << le.getDN();
this->breakline( line.str(), m_ldifstream );
const LDAPAttributeList *al = le.getAttributes();
LDAPAttributeList::const_iterator i = al->begin();
for ( ; i != al->end(); i++ )
{
StringList values = i->getValues();
StringList::const_iterator j = values.begin();
for( ; j != values.end(); j++)
{
// clear output stream
line.str("");
line << i->getName() << ": " << *j;
this->breakline( line.str(), m_ldifstream );
}
}
}
void LdifWriter::writeIncludeRecord( const std::string& target )
{
DEBUG(LDAP_DEBUG_TRACE, "writeIncludeRecord: " << target << std::endl);
std::string scheme = target.substr( 0, sizeof("file:")-1 );
if ( m_version == 1 )
{
std::ostringstream err;
err << "\"include\" not allowed in LDIF version 1.";
throw( std::runtime_error(err.str()) );
}
if ( m_addSeparator )
{
m_ldifstream << std::endl;
} else {
m_addSeparator = true;
}
m_ldifstream << "include: ";
if ( scheme != "file:" )
{
m_ldifstream << "file://";
}
m_ldifstream << target << std::endl;
}
void LdifWriter::breakline( const std::string &line, std::ostream &out )
{
std::string::size_type pos = 0;
std::string::size_type linelength = 76;
bool first = true;
if ( line.length() >= linelength )
{
while ( pos < line.length() )
{
if (! first )
{
out << " ";
}
out << line.substr(pos, linelength) << std::endl;
pos += linelength;
if ( first )
{
first = false;
linelength--; //account for the leading space
}
}
} else {
out << line << std::endl;
}
}
// $OpenLDAP$
/*
* Copyright 2008-2012 The OpenLDAP Foundation, All Rights Reserved.
* COPYING RESTRICTIONS APPLY, see COPYRIGHT file
*/
#ifndef LDIF_WRITER_H
#define LDIF_WRITER_H
#include <LDAPEntry.h>
#include <iosfwd>
#include <list>
class LdifWriter
{
public:
LdifWriter( std::ostream& output, int version = 0 );
void writeRecord(const LDAPEntry& le);
void writeIncludeRecord(const std::string& target);
private:
void breakline( const std::string &line, std::ostream &out );
std::ostream& m_ldifstream;
int m_version;
bool m_addSeparator;
};
#endif /* LDIF_WRITER_H */
# $OpenLDAP$
###
# Copyright 2000-2012 The OpenLDAP Foundation, All Rights Reserved.
# COPYING RESTRICTIONS APPLY, see COPYRIGHT file
##
lib_LTLIBRARIES = libldapcpp.la
libldapcpp_la_SOURCES = LDAPAddRequest.cpp \
LDAPAsynConnection.cpp \
LDAPAttribute.cpp \
LDAPAttributeList.cpp \
LDAPAttrType.cpp \
LDAPBindRequest.cpp \
LDAPCompareRequest.cpp \
LDAPConnection.cpp \
LDAPConstraints.cpp \
LDAPControl.cpp \
LDAPControlSet.cpp \
LDAPDeleteRequest.cpp \
LDAPEntry.cpp \
LDAPEntryList.cpp \
LDAPException.cpp \
LDAPExtRequest.cpp \
LDAPExtResult.cpp \
LDAPMessage.cpp \
LDAPMessageQueue.cpp \
LDAPModDNRequest.cpp \
LDAPModification.cpp \
LDAPModifyRequest.cpp \
LDAPModList.cpp \
LDAPObjClass.cpp \
LDAPRebind.cpp \
LDAPRebindAuth.cpp \
LDAPReferenceList.cpp \
LDAPRequest.cpp \
LDAPResult.cpp \
LDAPSaslBindResult.cpp \
LDAPSchema.cpp \
LDAPSearchReference.cpp \
LDAPSearchRequest.cpp \
LDAPSearchResult.cpp \
LDAPSearchResults.cpp \
LDAPUrl.cpp \
LDAPUrlList.cpp \
LdifReader.cpp \
LdifWriter.cpp \
SaslInteraction.cpp \
SaslInteractionHandler.cpp \
StringList.cpp \
TlsOptions.cpp
include_HEADERS = LDAPAsynConnection.h \
LDAPAttribute.h \
LDAPAttributeList.h \
LDAPAttrType.h \
LDAPConnection.h \
LDAPConstraints.h \
LDAPControl.h \
LDAPControlSet.h \
LDAPEntry.h \
LDAPEntryList.h \
LDAPException.h \
LDAPExtResult.h \
LDAPMessage.h \
LDAPMessageQueue.h \
LDAPModification.h \
LDAPModList.h \
LDAPObjClass.h \
LDAPRebind.h \
LDAPRebindAuth.h \
LDAPReferenceList.h \
LDAPResult.h \
LDAPSaslBindResult.h \
LDAPSchema.h \
LDAPSearchReference.h \
LDAPSearchResult.h \
LDAPSearchResults.h \
LDAPUrl.h \
LDAPUrlList.h \
LdifReader.h \
LdifWriter.h \
SaslInteraction.h \
SaslInteractionHandler.h \
StringList.h \
TlsOptions.h
noinst_HEADERS = ac/time.h \
debug.h \
LDAPAddRequest.h \
LDAPBindRequest.h \
LDAPCompareRequest.h \
LDAPDeleteRequest.h \
LDAPExtRequest.h \
LDAPModDNRequest.h \
LDAPModifyRequest.h \
LDAPRequest.h \
LDAPSearchRequest.h
libldapcpp_la_LIBADD = -lldap -llber
libldapcpp_la_LDFLAGS = -version-info @OPENLDAP_CPP_API_VERSION@
# Makefile.in generated by automake 1.11 from Makefile.am.
# @configure_input@
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
# 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation,
# Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE.
@SET_MAKE@
# $OpenLDAP$
###
# Copyright 2000-2012 The OpenLDAP Foundation, All Rights Reserved.
# COPYING RESTRICTIONS APPLY, see COPYRIGHT file
VPATH = @srcdir@
pkgdatadir = $(datadir)/@PACKAGE@
pkgincludedir = $(includedir)/@PACKAGE@
pkglibdir = $(libdir)/@PACKAGE@
pkglibexecdir = $(libexecdir)/@PACKAGE@
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
install_sh_DATA = $(install_sh) -c -m 644
install_sh_PROGRAM = $(install_sh) -c
install_sh_SCRIPT = $(install_sh) -c
INSTALL_HEADER = $(INSTALL_DATA)
transform = $(program_transform_name)
NORMAL_INSTALL = :
PRE_INSTALL = :
POST_INSTALL = :
NORMAL_UNINSTALL = :
PRE_UNINSTALL = :
POST_UNINSTALL = :
build_triplet = @build@
host_triplet = @host@
subdir = src
DIST_COMMON = $(include_HEADERS) $(noinst_HEADERS) \
$(srcdir)/Makefile.am $(srcdir)/Makefile.in \
$(srcdir)/config.h.in
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/configure.in
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
mkinstalldirs = $(install_sh) -d
CONFIG_HEADER = config.h
CONFIG_CLEAN_FILES =
CONFIG_CLEAN_VPATH_FILES =
am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
am__vpath_adj = case $$p in \
$(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
*) f=$$p;; \
esac;
am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`;
am__install_max = 40
am__nobase_strip_setup = \
srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'`
am__nobase_strip = \
for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||"
am__nobase_list = $(am__nobase_strip_setup); \
for p in $$list; do echo "$$p $$p"; done | \
sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \
$(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \
if (++n[$$2] == $(am__install_max)) \
{ print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \
END { for (dir in files) print dir, files[dir] }'
am__base_list = \
sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \
sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g'
am__installdirs = "$(DESTDIR)$(libdir)" "$(DESTDIR)$(includedir)"
LTLIBRARIES = $(lib_LTLIBRARIES)
libldapcpp_la_DEPENDENCIES =
am_libldapcpp_la_OBJECTS = LDAPAddRequest.lo LDAPAsynConnection.lo \
LDAPAttribute.lo LDAPAttributeList.lo LDAPAttrType.lo \
LDAPBindRequest.lo LDAPCompareRequest.lo LDAPConnection.lo \
LDAPConstraints.lo LDAPControl.lo LDAPControlSet.lo \
LDAPDeleteRequest.lo LDAPEntry.lo LDAPEntryList.lo \
LDAPException.lo LDAPExtRequest.lo LDAPExtResult.lo \
LDAPMessage.lo LDAPMessageQueue.lo LDAPModDNRequest.lo \
LDAPModification.lo LDAPModifyRequest.lo LDAPModList.lo \
LDAPObjClass.lo LDAPRebind.lo LDAPRebindAuth.lo \
LDAPReferenceList.lo LDAPRequest.lo LDAPResult.lo \
LDAPSaslBindResult.lo LDAPSchema.lo LDAPSearchReference.lo \
LDAPSearchRequest.lo LDAPSearchResult.lo LDAPSearchResults.lo \
LDAPUrl.lo LDAPUrlList.lo LdifReader.lo LdifWriter.lo \
SaslInteraction.lo SaslInteractionHandler.lo StringList.lo \
TlsOptions.lo
libldapcpp_la_OBJECTS = $(am_libldapcpp_la_OBJECTS)
libldapcpp_la_LINK = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) \
$(LIBTOOLFLAGS) --mode=link $(CXXLD) $(AM_CXXFLAGS) \
$(CXXFLAGS) $(libldapcpp_la_LDFLAGS) $(LDFLAGS) -o $@
DEFAULT_INCLUDES = -I.@am__isrc@
depcomp = $(SHELL) $(top_srcdir)/depcomp
am__depfiles_maybe = depfiles
am__mv = mv -f
CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
$(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS)
LTCXXCOMPILE = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
--mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
$(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS)
CXXLD = $(CXX)
CXXLINK = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
--mode=link $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(AM_LDFLAGS) \
$(LDFLAGS) -o $@
SOURCES = $(libldapcpp_la_SOURCES)
DIST_SOURCES = $(libldapcpp_la_SOURCES)
HEADERS = $(include_HEADERS) $(noinst_HEADERS)
ETAGS = etags
CTAGS = ctags
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
ACLOCAL = @ACLOCAL@
AMTAR = @AMTAR@
AR = @AR@
AUTOCONF = @AUTOCONF@
AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@
AWK = @AWK@
CC = @CC@
CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
CXX = @CXX@
CXXCPP = @CXXCPP@
CXXDEPMODE = @CXXDEPMODE@
CXXFLAGS = @CXXFLAGS@
CYGPATH_W = @CYGPATH_W@
DEFS = @DEFS@
DEPDIR = @DEPDIR@
DSYMUTIL = @DSYMUTIL@
DUMPBIN = @DUMPBIN@
ECHO_C = @ECHO_C@
ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
EGREP = @EGREP@
EXEEXT = @EXEEXT@
FGREP = @FGREP@
GREP = @GREP@
INSTALL = @INSTALL@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
LD = @LD@
LDFLAGS = @LDFLAGS@
LIBOBJS = @LIBOBJS@
LIBS = @LIBS@
LIBTOOL = @LIBTOOL@
LIPO = @LIPO@
LN_S = @LN_S@
LTLIBOBJS = @LTLIBOBJS@
MAKEINFO = @MAKEINFO@
MKDIR_P = @MKDIR_P@
NM = @NM@
NMEDIT = @NMEDIT@
OBJDUMP = @OBJDUMP@
OBJEXT = @OBJEXT@
OPENLDAP_CPP_API_VERSION = @OPENLDAP_CPP_API_VERSION@
OTOOL = @OTOOL@
OTOOL64 = @OTOOL64@
PACKAGE = @PACKAGE@
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
PACKAGE_NAME = @PACKAGE_NAME@
PACKAGE_STRING = @PACKAGE_STRING@
PACKAGE_TARNAME = @PACKAGE_TARNAME@
PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
RANLIB = @RANLIB@
SED = @SED@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
STRIP = @STRIP@
VERSION = @VERSION@
abs_builddir = @abs_builddir@
abs_srcdir = @abs_srcdir@
abs_top_builddir = @abs_top_builddir@
abs_top_srcdir = @abs_top_srcdir@
ac_ct_CC = @ac_ct_CC@
ac_ct_CXX = @ac_ct_CXX@
ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
am__include = @am__include@
am__leading_dot = @am__leading_dot@
am__quote = @am__quote@
am__tar = @am__tar@
am__untar = @am__untar@
bindir = @bindir@
build = @build@
build_alias = @build_alias@
build_cpu = @build_cpu@
build_os = @build_os@
build_vendor = @build_vendor@
builddir = @builddir@
datadir = @datadir@
datarootdir = @datarootdir@
docdir = @docdir@
dvidir = @dvidir@
exec_prefix = @exec_prefix@
host = @host@
host_alias = @host_alias@
host_cpu = @host_cpu@
host_os = @host_os@
host_vendor = @host_vendor@
htmldir = @htmldir@
includedir = @includedir@
infodir = @infodir@
install_sh = @install_sh@
libdir = @libdir@
libexecdir = @libexecdir@
localedir = @localedir@
localstatedir = @localstatedir@
lt_ECHO = @lt_ECHO@
mandir = @mandir@
mkdir_p = @mkdir_p@
oldincludedir = @oldincludedir@
pdfdir = @pdfdir@
prefix = @prefix@
program_transform_name = @program_transform_name@
psdir = @psdir@
sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
srcdir = @srcdir@
sysconfdir = @sysconfdir@
target_alias = @target_alias@
top_build_prefix = @top_build_prefix@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
lib_LTLIBRARIES = libldapcpp.la
libldapcpp_la_SOURCES = LDAPAddRequest.cpp \
LDAPAsynConnection.cpp \
LDAPAttribute.cpp \
LDAPAttributeList.cpp \
LDAPAttrType.cpp \
LDAPBindRequest.cpp \
LDAPCompareRequest.cpp \
LDAPConnection.cpp \
LDAPConstraints.cpp \
LDAPControl.cpp \
LDAPControlSet.cpp \
LDAPDeleteRequest.cpp \
LDAPEntry.cpp \
LDAPEntryList.cpp \
LDAPException.cpp \
LDAPExtRequest.cpp \
LDAPExtResult.cpp \
LDAPMessage.cpp \
LDAPMessageQueue.cpp \
LDAPModDNRequest.cpp \
LDAPModification.cpp \
LDAPModifyRequest.cpp \
LDAPModList.cpp \
LDAPObjClass.cpp \
LDAPRebind.cpp \
LDAPRebindAuth.cpp \
LDAPReferenceList.cpp \
LDAPRequest.cpp \
LDAPResult.cpp \
LDAPSaslBindResult.cpp \
LDAPSchema.cpp \
LDAPSearchReference.cpp \
LDAPSearchRequest.cpp \
LDAPSearchResult.cpp \
LDAPSearchResults.cpp \
LDAPUrl.cpp \
LDAPUrlList.cpp \
LdifReader.cpp \
LdifWriter.cpp \
SaslInteraction.cpp \
SaslInteractionHandler.cpp \
StringList.cpp \
TlsOptions.cpp
include_HEADERS = LDAPAsynConnection.h \
LDAPAttribute.h \
LDAPAttributeList.h \
LDAPAttrType.h \
LDAPConnection.h \
LDAPConstraints.h \
LDAPControl.h \
LDAPControlSet.h \
LDAPEntry.h \
LDAPEntryList.h \
LDAPException.h \
LDAPExtResult.h \
LDAPMessage.h \
LDAPMessageQueue.h \
LDAPModification.h \
LDAPModList.h \
LDAPObjClass.h \
LDAPRebind.h \
LDAPRebindAuth.h \
LDAPReferenceList.h \
LDAPResult.h \
LDAPSaslBindResult.h \
LDAPSchema.h \
LDAPSearchReference.h \
LDAPSearchResult.h \
LDAPSearchResults.h \
LDAPUrl.h \
LDAPUrlList.h \
LdifReader.h \
LdifWriter.h \
SaslInteraction.h \
SaslInteractionHandler.h \
StringList.h \
TlsOptions.h
noinst_HEADERS = ac/time.h \
debug.h \
LDAPAddRequest.h \
LDAPBindRequest.h \
LDAPCompareRequest.h \
LDAPDeleteRequest.h \
LDAPExtRequest.h \
LDAPModDNRequest.h \
LDAPModifyRequest.h \
LDAPRequest.h \
LDAPSearchRequest.h
libldapcpp_la_LIBADD = -lldap -llber
libldapcpp_la_LDFLAGS = -version-info @OPENLDAP_CPP_API_VERSION@
all: config.h
$(MAKE) $(AM_MAKEFLAGS) all-am
.SUFFIXES:
.SUFFIXES: .cpp .lo .o .obj
$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
@for dep in $?; do \
case '$(am__configure_deps)' in \
*$$dep*) \
( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
&& { if test -f $@; then exit 0; else break; fi; }; \
exit 1;; \
esac; \
done; \
echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign src/Makefile'; \
$(am__cd) $(top_srcdir) && \
$(AUTOMAKE) --foreign src/Makefile
.PRECIOUS: Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
@case '$?' in \
*config.status*) \
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
*) \
echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
esac;
$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(top_srcdir)/configure: $(am__configure_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(ACLOCAL_M4): $(am__aclocal_m4_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(am__aclocal_m4_deps):
config.h: stamp-h1
@if test ! -f $@; then \
rm -f stamp-h1; \
$(MAKE) $(AM_MAKEFLAGS) stamp-h1; \
else :; fi
stamp-h1: $(srcdir)/config.h.in $(top_builddir)/config.status
@rm -f stamp-h1
cd $(top_builddir) && $(SHELL) ./config.status src/config.h
$(srcdir)/config.h.in: $(am__configure_deps)
($(am__cd) $(top_srcdir) && $(AUTOHEADER))
rm -f stamp-h1
touch $@
distclean-hdr:
-rm -f config.h stamp-h1
install-libLTLIBRARIES: $(lib_LTLIBRARIES)
@$(NORMAL_INSTALL)
test -z "$(libdir)" || $(MKDIR_P) "$(DESTDIR)$(libdir)"
@list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \
list2=; for p in $$list; do \
if test -f $$p; then \
list2="$$list2 $$p"; \
else :; fi; \
done; \
test -z "$$list2" || { \
echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(libdir)'"; \
$(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(libdir)"; \
}
uninstall-libLTLIBRARIES:
@$(NORMAL_UNINSTALL)
@list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \
for p in $$list; do \
$(am__strip_dir) \
echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(libdir)/$$f'"; \
$(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(libdir)/$$f"; \
done
clean-libLTLIBRARIES:
-test -z "$(lib_LTLIBRARIES)" || rm -f $(lib_LTLIBRARIES)
@list='$(lib_LTLIBRARIES)'; for p in $$list; do \
dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \
test "$$dir" != "$$p" || dir=.; \
echo "rm -f \"$${dir}/so_locations\""; \
rm -f "$${dir}/so_locations"; \
done
libldapcpp.la: $(libldapcpp_la_OBJECTS) $(libldapcpp_la_DEPENDENCIES)
$(libldapcpp_la_LINK) -rpath $(libdir) $(libldapcpp_la_OBJECTS) $(libldapcpp_la_LIBADD) $(LIBS)
mostlyclean-compile:
-rm -f *.$(OBJEXT)
distclean-compile:
-rm -f *.tab.c
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/LDAPAddRequest.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/LDAPAsynConnection.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/LDAPAttrType.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/LDAPAttribute.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/LDAPAttributeList.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/LDAPBindRequest.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/LDAPCompareRequest.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/LDAPConnection.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/LDAPConstraints.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/LDAPControl.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/LDAPControlSet.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/LDAPDeleteRequest.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/LDAPEntry.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/LDAPEntryList.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/LDAPException.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/LDAPExtRequest.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/LDAPExtResult.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/LDAPMessage.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/LDAPMessageQueue.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/LDAPModDNRequest.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/LDAPModList.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/LDAPModification.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/LDAPModifyRequest.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/LDAPObjClass.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/LDAPRebind.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/LDAPRebindAuth.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/LDAPReferenceList.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/LDAPRequest.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/LDAPResult.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/LDAPSaslBindResult.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/LDAPSchema.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/LDAPSearchReference.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/LDAPSearchRequest.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/LDAPSearchResult.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/LDAPSearchResults.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/LDAPUrl.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/LDAPUrlList.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/LdifReader.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/LdifWriter.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/SaslInteraction.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/SaslInteractionHandler.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/StringList.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/TlsOptions.Plo@am__quote@
.cpp.o:
@am__fastdepCXX_TRUE@ $(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ $<
.cpp.obj:
@am__fastdepCXX_TRUE@ $(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
.cpp.lo:
@am__fastdepCXX_TRUE@ $(LTCXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCXX_FALSE@ $(LTCXXCOMPILE) -c -o $@ $<
mostlyclean-libtool:
-rm -f *.lo
clean-libtool:
-rm -rf .libs _libs
install-includeHEADERS: $(include_HEADERS)
@$(NORMAL_INSTALL)
test -z "$(includedir)" || $(MKDIR_P) "$(DESTDIR)$(includedir)"
@list='$(include_HEADERS)'; test -n "$(includedir)" || list=; \
for p in $$list; do \
if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
echo "$$d$$p"; \
done | $(am__base_list) | \
while read files; do \
echo " $(INSTALL_HEADER) $$files '$(DESTDIR)$(includedir)'"; \
$(INSTALL_HEADER) $$files "$(DESTDIR)$(includedir)" || exit $$?; \
done
uninstall-includeHEADERS:
@$(NORMAL_UNINSTALL)
@list='$(include_HEADERS)'; test -n "$(includedir)" || list=; \
files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \
test -n "$$files" || exit 0; \
echo " ( cd '$(DESTDIR)$(includedir)' && rm -f" $$files ")"; \
cd "$(DESTDIR)$(includedir)" && rm -f $$files
ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) '{ files[$$0] = 1; nonempty = 1; } \
END { if (nonempty) { for (i in files) print i; }; }'`; \
mkid -fID $$unique
tags: TAGS
TAGS: $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
set x; \
here=`pwd`; \
list='$(SOURCES) $(HEADERS) config.h.in $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) '{ files[$$0] = 1; nonempty = 1; } \
END { if (nonempty) { for (i in files) print i; }; }'`; \
shift; \
if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
test -n "$$unique" || unique=$$empty_fix; \
if test $$# -gt 0; then \
$(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
"$$@" $$unique; \
else \
$(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
$$unique; \
fi; \
fi
ctags: CTAGS
CTAGS: $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
list='$(SOURCES) $(HEADERS) config.h.in $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) '{ files[$$0] = 1; nonempty = 1; } \
END { if (nonempty) { for (i in files) print i; }; }'`; \
test -z "$(CTAGS_ARGS)$$unique" \
|| $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
$$unique
GTAGS:
here=`$(am__cd) $(top_builddir) && pwd` \
&& $(am__cd) $(top_srcdir) \
&& gtags -i $(GTAGS_ARGS) "$$here"
distclean-tags:
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
distdir: $(DISTFILES)
@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
list='$(DISTFILES)'; \
dist_files=`for file in $$list; do echo $$file; done | \
sed -e "s|^$$srcdirstrip/||;t" \
-e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
case $$dist_files in \
*/*) $(MKDIR_P) `echo "$$dist_files" | \
sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
sort -u` ;; \
esac; \
for file in $$dist_files; do \
if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
if test -d $$d/$$file; then \
dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
if test -d "$(distdir)/$$file"; then \
find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
fi; \
if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
fi; \
cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
else \
test -f "$(distdir)/$$file" \
|| cp -p $$d/$$file "$(distdir)/$$file" \
|| exit 1; \
fi; \
done
check-am: all-am
check: check-am
all-am: Makefile $(LTLIBRARIES) $(HEADERS) config.h
installdirs:
for dir in "$(DESTDIR)$(libdir)" "$(DESTDIR)$(includedir)"; do \
test -z "$$dir" || $(MKDIR_P) "$$dir"; \
done
install: install-am
install-exec: install-exec-am
install-data: install-data-am
uninstall: uninstall-am
install-am: all-am
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
installcheck: installcheck-am
install-strip:
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
`test -z '$(STRIP)' || \
echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
mostlyclean-generic:
clean-generic:
distclean-generic:
-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
-test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
maintainer-clean-generic:
@echo "This command is intended for maintainers to use"
@echo "it deletes files that may require special tools to rebuild."
clean: clean-am
clean-am: clean-generic clean-libLTLIBRARIES clean-libtool \
mostlyclean-am
distclean: distclean-am
-rm -rf ./$(DEPDIR)
-rm -f Makefile
distclean-am: clean-am distclean-compile distclean-generic \
distclean-hdr distclean-tags
dvi: dvi-am
dvi-am:
html: html-am
html-am:
info: info-am
info-am:
install-data-am: install-includeHEADERS
install-dvi: install-dvi-am
install-dvi-am:
install-exec-am: install-libLTLIBRARIES
install-html: install-html-am
install-html-am:
install-info: install-info-am
install-info-am:
install-man:
install-pdf: install-pdf-am
install-pdf-am:
install-ps: install-ps-am
install-ps-am:
installcheck-am:
maintainer-clean: maintainer-clean-am
-rm -rf ./$(DEPDIR)
-rm -f Makefile
maintainer-clean-am: distclean-am maintainer-clean-generic
mostlyclean: mostlyclean-am
mostlyclean-am: mostlyclean-compile mostlyclean-generic \
mostlyclean-libtool
pdf: pdf-am
pdf-am:
ps: ps-am
ps-am:
uninstall-am: uninstall-includeHEADERS uninstall-libLTLIBRARIES
.MAKE: all install-am install-strip
.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
clean-libLTLIBRARIES clean-libtool ctags distclean \
distclean-compile distclean-generic distclean-hdr \
distclean-libtool distclean-tags distdir dvi dvi-am html \
html-am info info-am install install-am install-data \
install-data-am install-dvi install-dvi-am install-exec \
install-exec-am install-html install-html-am \
install-includeHEADERS install-info install-info-am \
install-libLTLIBRARIES install-man install-pdf install-pdf-am \
install-ps install-ps-am install-strip installcheck \
installcheck-am installdirs maintainer-clean \
maintainer-clean-generic mostlyclean mostlyclean-compile \
mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
tags uninstall uninstall-am uninstall-includeHEADERS \
uninstall-libLTLIBRARIES
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
.NOEXPORT:
// $OpenLDAP$
/*
* Copyright 2007-2012 The OpenLDAP Foundation, All Rights Reserved.
* COPYING RESTRICTIONS APPLY, see COPYRIGHT file
*/
#include <SaslInteraction.h>
#include <iostream>
#include "debug.h"
SaslInteraction::SaslInteraction( sasl_interact_t *interact ) :
m_interact(interact) {}
SaslInteraction::~SaslInteraction()
{
DEBUG(LDAP_DEBUG_TRACE, "SaslInteraction::~SaslInteraction()" << std::endl);
}
unsigned long SaslInteraction::getId() const
{
return m_interact->id;
}
const std::string SaslInteraction::getPrompt() const
{
return std::string(m_interact->prompt);
}
const std::string SaslInteraction::getChallenge() const
{
return std::string(m_interact->challenge);
}
const std::string SaslInteraction::getDefaultResult() const
{
return std::string(m_interact->defresult);
}
void SaslInteraction::setResult(const std::string &res)
{
m_result = res;
m_interact->result = m_result.data();
m_interact->len = m_result.size();
}
// $OpenLDAP$
/*
* Copyright 2007-2012 The OpenLDAP Foundation, All Rights Reserved.
* COPYING RESTRICTIONS APPLY, see COPYRIGHT file
*/
#ifndef SASL_INTERACTION_H
#define SASL_INTERACTION_H
#include <string>
#include <sasl/sasl.h>
class SaslInteraction {
public:
SaslInteraction( sasl_interact_t *interact );
~SaslInteraction();
unsigned long getId() const;
const std::string getPrompt() const;
const std::string getChallenge() const;
const std::string getDefaultResult() const;
void setResult(const std::string &res);
private:
sasl_interact_t *m_interact;
std::string m_result;
};
#endif /* SASL_INTERACTION_H */
// $OpenLDAP$
/*
* Copyright 2007-2012 The OpenLDAP Foundation, All Rights Reserved.
* COPYING RESTRICTIONS APPLY, see COPYRIGHT file
*/
#include <iostream>
#include <iomanip>
#include <limits>
#include "config.h"
#ifdef HAVE_TERMIOS_H
#include <termios.h>
#include <unistd.h>
#include <cstdio>
#endif
#include <string.h>
#include "SaslInteractionHandler.h"
#include "SaslInteraction.h"
#include "debug.h"
void DefaultSaslInteractionHandler::handleInteractions(
const std::list<SaslInteraction*> &cb )
{
DEBUG(LDAP_DEBUG_TRACE, "DefaultSaslInteractionHandler::handleCallbacks()"
<< std::endl );
std::list<SaslInteraction*>::const_iterator i;
for (i = cb.begin(); i != cb.end(); i++ ) {
bool noecho;
cleanupList.push_back(*i);
std::cout << (*i)->getPrompt();
if (! (*i)->getDefaultResult().empty() ) {
std::cout << "(" << (*i)->getDefaultResult() << ")" ;
}
std:: cout << ": ";
switch ( (*i)->getId() ) {
case SASL_CB_PASS:
case SASL_CB_ECHOPROMPT:
noecho = true;
noecho = true;
break;
default:
noecho = false;
break;
}
#ifdef HAVE_TERMIOS_H
/* turn off terminal echo if needed */
struct termios old_attr;
if ( noecho ) {
struct termios attr;
if (tcgetattr(STDIN_FILENO, &attr) < 0) {
perror("tcgetattr");
}
/* save terminal attributes */
memcpy(&old_attr, &attr, sizeof(attr));
/* disable echo */
attr.c_lflag &= ~(ECHO);
/* write attributes to terminal */
if (tcsetattr(STDIN_FILENO, TCSAFLUSH, &attr) < 0) {
perror("tcsetattr");
}
}
#endif /* HAVE_TERMIOS_H */
std::string input;
std::cin >> std::noskipws >> input;
std::cin >> std::skipws;
(*i)->setResult(input);
if( std::cin.fail() ) {
std::cin.clear();
}
/* ignore the rest of the input line */
std::cin.ignore(std::numeric_limits<std::streamsize>::max(), '\n');
#ifdef HAVE_TERMIOS_H
/* restore terminal settings */
if ( noecho ) {
tcsetattr(STDIN_FILENO, TCSANOW, &old_attr);
std::cout << std::endl;
}
#endif /* HAVE_TERMIOS_H */
}
}
DefaultSaslInteractionHandler::~DefaultSaslInteractionHandler()
{
DEBUG(LDAP_DEBUG_TRACE, "DefaultSaslInteractionHandler::~DefaultSaslInteractionHandler()"
<< std::endl );
std::list<SaslInteraction*>::const_iterator i;
for (i = cleanupList.begin(); i != cleanupList.end(); i++ ) {
delete(*i);
}
}
// $OpenLDAP$
/*
* Copyright 2007-2012 The OpenLDAP Foundation, All Rights Reserved.
* COPYING RESTRICTIONS APPLY, see COPYRIGHT file
*/
#ifndef SASL_INTERACTION_HANDLER_H
#define SASL_INTERACTION_HANDLER_H
#include <list>
class SaslInteraction;
class SaslInteractionHandler {
public:
virtual void handleInteractions( const std::list<SaslInteraction*> &cb )=0;
virtual ~SaslInteractionHandler() {}
};
class DefaultSaslInteractionHandler {
public:
virtual void handleInteractions( const std::list<SaslInteraction*> &cb );
virtual ~DefaultSaslInteractionHandler();
private:
std::list<SaslInteraction*> cleanupList;
};
#endif /* SASL_INTERACTION_HANDLER_H */
// $OpenLDAP$
/*
* Copyright 2000-2012 The OpenLDAP Foundation, All Rights Reserved.
* COPYING RESTRICTIONS APPLY, see COPYRIGHT file
*/
#include "StringList.h"
#include "debug.h"
#include <cstdlib>
using namespace std;
StringList::StringList(){
}
StringList::StringList(const StringList& sl){
m_data= StringList::ListType(sl.m_data);
}
StringList::StringList(char** values){
if(values == 0){
m_data=StringList::ListType();
}else{
char** i;
for(i=values; *i != 0; i++){
m_data.push_back(string(*i));
}
}
}
StringList::~StringList(){
DEBUG(LDAP_DEBUG_TRACE,"StringList::~StringList()" << endl);
}
char** StringList::toCharArray() const{
if(!empty()){
char** ret = (char**) malloc(sizeof(char*) * (size()+1));
StringList::const_iterator i;
int j=0;
for(i=begin(); i != end(); i++,j++){
ret[j]=(char*) malloc(sizeof(char) * (i->size()+1));
i->copy(ret[j],string::npos);
ret[j][i->size()]=0;
}
ret[size()]=0;
return ret;
}else{
return 0;
}
}
void StringList::add(const string& value){
m_data.push_back(value);
}
size_t StringList::size() const{
return m_data.size();
}
bool StringList::empty() const{
return m_data.empty();
}
StringList::const_iterator StringList::begin() const{
return m_data.begin();
}
StringList::const_iterator StringList::end() const{
return m_data.end();
}
void StringList::clear(){
m_data.clear();
}