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/trunk/src/ircd.c (file contents):
Revision 4850 by michael, Wed Nov 5 17:06:35 2014 UTC vs.
Revision 5723 by michael, Sun Mar 22 16:28:58 2015 UTC

# Line 1 | Line 1
1   /*
2   *  ircd-hybrid: an advanced, lightweight Internet Relay Chat Daemon (ircd)
3   *
4 < *  Copyright (c) 1997-2014 ircd-hybrid development team
4 > *  Copyright (c) 1997-2015 ircd-hybrid development team
5   *
6   *  This program is free software; you can redistribute it and/or modify
7   *  it under the terms of the GNU General Public License as published by
# Line 63 | Line 63
63   GeoIP *geoip_ctx;
64   #endif
65  
66 + /* /quote set variables */
67 + struct SetOptions GlobalSetOptions;
68 + struct Counter Count;
69 + struct ServerState_t server_state;
70 + struct ServerStatistics ServerStats;
71   struct timeval SystemTime;
67 struct Client me;             /* That's me */
72   struct Connection meConnection; /* That's also part of me */
73 + struct Client me = { .connection = &meConnection };  /* That's me */
74  
75 + char **myargv;
76   const char *logFileName = LPATH;
77   const char *pidFileName = PPATH;
78  
79 < char **myargv;
80 <
75 < int dorehash = 0;
76 < int doremotd = 0;
77 <
78 < /* Set to zero because it should be initialized later using
79 < * initialize_server_capabs
80 < */
79 > unsigned int dorehash;
80 > unsigned int doremotd;
81   unsigned int default_server_capabs;
82   unsigned int splitmode;
83   unsigned int splitchecking;
# Line 237 | Line 237 | io_loop(void)
237      /* Check to see whether we have to rehash the configuration .. */
238      if (dorehash)
239      {
240 <      rehash(1);
240 >      conf_rehash(1);
241        dorehash = 0;
242      }
243  
# Line 260 | Line 260 | io_loop(void)
260   static void
261   initialize_global_set_options(void)
262   {
263 <  GlobalSetOptions.autoconn  = 1;
263 >  GlobalSetOptions.maxclients = ConfigServerInfo.default_max_clients;
264 >  GlobalSetOptions.autoconn = 1;
265    GlobalSetOptions.spam_time = MIN_JOIN_LEAVE_TIME;
266 <  GlobalSetOptions.spam_num  = MAX_JOIN_LEAVE_COUNT;
267 <
268 <  if (ConfigGeneral.default_floodcount)
269 <    GlobalSetOptions.floodcount = ConfigGeneral.default_floodcount;
269 <  else
270 <    GlobalSetOptions.floodcount = 10;
271 <
272 <  /* XXX I have no idea what to try here - Dianora */
273 <  GlobalSetOptions.joinfloodcount = 16;
274 <  GlobalSetOptions.joinfloodtime = 8;
266 >  GlobalSetOptions.spam_num = MAX_JOIN_LEAVE_COUNT;
267 >  GlobalSetOptions.floodcount = ConfigGeneral.default_floodcount;
268 >  GlobalSetOptions.joinfloodcount = ConfigChannel.default_join_flood_count;
269 >  GlobalSetOptions.joinfloodtime = ConfigChannel.default_join_flood_time;
270  
271    split_servers = ConfigChannel.default_split_server_count;
272    split_users   = ConfigChannel.default_split_user_count;
# Line 322 | Line 317 | write_pidfile(const char *filename)
317      snprintf(buff, sizeof(buff), "%u\n", pid);
318  
319      if (fputs(buff, fb) == -1)
320 <      ilog(LOG_TYPE_IRCD, "Error writing %u to pid file %s (%s)",
320 >      ilog(LOG_TYPE_IRCD, "Error writing %u to pid file %s: %s",
321             pid, filename, strerror(errno));
322  
323      fclose(fb);
324    }
325    else
326 <  {
332 <    ilog(LOG_TYPE_IRCD, "Error opening pid file %s (%s)",
326 >    ilog(LOG_TYPE_IRCD, "Error opening pid file %s: %s",
327           filename, strerror(errno));
334  }
328   }
329  
330   /* check_pidfile()
# Line 436 | Line 429 | ssl_init(void)
429    SSL_CTX_set_verify(ConfigServerInfo.server_ctx, SSL_VERIFY_PEER|SSL_VERIFY_CLIENT_ONCE,
430                       always_accept_verify_cb);
431    SSL_CTX_set_session_cache_mode(ConfigServerInfo.server_ctx, SSL_SESS_CACHE_OFF);
432 +  SSL_CTX_set_cipher_list(ConfigServerInfo.server_ctx, "EECDH+HIGH:EDH+HIGH:HIGH:!aNULL");
433  
434   #if OPENSSL_VERSION_NUMBER >= 0x009080FFL && !defined(OPENSSL_NO_ECDH)
435    {
# Line 482 | Line 476 | main(int argc, char *argv[])
476    /* Setup corefile size immediately after boot -kre */
477    setup_corefile();
478  
479 <  /* save server boot time right away, so getrusage works correctly */
479 >  /* Save server boot time right away, so getrusage works correctly */
480    set_time();
481  
482 <  /* It ain't random, but it ought to be a little harder to guess */
482 >  /* It's not random, but it ought to be a little harder to guess */
483    init_genrand(SystemTime.tv_sec ^ (SystemTime.tv_usec | (getpid() << 20)));
484  
485 <  me.connection = &meConnection;
486 <  dlinkAdd(&me, &me.node, &global_client_list);  /* Pointer to beginning
493 <                                                   of Client list */
494 <  ConfigLog.use_logging = 1;
485 >  dlinkAdd(&me, &me.node, &global_client_list);
486 >
487    ConfigGeneral.dpath      = DPATH;
488    ConfigGeneral.spath      = SPATH;
489    ConfigGeneral.mpath      = MPATH;
# Line 503 | Line 495 | main(int argc, char *argv[])
495    ConfigGeneral.resvfile   = RESVPATH; /* resv file                 */
496  
497    myargv = argv;
498 <  umask(077);                /* better safe than sorry --SRB */
498 >  umask(077);  /* umask 077: u=rwx,g=,o= */
499  
500    parseargs(&argc, &argv, myopts);
501  
# Line 556 | Line 548 | main(int argc, char *argv[])
548    read_conf_files(1);   /* cold start init conf files */
549    init_uid();
550    initialize_server_capabs();   /* Set up default_server_capabs */
551 <  initialize_global_set_options();
551 >  initialize_global_set_options();  /* Has to be called after read_conf_files() */
552    channel_init();
553    read_links_file();
554    motd_init();
555 +  user_usermodes_init();
556   #ifdef HAVE_LIBGEOIP
557    geoip_ctx = GeoIP_new(GEOIP_MEMORY_CACHE);
558   #endif
# Line 589 | Line 582 | main(int argc, char *argv[])
582  
583    strlcpy(me.info, ConfigServerInfo.description, sizeof(me.info));
584  
585 <  me.from                   = &me;
586 <  me.servptr                = &me;
587 <  me.connection->lasttime  = CurrentTime;
588 <  me.connection->since     = CurrentTime;
585 >  me.from = &me;
586 >  me.servptr = &me;
587 >  me.connection->lasttime = CurrentTime;
588 >  me.connection->since = CurrentTime;
589    me.connection->firsttime = CurrentTime;
590  
591    SetMe(&me);
# Line 609 | Line 602 | main(int argc, char *argv[])
602    load_xline_database();
603    load_resv_database();
604  
612  if (chdir(MODPATH))
613  {
614    ilog(LOG_TYPE_IRCD, "Could not load core modules. Terminating!");
615    exit(EXIT_FAILURE);
616  }
617
605    load_all_modules(1);
606    load_conf_modules();
607    load_core_modules(1);
608  
622  /* Go back to DPATH after checking to see if we can chdir to MODPATH */
623  if (chdir(ConfigGeneral.dpath))
624  {
625    perror("chdir");
626    exit(EXIT_FAILURE);
627  }
628
629  /*
630   * assemble_umode_buffer() has to be called after
631   * reading conf/loading modules.
632   */
633  assemble_umode_buffer();
634
609    write_pidfile(pidFileName);
610  
611    ilog(LOG_TYPE_IRCD, "Server Ready");

Diff Legend

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