Bläddra i källkod

HPCC-15003 Secmanager should remove superflous artifacts

There are several security manager artifacts that were "work in progress" at
some point in the past. They are not used and there is no reason to keep them
around, so this PR removes all references to them

Signed-off-by: Russ Whitehead <william.whitehead@lexisnexis.com>
Russ Whitehead 9 år sedan
förälder
incheckning
574b6868e7

+ 0 - 1
system/security/LdapSecurity/CMakeLists.txt

@@ -32,7 +32,6 @@ set (    SRCS
          ../shared/authmap.cpp 
          ../shared/caching.cpp 
          ../shared/basesecurity.cpp
-         ../shared/defaultsecuritymanager.cpp
          aci.cpp 
          ldapconnection.cpp 
          ldapsecurity.cpp 

+ 0 - 11
system/security/LdapSecurity/ldapsecurity.cpp

@@ -22,7 +22,6 @@
 #include "ldapsecurity.ipp"
 #include "ldapsecurity.hpp"
 #include "authmap.ipp"
-#include "defaultsecuritymanager.hpp"
 
 /**********************************************************
  *     CLdapSecUser                                       *
@@ -1317,16 +1316,6 @@ LDAPSECURITY_API ISecManager * newLdapSecManager(const char *serviceName, IPrope
     return new CLdapSecManager(serviceName, config);
 }
 
-LDAPSECURITY_API ISecManager * newDefaultSecManager(const char *serviceName, IPropertyTree &config)
-{
-    return new CDefaultSecurityManager(serviceName, &config);
-}
-
-LDAPSECURITY_API ISecManager * newLocalSecManager(const char *serviceName, IPropertyTree &config)
-{
-    return new CLocalSecurityManager(serviceName, &config);
-}
-
 LDAPSECURITY_API IAuthMap *newDefaultAuthMap(IPropertyTree* config)
 {
     CAuthMap* authmap = new CAuthMap(NULL);

+ 0 - 2
system/security/LdapSecurity/ldapsecurity.hpp

@@ -33,8 +33,6 @@
 #endif 
 
 extern "C" LDAPSECURITY_API ISecManager * newLdapSecManager(const char *serviceName, IPropertyTree &config);
-extern "C" LDAPSECURITY_API ISecManager * newDefaultSecManager(const char *serviceName, IPropertyTree &config);
-extern "C" LDAPSECURITY_API ISecManager * newLocalSecManager(const char *serviceName, IPropertyTree &config);
 extern "C" LDAPSECURITY_API IAuthMap *newDefaultAuthMap(IPropertyTree* config);
 
 #endif

+ 0 - 1
system/security/htpasswdSecurity/CMakeLists.txt

@@ -28,7 +28,6 @@ set (    SRCS
          ../shared/authmap.cpp
          ../shared/caching.cpp
          ../shared/basesecurity.cpp
-         ../shared/defaultsecuritymanager.cpp
          ./htpasswdSecurity.cpp
     )
 

+ 3 - 3
system/security/htpasswdSecurity/htpasswdSecurity.cpp

@@ -17,15 +17,15 @@
 
 #pragma warning( disable : 4786 )
 
-#include "defaultsecuritymanager.hpp"
+#include "basesecurity.hpp"
 #include "authmap.ipp"
 #include <apr_md5.h>
 #include "htpasswdSecurity.hpp"
 
-class CHtpasswdSecurityManager : public CDefaultSecurityManager
+class CHtpasswdSecurityManager : public CBaseSecurityManager
 {
 public:
-	CHtpasswdSecurityManager(const char *serviceName, IPropertyTree *authconfig) : CDefaultSecurityManager(serviceName, (IPropertyTree *)NULL)
+    CHtpasswdSecurityManager(const char *serviceName, IPropertyTree *authconfig) : CBaseSecurityManager(serviceName, (IPropertyTree *)NULL)
 	{
 		if (authconfig)
 			authconfig->getProp("@htpasswdFile", pwFile);

+ 0 - 2
system/security/htpasswdSecurity/htpasswdSecurity.hpp

@@ -32,8 +32,6 @@
 
 #endif 
 
-#include "basesecurity.hpp"
-
 extern "C" 
 {
     HTPASSWDSECURITY_API ISecManager * newHtpasswdSecManager(const char *serviceName, IPropertyTree &config);

+ 0 - 106
system/security/shared/defaultsecuritymanager.cpp

@@ -1,106 +0,0 @@
-/*##############################################################################
-
-    HPCC SYSTEMS software Copyright (C) 2012 HPCC Systems®.
-
-    Licensed under the Apache License, Version 2.0 (the "License");
-    you may not use this file except in compliance with the License.
-    You may obtain a copy of the License at
-
-       http://www.apache.org/licenses/LICENSE-2.0
-
-    Unless required by applicable law or agreed to in writing, software
-    distributed under the License is distributed on an "AS IS" BASIS,
-    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-    See the License for the specific language governing permissions and
-    limitations under the License.
-############################################################################## */
-
-#pragma warning( disable : 4786 )
-
-#include "defaultsecuritymanager.hpp"
-#include "authmap.ipp"
-
-
-//#ifdef _WIN32
-CDefaultSecurityManager::CDefaultSecurityManager(const char *serviceName, const char *config) : CBaseSecurityManager(serviceName,config)
-{
-}
-
-CDefaultSecurityManager::CDefaultSecurityManager(const char *serviceName, IPropertyTree *config) : CBaseSecurityManager(serviceName,config)
-{
-}
-
-
-//========Local Secuirty Manager==========
-CLocalSecurityManager::CLocalSecurityManager(const char *serviceName, const char *config) : CDefaultSecurityManager(serviceName, config)
-{
-}
-
-CLocalSecurityManager::CLocalSecurityManager(const char *serviceName, IPropertyTree *config) : CDefaultSecurityManager(serviceName, config)
-{
-}
-
-CLocalSecurityManager::~CLocalSecurityManager()
-{
-}
-
-bool CLocalSecurityManager::IsPasswordValid(ISecUser& sec_user)
-{
-    IAuthenticatedUser* au = createAuthenticatedUser();
-    StringBuffer userbuf;
-#ifdef _WIN32
-    const char* realm = sec_user.getRealm();
-    if(realm&&*realm)
-        userbuf.append(realm).append("\\");
-#endif
-    userbuf.append(sec_user.getName());
-    return au->login(userbuf.str(), sec_user.credentials().getPassword());
-}
-
-
-IAuthMap * CLocalSecurityManager::createAuthMap(IPropertyTree * authconfig)
-{
-    CAuthMap* authmap = new CAuthMap(this);
-
-    IPropertyTreeIterator *loc_iter = NULL;
-    loc_iter = authconfig->getElements(".//Location");
-    if (loc_iter != NULL)
-    {
-        IPropertyTree *location = NULL;
-        loc_iter->first();
-        while(loc_iter->isValid())
-        {
-            location = &loc_iter->query();
-            if (location)
-            {
-                StringBuffer pathstr, rstr, required, description;
-                location->getProp("@path", pathstr);
-                location->getProp("@resource", rstr);
-                location->getProp("@required", required);
-                location->getProp("@description", description);
-                
-                if(pathstr.length() == 0)
-                    throw MakeStringException(-1, "path empty in Authenticate/Location");
-                if(rstr.length() == 0)
-                    throw MakeStringException(-1, "resource empty in Authenticate/Location");
-
-                ISecResourceList* rlist = authmap->queryResourceList(pathstr.str());
-                if(rlist == NULL)
-                {
-                    rlist = createResourceList("localsecurity");                        
-                    authmap->add(pathstr.str(), rlist);
-                }
-                ISecResource* rs = rlist->addResource(rstr.str());
-                unsigned requiredaccess = str2perm(required.str());
-                rs->setRequiredAccessFlags(requiredaccess);
-                rs->setDescription(description.str());
-            }
-            loc_iter->next();
-        }
-        loc_iter->Release();
-        loc_iter = NULL;
-    }
-
-    return authmap;
-}
-

+ 0 - 106
system/security/shared/defaultsecuritymanager.hpp

@@ -1,106 +0,0 @@
-/*##############################################################################
-
-    HPCC SYSTEMS software Copyright (C) 2012 HPCC Systems®.
-
-    Licensed under the Apache License, Version 2.0 (the "License");
-    you may not use this file except in compliance with the License.
-    You may obtain a copy of the License at
-
-       http://www.apache.org/licenses/LICENSE-2.0
-
-    Unless required by applicable law or agreed to in writing, software
-    distributed under the License is distributed on an "AS IS" BASIS,
-    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-    See the License for the specific language governing permissions and
-    limitations under the License.
-############################################################################## */
-
-#ifndef DEFAULTSECURITY_INCL
-#define DEFAULTSECURITY_INCL
-
-#include "basesecurity.hpp"
-
-class CDefaultSecurityManager : public CBaseSecurityManager
-{
-protected:
-
-public:
-    CDefaultSecurityManager(const char *serviceName, const char *config);
-    CDefaultSecurityManager(const char *serviceName, IPropertyTree *config);
-    virtual ~CDefaultSecurityManager(){};
-    virtual bool dbauthenticate(ISecUser& User, StringBuffer& SQLQuery){return true;}
-    virtual bool dbValidateResource(ISecResource& res,int usernum,const char* realm)
-    {
-        CSecurityResource * tmpResource =  (CSecurityResource*)(&res);
-        if(tmpResource)
-            tmpResource->setAccessFlags(SecAccess_Full);
-        return true;
-    }
-
-    virtual int getAccessFlagsEx(SecResourceType rtype, ISecUser& sec_user, const char* resourcename)
-    {
-        return SecAccess_Full;
-    }
-    virtual int authorizeFileScope(ISecUser & user, const char * filescope)
-    {
-        return SecAccess_Full;
-    }
-    virtual bool authorizeFileScope(ISecUser & user, ISecResourceList * resources)
-    {
-        if(resources)
-        {
-            int cnt = resources->count();
-            for(int i = 0; i < cnt; i++)
-            {
-                ISecResource* r = resources->queryResource(i);
-                if(r)
-                    r->setAccessFlags(SecAccess_Full);
-            }
-        }
-
-        return true;
-    }
-    virtual int authorizeWorkunitScope(ISecUser & user, const char * filescope)
-    {
-        return SecAccess_Full;
-    }
-    virtual bool authorizeWorkunitScope(ISecUser & user, ISecResourceList * resources)
-    {
-        if(resources)
-        {
-            int cnt = resources->count();
-            for(int i = 0; i < cnt; i++)
-            {
-                ISecResource* r = resources->queryResource(i);
-                if(r)
-                    r->setAccessFlags(SecAccess_Full);
-            }
-        }
-
-        return true;
-    }
-    virtual bool createUserScopes() { return false; }
-    virtual aindex_t getManagedFileScopes(IArrayOf<ISecResource>& scopes) { return 0; }
-    virtual int queryDefaultPermission(ISecUser& user) { return SecAccess_Full; }
-    virtual secManagerType querySecMgrType() { return SMT_Default; }
-    inline virtual const char* querySecMgrTypeName() { return "Default"; }
-};
-
-class CLocalSecurityManager : public CDefaultSecurityManager
-{
-public:
-    CLocalSecurityManager(const char *serviceName, const char *config);
-    CLocalSecurityManager(const char *serviceName, IPropertyTree *config);
-    virtual ~CLocalSecurityManager();
-    IAuthMap * createAuthMap(IPropertyTree * authconfig);
-protected:
-    virtual bool IsPasswordValid(ISecUser& sec_user);
-    virtual secManagerType querySecMgrType() { return SMT_Local; }
-    inline virtual const char* querySecMgrTypeName() { return "Local"; }
-};
-
-
-#endif // DEFAULTSECURITY_INCL
-//end
-
-

+ 0 - 30
system/security/shared/secloader.hpp

@@ -91,36 +91,6 @@ public:
             else
                 throw MakeStringException(-1, "procedure newLdapSecManager of %s can't be loaded", realName.str());
         }
