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

Comparing:
ircd-hybrid-8/src/ircd.c (file contents), Revision 1309 by michael, Sun Mar 25 11:24:18 2012 UTC vs.
ircd-hybrid/trunk/src/ircd.c (file contents), Revision 1632 by michael, Sun Nov 4 15:37:10 2012 UTC

# Line 36 | Line 36
36   #include "ircd_signal.h"
37   #include "s_gline.h"
38   #include "motd.h"
39 + #include "conf.h"
40   #include "hostmask.h"
41   #include "numeric.h"
42   #include "packet.h"
# Line 45 | Line 46
46   #include "rng_mt.h"
47   #include "s_auth.h"
48   #include "s_bsd.h"
48 #include "conf.h"
49   #include "log.h"
50   #include "s_misc.h"
51   #include "s_serv.h"      /* try_connections */
# Line 59 | Line 59
59   #include "motd.h"
60   #include "supported.h"
61   #include "watch.h"
62 <
62 > #include "conf_db.h"
63 > #include "conf_class.h"
64  
65   /* /quote set variables */
66   struct SetOptions GlobalSetOptions;
# Line 72 | Line 73 | struct server_info ServerInfo;
73   struct admin_info AdminInfo = { NULL, NULL, NULL };
74   struct Counter Count = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
75   struct ServerState_t server_state = { 0 };
76 < struct logging_entry ConfigLoggingEntry = { 1, 1 };
76 > struct logging_entry ConfigLoggingEntry = { .use_logging = 1 };
77   struct ServerStatistics ServerStats;
78   struct timeval SystemTime;
79   struct Client me;             /* That's me */
# Line 82 | Line 83 | const char *logFileName = LPATH;
83   const char *pidFileName = PPATH;
84  
85   char **myargv;
85 char ircd_platform[PLATFORMLEN];
86  
87   int dorehash = 0;
88   int doremotd = 0;
# Line 142 | Line 142 | make_daemon(void)
142  
143   static int printVersion = 0;
144  
145 < struct lgetopt myopts[] = {
145 > static struct lgetopt myopts[] = {
146    {"dlinefile",  &ConfigFileEntry.dlinefile,
147     STRING, "File to use for dline.conf"},
148    {"configfile", &ConfigFileEntry.configfile,
# Line 175 | Line 175 | set_time(void)
175    {
176      ilog(LOG_TYPE_IRCD, "Clock Failure (%s), TS can be corrupted",
177           strerror(errno));
178 <    sendto_realops_flags(UMODE_ALL, L_ALL,
178 >    sendto_realops_flags(UMODE_ALL, L_ALL, SEND_NOTICE,
179                           "Clock Failure (%s), TS can be corrupted",
180                           strerror(errno));
181      restart("Clock Failure");
# Line 244 | Line 244 | io_loop(void)
244      if (doremotd)
245      {
246        read_message_file(&ConfigFileEntry.motd);
247 <      sendto_realops_flags(UMODE_ALL, L_ALL,
247 >      sendto_realops_flags(UMODE_ALL, L_ALL, SEND_NOTICE,
248                             "Got signal SIGUSR1, reloading ircd motd file");
249        doremotd = 0;
250      }
# Line 299 | Line 299 | static void
299   initialize_message_files(void)
300   {
301    init_message_file(USER_MOTD, MPATH, &ConfigFileEntry.motd);
302  init_message_file(OPER_MOTD, OPATH, &ConfigFileEntry.opermotd);
302    init_message_file(USER_LINKS, LIPATH, &ConfigFileEntry.linksfile);
303  
304    read_message_file(&ConfigFileEntry.motd);
306  read_message_file(&ConfigFileEntry.opermotd);
305    read_message_file(&ConfigFileEntry.linksfile);
306  
307    init_isupport();
# Line 336 | Line 334 | initialize_server_capabs(void)
334   static void
335   write_pidfile(const char *filename)
336   {
337 <  FBFILE *fb;
337 >  FILE *fb;
338  
339 <  if ((fb = fbopen(filename, "w")))
339 >  if ((fb = fopen(filename, "w")))
340    {
341      char buff[32];
342      unsigned int pid = (unsigned int)getpid();
345    size_t nbytes = snprintf(buff, sizeof(buff), "%u\n", pid);
343  
344 <    if ((fbputs(buff, fb, nbytes) == -1))
344 >    snprintf(buff, sizeof(buff), "%u\n", pid);
345 >
346 >    if ((fputs(buff, fb) == -1))
347        ilog(LOG_TYPE_IRCD, "Error writing %u to pid file %s (%s)",
348             pid, filename, strerror(errno));
349  
350 <    fbclose(fb);
352 <    return;
350 >    fclose(fb);
351    }
352    else
353    {
# Line 368 | Line 366 | write_pidfile(const char *filename)
366   static void
367   check_pidfile(const char *filename)
368   {
369 <  FBFILE *fb;
369 >  FILE *fb;
370    char buff[32];
371    pid_t pidfromfile;
372  
373    /* Don't do logging here, since we don't have log() initialised */
374 <  if ((fb = fbopen(filename, "r")))
374 >  if ((fb = fopen(filename, "r")))
375    {
376 <    if (fbgets(buff, 20, fb) == NULL)
376 >    if (fgets(buff, 20, fb) == NULL)
377      {
378        /* log(L_ERROR, "Error reading from pid file %s (%s)", filename,
379         * strerror(errno));
# Line 393 | Line 391 | check_pidfile(const char *filename)
391        }
392      }
393  
394 <    fbclose(fb);
394 >    fclose(fb);
395    }
396    else if (errno != ENOENT)
397    {
# Line 445 | Line 443 | init_ssl(void)
443      ilog(LOG_TYPE_IRCD, "ERROR: Could not initialize the SSL Server context -- %s\n", s);
444    }
445  
446 <  SSL_CTX_set_options(ServerInfo.server_ctx, SSL_OP_NO_SSLv2);
446 >  SSL_CTX_set_options(ServerInfo.server_ctx, SSL_OP_NO_SSLv2|SSL_OP_NO_SSLv3|SSL_OP_NO_TLSv1);
447    SSL_CTX_set_options(ServerInfo.server_ctx, SSL_OP_TLS_ROLLBACK_BUG|SSL_OP_ALL);
448    SSL_CTX_set_verify(ServerInfo.server_ctx, SSL_VERIFY_NONE, NULL);
449  
# Line 458 | Line 456 | init_ssl(void)
456      ilog(LOG_TYPE_IRCD, "ERROR: Could not initialize the SSL Client context -- %s\n", s);
457    }
458  
459 <  SSL_CTX_set_options(ServerInfo.client_ctx, SSL_OP_NO_SSLv2);
459 >  SSL_CTX_set_options(ServerInfo.client_ctx, SSL_OP_NO_SSLv2|SSL_OP_NO_SSLv3|SSL_OP_NO_TLSv1);
460    SSL_CTX_set_options(ServerInfo.client_ctx, SSL_OP_TLS_ROLLBACK_BUG|SSL_OP_ALL);
461    SSL_CTX_set_verify(ServerInfo.client_ctx, SSL_VERIFY_NONE, NULL);
462   #endif /* HAVE_LIBCRYPTO */
# Line 508 | Line 506 | main(int argc, char *argv[])
506    ConfigFileEntry.configfile = CPATH;  /* Server configuration file */
507    ConfigFileEntry.klinefile  = KPATH;  /* Server kline file         */
508    ConfigFileEntry.xlinefile  = XPATH;  /* Server xline file         */
511  ConfigFileEntry.rxlinefile = RXPATH; /* Server regex xline file   */
512  ConfigFileEntry.rklinefile = RKPATH; /* Server regex kline file   */
509    ConfigFileEntry.dlinefile  = DLPATH; /* dline file                */
510 <  ConfigFileEntry.glinefile  = GPATH;  /* gline log file            */
511 <  ConfigFileEntry.cresvfile  = CRESVPATH; /* channel resv file      */
516 <  ConfigFileEntry.nresvfile  = NRESVPATH; /* nick resv file         */
510 > //  ConfigFileEntry.cresvfile  = CRESVPATH; /* channel resv file      */
511 > //  ConfigFileEntry.nresvfile  = NRESVPATH; /* nick resv file         */
512    myargv = argv;
513    umask(077);                /* better safe than sorry --SRB */
514  
# Line 543 | Line 538 | main(int argc, char *argv[])
538  
539    setup_signals();
540  
546  get_ircd_platform(ircd_platform);
547
541    /* Init the event subsystem */
542    eventInit();
543    /* We need this to initialise the fd array before anything else */
# Line 563 | Line 556 | main(int argc, char *argv[])
556    init_hash();
557    init_ip_hash_table();      /* client host ip hash table */
558    init_host_hash();          /* Host-hashtable. */
566  clear_tree_parse();
559    init_client();
560 <  init_class();
561 <  init_whowas();
560 >  class_init();
561 >  whowas_init();
562    watch_init();
563    init_auth();          /* Initialise the auth code */
564    init_resolver();      /* Needs to be setup before the io loop */
565 +  modules_init();
566    read_conf_files(1);   /* cold start init conf files */
567    init_uid();
568    initialize_server_capabs();   /* Set up default_server_capabs */
# Line 616 | Line 609 | main(int argc, char *argv[])
609    /* add ourselves to global_serv_list */
610    dlinkAdd(&me, make_dlink_node(), &global_serv_list);
611  
612 +  load_kline_database();
613 +  load_dline_database();
614 +  load_gline_database();
615 +  load_xline_database();
616 +  load_resv_database();
617 +
618    if (chdir(MODPATH))
619    {
620      ilog(LOG_TYPE_IRCD, "Could not load core modules. Terminating!");
# Line 653 | Line 652 | main(int argc, char *argv[])
652    /* Setup the timeout check. I'll shift it later :)  -- adrian */
653    eventAddIsh("comm_checktimeouts", comm_checktimeouts, NULL, 1);
654  
655 +  eventAddIsh("save_all_databases", save_all_databases, NULL, DATABASE_UPDATE_TIMEOUT);
656 +
657    if (ConfigServerHide.links_delay > 0)
658      eventAddIsh("write_links_file", write_links_file, NULL, ConfigServerHide.links_delay);
659    else

Diff Legend

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