]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/inspircd.cpp
Fix a compiler warning about a redefinition of some symbol.
[user/henk/code/inspircd.git] / src / inspircd.cpp
index 9a64331b5f1faeabe84d3a3540f96e15db0edccf..518b1b5bbdc80c5a9e037d78001861a3641e8e3f 100644 (file)
@@ -586,7 +586,7 @@ InspIRCd::InspIRCd(int argc, char** argv)
        printf_c("(C) InspIRCd Development Team.\033[0m\n\n");
        printf_c("Developers:\n");
        printf_c("\t\033[1;32mBrain, FrostyCoolSlug, w00t, Om, Special\n");
-       printf_c("\t\033[1;32mpippijn, peavey, aquanight, fez\033[0m\n\n");
+       printf_c("\t\033[1;32mpippijn, peavey, aquanight, fez, psychon, dz\033[0m\n\n");
        printf_c("Others:\t\t\t\033[1;32mSee /INFO Output\033[0m\n");
 
        Config->ClearStack();
@@ -730,48 +730,59 @@ InspIRCd::InspIRCd(int argc, char** argv)
        Logs->Log("STARTUP", DEFAULT, "Startup complete as '%s'[%s], %d max open sockets", Config->ServerName,Config->GetSID().c_str(), SE->GetMaxFds());
 
 #ifndef WIN32
-       if (*(this->Config->SetUser))
+       if (*(this->Config->SetGroup))
        {
-               // setuid
-               struct passwd *u;
+               int ret;
+
+               // setgroups
+               ret = setgroups(0, NULL);
+
+               if (ret == -1)
+               {
+                       this->Logs->Log("SETGROUPS", DEFAULT, "setgroups() failed (wtf?): %s", strerror(errno));
+                       this->QuickExit(0);
+               }
+
+               // setgid
+               struct group *g;
 
                errno = 0;
-               u = getpwnam(this->Config->SetUser);
+               g = getgrnam(this->Config->SetGroup);
 
-               if (!u)
+               if (!g)
                {
-                       this->Logs->Log("SETGUID", DEFAULT, "getpwnam() failed (bad user?): %s", strerror(errno));
+                       this->Logs->Log("SETGUID", DEFAULT, "getgrnam() failed (bad user?): %s", strerror(errno));
                        this->QuickExit(0);
                }
 
-               int ret = setuid(u->pw_uid);
+               ret = setgid(g->gr_gid);
 
                if (ret == -1)
                {
-                       this->Logs->Log("SETGUID", DEFAULT, "setuid() failed (bad user?): %s", strerror(errno));
+                       this->Logs->Log("SETGUID", DEFAULT, "setgid() failed (bad user?): %s", strerror(errno));
                        this->QuickExit(0);
                }
        }
 
-       if (*(this->Config->SetGroup))
+       if (*(this->Config->SetUser))
        {
-               // setgid
-               struct group *g;
+               // setuid
+               struct passwd *u;
 
                errno = 0;
-               g = getgrnam(this->Config->SetGroup);
+               u = getpwnam(this->Config->SetUser);
 
-               if (!g)
+               if (!u)
                {
-                       this->Logs->Log("SETGUID", DEFAULT, "getgrnam() failed (bad user?): %s", strerror(errno));
+                       this->Logs->Log("SETGUID", DEFAULT, "getpwnam() failed (bad user?): %s", strerror(errno));
                        this->QuickExit(0);
                }
 
-               int ret = setgid(g->gr_gid);
+               int ret = setuid(u->pw_uid);
 
                if (ret == -1)
                {
-                       this->Logs->Log("SETGUID", DEFAULT, "setgid() failed (bad user?): %s", strerror(errno));
+                       this->Logs->Log("SETGUID", DEFAULT, "setuid() failed (bad user?): %s", strerror(errno));
                        this->QuickExit(0);
                }
        }