-        else if(stricmp(model_name, "Local") == 0)
-        {
-            realName.append(SharedObjectPrefix).append(LDAPSECLIB).append(SharedObjectExtension);
-            HINSTANCE ldapseclib = LoadSharedObject(realName.str(), true, false);
-            if(ldapseclib == NULL)
-                throw MakeStringException(-1, "can't load library %s", realName.str());
-
-            newSecManager_t_ xproc = NULL;
-            xproc = (newSecManager_t_)GetSharedProcedure(ldapseclib, "newLocalSecManager");
-
-            if (xproc)
-                return xproc(servicename, *cfg);
-            else
-                throw MakeStringException(-1, "procedure newLocalSecManager of %s can't be loaded", realName.str());
-        }
-        else if(stricmp(model_name, "Default") == 0)
-        {
-            realName.append(SharedObjectPrefix).append(LDAPSECLIB).append(SharedObjectExtension);
-            HINSTANCE ldapseclib = LoadSharedObject(realName.str(), true, false);
-            if(ldapseclib == NULL)
-                throw MakeStringException(-1, "can't load library %s", realName.str());
-
-            newSecManager_t_ xproc = NULL;
-            xproc = (newSecManager_t_)GetSharedProcedure(ldapseclib, "newDefaultSecManager");
-
-            if (xproc)
-                return xproc(servicename, *cfg);
-            else
-                throw MakeStringException(-1, "procedure newDefaultSecManager of %s can't be loaded", realName.str());
-        }
         else if(stricmp(model_name, "htpasswd") == 0)
         {
             realName.append(SharedObjectPrefix).append(HTPASSWDSECLIB).append(SharedObjectExtension);