The InspIRCd Project
Home | Developers | Wiki | Forums | Bug Tracker | SVN | Download
Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members

ModuleLDAPAuth Class Reference

Inheritance diagram for ModuleLDAPAuth:

Inheritance graph
[legend]
Collaboration diagram for ModuleLDAPAuth:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 ModuleLDAPAuth (InspIRCd *Me)
virtual ~ModuleLDAPAuth ()
virtual void OnRehash (User *user, const std::string &parameter)
 Called on rehash.
bool Connect ()
virtual int OnUserRegister (User *user)
 Called whenever a user is about to register their connection (e.g.
bool CheckCredentials (User *user)
virtual void OnUserDisconnect (User *user)
 Called whenever a user's socket is closed.
virtual bool OnCheckReady (User *user)
 Called to check if a user who is connecting can now be allowed to register If any modules return false for this function, the user is held in the waiting state until all modules return true.
virtual Version GetVersion ()
 Returns the version number of a Module.
 ModuleLDAPAuth (InspIRCd *Me)
virtual ~ModuleLDAPAuth ()
virtual void OnRehash (User *user, const std::string &parameter)
 Called on rehash.
bool Connect ()
virtual int OnPassCompare (Extensible *ex, const std::string &data, const std::string &input, const std::string &hashtype)
 Called whenever a password check is to be made.
bool LookupOper (User *user, const std::string &what, const std::string &opassword)
virtual Version GetVersion ()
 Returns the version number of a Module.

Private Attributes

std::string base
std::string attribute
std::string ldapserver
std::string allowpattern
std::string killreason
std::string username
std::string password
int searchscope
bool verbose
bool useusername
LDAP * conn
LDAP * conn

Detailed Description

Definition at line 34 of file m_ldapauth.cpp.


Constructor & Destructor Documentation

ModuleLDAPAuth::ModuleLDAPAuth InspIRCd Me  )  [inline]
 

Definition at line 49 of file m_ldapauth.cpp.

References ModuleManager::Attach(), conn, I_OnCheckReady, I_OnRehash, I_OnUserDisconnect, I_OnUserRegister, InspIRCd::Modules, OnRehash(), and Module::ServerInstance.

virtual ModuleLDAPAuth::~ModuleLDAPAuth  )  [inline, virtual]
 

Definition at line 58 of file m_ldapauth.cpp.

References conn.

ModuleLDAPAuth::ModuleLDAPAuth InspIRCd Me  )  [inline]
 

Definition at line 44 of file m_ldapoper.cpp.

References ModuleManager::Attach(), conn, I_OnPassCompare, I_OnRehash, InspIRCd::Modules, OnRehash(), and Module::ServerInstance.

virtual ModuleLDAPAuth::~ModuleLDAPAuth  )  [inline, virtual]
 

Definition at line 53 of file m_ldapoper.cpp.

References conn.


Member Function Documentation

bool ModuleLDAPAuth::CheckCredentials User user  )  [inline]
 

Definition at line 130 of file m_ldapauth.cpp.

References attribute, base, conn, Connect(), Extensible::Extend(), User::host, User::ident, User::nick, User::password, password, searchscope, Module::ServerInstance, InspIRCd::SNO, username, useusername, verbose, and SnomaskManager::WriteToSnoMask().

Referenced by OnUserRegister().

bool ModuleLDAPAuth::Connect  )  [inline]
 

Definition at line 78 of file m_ldapoper.cpp.

References conn, and ldapserver.

bool ModuleLDAPAuth::Connect  )  [inline]
 

Definition at line 88 of file m_ldapauth.cpp.

References conn, ldapserver, Module::ServerInstance, InspIRCd::SNO, verbose, and SnomaskManager::WriteToSnoMask().

Referenced by CheckCredentials(), LookupOper(), and OnRehash().

virtual Version ModuleLDAPAuth::GetVersion  )  [inline, virtual]
 

Returns the version number of a Module.

The method should return a Version object with its version information assigned via Version::Version

Reimplemented from Module.

Definition at line 169 of file m_ldapoper.cpp.

References API_VERSION, and VF_VENDOR.

virtual Version ModuleLDAPAuth::GetVersion  )  [inline, virtual]
 

Returns the version number of a Module.

The method should return a Version object with its version information assigned via Version::Version

Reimplemented from Module.

Definition at line 213 of file m_ldapauth.cpp.

References API_VERSION, and VF_VENDOR.

bool ModuleLDAPAuth::LookupOper User user,
const std::string what,
const std::string opassword
[inline]
 

Definition at line 115 of file m_ldapoper.cpp.

References base, conn, Connect(), password, searchscope, and username.

Referenced by OnPassCompare().

virtual bool ModuleLDAPAuth::OnCheckReady User user  )  [inline, virtual]
 

Called to check if a user who is connecting can now be allowed to register If any modules return false for this function, the user is held in the waiting state until all modules return true.

For example a module which implements ident lookups will continue to return false for a user until their ident lookup is completed. Note that the registration timeout for a user overrides these checks, if the registration timeout is reached, the user is disconnected even if modules report that the user is not ready to connect.

Parameters:
user The user to check
Returns:
true to indicate readiness, false if otherwise

Reimplemented from Module.

Definition at line 208 of file m_ldapauth.cpp.

References Extensible::GetExt().

virtual int ModuleLDAPAuth::OnPassCompare Extensible ex,
const std::string data,
const std::string input,
const std::string hashtype
[inline, virtual]
 

Called whenever a password check is to be made.

Replaces the old OldOperCompare API. The password field (from the config file) is in 'password' and is to be compared against 'input'. This method allows for encryption of passwords (oper, connect:allow, die/restart, etc). You should return a nonzero value to override the normal comparison, or zero to pass it on.

