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-7.2/src/ircd.c (file contents), Revision 982 by michael, Thu Aug 13 22:15:08 2009 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"
# Line 47 | Line 47
47   #include "parse.h"
48   #include "irc_res.h"
49   #include "restart.h"
50 + #include "rng_mt.h"
51   #include "s_auth.h"
52   #include "s_bsd.h"
53   #include "s_conf.h"
54   #include "s_log.h"
55   #include "s_misc.h"
56   #include "s_serv.h"      /* try_connections */
56 #include "s_stats.h"
57   #include "send.h"
58   #include "whowas.h"
59   #include "modules.h"
# Line 63 | Line 63
63   #include "balloc.h"
64   #include "motd.h"
65   #include "supported.h"
66 + #include "watch.h"
67  
68   /* Try and find the correct name to use with getrlimit() for setting the max.
69   * number of files allowed to be open by this process.
# Line 80 | Line 81 | struct admin_info AdminInfo = { NULL, NU
81   struct Counter Count = { 0, 0, 0, 0, 0, 0, 0, 0 };
82   struct ServerState_t server_state = { 0 };
83   struct logging_entry ConfigLoggingEntry = { 1, {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0} };
84 + struct ServerStatistics ServerStats;
85   struct timeval SystemTime;
86   struct Client me;             /* That's me */
87   struct LocalUser meLocalUser; /* That's also part of me */
86 unsigned long connect_id = 0; /* unique connect ID */
88  
88 static unsigned long initialVMTop = 0;   /* top of virtual memory at init */
89   const char *logFileName = LPATH;
90   const char *pidFileName = PPATH;
91  
# Line 122 | Line 122 | unsigned int split_servers;
122  
123   int rehashed_klines = 0;
124  
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 }
125  
126 + #ifndef _WIN32
127   /*
128   * print_startup - print startup information
129   */
# Line 176 | Line 156 | make_daemon(void)
156   }
157   #endif
158  
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 }
191
159   static int printVersion = 0;
160  
161   struct lgetopt myopts[] = {
# Line 281 | Line 248 | io_loop(void)
248        {
249          struct Client *client_p = ptr->data;
250          assert(client_p->localClient->list_task);
251 <        safe_list_channels(client_p, client_p->localClient->list_task, 0, 0);
251 >        safe_list_channels(client_p, client_p->localClient->list_task, 0);
252        }
253      }
254  
# Line 380 | Line 347 | static void
347   initialize_server_capabs(void)
348   {
349    add_capability("QS", CAP_QS, 1);
383  add_capability("LL", CAP_LL, 1);
350    add_capability("EOB", CAP_EOB, 1);
351 +
352    if (ServerInfo.sid != NULL)   /* only enable TS6 if we have an SID */
353      add_capability("TS6", CAP_TS6, 0);
354 +
355    add_capability("ZIP", CAP_ZIP, 0);
356    add_capability("CLUSTER", CAP_CLUSTER, 1);
357   #ifdef HALFOPS
# Line 502 | Line 470 | init_ssl(void)
470    SSL_load_error_strings();
471    SSLeay_add_ssl_algorithms();
472  
473 <  ServerInfo.ctx = SSL_CTX_new(SSLv23_server_method());
506 <  if (!ServerInfo.ctx)
473 >  if ((ServerInfo.server_ctx = SSL_CTX_new(SSLv23_server_method())) == NULL)
474    {
475      const char *s;
476  
# Line 512 | Line 479 | init_ssl(void)
479      ilog(L_CRIT, "ERROR: Could not initialize the SSL context -- %s\n", s);
480    }
481  
482 <  SSL_CTX_set_options(ServerInfo.ctx, SSL_OP_NO_SSLv2);
483 <  SSL_CTX_set_options(ServerInfo.ctx, SSL_OP_TLS_ROLLBACK_BUG|SSL_OP_ALL);
484 <  SSL_CTX_set_verify(ServerInfo.ctx, SSL_VERIFY_NONE, NULL);
482 >  SSL_CTX_set_options(ServerInfo.server_ctx, SSL_OP_NO_SSLv2);
483 >  SSL_CTX_set_options(ServerInfo.server_ctx, SSL_OP_TLS_ROLLBACK_BUG|SSL_OP_ALL);
484 >  SSL_CTX_set_verify(ServerInfo.server_ctx, SSL_VERIFY_NONE, NULL);
485  
486    bio_spare_fd = save_spare_fd("SSL private key validation");
487   #endif /* HAVE_LIBCRYPTO */
# Line 529 | Line 496 | init_ssl(void)
496   static void
497   init_callbacks(void)
498   {
499 <  iorecv_cb = register_callback("iorecv", NULL);
500 <  iosend_cb = register_callback("iosend", NULL);
499 >  iorecv_cb = register_callback("iorecv", iorecv_default);
500 >  iosend_cb = register_callback("iosend", iosend_default);
501    iorecvctrl_cb = register_callback("iorecvctrl", NULL);
502    iosendctrl_cb = register_callback("iosendctrl", NULL);
503   }
# Line 545 | Line 512 | main(int argc, char *argv[])
512    if (geteuid() == 0)
513    {
514      fprintf(stderr, "Don't run ircd as root!!!\n");
515 <    return(-1);
515 >    return -1;
516    }
517  
518    /* Setup corefile size immediately after boot -kre */
519    setup_corefile();
553
554  /* set initialVMTop before we allocate any memory */
555  initialVMTop = get_vm_top();
520   #endif
521  
522    /* save server boot time right away, so getrusage works correctly */
523    set_time();
524  
525 <    /* It ain't random, but it ought to be a little harder to guess */
526 <  srand(SystemTime.tv_sec ^ (SystemTime.tv_usec | (getpid() << 20)));
525 >  /* It ain't random, but it ought to be a little harder to guess */
526 >  init_genrand(SystemTime.tv_sec ^ (SystemTime.tv_usec | (getpid() << 20)));
527 >
528    memset(&me, 0, sizeof(me));
529    memset(&meLocalUser, 0, sizeof(meLocalUser));
530    me.localClient = &meLocalUser;
# Line 567 | Line 532 | main(int argc, char *argv[])
532                                                     of Client list */
533  
534    memset(&ServerInfo, 0, sizeof(ServerInfo));
535 +  memset(&ServerStats, 0, sizeof(ServerStats));
536  
537    /* Initialise the channel capability usage counts... */
538    init_chcap_usage_counts();
# Line 638 | Line 604 | main(int argc, char *argv[])
604    init_client();
605    init_class();
606    init_whowas();
607 <  init_stats();
607 >  watch_init();
608    read_conf_files(1);   /* cold start init conf files */
643  initServerMask();
609    me.id[0] = '\0';
610    init_uid();
611    init_auth();          /* Initialise the auth code */
# Line 656 | Line 621 | main(int argc, char *argv[])
621      ilog(L_CRIT, "No server name specified in serverinfo block.");
622      exit(EXIT_FAILURE);
623    }
624 +
625    strlcpy(me.name, ServerInfo.name, sizeof(me.name));
626  
627    /* serverinfo{} description must exist.  If not, error out.*/
# Line 665 | Line 631 | main(int argc, char *argv[])
631        "ERROR: No server description specified in serverinfo block.");
632      exit(EXIT_FAILURE);
633    }
634 +
635    strlcpy(me.info, ServerInfo.description, sizeof(me.info));
636  
637    me.from    = &me;
# Line 727 | Line 694 | main(int argc, char *argv[])
694      eventAddIsh("check_splitmode", check_splitmode, NULL, 60);
695  
696    io_loop();
697 <  return(0);
697 >  return 0;
698   }

Comparing:
ircd-hybrid/src/ircd.c (property svn:keywords), Revision 30 by adx, Sun Oct 2 20:03:27 2005 UTC vs.
ircd-hybrid-7.2/src/ircd.c (property svn:keywords), Revision 982 by michael, Thu Aug 13 22:15:08 2009 UTC

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

Diff Legend

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