ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/svn/ircd-hybrid/trunk/src/ircd.c
(Generate patch)

Comparing:
ircd-hybrid/src/ircd.c (file contents), Revision 30 by adx, Sun Oct 2 20:03:27 2005 UTC vs.
ircd-hybrid/trunk/src/ircd.c (file contents), Revision 2330 by michael, Sun Jun 23 13:29:56 2013 UTC

# Line 19 | Line 19
19   *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307
20   *  USA
21   *
22 < *  $Id: ircd.c,v 7.369 2005/09/24 09:27:18 michael Exp $
22 > *  $Id$
23   */
24  
25   #include "stdinc.h"
26   #include "s_user.h"
27 < #include "tools.h"
27 > #include "list.h"
28   #include "ircd.h"
29   #include "channel.h"
30   #include "channel_mode.h"
31   #include "client.h"
32 #include "common.h"
32   #include "event.h"
33   #include "fdlist.h"
34   #include "hash.h"
35   #include "irc_string.h"
37 #include "sprintf_irc.h"
36   #include "ircd_signal.h"
39 #include "list.h"
37   #include "s_gline.h"
38   #include "motd.h"
39 < #include "ircd_handler.h"
43 < #include "msg.h"         /* msgtab */
39 > #include "conf.h"
40   #include "hostmask.h"
41   #include "numeric.h"
42   #include "packet.h"
43   #include "parse.h"
44   #include "irc_res.h"
45   #include "restart.h"
46 + #include "rng_mt.h"
47   #include "s_auth.h"
48   #include "s_bsd.h"
49 < #include "s_conf.h"
53 < #include "s_log.h"
49 > #include "log.h"
50   #include "s_misc.h"
51   #include "s_serv.h"      /* try_connections */
56 #include "s_stats.h"
52   #include "send.h"
53   #include "whowas.h"
54   #include "modules.h"
55   #include "memory.h"
56 + #include "mempool.h"
57   #include "hook.h"
58   #include "ircd_getopt.h"
63 #include "balloc.h"
64 #include "motd.h"
59   #include "supported.h"
60 + #include "watch.h"
61 + #include "conf_db.h"
62 + #include "conf_class.h"
63  
67 /* Try and find the correct name to use with getrlimit() for setting the max.
68 * number of files allowed to be open by this process.
69 */
64  
65 + #ifdef HAVE_LIBGEOIP
66 + GeoIP *geoip_ctx;
67 + #endif
68   /* /quote set variables */
69   struct SetOptions GlobalSetOptions;
70  
# Line 77 | Line 74 | struct config_file_entry ConfigFileEntry
74   struct server_info ServerInfo;
75   /* admin info set from ircd.conf */
76   struct admin_info AdminInfo = { NULL, NULL, NULL };
77 < struct Counter Count = { 0, 0, 0, 0, 0, 0, 0, 0 };
77 > struct Counter Count = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
78   struct ServerState_t server_state = { 0 };
79 < struct logging_entry ConfigLoggingEntry = { 1, {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0} };
79 > struct logging_entry ConfigLoggingEntry = { .use_logging = 1 };
80 > struct ServerStatistics ServerStats;
81   struct timeval SystemTime;
82   struct Client me;             /* That's me */
83   struct LocalUser meLocalUser; /* That's also part of me */
86 unsigned long connect_id = 0; /* unique connect ID */
84  
88 static unsigned long initialVMTop = 0;   /* top of virtual memory at init */
85   const char *logFileName = LPATH;
86   const char *pidFileName = PPATH;
87  
88   char **myargv;
93 char ircd_platform[PLATFORMLEN];
89  
90   int dorehash = 0;
91   int doremotd = 0;
97 time_t nextconnect = 1;       /* time for next try_connections call */
92  
93   /* Set to zero because it should be initialized later using
94   * initialize_server_capabs
95   */
96   int default_server_capabs = 0;
97 <
98 < #ifdef HAVE_LIBCRYPTO
99 < int bio_spare_fd = -1;
106 < #endif
107 <
108 < int splitmode;
109 < int splitchecking;
110 < int split_users;
97 > unsigned int splitmode;
98 > unsigned int splitchecking;
99 > unsigned int split_users;
100   unsigned int split_servers;
101  
102   /* Do klines the same way hybrid-6 did them, i.e. at the
# Line 122 | Line 111 | unsigned int split_servers;
111  
112   int rehashed_klines = 0;
113  
125 /*
126 * get_vm_top - get the operating systems notion of the resident set size
127 */
128 #ifndef _WIN32
129 static unsigned long
130 get_vm_top(void)
131 {
132  /*
133   * NOTE: sbrk is not part of the ANSI C library or the POSIX.1 standard
134   * however it seems that everyone defines it. Calling sbrk with a 0
135   * argument will return a pointer to the top of the process virtual
136   * memory without changing the process size, so this call should be
137   * reasonably safe (sbrk returns the new value for the top of memory).
138   * This code relies on the notion that the address returned will be an
139   * offset from 0 (NULL), so the result of sbrk is cast to a size_t and
140   * returned. We really shouldn't be using it here but...
141   */
142
143  void *vptr = sbrk(0);
144  return((unsigned long)vptr);
145 }
114  
115   /*
116   * print_startup - print startup information
# Line 174 | Line 142 | make_daemon(void)
142  
143    setsid();
144   }
177 #endif
178
179 /*
180 * get_maxrss - get the operating systems notion of the resident set size
181 */
182 unsigned long
183 get_maxrss(void)
184 {
185 #ifdef _WIN32
186  return (0);   /* FIXME */
187 #else
188  return (get_vm_top() - initialVMTop);
189 #endif
190 }
145  
146   static int printVersion = 0;
147  
148 < struct lgetopt myopts[] = {
195 <  {"dlinefile",  &ConfigFileEntry.dlinefile,
196 <   STRING, "File to use for dline.conf"},
148 > static struct lgetopt myopts[] = {
149    {"configfile", &ConfigFileEntry.configfile,
150     STRING, "File to use for ircd.conf"},
151 +  {"glinefile",  &ConfigFileEntry.glinefile,
152 +   STRING, "File to use for gline database"},
153    {"klinefile",  &ConfigFileEntry.klinefile,
154 <   STRING, "File to use for kline.conf"},
154 >   STRING, "File to use for kline database"},
155 >  {"dlinefile",  &ConfigFileEntry.dlinefile,
156 >   STRING, "File to use for dline database"},
157    {"xlinefile",  &ConfigFileEntry.xlinefile,
158 <   STRING, "File to use for xline.conf"},
158 >   STRING, "File to use for xline database"},
159 >  {"resvfile",  &ConfigFileEntry.resvfile,
160 >   STRING, "File to use for resv database"},
161    {"logfile",    &logFileName,
162     STRING, "File to use for ircd.log"},
163    {"pidfile",    &pidFileName,
# Line 217 | Line 175 | set_time(void)
175   {
176    static char to_send[200];
177    struct timeval newtime;
220 #ifdef _WIN32
221  FILETIME ft;
222
223  GetSystemTimeAsFileTime(&ft);
224  if (ft.dwLowDateTime < 0xd53e8000)
225    ft.dwHighDateTime--;
226  ft.dwLowDateTime -= 0xd53e8000;
227  ft.dwHighDateTime -= 0x19db1de;
228
229  newtime.tv_sec  = (*(uint64_t *) &ft) / 10000000;
230  newtime.tv_usec = (*(uint64_t *) &ft) / 10 % 1000000;
231 #else
178    newtime.tv_sec  = 0;
179    newtime.tv_usec = 0;
180  
181    if (gettimeofday(&newtime, NULL) == -1)
182    {
183 <    ilog(L_ERROR, "Clock Failure (%s), TS can be corrupted",
183 >    ilog(LOG_TYPE_IRCD, "Clock Failure (%s), TS can be corrupted",
184           strerror(errno));
185 <    sendto_realops_flags(UMODE_ALL, L_ALL,
185 >    sendto_realops_flags(UMODE_ALL, L_ALL, SEND_NOTICE,
186                           "Clock Failure (%s), TS can be corrupted",
187                           strerror(errno));
188      restart("Clock Failure");
189    }
244 #endif
190  
191    if (newtime.tv_sec < CurrentTime)
192    {
193 <    ircsprintf(to_send, "System clock is running backwards - (%lu < %lu)",
194 <               (unsigned long)newtime.tv_sec, (unsigned long)CurrentTime);
193 >    snprintf(to_send, sizeof(to_send),
194 >             "System clock is running backwards - (%lu < %lu)",
195 >             (unsigned long)newtime.tv_sec, (unsigned long)CurrentTime);
196      report_error(L_ALL, to_send, me.name, 0);
197      set_back_events(CurrentTime - newtime.tv_sec);
198    }
# Line 281 | Line 227 | io_loop(void)
227        {
228          struct Client *client_p = ptr->data;
229          assert(client_p->localClient->list_task);
230 <        safe_list_channels(client_p, client_p->localClient->list_task, 0, 0);
230 >        safe_list_channels(client_p, client_p->localClient->list_task, 0);
231        }
232      }
233  
# Line 304 | Line 250 | io_loop(void)
250      }
251      if (doremotd)
252      {
253 <      read_message_file(&ConfigFileEntry.motd);
254 <      sendto_realops_flags(UMODE_ALL, L_ALL,
255 <                           "Got signal SIGUSR1, reloading ircd motd file");
253 >      motd_recache();
254 >      sendto_realops_flags(UMODE_ALL, L_ALL, SEND_NOTICE,
255 >                           "Got signal SIGUSR1, reloading motd files");
256        doremotd = 0;
257      }
258    }
# Line 347 | Line 293 | initialize_global_set_options(void)
293    }
294  
295    GlobalSetOptions.ident_timeout = IDENT_TIMEOUT;
350  GlobalSetOptions.idletime = ConfigFileEntry.idletime;
296    /* End of global set options */
297   }
298  
354 /* initialize_message_files()
355 *
356 * inputs       - none
357 * output       - none
358 * side effects - Set up all message files needed, motd etc.
359 */
360 static void
361 initialize_message_files(void)
362 {
363  init_message_file(USER_MOTD, MPATH, &ConfigFileEntry.motd);
364  init_message_file(OPER_MOTD, OPATH, &ConfigFileEntry.opermotd);
365  init_message_file(USER_LINKS, LIPATH, &ConfigFileEntry.linksfile);
366
367  read_message_file(&ConfigFileEntry.motd);
368  read_message_file(&ConfigFileEntry.opermotd);
369  read_message_file(&ConfigFileEntry.linksfile);
370
371  init_isupport();
372 }
373
299   /* initialize_server_capabs()
300   *
301   * inputs       - none
# Line 380 | Line 305 | static void
305   initialize_server_capabs(void)
306   {
307    add_capability("QS", CAP_QS, 1);
383  add_capability("LL", CAP_LL, 1);
308    add_capability("EOB", CAP_EOB, 1);
309 <  if (ServerInfo.sid != NULL)   /* only enable TS6 if we have an SID */
386 <    add_capability("TS6", CAP_TS6, 0);
387 <  add_capability("ZIP", CAP_ZIP, 0);
309 >  add_capability("TS6", CAP_TS6, 0);
310    add_capability("CLUSTER", CAP_CLUSTER, 1);
311 + //  add_capability("FAKEHOST", CAP_FAKEHOST, 1);
312 +  add_capability("SVS", CAP_SVS, 1);
313   #ifdef HALFOPS
314    add_capability("HOPS", CAP_HOPS, 1);
315   #endif
# Line 400 | Line 324 | initialize_server_capabs(void)
324   static void
325   write_pidfile(const char *filename)
326   {
327 <  FBFILE *fb;
327 >  FILE *fb;
328  
329 <  if ((fb = fbopen(filename, "w")))
329 >  if ((fb = fopen(filename, "w")))
330    {
331      char buff[32];
332      unsigned int pid = (unsigned int)getpid();
409    size_t nbytes = ircsprintf(buff, "%u\n", pid);
333  
334 <    if ((fbputs(buff, fb, nbytes) == -1))
335 <      ilog(L_ERROR, "Error writing %u to pid file %s (%s)",
334 >    snprintf(buff, sizeof(buff), "%u\n", pid);
335 >
336 >    if ((fputs(buff, fb) == -1))
337 >      ilog(LOG_TYPE_IRCD, "Error writing %u to pid file %s (%s)",
338             pid, filename, strerror(errno));
339  
340 <    fbclose(fb);
416 <    return;
340 >    fclose(fb);
341    }
342    else
343    {
344 <    ilog(L_ERROR, "Error opening pid file %s", filename);
344 >    ilog(LOG_TYPE_IRCD, "Error opening pid file %s", filename);
345    }
346   }
347  
# Line 432 | Line 356 | write_pidfile(const char *filename)
356   static void
357   check_pidfile(const char *filename)
358   {
359 < #ifndef _WIN32
436 <  FBFILE *fb;
359 >  FILE *fb;
360    char buff[32];
361    pid_t pidfromfile;
362  
363    /* Don't do logging here, since we don't have log() initialised */
364 <  if ((fb = fbopen(filename, "r")))
364 >  if ((fb = fopen(filename, "r")))
365    {
366 <    if (fbgets(buff, 20, fb) == NULL)
366 >    if (fgets(buff, 20, fb) == NULL)
367      {
368        /* log(L_ERROR, "Error reading from pid file %s (%s)", filename,
369         * strerror(errno));
# Line 458 | Line 381 | check_pidfile(const char *filename)
381        }
382      }
383  
384 <    fbclose(fb);
384 >    fclose(fb);
385    }
386    else if (errno != ENOENT)
387    {
388      /* log(L_ERROR, "Error opening pid file %s", filename); */
389    }
467 #endif
390   }
391  
392   /* setup_corefile()
# Line 489 | Line 411 | setup_corefile(void)
411   #endif
412   }
413  
414 + #ifdef HAVE_LIBCRYPTO
415 + static int
416 + always_accept_verify_cb(int preverify_ok, X509_STORE_CTX *x509_ctx)
417 + {
418 +  return 1;
419 + }
420 + #endif
421 +
422   /* init_ssl()
423   *
424   * inputs       - nothing
# Line 496 | Line 426 | setup_corefile(void)
426   * side effects - setups SSL context.
427   */
428   static void
429 < init_ssl(void)
429 > ssl_init(void)
430   {
431   #ifdef HAVE_LIBCRYPTO
432    SSL_load_error_strings();
433    SSLeay_add_ssl_algorithms();
434  
435 <  ServerInfo.ctx = SSL_CTX_new(SSLv23_server_method());
506 <  if (!ServerInfo.ctx)
435 >  if ((ServerInfo.server_ctx = SSL_CTX_new(SSLv23_server_method())) == NULL)
436    {
437      const char *s;
438  
439 <    fprintf(stderr, "ERROR: Could not initialize the SSL context -- %s\n",
439 >    fprintf(stderr, "ERROR: Could not initialize the SSL Server context -- %s\n",
440              s = ERR_lib_error_string(ERR_get_error()));
441 <    ilog(L_CRIT, "ERROR: Could not initialize the SSL context -- %s\n", s);
441 >    ilog(LOG_TYPE_IRCD, "ERROR: Could not initialize the SSL Server context -- %s\n", s);
442    }
443  
444 <  SSL_CTX_set_options(ServerInfo.ctx, SSL_OP_NO_SSLv2);
445 <  SSL_CTX_set_options(ServerInfo.ctx, SSL_OP_TLS_ROLLBACK_BUG|SSL_OP_ALL);
446 <  SSL_CTX_set_verify(ServerInfo.ctx, SSL_VERIFY_NONE, NULL);
444 >  SSL_CTX_set_options(ServerInfo.server_ctx, SSL_OP_NO_SSLv2|SSL_OP_NO_SSLv3|SSL_OP_NO_TLSv1);
445 >  SSL_CTX_set_options(ServerInfo.server_ctx, SSL_OP_TLS_ROLLBACK_BUG|SSL_OP_ALL);
446 >  SSL_CTX_set_verify(ServerInfo.server_ctx, SSL_VERIFY_PEER|SSL_VERIFY_CLIENT_ONCE,
447 >                     always_accept_verify_cb);
448  
449 <  bio_spare_fd = save_spare_fd("SSL private key validation");
450 < #endif /* HAVE_LIBCRYPTO */
451 < }
449 >  if ((ServerInfo.client_ctx = SSL_CTX_new(SSLv23_client_method())) == NULL)
450 >  {
451 >    const char *s;
452  
453 < /* init_callbacks()
454 < *
455 < * inputs       - nothing
456 < * output       - nothing
457 < * side effects - setups standard hook points
458 < */
459 < static void
460 < init_callbacks(void)
461 < {
462 <  iorecv_cb = register_callback("iorecv", NULL);
533 <  iosend_cb = register_callback("iosend", NULL);
534 <  iorecvctrl_cb = register_callback("iorecvctrl", NULL);
535 <  iosendctrl_cb = register_callback("iosendctrl", NULL);
453 >    fprintf(stderr, "ERROR: Could not initialize the SSL Client context -- %s\n",
454 >            s = ERR_lib_error_string(ERR_get_error()));
455 >    ilog(LOG_TYPE_IRCD, "ERROR: Could not initialize the SSL Client context -- %s\n", s);
456 >  }
457 >
458 >  SSL_CTX_set_options(ServerInfo.client_ctx, SSL_OP_NO_SSLv2|SSL_OP_NO_SSLv3|SSL_OP_NO_TLSv1);
459 >  SSL_CTX_set_options(ServerInfo.client_ctx, SSL_OP_TLS_ROLLBACK_BUG|SSL_OP_ALL);
460 >  SSL_CTX_set_verify(ServerInfo.client_ctx, SSL_VERIFY_PEER|SSL_VERIFY_CLIENT_ONCE,
461 >                     always_accept_verify_cb);
462 > #endif /* HAVE_LIBCRYPTO */
463   }
464  
465   int
466   main(int argc, char *argv[])
467   {
468 <  /* Check to see if the user is running
542 <   * us as root, which is a nono
543 <   */
544 < #ifndef _WIN32
468 >  /* Check to see if the user is running us as root, which is a nono */
469    if (geteuid() == 0)
470    {
471      fprintf(stderr, "Don't run ircd as root!!!\n");
472 <    return(-1);
472 >    return -1;
473    }
474  
475    /* Setup corefile size immediately after boot -kre */
476    setup_corefile();
477  
554  /* set initialVMTop before we allocate any memory */
555  initialVMTop = get_vm_top();
556 #endif
557
478    /* save server boot time right away, so getrusage works correctly */
479    set_time();
480  
481 <    /* It ain't random, but it ought to be a little harder to guess */
482 <  srand(SystemTime.tv_sec ^ (SystemTime.tv_usec | (getpid() << 20)));
483 <  memset(&me, 0, sizeof(me));
564 <  memset(&meLocalUser, 0, sizeof(meLocalUser));
481 >  /* It ain't random, but it ought to be a little harder to guess */
482 >  init_genrand(SystemTime.tv_sec ^ (SystemTime.tv_usec | (getpid() << 20)));
483 >
484    me.localClient = &meLocalUser;
485 <  dlinkAdd(&me, &me.node, &global_client_list); /* Pointer to beginning
485 >  dlinkAdd(&me, &me.node, &global_client_list);  /* Pointer to beginning
486                                                     of Client list */
568
569  memset(&ServerInfo, 0, sizeof(ServerInfo));
570
487    /* Initialise the channel capability usage counts... */
488    init_chcap_usage_counts();
489  
490    ConfigFileEntry.dpath      = DPATH;
491 <  ConfigFileEntry.configfile = CPATH;  /* Server configuration file */
492 <  ConfigFileEntry.klinefile  = KPATH;  /* Server kline file         */
493 <  ConfigFileEntry.xlinefile  = XPATH;  /* Server xline file         */
494 <  ConfigFileEntry.rxlinefile = RXPATH; /* Server regex xline file   */
495 <  ConfigFileEntry.rklinefile = RKPATH; /* Server regex kline file   */
496 <  ConfigFileEntry.dlinefile  = DLPATH; /* dline file                */
497 <  ConfigFileEntry.glinefile  = GPATH;  /* gline log file            */
582 <  ConfigFileEntry.cresvfile  = CRESVPATH; /* channel resv file      */
583 <  ConfigFileEntry.nresvfile  = NRESVPATH; /* nick resv file         */
491 >  ConfigFileEntry.configfile = CPATH;    /* Server configuration file */
492 >  ConfigFileEntry.klinefile  = KPATH;    /* Server kline file         */
493 >  ConfigFileEntry.glinefile  = GPATH;    /* Server gline file         */
494 >  ConfigFileEntry.xlinefile  = XPATH;    /* Server xline file         */
495 >  ConfigFileEntry.dlinefile  = DLPATH;   /* dline file                */
496 >  ConfigFileEntry.resvfile   = RESVPATH; /* resv file                 */
497 >
498    myargv = argv;
499    umask(077);                /* better safe than sorry --SRB */
500  
# Line 598 | Line 512 | main(int argc, char *argv[])
512      exit(EXIT_FAILURE);
513    }
514  
515 <  init_ssl();
515 >  ssl_init();
516  
603 #ifndef _WIN32
517    if (!server_state.foreground)
518    {
519      make_daemon();
# Line 610 | Line 523 | main(int argc, char *argv[])
523      print_startup(getpid());
524  
525    setup_signals();
613 #endif
614
615  get_ircd_platform(ircd_platform);
526  
527    /* Init the event subsystem */
528    eventInit();
529 +
530    /* We need this to initialise the fd array before anything else */
531    fdlist_init();
532 <  init_log(logFileName);
532 >  log_set_file(LOG_TYPE_IRCD, 0, logFileName);
533    check_can_use_v6();
534    init_comm();         /* This needs to be setup early ! -- adrian */
535 +
536    /* Check if there is pidfile and daemon already running */
537    check_pidfile(pidFileName);
538  
539 < #ifndef NOBALLOC
628 <  initBlockHeap();
629 < #endif
539 >  mp_pool_init();
540    init_dlink_nodes();
541 <  init_callbacks();
632 <  initialize_message_files();
541 >  init_isupport();
542    dbuf_init();
543 <  init_hash();
543 >  hash_init();
544    init_ip_hash_table();      /* client host ip hash table */
545    init_host_hash();          /* Host-hashtable. */
546 <  clear_tree_parse();
547 <  init_client();
548 <  init_class();
549 <  init_whowas();
550 <  init_stats();
546 >  client_init();
547 >  class_init();
548 >  whowas_init();
549 >  watch_init();
550 >  auth_init();          /* Initialise the auth code */
551 >  init_resolver();      /* Needs to be setup before the io loop */
552 >  modules_init();
553    read_conf_files(1);   /* cold start init conf files */
643  initServerMask();
644  me.id[0] = '\0';
554    init_uid();
646  init_auth();          /* Initialise the auth code */
647 #ifndef _WIN32
648  init_resolver();      /* Needs to be setup before the io loop */
649 #endif
555    initialize_server_capabs();   /* Set up default_server_capabs */
556    initialize_global_set_options();
557 <  init_channels();
557 >  channel_init();
558 >  read_links_file();
559 >  motd_init();
560 > #ifdef HAVE_LIBGEOIP
561 >  geoip_ctx = GeoIP_new(GEOIP_MEMORY_CACHE);
562 > #endif
563  
564 <  if (ServerInfo.name == NULL)
564 >  if (EmptyString(ServerInfo.sid))
565    {
566 <    ilog(L_CRIT, "No server name specified in serverinfo block.");
566 >    ilog(LOG_TYPE_IRCD, "ERROR: No server id specified in serverinfo block.");
567      exit(EXIT_FAILURE);
568    }
569 +
570 +  strlcpy(me.id, ServerInfo.sid, sizeof(me.id));
571 +
572 +  if (EmptyString(ServerInfo.name))
573 +  {
574 +    ilog(LOG_TYPE_IRCD, "ERROR: No server name specified in serverinfo block.");
575 +    exit(EXIT_FAILURE);
576 +  }
577 +
578    strlcpy(me.name, ServerInfo.name, sizeof(me.name));
579  
580    /* serverinfo{} description must exist.  If not, error out.*/
581 <  if (ServerInfo.description == NULL)
581 >  if (EmptyString(ServerInfo.description))
582    {
583 <    ilog(L_CRIT,
665 <      "ERROR: No server description specified in serverinfo block.");
583 >    ilog(LOG_TYPE_IRCD, "ERROR: No server description specified in serverinfo block.");
584      exit(EXIT_FAILURE);
585    }
586 +
587    strlcpy(me.info, ServerInfo.description, sizeof(me.info));
588  
589 <  me.from    = &me;
590 <  me.servptr = &me;
589 >  me.from                   = &me;
590 >  me.servptr                = &me;
591 >  me.localClient->lasttime  = CurrentTime;
592 >  me.localClient->since     = CurrentTime;
593 >  me.localClient->firsttime = CurrentTime;
594  
595    SetMe(&me);
596    make_server(&me);
597  
598 <  me.lasttime = me.since = me.firsttime = CurrentTime;
598 >  hash_add_id(&me);
599    hash_add_client(&me);
600    
601    /* add ourselves to global_serv_list */
602    dlinkAdd(&me, make_dlink_node(), &global_serv_list);
603  
604 <  check_class();
604 >  load_kline_database();
605 >  load_dline_database();
606 >  load_gline_database();
607 >  load_xline_database();
608 >  load_resv_database();
609  
684 #ifndef STATIC_MODULES
610    if (chdir(MODPATH))
611    {
612 <    ilog (L_CRIT, "Could not load core modules. Terminating!");
612 >    ilog(LOG_TYPE_IRCD, "Could not load core modules. Terminating!");
613      exit(EXIT_FAILURE);
614    }
615  
616    load_all_modules(1);
617    load_conf_modules();
618    load_core_modules(1);
619 +
620    /* Go back to DPATH after checking to see if we can chdir to MODPATH */
621 <  chdir(ConfigFileEntry.dpath);
622 < #else
623 <  load_all_modules(1);
624 < #endif
621 >  if (chdir(ConfigFileEntry.dpath))
622 >  {
623 >    perror("chdir");
624 >    exit(EXIT_FAILURE);
625 >  }
626 >
627    /*
628     * assemble_umode_buffer() has to be called after
629     * reading conf/loading modules.
# Line 704 | Line 632 | main(int argc, char *argv[])
632  
633    write_pidfile(pidFileName);
634  
635 <  ilog(L_NOTICE, "Server Ready");
635 >  ilog(LOG_TYPE_IRCD, "Server Ready");
636  
637    eventAddIsh("cleanup_glines", cleanup_glines, NULL, CLEANUP_GLINES_TIME);
638    eventAddIsh("cleanup_tklines", cleanup_tklines, NULL, CLEANUP_TKLINES_TIME);
# Line 713 | Line 641 | main(int argc, char *argv[])
641    /* No, 'cause after a restart it would cause all sorts of nick collides */
642    eventAddIsh("try_connections", try_connections, NULL, STARTUP_CONNECTIONS_TIME);
643  
716  eventAddIsh("collect_zipstats", collect_zipstats, NULL, ZIPSTATS_TIME);
717
644    /* Setup the timeout check. I'll shift it later :)  -- adrian */
645    eventAddIsh("comm_checktimeouts", comm_checktimeouts, NULL, 1);
646  
647 +  eventAddIsh("save_all_databases", save_all_databases, NULL, DATABASE_UPDATE_TIMEOUT);
648 +
649    if (ConfigServerHide.links_delay > 0)
650      eventAddIsh("write_links_file", write_links_file, NULL, ConfigServerHide.links_delay);
651    else
# Line 727 | Line 655 | main(int argc, char *argv[])
655      eventAddIsh("check_splitmode", check_splitmode, NULL, 60);
656  
657    io_loop();
658 <  return(0);
658 >  return 0;
659   }

Comparing:
ircd-hybrid/src/ircd.c (property svn:keywords), Revision 30 by adx, Sun Oct 2 20:03:27 2005 UTC vs.
ircd-hybrid/trunk/src/ircd.c (property svn:keywords), Revision 2330 by michael, Sun Jun 23 13:29:56 2013 UTC

# Line 1 | Line 1
1 < "Id Revision"
1 > Id Revision

Diff Legend

Removed lines
+ Added lines
< Changed lines (old)
> Changed lines (new)