*
* This file is part of x3.
*
- * srvx is free software; you can redistribute it and/or modify
+ * x3 is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
#include "modcmd.h"
#include "saxdb.h"
#include "sendmail.h"
+#include "shun.h"
#include "timeq.h"
#include "chanserv.h"
{ "MSG_MODULE_UNKNOWN", "No module has been registered with name $b%s$b." },
{ "MSG_INVALID_MODES", "$b%s$b is an invalid set of channel modes." },
{ "MSG_INVALID_GLINE", "Invalid G-line '%s'." },
+ { "MSG_INVALID_SHUN", "Invalid Shun '%s'." },
{ "MSG_INVALID_DURATION", "Invalid time span '%s'." },
{ "MSG_NOT_TARGET_NAME", "You must provide the name of a channel or user." },
{ "MSG_NOT_CHANNEL_NAME", "The channel name you specified is not a valid channel name." },
{
struct uplinkNode *uplink = malloc(sizeof(struct uplinkNode));
struct record_data *rd = data;
+ struct addrinfo hints, *ai;
int enabled = 1;
char *str;
- struct sockaddr_in *sin;
- unsigned long addr;
if(!uplink)
{
uplink->tries = 0;
str = database_get_data(rd->d.object, "bind_address", RECDB_QSTRING);
- uplink->bind_addr_len = sizeof(*sin);
- if (str && getipbyname(str, &addr))
+ memset(&hints, 0, sizeof(hints));
+ hints.ai_flags = AI_PASSIVE;
+ hints.ai_socktype = SOCK_STREAM;
+ if (!getaddrinfo(str, NULL, &hints, &ai))
{
- sin = calloc(1, uplink->bind_addr_len);
- sin->sin_family = AF_INET;
- sin->sin_addr.s_addr = addr;
- uplink->bind_addr = sin;
- }
- else
+ uplink->bind_addr_len = ai->ai_addrlen;
+ uplink->bind_addr = calloc(1, ai->ai_addrlen);
+ memcpy(uplink->bind_addr, ai->ai_addr, ai->ai_addrlen);
+ freeaddrinfo(ai);
+ }
+ else
{
uplink->bind_addr = NULL;
uplink->bind_addr_len = 0;
static int
set_item_rlimit(const char *name, void *data, void *extra)
{
- int rsrc, found;
+ long rsrc;
+ int found;
struct record_data *rd = data;
struct rlimit rlim;
const char *str;
- rsrc = (int)dict_find(extra, name, &found);
+ rsrc = (long)dict_find(extra, name, &found);
if (!found) {
log_module(MAIN_LOG, LOG_ERROR, "Invalid rlimit \"%s\" in rlimits section.", name);
return 0;
modcmd_init();
saxdb_init();
gline_init();
+ shun_init();
sendmail_init();
helpfile_init();
conf_globals(); /* initializes the core services */