Click here to Skip to main content
15,881,588 members
Articles / Desktop Programming / MFC

Implementing Interoperable LDAP Applications

Rate me:
Please Sign up or sign in to vote.
3.59/5 (16 votes)
14 Apr 200225 min read 186.7K   2.7K   60  
Implementing Ldap wrapper classes for both W2K and Unix
/*
 * ANNOTATED AND DOCUMENTED BY Eduardo Sobrino
 * -----------------------------------------------------------------------------
 * Project    : General LDAP User Support (UNIX + Windows)
 * Contents   : Provide a class that define and implements a general support for
 *            : LDAP User.
 * Depends    : UNMANAGED C/C++
 * Compatible : The following code will complie/run on Win32 (Windows) and any
 *            : UNIX platform.
 * File       : ClLdapUser.h
 * Copywright : Open Knowledge (c) 2000
 * Author     : Eduardo Sobrino
 * Date       : Jun/2000
 * Updated    : Aug/2000  (Added support for message queue [WIN32 only])
 */

#ifndef INCLUDE_CLLDAPUSER_
#define INCLUDE_CLLDAPUSER_

#include <ClLdap.h>

class ClLdapUser {
   private:

      ClLdap *pLdap ;                       // pointer to Ldap session object
      TCHAR  *pUsersDN ;                    // user DN

   public:

      ClLdapUser(ClLdap *pInLdap,TCHAR *pInUsersDN)
         { pLdap = pInLdap ; pUsersDN = xstrdup(pInUsersDN) ; } ;
     ~ClLdapUser()
         { if (pUsersDN) free(pUsersDN) ; } ;

      bool Delete(TCHAR *pUserId) ;
      bool Exists(TCHAR *pUserId) ;

      bool Find(TCHAR *pUserId,TCHAR *pAttr,TCHAR *pValue,int iValLen) ;

      bool Add(TCHAR *pAcct,TCHAR *pUserId,TCHAR *pPassword) ;
      bool Add(TCHAR *pUserId,TCHAR *pPassword)
         { return(Add(pUserId,pUserId,pPassword)) ; } ;

      bool UpdateAccount(TCHAR *pAcct,TCHAR *pUserId,TCHAR *pNewPassword) ;
      bool SetPassword(TCHAR *pUserId,TCHAR *pNewPassword) ;
      bool Authenticate(TCHAR *pUserId,TCHAR *pNewPassword) ;
}  ;

#endif

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here


Written By
Web Developer
Puerto Rico Puerto Rico
C/C++ programmer since 1984.

Comments and Discussions