]> git.saurik.com Git - apt.git/blobdiff - apt-pkg/init.cc
testcases runable as root
[apt.git] / apt-pkg / init.cc
index 81b601a7fa7ff45222743e4c04e14e515b4bee8b..d04c51621ddd2d67cecb0cb8da05330d498f8ee7 100644 (file)
 #include <apt-pkg/error.h>
 #include <apt-pkg/pkgsystem.h>
 #include <apt-pkg/configuration.h>
+#include <apt-pkg/macros.h>
 
+#include <string.h>
+#include <string>
 #include <cstdlib>
-#include <sys/stat.h>
 
 #include <apti18n.h>
                                                                        /*}}}*/
@@ -84,15 +86,26 @@ bool pkgInitConfig(Configuration &Cnf)
    Cnf.Set("Dir::Ignore-Files-Silently::", "\\.dpkg-[a-z]+$");
    Cnf.Set("Dir::Ignore-Files-Silently::", "\\.save$");
    Cnf.Set("Dir::Ignore-Files-Silently::", "\\.orig$");
+   Cnf.Set("Dir::Ignore-Files-Silently::", "\\.distUpgrade$");
+
+   // Repository security
+   // FIXME: this is set to "true" for backward compatiblity, once
+   //        jessie is out we want to change this to "false" to
+   //        improve security
+   Cnf.CndSet("Acquire::AllowInsecureRepositories", true);
+   Cnf.CndSet("Acquire::AllowDowngradeToInsecureRepositories", false);
 
    // Default cdrom mount point
    Cnf.CndSet("Acquire::cdrom::mount", "/media/cdrom/");
 
+   // The default user we drop to in the methods
+   Cnf.CndSet("APT::Sandbox::User", "_apt");
+
    bool Res = true;
    
    // Read an alternate config file
    const char *Cfg = getenv("APT_CONFIG");
-   if (Cfg != 0)
+   if (Cfg != 0 && strlen(Cfg) != 0)
    {
       if (RealFileExists(Cfg) == true)
         Res &= ReadConfigFile(Cnf,Cfg);