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-7.2/src/ircd.c (file contents), Revision 948 by michael, Tue Jul 21 17:34:06 2009 UTC vs.
ircd-hybrid/src/ircd.c (file contents), Revision 1028 by michael, Sun Nov 8 13:03:38 2009 UTC

# Line 24 | Line 24
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"
# Line 36 | Line 36
36   #include "irc_string.h"
37   #include "sprintf_irc.h"
38   #include "ircd_signal.h"
39 #include "list.h"
39   #include "s_gline.h"
40   #include "motd.h"
41   #include "ircd_handler.h"
# Line 47 | Line 46
46   #include "parse.h"
47   #include "irc_res.h"
48   #include "restart.h"
49 + #include "rng_mt.h"
50   #include "s_auth.h"
51   #include "s_bsd.h"
52   #include "s_conf.h"
# Line 85 | Line 85 | struct timeval SystemTime;
85   struct Client me;             /* That's me */
86   struct LocalUser meLocalUser; /* That's also part of me */
87  
88 static unsigned long initialVMTop = 0;   /* top of virtual memory at init */
88   const char *logFileName = LPATH;
89   const char *pidFileName = PPATH;
90  
# Line 94 | Line 93 | char ircd_platform[PLATFORMLEN];
93  
94   int dorehash = 0;
95   int doremotd = 0;
97 time_t nextconnect = 1;       /* time for next try_connections call */
96  
97   /* Set to zero because it should be initialized later using
98   * initialize_server_capabs
# Line 105 | Line 103 | int default_server_capabs = 0;
103   int bio_spare_fd = -1;
104   #endif
105  
106 < int splitmode;
107 < int splitchecking;
108 < int split_users;
106 > unsigned int splitmode;
107 > unsigned int splitchecking;
108 > unsigned int split_users;
109   unsigned int split_servers;
110  
111   /* Do klines the same way hybrid-6 did them, i.e. at the
# Line 153 | Line 151 | make_daemon(void)
151  
152    setsid();
153   }
156 #endif
154  
155   static int printVersion = 0;
156  
# Line 183 | Line 180 | set_time(void)
180   {
181    static char to_send[200];
182    struct timeval newtime;
186 #ifdef _WIN32
187  FILETIME ft;
188
189  GetSystemTimeAsFileTime(&ft);
190  if (ft.dwLowDateTime < 0xd53e8000)
191    ft.dwHighDateTime--;
192  ft.dwLowDateTime -= 0xd53e8000;
193  ft.dwHighDateTime -= 0x19db1de;
194
195  newtime.tv_sec  = (*(uint64_t *) &ft) / 10000000;
196  newtime.tv_usec = (*(uint64_t *) &ft) / 10 % 1000000;
197 #else
183    newtime.tv_sec  = 0;
184    newtime.tv_usec = 0;
185  
# Line 207 | Line 192 | set_time(void)
192                           strerror(errno));
193      restart("Clock Failure");
194    }
210 #endif
195  
196    if (newtime.tv_sec < CurrentTime)
197    {
# Line 399 | Line 383 | write_pidfile(const char *filename)
383   static void
384   check_pidfile(const char *filename)
385   {
402 #ifndef _WIN32
386    FBFILE *fb;
387    char buff[32];
388    pid_t pidfromfile;
# Line 431 | Line 414 | check_pidfile(const char *filename)
414    {
415      /* log(L_ERROR, "Error opening pid file %s", filename); */
416    }
434 #endif
417   }
418  
419   /* setup_corefile()
# Line 469 | Line 451 | init_ssl(void)
451    SSL_load_error_strings();
452    SSLeay_add_ssl_algorithms();
453  
454 <  ServerInfo.ctx = SSL_CTX_new(SSLv23_server_method());
473 <  if (!ServerInfo.ctx)
454 >  if ((ServerInfo.server_ctx = SSL_CTX_new(SSLv23_server_method())) == NULL)
455    {
456      const char *s;
457  
# Line 479 | Line 460 | init_ssl(void)
460      ilog(L_CRIT, "ERROR: Could not initialize the SSL context -- %s\n", s);
461    }
462  
463 <  SSL_CTX_set_options(ServerInfo.ctx, SSL_OP_NO_SSLv2);
464 <  SSL_CTX_set_options(ServerInfo.ctx, SSL_OP_TLS_ROLLBACK_BUG|SSL_OP_ALL);
465 <  SSL_CTX_set_verify(ServerInfo.ctx, SSL_VERIFY_NONE, NULL);
463 >  SSL_CTX_set_options(ServerInfo.server_ctx, SSL_OP_NO_SSLv2);
464 >  SSL_CTX_set_options(ServerInfo.server_ctx, SSL_OP_TLS_ROLLBACK_BUG|SSL_OP_ALL);
465 >  SSL_CTX_set_verify(ServerInfo.server_ctx, SSL_VERIFY_NONE, NULL);
466  
467    bio_spare_fd = save_spare_fd("SSL private key validation");
468   #endif /* HAVE_LIBCRYPTO */
# Line 508 | Line 489 | main(int argc, char *argv[])
489    /* Check to see if the user is running
490     * us as root, which is a nono
491     */
511 #ifndef _WIN32
492    if (geteuid() == 0)
493    {
494      fprintf(stderr, "Don't run ircd as root!!!\n");
495 <    return(-1);
495 >    return -1;
496    }
497  
498    /* Setup corefile size immediately after boot -kre */
499    setup_corefile();
520 #endif
500  
501    /* save server boot time right away, so getrusage works correctly */
502    set_time();
503  
504 <    /* It ain't random, but it ought to be a little harder to guess */
505 <  srand(SystemTime.tv_sec ^ (SystemTime.tv_usec | (getpid() << 20)));
504 >  /* It ain't random, but it ought to be a little harder to guess */
505 >  init_genrand(SystemTime.tv_sec ^ (SystemTime.tv_usec | (getpid() << 20)));
506 >
507    memset(&me, 0, sizeof(me));
508    memset(&meLocalUser, 0, sizeof(meLocalUser));
509    me.localClient = &meLocalUser;
# Line 565 | Line 545 | main(int argc, char *argv[])
545  
546    init_ssl();
547  
568 #ifndef _WIN32
548    if (!server_state.foreground)
549    {
550      make_daemon();
# Line 575 | Line 554 | main(int argc, char *argv[])
554      print_startup(getpid());
555  
556    setup_signals();
578 #endif
557  
558    get_ircd_platform(ircd_platform);
559  
# Line 589 | Line 567 | main(int argc, char *argv[])
567    /* Check if there is pidfile and daemon already running */
568    check_pidfile(pidFileName);
569  
592 #ifndef NOBALLOC
570    initBlockHeap();
594 #endif
571    init_dlink_nodes();
572    init_callbacks();
573    initialize_message_files();
# Line 604 | Line 580 | main(int argc, char *argv[])
580    init_class();
581    init_whowas();
582    watch_init();
583 +  init_auth();          /* Initialise the auth code */
584 +  init_resolver();      /* Needs to be setup before the io loop */
585    read_conf_files(1);   /* cold start init conf files */
586    me.id[0] = '\0';
587    init_uid();
610  init_auth();          /* Initialise the auth code */
611 #ifndef _WIN32
612  init_resolver();      /* Needs to be setup before the io loop */
613 #endif
588    initialize_server_capabs();   /* Set up default_server_capabs */
589    initialize_global_set_options();
590    init_channels();
# Line 645 | Line 619 | main(int argc, char *argv[])
619    /* add ourselves to global_serv_list */
620    dlinkAdd(&me, make_dlink_node(), &global_serv_list);
621  
648  check_class();
649
622   #ifndef STATIC_MODULES
623    if (chdir(MODPATH))
624    {

Diff Legend

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