Author: Ghostwolf <foxxe@wtfs.net>
[ircu2.10.12-pk.git] / ircd / ircd.c
index cfee4af807282c030b1719c438956a87ff32bdc7..ea3a538f1e74868eb7452cb2ca6e02f715be12b7 100644 (file)
@@ -378,7 +378,7 @@ static void check_pings(struct Event* ev) {
                   ":Your client may not be compatible with this server.");
        send_reply(cptr, SND_EXPLICIT | ERR_BADPING,
                   ":Compatible clients are available at "
-                  "ftp://ftp.undernet.org/pub/irc/clients");
+                  URL_CLIENTS);
       }    
       exit_client_msg(cptr,cptr,&me, "Ping Timeout");
       continue;
@@ -496,10 +496,6 @@ static char check_file_access(const char *path, char which, int mode) {
          "recompile to correct this.\n",
          which, path, strerror(errno));
 
-#ifdef CHROOTDIR
-  fprintf(stderr, "Keep in mind that paths are relative to CHROOTDIR.\n");
-#endif
-
   return 0;
 }
 
@@ -524,41 +520,10 @@ static void set_core_limit(void) {
 
 
 
-/*----------------------------------------------------------------------------
- * set_chroot_environment
- *--------------------------------------------------------------------------*/
-#ifdef CHROOTDIR
-static char set_chroot_environment(void) {
-  /* Must be root to chroot! Silly if you ask me... */
-  if (geteuid())
-    seteuid(0);
-
-  if (chdir(dpath)) {
-    fprintf(stderr, "Fail: Cannot chdir(%s): %s\n", dpath, strerror(errno));
-    return 0;
-  }
-  if (chroot(dpath)) {
-    fprintf(stderr, "Fail: Cannot chroot(%s): %s\n", dpath, strerror(errno));
-    return 0;
-  }
-  dpath = "/";
-  return 1;
-}
-#endif
-
-
 /*----------------------------------------------------------------------------
  * set_userid_if_needed()
  *--------------------------------------------------------------------------*/
 static int set_userid_if_needed(void) {
-  /* TODO: Drop privs correctly! */
-#if defined(IRC_GID) && defined(IRC_UID)
-  setgid (IRC_GID);
-  setegid(IRC_GID);
-  setuid (IRC_UID);
-  seteuid(IRC_UID);
-#endif
-
   if (getuid() == 0 || geteuid() == 0 ||
       getgid() == 0 || getegid() == 0) {
     fprintf(stderr, "ERROR:  This server will not run as superuser.\n");
@@ -584,11 +549,6 @@ int main(int argc, char **argv) {
   thisServer.uid  = getuid();
   thisServer.euid = geteuid();
 
-#ifdef CHROOTDIR
-  if (!set_chroot_environment())
-    return 1;
-#endif
-
 #if defined(HAVE_SETRLIMIT) && defined(RLIMIT_CORE)
   set_core_limit();
 #endif
@@ -613,11 +573,6 @@ int main(int argc, char **argv) {
   if (!check_file_access(SPATH, 'S', X_OK) ||
       !check_file_access(configfile, 'C', R_OK))
     return 4;
-      
-#ifdef DEBUG
-  if (!check_file_access(LPATH, 'L', W_OK))
-    return 5;
-#endif
 
   debug_init(thisServer.bootopt & BOOT_TTY);
   daemon_init(thisServer.bootopt & BOOT_TTY);
@@ -660,8 +615,8 @@ int main(int argc, char **argv) {
   uping_init();
 
   IPcheck_init();
-  timer_add(&connect_timer, try_connections, 0, TT_RELATIVE, 1);
-  timer_add(&ping_timer, check_pings, 0, TT_RELATIVE, 1);
+  timer_add(timer_init(&connect_timer), try_connections, 0, TT_RELATIVE, 1);
+  timer_add(timer_init(&ping_timer), check_pings, 0, TT_RELATIVE, 1);
 
   CurrentTime = time(NULL);