Anope IRC Services  Version 1.8
init.c
Go to the documentation of this file.
1 /* Initalization and related routines.
2  *
3  * (C) 2003-2014 Anope Team
4  * Contact us at team@anope.org
5  *
6  * Please read COPYING and README for further details.
7  *
8  * Based on the original code of Epona by Lara.
9  * Based on the original code of Services by Andy Church.
10  *
11  *
12  */
13 
14 #include "services.h"
15 #include "pseudo.h"
16 int servernum = 0;
17 
18 extern void moduleAddMsgs(void);
19 extern void moduleAddIRCDMsgs(void);
20 
21 /*************************************************************************/
22 
23 void introduce_user(const char *user)
24 {
25 
26  /* Watch out for infinite loops... */
27 #define LTSIZE 20
28  static int lasttimes[LTSIZE];
29  if (lasttimes[0] >= time(NULL) - 3)
30  fatal("introduce_user() loop detected");
31  memmove(lasttimes, lasttimes + 1, sizeof(lasttimes) - sizeof(int));
32  lasttimes[LTSIZE - 1] = time(NULL);
33 #undef LTSIZE
34 
35  /* Introduce OperServ first because on some IRCd's send
36  * we send data from OperServ before introduction completes.
37  * Patch fixing ratbox RESV support provided by Jobe. */
38  if (!user || stricmp(user, s_OperServ) == 0) {
40  }
41 
42  /* NickServ */
43  if (!user || stricmp(user, s_NickServ) == 0) {
45  }
46 
47  /* ChanServ */
48  if (!user || stricmp(user, s_ChanServ) == 0) {
50  }
51  if (s_HostServ && ircd->vhost
52  && (!user || stricmp(user, s_HostServ) == 0)) {
54  }
55 
56  if (!user || stricmp(user, s_MemoServ) == 0) {
58  }
59 
60  if (s_BotServ && (!user || stricmp(user, s_BotServ) == 0)) {
62  }
63 
64  if (!user || stricmp(user, s_HelpServ) == 0) {
66  }
67 
68  if (s_DevNull && (!user || stricmp(user, s_DevNull) == 0)) {
70  }
71 
72  if (!user || stricmp(user, s_GlobalNoticer) == 0) {
74  ircd->globalmode);
75  }
76 
77  /* We make aliases go online */
78  if (s_NickServAlias && (!user || stricmp(user, s_NickServAlias) == 0)) {
81  }
82 
83  if (s_ChanServAlias && (!user || stricmp(user, s_ChanServAlias) == 0)) {
86  }
87 
88  if (s_MemoServAlias && (!user || stricmp(user, s_MemoServAlias) == 0)) {
91  }
92 
93  if (s_BotServAlias && (!user || stricmp(user, s_BotServAlias) == 0)) {
96  }
97 
98  if (s_HelpServAlias && (!user || stricmp(user, s_HelpServAlias) == 0)) {
101  }
102 
103  if (s_OperServAlias && (!user || stricmp(user, s_OperServAlias) == 0)) {
106  }
107 
108  if (s_DevNullAlias && (!user || stricmp(user, s_DevNullAlias) == 0)) {
111  }
112  if (s_HostServAlias && ircd->vhost
113  && (!user || stricmp(user, s_HostServAlias) == 0)) {
116  }
118  && (!user || stricmp(user, s_GlobalNoticerAlias) == 0)) {
121  }
122 
123  /* We make the bots go online */
124  if (s_BotServ) {
125  BotInfo *bi;
126  int i;
127 
128  for (i = 0; i < 256; i++)
129  for (bi = botlists[i]; bi; bi = bi->next) {
130 
131  if (!user || !stricmp(user, bi->nick))
132  anope_cmd_bot_nick(bi->nick, bi->user, bi->host,
133  bi->real, ircd->botserv_bot_mode);
134  }
135  }
136 }
137 
138 /*************************************************************************/
139 
140 /* Set GID if necessary. Return 0 if successful (or if RUNGROUP not
141  * defined), else print an error message to logfile and return -1.
142  */
143 
144 static int set_group(void)
145 {
146 #if defined(RUNGROUP) && defined(HAVE_SETGRENT)
147  struct group *gr;
148 
149  setgrent();
150  while ((gr = getgrent()) != NULL) {
151  if (strcmp(gr->gr_name, RUNGROUP) == 0)
152  break;
153  }
154  endgrent();
155  if (gr) {
156  setgid(gr->gr_gid);
157  return 0;
158  } else {
159  alog("Unknown group `%s'\n", RUNGROUP);
160  return -1;
161  }
162 #else
163  return 0;
164 #endif
165 }
166 
167 /*************************************************************************/
168 
169 /* Parse command-line options for the "-dir" option only. Return 0 if all
170  * went well or -1 for a syntax error.
171  */
172 
173 /* XXX this could fail if we have "-some-option-taking-an-argument -dir" */
174 
175 static int parse_dir_options(int ac, char **av)
176 {
177  int i;
178  char *s;
179 
180  for (i = 1; i < ac; i++) {
181  s = av[i];
182  if (*s == '-') {
183  s++;
184  if (strcmp(s, "dir") == 0) {
185  if (++i >= ac) {
186  fprintf(stderr, "-dir requires a parameter\n");
187  return -1;
188  }
189  services_dir = av[i];
190  } else if (strcmp(s, "log") == 0) {
191  if (++i >= ac) {
192  fprintf(stderr, "-log requires a parameter\n");
193  return -1;
194  }
195  log_filename = av[i];
196  } else if (strcmp(s, "version") == 0) {
197  fprintf(stdout, "Anope-%s %s -- %s\n", version_number,
199  exit(EXIT_SUCCESS);
200  }
201  }
202  }
203  return 0;
204 }
205 
206 /*************************************************************************/
207 
208 /* Parse command-line options. Return 0 if all went well, -1 for an error
209  * with an option, or 1 for -help.
210  */
211 
212 static int parse_options(int ac, char **av)
213 {
214  int i;
215  char *s, *t;
216 
217  for (i = 1; i < ac; i++) {
218  s = av[i];
219  if (*s == '-') {
220  s++;
221  if (strcmp(s, "remote") == 0) {
222  if (++i >= ac) {
223  fprintf(stderr, "-remote requires hostname[:port]\n");
224  return -1;
225  }
226  s = av[i];
227  t = strchr(s, ':');
228  if (t) {
229  int portnum;
230  *t++ = 0;
231  portnum = atoi(t);
232  if ((portnum > 0) && (portnum < 65535))
233  RemotePort = portnum;
234  else {
235  fprintf(stderr,
236  "-remote: Port numbers must be in the range 1..65535. Using default.\n");
237  return -1;
238  }
239  }
240  RemoteServer = s;
241  } else if (strcmp(s, "local") == 0) {
242  if (++i >= ac) {
243  fprintf(stderr,
244  "-local requires hostname or [hostname]:[port]\n");
245  return -1;
246  }
247  s = av[i];
248  t = strchr(s, ':');
249  if (t) {
250  int portnum;
251  *t++ = 0;
252  portnum = atoi(t);
253  if ((portnum >= 0) && (portnum < 65535))
254  LocalPort = portnum;
255  else {
256  fprintf(stderr,
257  "-local: Port numbers must be in the range 1..65535 or 0. Using default.\n");
258  return -1;
259  }
260  }
261  LocalHost = s;
262  } else if (strcmp(s, "name") == 0) {
263  if (++i >= ac) {
264  fprintf(stderr, "-name requires a parameter\n");
265  return -1;
266  }
267  ServerName = av[i];
268  } else if (strcmp(s, "desc") == 0) {
269  if (++i >= ac) {
270  fprintf(stderr, "-desc requires a parameter\n");
271  return -1;
272  }
273  ServerDesc = av[i];
274  } else if (strcmp(s, "user") == 0) {
275  if (++i >= ac) {
276  fprintf(stderr, "-user requires a parameter\n");
277  return -1;
278  }
279  ServiceUser = av[i];
280  } else if (strcmp(s, "host") == 0) {
281  if (++i >= ac) {
282  fprintf(stderr, "-host requires a parameter\n");
283  return -1;
284  }
285  ServiceHost = av[i];
286  } else if (strcmp(s, "dir") == 0) {
287  /* Handled by parse_dir_options() */
288  i++; /* Skip parameter */
289  } else if (strcmp(s, "log") == 0) {
290  /* Handled by parse_dir_options(), too */
291  i++; /* Skip parameter */
292  } else if (strcmp(s, "update") == 0) {
293  if (++i >= ac) {
294  fprintf(stderr, "-update requires a parameter\n");
295  return -1;
296  }
297  s = av[i];
298  if (atoi(s) <= 0) {
299  fprintf(stderr,
300  "-update: number of seconds must be positive");
301  return -1;
302  } else
303  UpdateTimeout = atol(s);
304  } else if (strcmp(s, "expire") == 0) {
305  if (++i >= ac) {
306  fprintf(stderr, "-expire requires a parameter\n");
307  return -1;
308  }
309  s = av[i];
310  if (atoi(s) <= 0) {
311  fprintf(stderr,
312  "-expire: number of seconds must be positive\n");
313  return -1;
314  } else
315  ExpireTimeout = atol(s);
316  } else if (strcmp(s, "debug") == 0) {
317  debug++;
318  } else if (strcmp(s, "readonly") == 0) {
319  readonly = 1;
320  skeleton = 0;
321  } else if (strcmp(s, "skeleton") == 0) {
322  readonly = 0;
323  skeleton = 1;
324  } else if (strcmp(s, "nofork") == 0) {
325  nofork = 1;
326  } else if (strcmp(s, "logchan") == 0) {
327  if (!LogChannel) {
328  fprintf(stderr,
329  "-logchan: LogChannel must be defined in services.conf\n");
330  } else { /* LogChannel */
331 
332  logchan = 1;
333  }
334  } else if (strcmp(s, "forceload") == 0) {
335  forceload = 1;
336  } else if (strcmp(s, "nothird") == 0) {
337  nothird = 1;
338  } else if (strcmp(s, "protocoldebug") == 0) {
339  protocoldebug = 1;
340  } else if (strcmp(s, "support") == 0) {
341  nofork = 1;
342  debug++;
343  nothird = 1;
344  } else if (!strcmp(s, "noexpire")) {
345  noexpire = 1;
346  } else if (!strcmp(s, "help")) {
347  fprintf(stdout, "Anope-%s %s -- %s\n", version_number,
349  fprintf(stdout,
350  "Anope IRC Services (http://www.anope.org)\n");
351  fprintf(stdout, "Usage ./services [options] ...\n");
352  fprintf(stdout,
353  "-remote -remote hostname[:port]\n");
354  fprintf(stdout, "-local -local hostname[:port]\n");
355  fprintf(stdout, "-name -name servername\n");
356  fprintf(stdout, "-desc -desc serverdesc\n");
357  fprintf(stdout, "-user -user serviceuser\n");
358  fprintf(stdout, "-host -host servicehost\n");
359  fprintf(stdout,
360  "-update -update updatetime(secs)\n");
361  fprintf(stdout,
362  "-expire -expire expiretime(secs)\n");
363  fprintf(stdout, "-debug -debug\n");
364  fprintf(stdout, "-protocoldebug -protocoldebug\n");
365  fprintf(stdout, "-nofork -nofork\n");
366  fprintf(stdout, "-logchan -logchan channelname\n");
367  fprintf(stdout, "-skeleton -skeleton\n");
368  fprintf(stdout, "-forceload -forceload\n");
369  fprintf(stdout, "-nothird -nothird\n");
370  fprintf(stdout, "-support -support\n");
371  fprintf(stdout, "-readonly -readonly\n");
372  fprintf(stdout, "-noexpire -noexpire\n");
373  fprintf(stdout, "-version -version\n");
374  fprintf(stdout, "-help -help\n");
375  fprintf(stdout, "-log -log logfilename\n");
376  fprintf(stdout,
377  "-dir -dir servicesdirectory\n\n");
378  fprintf(stdout,
379  "Further support is available from http://www.anope.org\n");
380  fprintf(stdout,
381  "Or visit US on IRC at irc.anope.org #anope\n");
382  exit(EXIT_SUCCESS);
383  } else {
384  fprintf(stderr, "Unknown option -%s\n", s);
385  return -1;
386  }
387  } else {
388  fprintf(stderr, "Non-option arguments not allowed\n");
389  return -1;
390  }
391  }
392  return 0;
393 }
394 
395 /*************************************************************************/
396 
397 /* Remove our PID file. Done at exit. */
398 
399 static void remove_pidfile(void)
400 {
401  remove(PIDFilename);
402 }
403 
404 /*************************************************************************/
405 
406 /* Create our PID file and write the PID to it. */
407 
408 static void write_pidfile(void)
409 {
410  FILE *pidfile;
411 
412  pidfile = fopen(PIDFilename, "w");
413  if (pidfile) {
414  fprintf(pidfile, "%d\n", (int) getpid());
415  fclose(pidfile);
416  atexit(remove_pidfile);
417  } else {
418  log_perror("Warning: cannot write to PID file %s", PIDFilename);
419  }
420 }
421 
422 /*************************************************************************/
423 
424 /* Overall initialization routines. Return 0 on success, -1 on failure. */
425 
427 
428 int init_primary(int ac, char **av)
429 {
430  int started_from_term = isatty(0) && isatty(1) && isatty(2);
431 
432  /* Set file creation mask and group ID. */
433 #if defined(DEFUMASK) && HAVE_UMASK
434  umask(DEFUMASK);
435 #endif
436  if (set_group() < 0)
437  return -1;
438 
439  /* Parse command line for -dir and -version options. */
440  parse_dir_options(ac, av);
441 
442  /* Chdir to Services data directory. */
443  if (chdir(services_dir) < 0) {
444  fprintf(stderr, "chdir(%s): %s\n", services_dir, strerror(errno));
445  return -1;
446  }
447 
448  /* Open logfile, and complain if we didn't. */
449  if (open_log() < 0) {
450  openlog_errno = errno;
451  if (started_from_term) {
452  fprintf(stderr, "Warning: unable to open log file %s: %s\n",
453  log_filename, strerror(errno));
454  } else {
455  openlog_failed = 1;
456  }
457  }
458 
459  /* Read configuration file; exit if there are problems. */
460  if (!read_config(0)) {
461  return -1;
462  }
463 
464  /* Add IRCD Protocol Module; exit if there are errors */
465  if (protocol_module_init()) {
466  return -1;
467  }
468 
469  /* Add Encryption Module; exit if there are errors */
470  if (encryption_module_init()) {
471  return -1;
472  }
473  return 0;
474 }
475 
476 int init_secondary(int ac, char **av)
477 {
478  int i;
479  int started_from_term = isatty(0) && isatty(1) && isatty(2);
480 
481  /* Add Core MSG handles */
482  moduleAddMsgs();
483 
484  /* Parse all remaining command-line options. */
485  parse_options(ac, av);
486 
487  /* Parse the defcon mode string if needed */
488  if (DefConLevel && !ircd->delay_cl_intro) {
490  fprintf(stderr,
491  "services.conf: The given DefConChanModes mode string was incorrect (see log for exact errors)\n");
492  return -1;
493  }
494  }
495 #ifndef _WIN32
496  if (!nofork) {
497  if ((i = fork()) < 0) {
498  perror("fork()");
499  return -1;
500  } else if (i != 0) {
501  exit(0);
502  }
503  if (started_from_term) {
504  close(0);
505  close(1);
506  close(2);
507  }
508  if (setpgid(0, 0) < 0) {
509  perror("setpgid()");
510  return -1;
511  }
512  }
513 #else
514  /* Initialize winsocks -- codemastr */
515  {
516  WSADATA wsa;
517  if (WSAStartup(MAKEWORD(1, 1), &wsa)) {
518  alog("Failed to initialized WinSock library");
519  return -1;
520  }
521  }
522  if (!SupportedWindowsVersion()) {
523 
524  char *winver = GetWindowsVersion();
525 
526  alog("%s is not a supported version of Windows", winver);
527 
528  free(winver);
529 
530  return -1;
531 
532  }
533  if (!nofork) {
534  alog("Launching Anope into the background");
535  FreeConsole();
536  }
537 #endif
538 
539  /* Write our PID to the PID file. */
540  write_pidfile();
541 
542  /* Announce ourselves to the logfile. */
543  if (debug || readonly || skeleton) {
544  alog("Anope %s (ircd protocol: %s) starting up (options:%s%s%s)",
546  debug ? " debug" : "", readonly ? " readonly" : "",
547  skeleton ? " skeleton" : "");
548  } else {
549  alog("Anope %s (ircd protocol: %s) starting up",
551  }
552  start_time = time(NULL);
553 
554 
555 
556  /* If in read-only mode, close the logfile again. */
557  if (readonly)
558  close_log();
559 
560  /* Set signal handlers. Catch certain signals to let us do things or
561  * panic as necessary, and ignore all others.
562  */
563 
564 #ifndef _WIN32
565 #if defined(NSIG)
566  for (i = 1; i <= NSIG - 1; i++) {
567 #else
568  for (i = 1; i <= 31; i++) {
569 #endif
570  signal(i, SIG_IGN);
571  }
572 #else
573  /* work around to bug #527 */
574  signal(SIGILL, SIG_IGN);
575  signal(SIGBREAK, SIG_IGN);
576  signal(SIGABRT, SIG_IGN);
577 #endif
578 
579  signal(SIGINT, sighandler);
580  signal(SIGTERM, sighandler);
581 #ifndef _WIN32
582  signal(SIGQUIT, sighandler);
583 #endif
584  if (!DumpCore) {
585  signal(SIGSEGV, sighandler);
586 #ifndef _WIN32
587  signal(SIGBUS, sighandler);
588  signal(SIGTRAP, sighandler);
589 #endif
590  } else {
591  signal(SIGSEGV, SIG_DFL);
592 #ifndef _WIN32
593  signal(SIGBUS, sighandler);
594  signal(SIGTRAP, sighandler);
595 #endif
596  }
597 #ifndef _WIN32
598  signal(SIGQUIT, sighandler);
599  signal(SIGHUP, sighandler);
600  signal(SIGUSR2, sighandler);
601 #endif
602 
603 #ifdef SIGIOT
604  signal(SIGIOT, sighandler);
605 #endif
606  signal(SIGFPE, sighandler);
607 
608 #ifndef _WIN32
609  signal(SIGUSR1, sighandler); /* This is our "out-of-memory" panic switch */
610 #endif
611 
612  /* Initialize multi-language support */
613  lang_init();
614  if (debug)
615  alog("debug: Loaded languages");
616 
617 
618  /* Initialize subservices */
619  ns_init();
620  cs_init();
621  ms_init();
622  bs_init();
623  os_init();
624  hostserv_init();
625  helpserv_init();
626 
627 #ifdef USE_RDB
628  if (!rdb_init()) {
629  if (UseRDB) {
630  UseRDB = 0;
631  alog("Error: Disabling UseRDB due to errors with SQL");
632  }
633  } else {
634  if (MysqlSecure && UseRDB) {
635  UseRDB = 0;
636  alog("Error: MySQL password are encrypted using method in MysqlSecure disabling UseRDB");
637  }
638  }
639 #endif
640 
641  /* load any custom modules */
642  modules_init();
643 
644  /* Initialize random number generator */
645  rand_init();
647 
648  /* Load up databases */
649 #ifdef USE_RDB
650  if (UseRDB)
651  rdb_load_dbases();
652  /* Need a better way to handle this -dane */
653  if (!UseRDB) {
654 #endif
655  if (!skeleton) {
656  load_ns_dbase();
657  if (debug)
658  alog("debug: Loaded %s database (1/%d)", s_NickServ,
659  (PreNickDBName ? 8 : 7));
660  if (s_HostServ) {
661  load_hs_dbase();
662  if (debug)
663  alog("debug: Loaded %s database (2/%d)", s_HostServ,
664  (PreNickDBName ? 8 : 7));
665  } else if (debug) {
666  alog("debug: HostServ database (2/%d) not loaded because HostServ is disabled", (PreNickDBName ? 8 : 7));
667  }
668  if (s_BotServ) {
669  load_bs_dbase();
670  if (debug)
671  alog("debug: Loaded %s database (3/%d)", s_BotServ,
672  (PreNickDBName ? 8 : 7));
673  } else if (debug) {
674  alog("debug: BotServ database (3/%d) not loaded because BotServ is disabled", (PreNickDBName ? 8 : 7));
675  }
676  load_cs_dbase();
677  if (debug)
678  alog("debug: Loaded %s database (4/%d)", s_ChanServ,
679  (PreNickDBName ? 8 : 7));
680  }
681  load_os_dbase();
682  if (debug)
683  alog("debug: Loaded %s database (5/%d)", s_OperServ,
684  (PreNickDBName ? 8 : 7));
685  load_news();
686  if (debug)
687  alog("debug: Loaded news database (6/%d)",
688  (PreNickDBName ? 8 : 7));
689  load_exceptions();
690  if (debug)
691  alog("debug: Loaded exception database (7/%d)",
692  (PreNickDBName ? 8 : 7));
693  if (PreNickDBName) {
694  load_ns_req_db();
695  if (debug)
696  alog("debug: Loaded PreNick database (8/8)");
697  }
698 #ifdef USE_RDB
699  }
700 #endif
701  alog("Databases loaded");
702 
703  /* Save the databases back to file/mysql to reflect any changes */
704 #ifdef USE_RDB
705  if (!UseRDB) { /* Only save if we are not using remote databases
706  * to avoid floods. As a side effects our nice
707  * FFF databases won't get overwritten if the
708  * mysql db is broken (empty etc.) */
709 #endif
710  alog("Info: Reflecting database records.");
711  save_databases();
712 #ifdef USE_RDB
713  } else {
714  alog("Info: Not reflecting database records.");
715  }
716 #endif
718 
719  /* Connect to the remote server */
721  if (servsock < 0 && RemoteServer2) {
723  if (servsock < 0 && RemoteServer3) {
724  servsock =
726  if (servsock < 0) {
727  fatal_perror("Can't connect to server");
728  } else {
729  servernum = 3;
730  alog("Connected to Server %d (%s:%d)", servernum,
732  }
733  } else {
734  if (servsock < 0) {
735  fatal_perror("Can't connect to server");
736  }
737  servernum = 2;
738  alog("Connected to Server %d (%s:%d)", servernum,
740  }
741  } else {
742  if (servsock < 0) {
743  fatal_perror("Can't connect to server");
744  }
745  servernum = 1;
746  alog("Connected to Server %d (%s:%d)", servernum, RemoteServer,
747  RemotePort);
748  }
749 
752 
753  sgets2(inbuf, sizeof(inbuf), servsock);
754  if (strnicmp(inbuf, "ERROR", 5) == 0) {
755  /* Close server socket first to stop wallops, since the other
756  * server doesn't want to listen to us anyway */
757  disconn(servsock);
758  servsock = -1;
759  fatal("Remote server returned: %s", inbuf);
760  }
761 
762  /* Announce a logfile error if there was one */
763  if (openlog_failed) {
764  anope_cmd_global(NULL, "Warning: couldn't open logfile: %s",
766  }
767 
768  if (!ircd->delay_cl_intro)
769  init_tertiary();
770 
771  /* Success! */
772  return 0;
773 }
774 
775 /*************************************************************************/
776 
778 {
779  /* Begin our burst..*/
780  anope_cmd_bob();
781 
782  /* Bring in our pseudo-clients */
783  introduce_user(NULL);
784 
785  /* And hybrid needs Global joined in the logchan */
786  if (logchan && ircd->join2msg) {
787  /* XXX might desync */
789  }
790 
791  /* End our burst.. */
792  anope_cmd_eob();
793 
799 }
800 
801 /*************************************************************************/
E char * LocalHost
Definition: extern.h:271
E int RemotePort2
Definition: extern.h:266
E void hostserv_init(void)
Definition: hostserv.c:73
static void remove_pidfile(void)
Definition: init.c:399
char * MysqlSecure
Definition: config.c:316
E char * desc_NickServ
Definition: extern.h:292
E char * desc_DevNullAlias
Definition: extern.h:327
E char * desc_GlobalNoticer
Definition: extern.h:298
E void close_log(void)
Definition: log.c:109
static int parse_options(int ac, char **av)
Definition: init.c:212
E int readonly
Definition: extern.h:776
#define EVENT_STOP
Definition: events.h:15
E void load_exceptions(void)
Definition: sessions.c:394
E char * s_HelpServAlias
Definition: extern.h:315
E int DumpCore
Definition: extern.h:354
E char * RemoteServer2
Definition: extern.h:265
E char * s_BotServ
Definition: extern.h:287
E IRCDVar * ircd
Definition: extern.h:39
E void sighandler(int signum)
Definition: main.c:329
E void save_databases(void)
Definition: main.c:145
E char * desc_ChanServ
Definition: extern.h:293
E void load_ns_dbase(void)
Definition: nickserv.c:563
E char * desc_HostServAlias
Definition: extern.h:328
E int strnicmp(const char *s1, const char *s2, size_t len)
Definition: compat.c:73
E char * desc_ChanServAlias
Definition: extern.h:321
E char * PreNickDBName
Definition: extern.h:333
E void ns_init(void)
Definition: nickserv.c:232
E void send_event(const char *name, int argc,...)
Definition: events.c:37
E char * sgets2(char *buf, int len, ano_socket_t s)
Definition: sockutil.c:451
E char * desc_BotServAlias
Definition: extern.h:323
E time_t start_time
Definition: extern.h:797
int init_secondary(int ac, char **av)
Definition: init.c:476
E char * desc_OperServ
Definition: extern.h:297
int vhost
Definition: services.h:301
E char * RemoteServer
Definition: extern.h:262
E char * desc_DevNull
Definition: extern.h:299
char * hostservmode
Definition: services.h:281
E int stricmp(const char *s1, const char *s2)
Definition: compat.c:58
E void anope_cmd_nick(char *nick, char *name, char *mode)
Definition: ircd.c:200
E void anope_cmd_join(char *user, char *channel, time_t chantime)
Definition: ircd.c:352
E int UpdateTimeout
Definition: extern.h:344
int openlog_failed
Definition: init.c:426
E char * ServerDesc
Definition: extern.h:275
E int nofork
Definition: extern.h:779
E void load_os_dbase(void)
Definition: operserv.c:276
E void E void E void E void fatal_perror(const char *fmt,...) FORMAT(printf
char * memoservaliasmode
Definition: services.h:289
E int DefConLevel
Definition: extern.h:561
void modules_init(void)
Definition: modules.c:91
#define LTSIZE
void moduleAddMsgs(void)
Definition: messages.c:447
int rdb_load_dbases(void)
Definition: rdb.c:455
E int nothird
Definition: extern.h:781
char * botservmode
Definition: services.h:283
char * devnullmode
Definition: services.h:285
E int conn(const char *host, int port, const char *lhost, int lport)
Definition: sockutil.c:553
char * nickservmode
Definition: services.h:278
E char * desc_HostServ
Definition: extern.h:302
E char * DefConChanModes
Definition: extern.h:568
E char * services_dir
Definition: extern.h:773
E char * desc_MemoServ
Definition: extern.h:294
E char * s_GlobalNoticerAlias
Definition: extern.h:317
E char * s_OperServAlias
Definition: extern.h:316
int init_primary(int ac, char **av)
Definition: init.c:428
E void load_cs_dbase(void)
Definition: chanserv.c:423
E char inbuf[BUFSIZE]
Definition: extern.h:793
E void E void E void fatal(const char *fmt,...) FORMAT(printf
E char * s_OperServ
Definition: extern.h:289
E void load_hs_dbase(void)
Definition: hostserv.c:388
E char * desc_HelpServAlias
Definition: extern.h:324
E char * s_MemoServ
Definition: extern.h:286
E void os_init(void)
Definition: operserv.c:98
E char * ServiceHost
Definition: extern.h:277
E int RemotePort3
Definition: extern.h:269
E char * desc_GlobalNoticerAlias
Definition: extern.h:326
char * botserv_bot_mode
Definition: services.h:296
static void write_pidfile(void)
Definition: init.c:408
E int RemotePort
Definition: extern.h:263
E char * s_ChanServAlias
Definition: extern.h:312
E void ms_init(void)
Definition: memoserv.c:38
E int open_log(void)
Definition: log.c:89
E char * s_HelpServ
Definition: extern.h:288
int servernum
Definition: init.c:16
E int protocoldebug
Definition: extern.h:783
E int servsock
Definition: extern.h:794
E char * log_filename
Definition: extern.h:774
E char * strerror(int errnum)
Definition: compat.c:123
int rdb_init()
Definition: rdb.c:18
E const char version_flags[]
Definition: extern.h:771
E char * s_BotServAlias
Definition: extern.h:314
char * real
Definition: services.h:576
char * nickservaliasmode
Definition: services.h:287
E void alog(const char *fmt,...) FORMAT(printf
int delay_cl_intro
Definition: services.h:376
E void rand_init(void)
Definition: misc.c:977
char * chanservaliasmode
Definition: services.h:288
E int ExpireTimeout
Definition: extern.h:345
int encryption_module_init(void)
Definition: modules.c:158
char * helpservmode
Definition: services.h:284
#define EVENT_START
Definition: events.h:14
E int debug
Definition: extern.h:775
int join2msg
Definition: services.h:319
E char * desc_MemoServAlias
Definition: extern.h:322
E void disconn(ano_socket_t s)
Definition: sockutil.c:632
void modules_delayed_init(void)
Definition: modules.c:235
E int read_config(int reload)
Definition: config.c:894
char * memoservmode
Definition: services.h:280
E char * s_HostServ
Definition: extern.h:303
E int logchan
Definition: extern.h:777
E void add_entropy_userkeys(void)
Definition: misc.c:1028
E char * s_DevNullAlias
Definition: extern.h:318
E int skeleton
Definition: extern.h:778
E void load_bs_dbase(void)
Definition: botserv.c:435
E char * RemoteServer3
Definition: extern.h:268
E char * s_HostServAlias
Definition: extern.h:319
E const char version_number[]
Definition: extern.h:767
E void lang_init(void)
Definition: language.c:178
E int LocalPort
Definition: extern.h:272
int openlog_errno
Definition: init.c:426
E char * desc_BotServ
Definition: extern.h:295
int protocol_module_init(void)
Definition: modules.c:183
char * host
Definition: services.h:575
char * operservmode
Definition: services.h:282
E void anope_cmd_bob()
Definition: ircd.c:559
BotInfo * next
Definition: services.h:571
void moduleAddIRCDMsgs(void)
Definition: bahamut.c:636
E void load_news(void)
Definition: news.c:153
E void anope_cmd_connect(int servernum)
Definition: ircd.c:554
int UseRDB
Definition: config.c:320
E char * s_MemoServAlias
Definition: extern.h:313
E char * LogChannel
Definition: extern.h:280
#define EVENT_CONNECT
Definition: events.h:37
E char * desc_OperServAlias
Definition: extern.h:325
char * nick
Definition: services.h:573
E char * PIDFilename
Definition: extern.h:330
char * globalmode
Definition: services.h:286
E void helpserv_init(void)
Definition: helpserv.c:37
E BotInfo * botlists[256]
Definition: extern.h:64
E void bs_init(void)
Definition: botserv.c:71
char * chanservmode
Definition: services.h:279
E char * desc_HelpServ
Definition: extern.h:296
void init_tertiary()
Definition: init.c:777
char * devnullvaliasmode
Definition: services.h:294
E char * ServerName
Definition: extern.h:274
E int forceload
Definition: extern.h:780
E int defconParseModeString(const char *str)
Definition: operserv.c:1703
E void cs_init(void)
Definition: chanserv.c:380
E char * s_ChanServ
Definition: extern.h:285
char * globalaliasmode
Definition: services.h:295
char * helpservaliasmode
Definition: services.h:293
char * operservaliasmode
Definition: services.h:291
E void E void log_perror(const char *fmt,...) FORMAT(printf
E char * s_NickServ
Definition: extern.h:284
char * botservaliasmode
Definition: services.h:292
E char * ServiceUser
Definition: extern.h:276
E char * version_protocol
Definition: extern.h:770
E int noexpire
Definition: extern.h:782
E void anope_cmd_bot_nick(char *nick, char *user, char *host, char *real, char *modes)
Definition: ircd.c:224
void introduce_user(const char *user)
Definition: init.c:23
static int set_group(void)
Definition: init.c:144
char * user
Definition: services.h:574
char * hostservaliasmode
Definition: services.h:290
E char * desc_NickServAlias
Definition: extern.h:320
static int parse_dir_options(int ac, char **av)
Definition: init.c:175
E void load_ns_req_db(void)
Definition: nickserv.c:527
E const char version_build[]
Definition: extern.h:769
E char * s_GlobalNoticer
Definition: extern.h:290
E void anope_cmd_eob()
Definition: ircd.c:639
E char * s_NickServAlias
Definition: extern.h:311
E char * s_DevNull
Definition: extern.h:291
E void anope_cmd_global(char *source, const char *fmt,...)
Definition: ircd.c:506