Parameters:
ex The object that's causing the authentication (User* for <oper> <connect:allow> etc, Server* for <link>).
password The password from the configuration file (the password="" value).
input The password entered by the user or whoever.
hashtype The hash value from the config
Returns:
0 to do nothing (pass on to next module/default), 1 == password is OK, -1 == password is not OK

Reimplemented from Module.

Definition at line 100 of file m_ldapoper.cpp.

References LookupOper().

virtual void ModuleLDAPAuth::OnRehash User user,
const std::string parameter
[inline, virtual]
 

Called on rehash.

This method is called prior to a /REHASH or when a SIGHUP is received from the operating system. You should use it to reload any files so that your module keeps in step with the rest of the application. If a parameter is given, the core has done nothing. The module receiving the event can decide if this parameter has any relevence to it.

Parameters:
user The user performing the rehash, if any -- if this is server initiated, the value of this variable will be NULL.
parameter The (optional) parameter given to REHASH from the user.

Reimplemented from Module.

Definition at line 59 of file m_ldapoper.cpp.

References base, Conf, Connect(), ldapserver, password, ConfigReader::ReadValue(), searchscope, Module::ServerInstance, and username.

virtual void ModuleLDAPAuth::OnRehash User user,
const std::string parameter
[inline, virtual]
 

Called on rehash.

This method is called prior to a /REHASH or when a SIGHUP is received from the operating system. You should use it to reload any files so that your module keeps in step with the rest of the application. If a parameter is given, the core has done nothing. The module receiving the event can decide if this parameter has any relevence to it.

Parameters:
user The user performing the rehash, if any -- if this is server initiated, the value of this variable will be NULL.
parameter The (optional) parameter given to REHASH from the user.

Reimplemented from Module.

Definition at line 64 of file m_ldapauth.cpp.

References allowpattern, attribute, base, Conf, Connect(), killreason, ldapserver, password, ConfigReader::ReadFlag(), ConfigReader::ReadValue(), searchscope, Module::ServerInstance, username, useusername, and verbose.

Referenced by ModuleLDAPAuth().

virtual void ModuleLDAPAuth::OnUserDisconnect User user  )  [inline, virtual]
 

Called whenever a user's socket is closed.

The details of the exiting user are available to you in the parameter User *user This event is called for all users, registered or not, as a cleanup method for modules which might assign resources to user, such as dns lookups, objects and sockets.

Parameters:
user The user who is disconnecting

Reimplemented from Module.

Definition at line 202 of file m_ldapauth.cpp.

References Extensible::Shrink().

virtual int ModuleLDAPAuth::OnUserRegister User user  )  [inline, virtual]
 

Called whenever a user is about to register their connection (e.g.

before the user is sent the MOTD etc). Modules can use this method if they are performing a function which must be done before the actual connection is completed (e.g. ident lookups, dnsbl lookups, etc). Note that you should NOT delete the user record here by causing a disconnection! Use OnUserConnect for that instead.

Parameters:
user The user registering
Returns:
1 to indicate user quit, 0 to continue

Reimplemented from Module.

Definition at line 114 of file m_ldapauth.cpp.

References allowpattern, CheckCredentials(), Extensible::Extend(), killreason, InspIRCd::Match(), User::nick, UserManager::QuitUser(), Module::ServerInstance, and InspIRCd::Users.


Member Data Documentation

std::string ModuleLDAPAuth::allowpattern [private]
 

Definition at line 39 of file m_ldapauth.cpp.

Referenced by OnRehash(), and OnUserRegister().

std::string ModuleLDAPAuth::attribute [private]
 

Definition at line 37 of file m_ldapauth.cpp.

Referenced by CheckCredentials(), and OnRehash().

std::string ModuleLDAPAuth::base [private]
 

Definition at line 36 of file m_ldapauth.cpp.

Referenced by CheckCredentials(), LookupOper(), and OnRehash().

LDAP* ModuleLDAPAuth::conn [private]
 

Definition at line 41 of file m_ldapoper.cpp.

LDAP* ModuleLDAPAuth::conn [private]
 

Definition at line 46 of file m_ldapauth.cpp.

Referenced by CheckCredentials(), Connect(), LookupOper(), ModuleLDAPAuth(), and ~ModuleLDAPAuth().

std::string ModuleLDAPAuth::killreason [private]
 

Definition at line 40 of file m_ldapauth.cpp.

Referenced by OnRehash(), and OnUserRegister().

std::string ModuleLDAPAuth::ldapserver [private]
 

Definition at line 38 of file m_ldapauth.cpp.

Referenced by Connect(), and OnRehash().

std::string ModuleLDAPAuth::password [private]
 

Definition at line 42 of file m_ldapauth.cpp.

Referenced by CheckCredentials(), LookupOper(), and OnRehash().

int ModuleLDAPAuth::searchscope [private]
 

Definition at line 43 of file m_ldapauth.cpp.

Referenced by CheckCredentials(), LookupOper(), and OnRehash().

std::string ModuleLDAPAuth::username [private]
 

Definition at line 41 of file m_ldapauth.cpp.

Referenced by CheckCredentials(), LookupOper(), and OnRehash().

bool ModuleLDAPAuth::useusername [private]
 

Definition at line 45 of file m_ldapauth.cpp.

Referenced by CheckCredentials(), and OnRehash().

bool ModuleLDAPAuth::verbose [private]
 

Definition at line 44 of file m_ldapauth.cpp.

Referenced by CheckCredentials(), Connect(), and OnRehash().


The documentation for this class was generated from the following files: