| 34 |
|
#include "fdlist.h" |
| 35 |
|
#include "hash.h" |
| 36 |
|
#include "irc_string.h" |
| 37 |
– |
#include "sprintf_irc.h" |
| 37 |
|
#include "ircd_signal.h" |
| 38 |
|
#include "s_gline.h" |
| 39 |
|
#include "motd.h" |
| 194 |
|
|
| 195 |
|
if (newtime.tv_sec < CurrentTime) |
| 196 |
|
{ |
| 197 |
< |
ircsprintf(to_send, "System clock is running backwards - (%lu < %lu)", |
| 198 |
< |
(unsigned long)newtime.tv_sec, (unsigned long)CurrentTime); |
| 197 |
> |
snprintf(to_send, sizeof(to_send), |
| 198 |
> |
"System clock is running backwards - (%lu < %lu)", |
| 199 |
> |
(unsigned long)newtime.tv_sec, (unsigned long)CurrentTime); |
| 200 |
|
report_error(L_ALL, to_send, me.name, 0); |
| 201 |
|
set_back_events(CurrentTime - newtime.tv_sec); |
| 202 |
|
} |
| 331 |
|
{ |
| 332 |
|
add_capability("QS", CAP_QS, 1); |
| 333 |
|
add_capability("EOB", CAP_EOB, 1); |
| 334 |
< |
|
| 335 |
< |
if (ServerInfo.sid != NULL) /* only enable TS6 if we have an SID */ |
| 336 |
< |
add_capability("TS6", CAP_TS6, 0); |
| 337 |
< |
|
| 334 |
> |
add_capability("TS6", CAP_TS6, 0); |
| 335 |
|
add_capability("ZIP", CAP_ZIP, 0); |
| 336 |
|
add_capability("CLUSTER", CAP_CLUSTER, 1); |
| 337 |
|
#ifdef HALFOPS |
| 354 |
|
{ |
| 355 |
|
char buff[32]; |
| 356 |
|
unsigned int pid = (unsigned int)getpid(); |
| 357 |
< |
size_t nbytes = ircsprintf(buff, "%u\n", pid); |
| 357 |
> |
size_t nbytes = snprintf(buff, sizeof(buff), "%u\n", pid); |
| 358 |
|
|
| 359 |
|
if ((fbputs(buff, fb, nbytes) == -1)) |
| 360 |
|
ilog(L_ERROR, "Error writing %u to pid file %s (%s)", |
| 580 |
|
init_auth(); /* Initialise the auth code */ |
| 581 |
|
init_resolver(); /* Needs to be setup before the io loop */ |
| 582 |
|
read_conf_files(1); /* cold start init conf files */ |
| 586 |
– |
me.id[0] = '\0'; |
| 583 |
|
init_uid(); |
| 584 |
|
initialize_server_capabs(); /* Set up default_server_capabs */ |
| 585 |
|
initialize_global_set_options(); |
| 586 |
|
init_channels(); |
| 587 |
|
|
| 588 |
< |
if (ServerInfo.name == NULL) |
| 588 |
> |
if (EmptyString(ServerInfo.sid)) |
| 589 |
|
{ |
| 590 |
< |
ilog(L_CRIT, "No server name specified in serverinfo block."); |
| 590 |
> |
ilog(L_CRIT, "ERROR: No server id specified in serverinfo block."); |
| 591 |
> |
exit(EXIT_FAILURE); |
| 592 |
> |
} |
| 593 |
> |
|
| 594 |
> |
strlcpy(me.id, ServerInfo.sid, sizeof(me.id)); |
| 595 |
> |
|
| 596 |
> |
if (EmptyString(ServerInfo.name)) |
| 597 |
> |
{ |
| 598 |
> |
ilog(L_CRIT, "ERROR: No server name specified in serverinfo block."); |
| 599 |
|
exit(EXIT_FAILURE); |
| 600 |
|
} |
| 601 |
|
|
| 602 |
|
strlcpy(me.name, ServerInfo.name, sizeof(me.name)); |
| 603 |
|
|
| 604 |
|
/* serverinfo{} description must exist. If not, error out.*/ |
| 605 |
< |
if (ServerInfo.description == NULL) |
| 605 |
> |
if (EmptyString(ServerInfo.description)) |
| 606 |
|
{ |
| 607 |
< |
ilog(L_CRIT, |
| 604 |
< |
"ERROR: No server description specified in serverinfo block."); |
| 607 |
> |
ilog(L_CRIT, "ERROR: No server description specified in serverinfo block."); |
| 608 |
|
exit(EXIT_FAILURE); |
| 609 |
|
} |
| 610 |
|
|
| 617 |
|
make_server(&me); |
| 618 |
|
|
| 619 |
|
me.lasttime = me.since = me.firsttime = CurrentTime; |
| 620 |
+ |
|
| 621 |
+ |
hash_add_id(&me); |
| 622 |
|
hash_add_client(&me); |
| 623 |
|
|
| 624 |
|
/* add ourselves to global_serv_list */ |
| 625 |
|
dlinkAdd(&me, make_dlink_node(), &global_serv_list); |
| 626 |
|
|
| 622 |
– |
#ifndef STATIC_MODULES |
| 627 |
|
if (chdir(MODPATH)) |
| 628 |
|
{ |
| 629 |
< |
ilog (L_CRIT, "Could not load core modules. Terminating!"); |
| 629 |
> |
ilog(L_CRIT, "Could not load core modules. Terminating!"); |
| 630 |
|
exit(EXIT_FAILURE); |
| 631 |
|
} |
| 632 |
|
|
| 633 |
|
load_all_modules(1); |
| 634 |
|
load_conf_modules(); |
| 635 |
|
load_core_modules(1); |
| 636 |
+ |
|
| 637 |
|
/* Go back to DPATH after checking to see if we can chdir to MODPATH */ |
| 638 |
< |
chdir(ConfigFileEntry.dpath); |
| 639 |
< |
#else |
| 640 |
< |
load_all_modules(1); |
| 641 |
< |
#endif |
| 638 |
> |
if (chdir(ConfigFileEntry.dpath)) |
| 639 |
> |
{ |
| 640 |
> |
perror("chdir"); |
| 641 |
> |
exit(EXIT_FAILURE); |
| 642 |
> |
} |
| 643 |
> |
|
| 644 |
|
/* |
| 645 |
|
* assemble_umode_buffer() has to be called after |
| 646 |
|
* reading conf/loading modules. |