]> git.netwichtig.de Git - user/henk/code/inspircd.git/commitdiff
Remove the ServerConfig::DirValid check that breaks symlinks
authordanieldg <danieldg@e03df62e-2008-0410-955e-edbf42e46eb7>
Mon, 25 May 2009 22:50:49 +0000 (22:50 +0000)
committerdanieldg <danieldg@e03df62e-2008-0410-955e-edbf42e46eb7>
Mon, 25 May 2009 22:50:49 +0000 (22:50 +0000)
This was included as a security check to prevent symlink attacks,
but this is no longer useful; anyone who can exploit the attack now
can just modify the ircd itself.

git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@11390 e03df62e-2008-0410-955e-edbf42e46eb7

include/configreader.h
src/configreader.cpp
src/modules.cpp

index 3eb456b1fb46dfd22b3506b3f654e434d734205a..d0feaccbb6de1d6788f6991f95d0099b7a9573d3 100644 (file)
@@ -905,12 +905,6 @@ class CoreExport ServerConfig : public Extensible
         */
        std::string GetFullProgDir();
 
-       /** Returns true if a directory is valid (within the modules directory).
-        * @param dirandfile The directory and filename to check
-        * @return True if the directory is valid
-        */
-       static bool DirValid(const char* dirandfile);
-
        /** Clean a filename, stripping the directories (and drives) from string.
         * @param name Directory to tidy
         * @return The cleaned filename
index 0fcf88e9da204a7d6ba25506575d54e38d7c4a84..51045ef5859a8dba15f215e3666849a43f7e9b64 100644 (file)
@@ -2046,64 +2046,6 @@ char* ServerConfig::CleanFilename(char* name)
 }
 
 
-bool ServerConfig::DirValid(const char* dirandfile)
-{
-#ifdef WINDOWS
-       return true;
-#else
-
-       char work[1024];
-       char buffer[1024];
-       char otherdir[1024];
-       int p;
-
-       strlcpy(work, dirandfile, 1024);
-       p = strlen(work);
-
-       // we just want the dir
-       while (*work)
-       {
-               if (work[p] == '/')
-               {
-                       work[p] = '\0';
-                       break;
-               }
-
-               work[p--] = '\0';
-       }
-
-       // Get the current working directory
-       if (getcwd(buffer, 1024 ) == NULL )
-               return false;
-
-       if (chdir(work) == -1)
-               return false;
-
-       if (getcwd(otherdir, 1024 ) == NULL )
-               return false;
-
-       if (chdir(buffer) == -1)
-               return false;
-
-       size_t t = strlen(work);
-
-       if (strlen(otherdir) >= t)
-       {
-               otherdir[t] = '\0';
-               if (!strcmp(otherdir,work))
-               {
-                       return true;
-               }
-
-               return false;
-       }
-       else
-       {
-               return false;
-       }
-#endif
-}
-
 std::string ServerConfig::GetFullProgDir()
 {
        char buffer[PATH_MAX];
index 5d61812c026976aee26067f16f1d3c5aef29b5f1..71f4d7524d7ef00bf53eb803cdbab3889de54e1a 100644 (file)
@@ -397,13 +397,6 @@ bool ModuleManager::Load(const char* filename)
        snprintf(modfile,MAXBUF,"%s/%s",Instance->Config->ModPath,filename);
        std::string filename_str = filename;
 
-       if (!ServerConfig::DirValid(modfile))
-       {
-               LastModuleError = "Module " + std::string(filename) + " is not in the module directory that i am configured to look in (is "+Instance->Config->ModPath+" really a symlink?)";
-               Instance->Logs->Log("MODULE", DEFAULT, LastModuleError);
-               return false;
-       }
-
        if (!ServerConfig::FileExists(modfile))
        {
                LastModuleError = "Module file could not be found: " + filename_str;