CLDAPConnectionManager.h [plain text]
#ifndef _CLDAPCONNECTIONMANAGER_H
#define _CLDAPCONNECTIONMANAGER_H
#include <unistd.h>
#include <map> // STL map class
#include <string> // STL string class
#include <list>
#include <DirectoryService/DirServicesTypes.h>
#include <DirectoryServiceCore/DSMutexSemaphore.h>
#include <DirectoryServiceCore/DSEventSemaphore.h>
#include "CLDAPConnection.h"
using namespace std;
typedef struct sLDAPContinueData {
int fLDAPMsgId; tDirNodeReference fNodeRef; CLDAPConnection *fLDAPConnection; LDAPMessage *fResult; LDAP *fRefLD; UInt32 fRecNameIndex; UInt32 fRecTypeIndex; UInt32 fTotalRecCount; UInt32 fLimitRecSearch; void *fAuthHndl;
void *fAuthHandlerProc;
char *fAuthAuthorityData;
tContextData fPassPlugContinueData;
} sLDAPContinueData;
class CLDAPv3Configs;
struct sLDAPContextData : public CObject<sLDAPContextData>
{
int fType; UInt32 offset; UInt32 index;
char *fOpenRecordType; char *fOpenRecordName; char *fOpenRecordDN;
uid_t fUID;
uid_t fEffectiveUID;
tDirReference fPWSRef;
tDirNodeReference fPWSNodeRef;
UInt32 fPWSUserIDLength;
char *fPWSUserID;
CLDAPConnection *fLDAPConnection;
public:
sLDAPContextData ( CLDAPConnection *inConnection = NULL );
sLDAPContextData ( const sLDAPContextData& inContextData );
protected:
~sLDAPContextData ( void );
};
typedef map<string, CLDAPConnection *> LDAPConnectionMap;
typedef LDAPConnectionMap::iterator LDAPConnectionMapI;
typedef list<CLDAPConnection *> LDAPAuthConnectionList;
typedef LDAPAuthConnectionList::const_iterator LDAPAuthConnectionListI;
class CLDAPConnectionManager
{
public:
static int32_t fCheckThreadActive;
static double fCheckFailedLastRun;
static DSEventSemaphore fCheckFailedEvent;
public:
CLDAPConnectionManager ( CLDAPv3Configs *inConfigObject );
virtual ~CLDAPConnectionManager ( void );
bool IsSASLMethodSupported ( CFStringRef inMethod );
sLDAPContextData *CreateContextForNode ( const char *inNodeName );
CLDAPConnection *GetConnection ( const char *inNodeName );
tDirStatus AuthConnection ( CLDAPConnection **inConnection, const char *inLDAPUsername, const char *inRecordType,
const char *inKerberosID, const char *inPassword );
tDirStatus AuthConnectionKerberos ( CLDAPConnection **inConnection, const char *inUsername, const char *inRecordType,
krb5_creds *inCredsPtr, const char *inKerberosID );
tDirStatus VerifyCredentials ( CLDAPConnection *inConnection, const char *inLDAPUsername, const char *inRecordType,
const char *inKerberosID, const char *inPassword );
void NodeDeleted ( const char *inNodeName );
void PeriodicTask ( void );
void NetworkTransition ( void );
void SystemGoingToSleep ( void );
void SystemWillPowerOn ( void );
private:
LDAPConnectionMap fLDAPConnectionMap;
LDAPAuthConnectionList fLDAPAuthConnectionList;
DSMutexSemaphore fLDAPConnectionMapMutex;
CLDAPv3Configs *fConfigObject;
CFArrayRef fSupportedSASLMethods;
private:
void CheckFailed ( void );
void LaunchCheckFailedThread ( bool bForceCheck );
static void *CheckFailedServers ( void *inInfo );
};
#endif // __CLDAPNode_h__