Skip to content

Commit

Permalink
HPCC-32711 Define LDAP security manager abstraction
Browse files Browse the repository at this point in the history
Replace platform references to CLdapSecManager with references to the
ILdapSecManager abstraction.

Signed-off-by: Tim Klemm <[email protected]>
  • Loading branch information
Tim Klemm authored and Tim Klemm committed Nov 8, 2024
1 parent ea1047a commit 6b1a8a6
Show file tree
Hide file tree
Showing 11 changed files with 194 additions and 137 deletions.
2 changes: 1 addition & 1 deletion dali/server/daldap.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ class CDaliLdapConnection: implements IDaliLdapConnection, public CInterface

if (!authenticated)
{
CLdapSecManager* ldapSecMgr = dynamic_cast<CLdapSecManager*>(ldapsecurity.get());
ILdapSecManager* ldapSecMgr = dynamic_cast<ILdapSecManager*>(ldapsecurity.get());
if (!ldapSecMgr || !ldapSecMgr->isSuperUser(user))
{
DBGLOG("LDAP: EnableScopeScans caller %s must be an LDAP HPCC Admin", username.str());
Expand Down
2 changes: 1 addition & 1 deletion esp/platform/espcontext.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -456,7 +456,7 @@ class CEspContext : public CInterface, implements IEspContext
virtual void ensureSuperUser(unsigned excCode, const char* excMsg)
{
#ifdef _USE_OPENLDAP
CLdapSecManager* secmgr = dynamic_cast<CLdapSecManager*>(m_secmgr.get());
ILdapSecManager* secmgr = dynamic_cast<ILdapSecManager*>(m_secmgr.get());
if (secmgr && !secmgr->isSuperUser(m_user.get()))
{
setAuthStatus(AUTH_STATUS_NOACCESS);
Expand Down
12 changes: 6 additions & 6 deletions esp/services/espcontrol/ws_espcontrolservice.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ bool CWSESPControlEx::onSetLogging(IEspContext& context, IEspSetLoggingRequest&
try
{
#ifdef _USE_OPENLDAP
CLdapSecManager* secmgr = dynamic_cast<CLdapSecManager*>(context.querySecManager());
ILdapSecManager* secmgr = dynamic_cast<ILdapSecManager*>(context.querySecManager());
if(secmgr && !secmgr->isSuperUser(context.queryUser()))
{
context.setAuthStatus(AUTH_STATUS_NOACCESS);
Expand Down Expand Up @@ -220,7 +220,7 @@ bool CWSESPControlEx::onGetLoggingSettings(IEspContext& context, IEspGetLoggingS
try
{
#ifdef _USE_OPENLDAP
CLdapSecManager* secmgr = dynamic_cast<CLdapSecManager*>(context.querySecManager());
ILdapSecManager* secmgr = dynamic_cast<ILdapSecManager*>(context.querySecManager());
if(secmgr && !secmgr->isSuperUser(context.queryUser()))
{
context.setAuthStatus(AUTH_STATUS_NOACCESS);
Expand Down Expand Up @@ -264,7 +264,7 @@ bool CWSESPControlEx::onSessionQuery(IEspContext& context, IEspSessionQueryReque
try
{
#ifdef _USE_OPENLDAP
CLdapSecManager* secmgr = dynamic_cast<CLdapSecManager*>(context.querySecManager());
ILdapSecManager* secmgr = dynamic_cast<ILdapSecManager*>(context.querySecManager());
if(secmgr && !secmgr->isSuperUser(context.queryUser()))
{
context.setAuthStatus(AUTH_STATUS_NOACCESS);
Expand Down Expand Up @@ -305,7 +305,7 @@ bool CWSESPControlEx::onSessionInfo(IEspContext& context, IEspSessionInfoRequest
try
{
#ifdef _USE_OPENLDAP
CLdapSecManager* secmgr = dynamic_cast<CLdapSecManager*>(context.querySecManager());
ILdapSecManager* secmgr = dynamic_cast<ILdapSecManager*>(context.querySecManager());
if(secmgr && !secmgr->isSuperUser(context.queryUser()))
{
context.setAuthStatus(AUTH_STATUS_NOACCESS);
Expand Down Expand Up @@ -349,7 +349,7 @@ bool CWSESPControlEx::onCleanSession(IEspContext& context, IEspCleanSessionReque
try
{
#ifdef _USE_OPENLDAP
CLdapSecManager* secmgr = dynamic_cast<CLdapSecManager*>(context.querySecManager());
ILdapSecManager* secmgr = dynamic_cast<ILdapSecManager*>(context.querySecManager());
if(secmgr && !secmgr->isSuperUser(context.queryUser()))
{
context.setAuthStatus(AUTH_STATUS_NOACCESS);
Expand Down Expand Up @@ -384,7 +384,7 @@ bool CWSESPControlEx::onSetSessionTimeout(IEspContext& context, IEspSetSessionTi
try
{
#ifdef _USE_OPENLDAP
CLdapSecManager* secmgr = dynamic_cast<CLdapSecManager*>(context.querySecManager());
ILdapSecManager* secmgr = dynamic_cast<ILdapSecManager*>(context.querySecManager());
if(secmgr && !secmgr->isSuperUser(context.queryUser()))
{
context.setAuthStatus(AUTH_STATUS_NOACCESS);
Expand Down
4 changes: 2 additions & 2 deletions esp/services/ldapenvironment/ldapenvironmentService.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class CldapenvironmentEx : public Cldapenvironment //base class name built from
{
private:
IPropertyTree * cfg;
CLdapSecManager* secmgr = nullptr;
ILdapSecManager* secmgr = nullptr;
StringBuffer ldapRootOU;
StringBuffer sharedFilesBaseDN;
StringBuffer sharedGroupsBaseDN;
Expand Down Expand Up @@ -52,7 +52,7 @@ class CldapenvironmentEx : public Cldapenvironment //base class name built from
virtual void init(IPropertyTree *_cfg, const char *_process, const char *_service);
bool onLDAPQueryDefaults(IEspContext &context, IEspLDAPQueryDefaultsRequest &req, IEspLDAPQueryDefaultsResponse &resp);
bool onLDAPCreateEnvironment(IEspContext &context, IEspLDAPCreateEnvironmentRequest &req, IEspLDAPCreateEnvironmentResponse &resp);
void setSecMgr( ISecManager*sm) { secmgr = dynamic_cast<CLdapSecManager*>(sm); }
void setSecMgr( ISecManager*sm) { secmgr = dynamic_cast<ILdapSecManager*>(sm); }
};


Expand Down
Loading

0 comments on commit 6b1a8a6

Please sign in to comment.