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/trunk/src/ircd.c (file contents):
Revision 2872 by michael, Sun Jan 19 17:25:38 2014 UTC vs.
Revision 3140 by michael, Wed Mar 12 19:23:20 2014 UTC

# Line 1 | Line 1
1   /*
2 < *  ircd-hybrid: an advanced Internet Relay Chat Daemon(ircd).
3 < *  ircd.c: Starts up and runs the ircd.
2 > *  ircd-hybrid: an advanced, lightweight Internet Relay Chat Daemon (ircd)
3   *
4 < *  Copyright (C) 2002 by the past and present ircd coders, and others.
4 > *  Copyright (c) 1997-2014 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 18 | Line 17
17   *  along with this program; if not, write to the Free Software
18   *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307
19   *  USA
20 < *
21 < *  $Id$
20 > */
21 >
22 > /*! \file ircd.c
23 > * \brief Starts up and runs the ircd.
24 > * \version $Id$
25   */
26  
27   #include "stdinc.h"
# Line 139 | Line 141 | make_daemon(void)
141   static int printVersion = 0;
142  
143   static struct lgetopt myopts[] = {
144 <  {"configfile", &ConfigFileEntry.configfile,
144 >  {"configfile", &ConfigFileEntry.configfile,
145     STRING, "File to use for ircd.conf"},
146    {"glinefile",  &ConfigFileEntry.glinefile,
147     STRING, "File to use for gline database"},
148 <  {"klinefile",  &ConfigFileEntry.klinefile,
148 >  {"klinefile",  &ConfigFileEntry.klinefile,
149     STRING, "File to use for kline database"},
150    {"dlinefile",  &ConfigFileEntry.dlinefile,
151     STRING, "File to use for dline database"},
152 <  {"xlinefile",  &ConfigFileEntry.xlinefile,
152 >  {"xlinefile",  &ConfigFileEntry.xlinefile,
153     STRING, "File to use for xline database"},
154    {"resvfile",  &ConfigFileEntry.resvfile,
155     STRING, "File to use for resv database"},
156 <  {"logfile",    &logFileName,
156 >  {"logfile",    &logFileName,
157     STRING, "File to use for ircd.log"},
158    {"pidfile",    &pidFileName,
159     STRING, "File to use for process ID"},
160 <  {"foreground", &server_state.foreground,
160 >  {"foreground", &server_state.foreground,
161     YESNO, "Run in foreground (don't detach)"},
162 <  {"version",    &printVersion,
162 >  {"version",    &printVersion,
163     YESNO, "Print version and exit"},
164    {"help", NULL, USAGE, "Print this text"},
165    {NULL, NULL, STRING, NULL},
# Line 166 | Line 168 | static struct lgetopt myopts[] = {
168   void
169   set_time(void)
170   {
171 <  static char to_send[IRCD_BUFSIZE];
170 <  struct timeval newtime;
171 <  newtime.tv_sec  = 0;
172 <  newtime.tv_usec = 0;
171 >  struct timeval newtime = { .tv_sec = 0, .tv_usec = 0 };
172  
173    if (gettimeofday(&newtime, NULL) == -1)
174    {
# Line 183 | Line 182 | set_time(void)
182  
183    if (newtime.tv_sec < CurrentTime)
184    {
185 <    snprintf(to_send, sizeof(to_send),
186 <             "System clock is running backwards - (%lu < %lu)",
187 <             (unsigned long)newtime.tv_sec, (unsigned long)CurrentTime);
188 <    report_error(L_ALL, to_send, me.name, 0);
185 >    ilog(LOG_TYPE_IRCD, "System clock is running backwards - (%lu < %lu)",
186 >         (unsigned long)newtime.tv_sec, (unsigned long)CurrentTime);
187 >    sendto_realops_flags(UMODE_DEBUG, L_ALL, SEND_NOTICE,
188 >                         "System clock is running backwards - (%lu < %lu)",
189 >                         (unsigned long)newtime.tv_sec,
190 >                         (unsigned long)CurrentTime);
191      set_back_events(CurrentTime - newtime.tv_sec);
192    }
193  
# Line 201 | Line 202 | io_loop(void)
202    {
203      /*
204       * Maybe we want a flags word?
205 <     * ie. if (REHASHED_KLINES(global_flags))
205 >     * ie. if (REHASHED_KLINES(global_flags))
206       * SET_REHASHED_KLINES(global_flags)
207       * CLEAR_REHASHED_KLINES(global_flags)
208       *
# Line 233 | Line 234 | io_loop(void)
234      comm_select();
235      exit_aborted_clients();
236      free_exited_clients();
236    send_queued_all();
237  
238      /* Check to see whether we have to rehash the configuration .. */
239      if (dorehash)
# Line 245 | Line 245 | io_loop(void)
245      {
246        motd_recache();
247        sendto_realops_flags(UMODE_ALL, L_ALL, SEND_NOTICE,
248 <                           "Got signal SIGUSR1, reloading motd files");
248 >                           "Got signal SIGUSR1, reloading motd file(s)");
249        doremotd = 0;
250      }
251    }
# Line 255 | Line 255 | io_loop(void)
255   *
256   * inputs       - none
257   * output       - none
258 < * side effects - This sets all global set options needed
258 > * side effects - This sets all global set options needed
259   */
260   static void
261   initialize_global_set_options(void)
# Line 301 | Line 301 | initialize_server_capabs(void)
301    add_capability("EOB", CAP_EOB, 1);
302    add_capability("TS6", CAP_TS6, 0);
303    add_capability("CLUSTER", CAP_CLUSTER, 1);
304 //  add_capability("FAKEHOST", CAP_FAKEHOST, 1);
304    add_capability("SVS", CAP_SVS, 1);
305   #ifdef HALFOPS
306    add_capability("HOPS", CAP_HOPS, 1);
# Line 422 | Line 421 | static void
421   ssl_init(void)
422   {
423   #ifdef HAVE_LIBCRYPTO
424 +  const unsigned char session_id[] = "ircd-hybrid";
425 +
426    SSL_load_error_strings();
427    SSLeay_add_ssl_algorithms();
428  
# Line 438 | Line 439 | ssl_init(void)
439    SSL_CTX_set_options(ServerInfo.server_ctx, SSL_OP_TLS_ROLLBACK_BUG|SSL_OP_ALL);
440    SSL_CTX_set_verify(ServerInfo.server_ctx, SSL_VERIFY_PEER|SSL_VERIFY_CLIENT_ONCE,
441                       always_accept_verify_cb);
442 +  SSL_CTX_set_session_id_context(ServerInfo.server_ctx, session_id, sizeof(session_id) - 1);
443  
444    if ((ServerInfo.client_ctx = SSL_CTX_new(SSLv23_client_method())) == NULL)
445    {
# Line 477 | Line 479 | main(int argc, char *argv[])
479    me.localClient = &meLocalUser;
480    dlinkAdd(&me, &me.node, &global_client_list);  /* Pointer to beginning
481                                                     of Client list */
480  /* Initialise the channel capability usage counts... */
481  init_chcap_usage_counts();
482
482    ConfigFileEntry.dpath      = DPATH;
483    ConfigFileEntry.configfile = CPATH;    /* Server configuration file */
484    ConfigFileEntry.klinefile  = KPATH;    /* Server kline file         */
# Line 590 | Line 589 | main(int argc, char *argv[])
589  
590    hash_add_id(&me);
591    hash_add_client(&me);
592 <  
592 >
593    /* add ourselves to global_serv_list */
594    dlinkAdd(&me, make_dlink_node(), &global_serv_list);
595  

Diff Legend

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