Merge branch 'master' into authd-framework-2

This commit is contained in:
Elizabeth Myers 2016-03-22 17:43:43 -05:00
commit 238a9ed590
101 changed files with 1876 additions and 4820 deletions

8
.appveyor-build.sh Normal file
View file

@ -0,0 +1,8 @@
set -v
export PATH=/mingw64/bin:/usr/local/bin:/usr/bin:/bin:/c/Windows/system32:/c/Windows:/c/Windows/System32/Wbem:/c/Windows/System32/WindowsPowerShell/v1.0:/usr/bin/site_perl:/usr/bin/vendor_perl:/usr/bin/core_perl
sh ./autogen.sh
./configure --prefix=c:/projects/charybdis/build --enable-openssl=/mingw64 --build=x86_64-pc-mingw64 --host=x86_64-pc-mingw64
make -j2
make install

15
.appveyor.yml Normal file
View file

@ -0,0 +1,15 @@
version: 3.6-dev_{build}
clone_depth: 10
install:
- c:\msys64\usr\bin\sh.exe -lc "pacman -Sy --noconfirm git"
- c:\msys64\usr\bin\sh.exe -lc "uname -a"
- c:\msys64\usr\bin\sh.exe -lc "cat /proc/cpuinfo"
- c:\msys64\usr\bin\sh.exe -lc "cat /proc/meminfo"
- c:\msys64\usr\bin\sh.exe -lc "cygcheck -s -v > $APPVEYOR_BUILD_FOLDER/cygcheck.log 2>&1"
- ps: Push-AppveyorArtifact cygcheck.log
build_script:
- c:\msys64\usr\bin\sh.exe -lc "cd $APPVEYOR_BUILD_FOLDER; sh .appveyor-build.sh"
# - c:\msys64\usr\bin\sh.exe -lc "cd $APPVEYOR_BUILD_FOLDER/build/bin; ./charybdis -version"
on_failure:
- ps: Push-AppveyorArtifact config.log
- ps: Push-AppveyorArtifact librb\include\librb-config.h

6
.gitignore vendored
View file

@ -46,11 +46,11 @@ scripts/*.tar.gz
include/setup.h
include/setup.h.in
ircd/charybdis
ircd/lex.yy.c
ircd/ircd_parser.c
ircd/ircd_parser.h
ircd/ircd_lexer.c
ircd/version.c
ircd/version.c.last
ircd/y.tab.h
ircd/y.tab.c
ssld/ssld
tools/charybdis-mkpasswd
tools/genssl

View file

@ -44,9 +44,6 @@ matrix:
compiler: clang
env: COMPILER=clang LIBTOOLIZE=glibtoolize
branches:
except:
- authd-framework
osx_image: xcode7.3

View file

@ -33,7 +33,7 @@ ThaPrince, Jon Christopherson <jon -at- vile.com>
twincest, River Tarnell <river -at- attenuate.org>
w00t, Robin Burchell <surreal.w00t -at- gmail.com>
For a list of contributors to ircd-ratbox, ircd-hyrbid, and ircd2.8 (the
For a list of contributors to ircd-ratbox, ircd-hybrid, and ircd2.8 (the
predecessors to Charybdis), see the doc/credits-past.txt file in the Charybdis
distribution.

View file

@ -42,3 +42,6 @@ install-exec-hook:
rm -f ${DESTDIR}${moduledir}/*.la
rm -f ${DESTDIR}${moduledir}/autoload/*.la
rm -f ${DESTDIR}${moduledir}/extensions/*.la
rm -f ${DESTDIR}${moduledir}/*.dll.a
rm -f ${DESTDIR}${moduledir}/autoload/*.dll.a
rm -f ${DESTDIR}${moduledir}/extensions/*.dll.a

View file

@ -1,4 +1,4 @@
# charybdis [![Build Status](https://travis-ci.org/charybdis-ircd/charybdis.svg?branch=master)](https://travis-ci.org/charybdis-ircd/charybdis)
# charybdis [![POSIX Build Status](https://travis-ci.org/charybdis-ircd/charybdis.svg?branch=master)](https://travis-ci.org/charybdis-ircd/charybdis) [![Windows Build Status](https://ci.appveyor.com/api/projects/status/is0obsml8xyq2qk7/branch/master?svg=true)](https://ci.appveyor.com/project/kaniini/charybdis/branch/master)
Charybdis is an IRCv3 server designed to be highly scalable. It implements IRCv3.1 and some parts of IRCv3.2.

View file

@ -6,7 +6,10 @@ authd_SOURCES = \
authd.c \
res.c \
reslib.c \
reslist.c \
dns.c \
getaddrinfo.c \
getnameinfo.c \
provider.c \
providers/rdns.c \
providers/ident.c

View file

@ -52,7 +52,7 @@ handle_stat(int parc, char *parv[])
/* XXX Should log this somehow */
return;
if (!(handler = authd_stat_handlers[parv[2][0]]))
if (!(handler = authd_stat_handlers[(unsigned char)parv[2][0]]))
return;
handler(parv[1], parv[2][0]);
@ -67,7 +67,7 @@ handle_reload(int parc, char *parv[])
/* XXX Should log this somehow */
return;
if (!(handler = authd_reload_handlers[parv[1][0]]))
if (!(handler = authd_reload_handlers[(unsigned char)parv[1][0]]))
return;
handler(parv[1][0]);
@ -89,7 +89,7 @@ parse_request(rb_helper *helper)
if(parc < 1)
continue;
handler = authd_cmd_handlers[parv[0][0]];
handler = authd_cmd_handlers[(unsigned char)parv[0][0]];
if (handler != NULL)
handler(parc, parv);
}
@ -101,7 +101,7 @@ error_cb(rb_helper *helper)
exit(1);
}
#ifndef WINDOWS
#ifndef _WIN32
static void
dummy_handler(int sig)
{
@ -112,7 +112,7 @@ dummy_handler(int sig)
static void
setup_signals(void)
{
#ifndef WINDOWS
#ifndef _WIN32
struct sigaction act;
act.sa_flags = 0;

View file

@ -119,14 +119,11 @@ handle_lookup_ip_reply(void *data, struct DNSReply *reply)
{
struct dns_query *query = data;
char ip[64] = "*";
query_type type = QUERY_INVALID;
if(!query)
if(query == NULL)
/* Shouldn't happen */
exit(2);
type = query->type;
if(reply == NULL)
goto end;
@ -155,7 +152,7 @@ handle_lookup_ip_reply(void *data, struct DNSReply *reply)
end:
if(query->callback)
query->callback(ip, ip[0] != '*', type, query->data);
query->callback(ip, ip[0] != '*', query->type, query->data);
rb_free(query);
}
@ -166,14 +163,11 @@ handle_lookup_hostname_reply(void *data, struct DNSReply *reply)
{
struct dns_query *query = data;
char *hostname = NULL;
query_type type = QUERY_INVALID;
if(query == NULL)
/* Shouldn't happen */
exit(4);
type = query->type;
if(reply == NULL)
goto end;

617
authd/getaddrinfo.c Normal file
View file

@ -0,0 +1,617 @@
/*
* Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of the project nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
#ifdef _WIN32
#include <rb_lib.h>
#include "getaddrinfo.h"
/* $Id$ */
static const char in_addrany[] = { 0, 0, 0, 0 };
static const char in_loopback[] = { 127, 0, 0, 1 };
static const char in6_addrany[] = {
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
};
static const char in6_loopback[] = {
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1
};
static const struct afd {
int a_af;
int a_addrlen;
int a_socklen;
int a_off;
const char *a_addrany;
const char *a_loopback;
int a_scoped;
} afdl [] = {
#define N_INET6 0
#ifdef IPV6
{PF_INET6, sizeof(struct in6_addr),
sizeof(struct sockaddr_in6),
offsetof(struct sockaddr_in6, sin6_addr),
in6_addrany, in6_loopback, 1},
#endif
#define N_INET 1
{PF_INET, sizeof(struct in_addr),
sizeof(struct sockaddr_in),
offsetof(struct sockaddr_in, sin_addr),
in_addrany, in_loopback, 0},
{0, 0, 0, 0, NULL, NULL, 0},
};
struct explore {
int e_af;
int e_socktype;
int e_protocol;
const char *e_protostr;
int e_wild;
#define WILD_AF(ex) ((ex)->e_wild & 0x01)
#define WILD_SOCKTYPE(ex) ((ex)->e_wild & 0x02)
#define WILD_PROTOCOL(ex) ((ex)->e_wild & 0x04)
};
static const struct explore explore[] = {
#ifdef IPV6
{ PF_INET6, SOCK_DGRAM, IPPROTO_UDP, "udp", 0x07 },
{ PF_INET6, SOCK_STREAM, IPPROTO_TCP, "tcp", 0x07 },
{ PF_INET6, SOCK_RAW, ANY, NULL, 0x05 },
#endif
{ PF_INET, SOCK_DGRAM, IPPROTO_UDP, "udp", 0x07 },
{ PF_INET, SOCK_STREAM, IPPROTO_TCP, "tcp", 0x07 },
{ PF_INET, SOCK_RAW, ANY, NULL, 0x05 },
{ PF_UNSPEC, SOCK_DGRAM, IPPROTO_UDP, "udp", 0x07 },
{ PF_UNSPEC, SOCK_STREAM, IPPROTO_TCP, "tcp", 0x07 },
{ PF_UNSPEC, SOCK_RAW, ANY, NULL, 0x05 },
{ -1, 0, 0, NULL, 0 },
};
#define PTON_MAX 16
static int str_isnumber(const char *);
static int explore_null(const struct rb_addrinfo *,
const char *, struct rb_addrinfo **);
static int explore_numeric(const struct rb_addrinfo *, const char *,
const char *, struct rb_addrinfo **);
static struct rb_addrinfo *get_ai(const struct rb_addrinfo *,
const struct afd *, const char *);
static int get_portmatch(const struct rb_addrinfo *, const char *);
static int get_port(struct rb_addrinfo *, const char *, int);
static const struct afd *find_afd(int);
#if 0
/* We will need this should we ever want gai_strerror() */
static char *ai_errlist[] = {
"Success",
"Address family for hostname not supported", /* EAI_ADDRFAMILY */
"Temporary failure in name resolution", /* EAI_AGAIN */
"Invalid value for ai_flags", /* EAI_BADFLAGS */
"Non-recoverable failure in name resolution", /* EAI_FAIL */
"ai_family not supported", /* EAI_FAMILY */
"Memory allocation failure", /* EAI_MEMORY */
"No address associated with hostname", /* EAI_NODATA */
"hostname nor servname provided, or not known", /* EAI_NONAME */
"servname not supported for ai_socktype", /* EAI_SERVICE */
"ai_socktype not supported", /* EAI_SOCKTYPE */
"System error returned in errno", /* EAI_SYSTEM */
"Invalid value for hints", /* EAI_BADHINTS */
"Resolved protocol is unknown", /* EAI_PROTOCOL */
"Unknown error", /* EAI_MAX */
};
#endif
/* XXX macros that make external reference is BAD. */
#define GET_AI(ai, afd, addr) \
do { \
/* external reference: pai, error, and label free */ \
(ai) = get_ai(pai, (afd), (addr)); \
if ((ai) == NULL) { \
error = EAI_MEMORY; \
goto free; \
} \
} while (/*CONSTCOND*/0)
#define GET_PORT(ai, serv) \
do { \
/* external reference: error and label free */ \
error = get_port((ai), (serv), 0); \
if (error != 0) \
goto free; \
} while (/*CONSTCOND*/0)
#define ERR(err) \
do { \
/* external reference: error, and label bad */ \
error = (err); \
goto bad; \
/*NOTREACHED*/ \
} while (/*CONSTCOND*/0)
#define MATCH_FAMILY(x, y, w) \
((x) == (y) || (/*CONSTCOND*/(w) && ((x) == PF_UNSPEC || (y) == PF_UNSPEC)))
#define MATCH(x, y, w) \
((x) == (y) || (/*CONSTCOND*/(w) && ((x) == ANY || (y) == ANY)))
#if 0
/* We will need this should we ever want gai_strerror() */
char *
gai_strerror(int ecode)
{
if (ecode < 0 || ecode > EAI_MAX)
ecode = EAI_MAX;
return ai_errlist[ecode];
}
#endif
void
rb_freeaddrinfo(struct rb_addrinfo *ai)
{
struct rb_addrinfo *next;
do {
next = ai->ai_next;
if (ai->ai_canonname)
rb_free(ai->ai_canonname);
/* no need to free(ai->ai_addr) */
rb_free(ai);
ai = next;
} while (ai);
}
static int
str_isnumber(const char *p)
{
char *ep;
if (*p == '\0')
return NO;
ep = NULL;
errno = 0;
(void)strtoul(p, &ep, 10);
if (errno == 0 && ep && *ep == '\0')
return YES;
else
return NO;
}
int
rb_getaddrinfo(const char *hostname, const char *servname,
const struct rb_addrinfo *hints, struct rb_addrinfo **res)
{
struct rb_addrinfo sentinel;
struct rb_addrinfo *cur;
int error = 0;
struct rb_addrinfo ai;
struct rb_addrinfo ai0;
struct rb_addrinfo *pai;
const struct explore *ex;
memset(&sentinel, 0, sizeof(sentinel));
cur = &sentinel;
pai = &ai;
pai->ai_flags = 0;
pai->ai_family = PF_UNSPEC;
pai->ai_socktype = ANY;
pai->ai_protocol = ANY;
pai->ai_addrlen = 0;
pai->ai_canonname = NULL;
pai->ai_addr = NULL;
pai->ai_next = NULL;
if (hostname == NULL && servname == NULL)
return EAI_NONAME;
if (hints) {
/* error check for hints */
if (hints->ai_addrlen || hints->ai_canonname ||
hints->ai_addr || hints->ai_next)
ERR(EAI_BADHINTS); /* xxx */
if (hints->ai_flags & ~AI_MASK)
ERR(EAI_BADFLAGS);
switch (hints->ai_family) {
case PF_UNSPEC:
case PF_INET:
#ifdef IPV6
case PF_INET6:
#endif
break;
default:
ERR(EAI_FAMILY);
}
memcpy(pai, hints, sizeof(*pai));
/*
* if both socktype/protocol are specified, check if they
* are meaningful combination.
*/
if (pai->ai_socktype != ANY && pai->ai_protocol != ANY) {
for (ex = explore; ex->e_af >= 0; ex++) {
if (pai->ai_family != ex->e_af)
continue;
if (ex->e_socktype == ANY)
continue;
if (ex->e_protocol == ANY)
continue;
if (pai->ai_socktype == ex->e_socktype &&
pai->ai_protocol != ex->e_protocol) {
ERR(EAI_BADHINTS);
}
}
}
}
/*
* check for special cases. (1) numeric servname is disallowed if
* socktype/protocol are left unspecified. (2) servname is disallowed
* for raw and other inet{,6} sockets.
*/
if (MATCH_FAMILY(pai->ai_family, PF_INET, 1)
#ifdef IPV6
|| MATCH_FAMILY(pai->ai_family, PF_INET6, 1)
#endif
) {
ai0 = *pai; /* backup *pai */
if (pai->ai_family == PF_UNSPEC) {
#ifdef IPV6
pai->ai_family = PF_INET6;
#else
pai->ai_family = PF_INET;
#endif
}
error = get_portmatch(pai, servname);
if (error)
ERR(error);
*pai = ai0;
}
ai0 = *pai;
/* NULL hostname, or numeric hostname */
for (ex = explore; ex->e_af >= 0; ex++) {
*pai = ai0;
/* PF_UNSPEC entries are prepared for DNS queries only */
if (ex->e_af == PF_UNSPEC)
continue;
if (!MATCH_FAMILY(pai->ai_family, ex->e_af, WILD_AF(ex)))
continue;
if (!MATCH(pai->ai_socktype, ex->e_socktype, WILD_SOCKTYPE(ex)))
continue;
if (!MATCH(pai->ai_protocol, ex->e_protocol, WILD_PROTOCOL(ex)))
continue;
if (pai->ai_family == PF_UNSPEC)
pai->ai_family = ex->e_af;
if (pai->ai_socktype == ANY && ex->e_socktype != ANY)
pai->ai_socktype = ex->e_socktype;
if (pai->ai_protocol == ANY && ex->e_protocol != ANY)
pai->ai_protocol = ex->e_protocol;
if (hostname == NULL)
error = explore_null(pai, servname, &cur->ai_next);
else
error = explore_numeric(pai, hostname, servname, &cur->ai_next);
if (error)
goto free;
while (cur && cur->ai_next)
cur = cur->ai_next;
}
/*
* XXX
* If numreic representation of AF1 can be interpreted as FQDN
* representation of AF2, we need to think again about the code below.
*/
if (sentinel.ai_next)
goto good;
if (pai->ai_flags & AI_NUMERICHOST)
ERR(EAI_NONAME);
if (hostname == NULL)
ERR(EAI_NODATA);
/* XXX */
if (sentinel.ai_next)
error = 0;
if (error)
goto free;
if (error == 0) {
if (sentinel.ai_next) {
good:
*res = sentinel.ai_next;
return SUCCESS;
} else
error = EAI_FAIL;
}
free:
bad:
if (sentinel.ai_next)
rb_freeaddrinfo(sentinel.ai_next);
*res = NULL;
return error;
}
/*
* hostname == NULL.
* passive socket -> anyaddr (0.0.0.0 or ::)
* non-passive socket -> localhost (127.0.0.1 or ::1)
*/
static int
explore_null(const struct rb_addrinfo *pai, const char *servname, struct rb_addrinfo **res)
{
int s;
const struct afd *afd;
struct rb_addrinfo *cur;
struct rb_addrinfo sentinel;
int error;
*res = NULL;
sentinel.ai_next = NULL;
cur = &sentinel;
/*
* filter out AFs that are not supported by the kernel
* XXX errno?
*/
s = socket(pai->ai_family, SOCK_DGRAM, 0);
if (s < 0) {
#ifdef _WIN32
errno = WSAGetLastError();
#endif
if (errno != EMFILE)
return 0;
} else
#ifdef _WIN32
closesocket(s);
#else
close(s);
#endif
/*
* if the servname does not match socktype/protocol, ignore it.
*/
if (get_portmatch(pai, servname) != 0)
return 0;
afd = find_afd(pai->ai_family);
if (afd == NULL)
return 0;
if (pai->ai_flags & AI_PASSIVE) {
GET_AI(cur->ai_next, afd, afd->a_addrany);
GET_PORT(cur->ai_next, servname);
} else {
GET_AI(cur->ai_next, afd, afd->a_loopback);
GET_PORT(cur->ai_next, servname);
}
cur = cur->ai_next;
*res = sentinel.ai_next;
return 0;
free:
if (sentinel.ai_next)
rb_freeaddrinfo(sentinel.ai_next);
return error;
}
/*
* numeric hostname
*/
static int
explore_numeric(const struct rb_addrinfo *pai, const char *hostname,
const char *servname, struct rb_addrinfo **res)
{
const struct afd *afd;
struct rb_addrinfo *cur;
struct rb_addrinfo sentinel;
int error;
char pton[PTON_MAX];
*res = NULL;
sentinel.ai_next = NULL;
cur = &sentinel;
/*
* if the servname does not match socktype/protocol, ignore it.
*/
if (get_portmatch(pai, servname) != 0)
return 0;
afd = find_afd(pai->ai_family);
if (afd == NULL)
return 0;
switch (afd->a_af) {
#if 0 /*X/Open spec*/
case AF_INET:
if (rb_inet_pton
if (inet_aton(hostname, (struct in_addr *)pton) == 1) {
if (pai->ai_family == afd->a_af ||
pai->ai_family == PF_UNSPEC /*?*/) {
GET_AI(cur->ai_next, afd, pton);
GET_PORT(cur->ai_next, servname);
while (cur && cur->ai_next)
cur = cur->ai_next;
} else
ERR(EAI_FAMILY); /*xxx*/
}
break;
#endif
default:
if (rb_inet_pton(afd->a_af, hostname, pton) == 1) {
if (pai->ai_family == afd->a_af ||
pai->ai_family == PF_UNSPEC /*?*/) {
GET_AI(cur->ai_next, afd, pton);
GET_PORT(cur->ai_next, servname);
while (cur && cur->ai_next)
cur = cur->ai_next;
} else
ERR(EAI_FAMILY); /* XXX */
}
break;
}
*res = sentinel.ai_next;
return 0;
free:
bad:
if (sentinel.ai_next)
rb_freeaddrinfo(sentinel.ai_next);
return error;
}
static struct rb_addrinfo *
get_ai(const struct rb_addrinfo *pai, const struct afd *afd, const char *addr)
{
char *p;
struct rb_addrinfo *ai;
ai = (struct rb_addrinfo *)rb_malloc(sizeof(struct rb_addrinfo)
+ (afd->a_socklen));
if (ai == NULL)
return NULL;
memcpy(ai, pai, sizeof(struct rb_addrinfo));
ai->ai_addr = (struct sockaddr *)(void *)(ai + 1);
memset(ai->ai_addr, 0, (size_t)afd->a_socklen);
ai->ai_addrlen = afd->a_socklen;
ai->ai_addr->sa_family = ai->ai_family = afd->a_af;
p = (char *)(void *)(ai->ai_addr);
memcpy(p + afd->a_off, addr, (size_t)afd->a_addrlen);
return ai;
}
static int
get_portmatch(const struct rb_addrinfo *ai, const char *servname)
{
struct rb_addrinfo xai;
memcpy(&xai, ai, sizeof(struct rb_addrinfo));
return(get_port(&xai, servname, 1));
}
static int
get_port(struct rb_addrinfo *ai, const char *servname, int matchonly)
{
const char *proto;
struct servent *sp;
int port;
int allownumeric;
if (servname == NULL)
return 0;
switch (ai->ai_family) {
case AF_INET:
#ifdef AF_INET6
case AF_INET6:
#endif
break;
default:
return 0;
}
switch (ai->ai_socktype) {
case SOCK_RAW:
return EAI_SERVICE;
case SOCK_DGRAM:
case SOCK_STREAM:
allownumeric = 1;
break;
case ANY:
allownumeric = 0;
break;
default:
return EAI_SOCKTYPE;
}
if (str_isnumber(servname)) {
if (!allownumeric)
return EAI_SERVICE;
port = atoi(servname);
if (port < 0 || port > 65535)
return EAI_SERVICE;
port = htons(port);
} else {
switch (ai->ai_socktype) {
case SOCK_DGRAM:
proto = "udp";
break;
case SOCK_STREAM:
proto = "tcp";
break;
default:
proto = NULL;
break;
}
if ((sp = getservbyname(servname, proto)) == NULL)
return EAI_SERVICE;
port = sp->s_port;
}
if (!matchonly) {
switch (ai->ai_family) {
case AF_INET:
((struct sockaddr_in *)(void *)
ai->ai_addr)->sin_port = port;
break;
#ifdef IPV6
case AF_INET6:
((struct sockaddr_in6 *)(void *)
ai->ai_addr)->sin6_port = port;
break;
#endif
}
}
return 0;
}
static const struct afd *
find_afd(int af)
{
const struct afd *afd;
if (af == PF_UNSPEC)
return(NULL);
for (afd = afdl; afd->a_af; afd++)
{
if (afd->a_af == af)
return(afd);
}
return(NULL);
}
#endif

130
authd/getaddrinfo.h Normal file
View file

@ -0,0 +1,130 @@
/*
* Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of the project nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $Id$
*/
struct rb_addrinfo {
int ai_flags;
int ai_family;
int ai_socktype;
int ai_protocol;
size_t ai_addrlen;
char *ai_canonname;
struct sockaddr *ai_addr;
struct rb_addrinfo *ai_next;
};
#ifndef AI_PASSIVE
#define AI_PASSIVE 0x00000001 /* get address to use bind() */
#endif /* AI_PASSIVE */
#ifndef AI_NUMERICHOST
#define AI_NUMERICHOST 0x00000004 /* prevent name resolution */
#endif /* AI_NUMERICHOST */
#ifndef EAI_FAIL
#define EAI_FAIL 4 /* non-recoverable failure in name resolution */
#endif /* EAI_FAIL */
#ifndef EAI_FAMILY
#define EAI_FAMILY 5 /* ai_family not supported */
#endif /* EAI_FAMILY */
#ifndef EAI_MEMORY
#define EAI_MEMORY 6 /* memory allocation failure */
#endif /* EAI_MEMORY */
#ifndef EAI_NONAME
#define EAI_NONAME 8 /* hostname nor servname provided, or not known */
#endif /* EAI_NONAME */
#ifndef EAI_SYSTEM
#define EAI_SYSTEM 11 /* system error returned in errno */
#endif /* EAI_SYSTEM */
#ifndef NI_NUMERICHOST
#define NI_NUMERICHOST 0x00000002
#endif /* NI_NUMERICHOST */
#ifndef NI_NAMEREQD
#define NI_NAMEREQD 0x00000004
#endif /* NI_NAMEREQD */
#ifndef NI_NUMERICSERV
#define NI_NUMERICSERV 0x00000008
#endif /* NI_NUMERICSERV */
#ifndef NI_DGRAM
#define NI_DGRAM 0x00000010
#endif /* NI_DGRAM */
#ifndef INADDR_NONE
#define INADDR_NONE ((unsigned int) 0xffffffff)
#endif /* INADDR_NONE */
int rb_getaddrinfo(const char *hostname, const char *servname,
const struct rb_addrinfo *hints, struct rb_addrinfo **res);
void rb_freeaddrinfo(struct rb_addrinfo *ai);
#define SUCCESS 0
#define ANY 0
#define YES 1
#define NO 0
#undef EAI_ADDRFAMILY
#undef EAI_AGAIN
#undef EAI_BADFLAGS
#undef EAI_FAIL
#undef EAI_FAMILY
#undef EAI_MEMORY
#undef EAI_NODATA
#undef EAI_NONAME
#undef EAI_SERVICE
#undef EAI_SOCKTYPE
#undef EAI_SYSTEM
#undef EAI_BADHINTS
#undef EAI_PROTOCOL
#undef EAI_MAX
#undef AI_MASK
#define EAI_ADDRFAMILY 1 /* address family for hostname not supported */
#define EAI_AGAIN 2 /* temporary failure in name resolution */
#define EAI_BADFLAGS 3 /* invalid value for ai_flags */
#define EAI_FAIL 4 /* non-recoverable failure in name resolution */
#define EAI_FAMILY 5 /* ai_family not supported */
#define EAI_MEMORY 6 /* memory allocation failure */
#define EAI_NODATA 7 /* no address associated with hostname */
#define EAI_NONAME 8 /* hostname nor servname provided, or not known */
#define EAI_SERVICE 9 /* servname not supported for ai_socktype */
#define EAI_SOCKTYPE 10 /* ai_socktype not supported */
#define EAI_SYSTEM 11 /* system error returned in errno */
#define EAI_BADHINTS 12
#define EAI_PROTOCOL 13
#define EAI_MAX 14
#define AI_MASK (AI_PASSIVE | AI_NUMERICHOST)

242
authd/getnameinfo.c Normal file
View file

@ -0,0 +1,242 @@
/*
* Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of the project nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
/*
* Issues to be discussed:
* - Thread safe-ness must be checked
* - RFC2553 says that we should raise error on short buffer. X/Open says
* we need to truncate the result. We obey RFC2553 (and X/Open should be
* modified). ipngwg rough consensus seems to follow RFC2553.
* - What is "local" in NI_FQDN?
* - NI_NAMEREQD and NI_NUMERICHOST conflict with each other.
* - (KAME extension) always attach textual scopeid (fe80::1%lo0), if
* sin6_scope_id is filled - standardization status?
* XXX breaks backward compat for code that expects no scopeid.
* beware on merge.
*/
#ifdef _WIN32
#include <rb_lib.h>
#include "getaddrinfo.h"
#include "getnameinfo.h"
/* $Id$ */
static const struct afd {
int a_af;
int a_addrlen;
rb_socklen_t a_socklen;
int a_off;
} afdl [] = {
#ifdef IPV6
{PF_INET6, sizeof(struct in6_addr), sizeof(struct sockaddr_in6),
offsetof(struct sockaddr_in6, sin6_addr)},
#endif
{PF_INET, sizeof(struct in_addr), sizeof(struct sockaddr_in),
offsetof(struct sockaddr_in, sin_addr)},
{0, 0, 0, 0},
};
struct sockinet
{
unsigned char si_len;
unsigned char si_family;
unsigned short si_port;
};
#ifdef IPV6
static int ip6_parsenumeric(const struct sockaddr *, const char *, char *,
size_t, int);
#endif
int
rb_getnameinfo(const struct sockaddr *sa, rb_socklen_t salen, char *host,
size_t hostlen, char *serv, size_t servlen, int flags)
{
const struct afd *afd;
struct servent *sp;
unsigned short port;
int family, i;
const char *addr;
uint32_t v4a;
char numserv[512];
char numaddr[512];
if (sa == NULL)
return EAI_FAIL;
/* if (sa->sa_len != salen)
return EAI_FAIL;
*/
family = sa->sa_family;
for (i = 0; afdl[i].a_af; i++)
if (afdl[i].a_af == family) {
afd = &afdl[i];
goto found;
}
return EAI_FAMILY;
found:
if (salen != afd->a_socklen)
return EAI_FAIL;
/* network byte order */
port = ((const struct sockinet *)sa)->si_port;
addr = (const char *)sa + afd->a_off;
if (serv == NULL || servlen == 0) {
/*
* do nothing in this case.
* in case you are wondering if "&&" is more correct than
* "||" here: rfc2553bis-03 says that serv == NULL OR
* servlen == 0 means that the caller does not want the result.
*/
} else {
if (flags & NI_NUMERICSERV)
sp = NULL;
else {
sp = getservbyport(port,
(flags & NI_DGRAM) ? "udp" : "tcp");
}
if (sp) {
if (strlen(sp->s_name) + 1 > servlen)
return EAI_MEMORY;
rb_strlcpy(serv, sp->s_name, servlen);
} else {
snprintf(numserv, sizeof(numserv), "%u", ntohs(port));
if (strlen(numserv) + 1 > servlen)
return EAI_MEMORY;
rb_strlcpy(serv, numserv, servlen);
}
}
switch (sa->sa_family) {
case AF_INET:
v4a = (uint32_t)
ntohl(((const struct sockaddr_in *)sa)->sin_addr.s_addr);
if (IN_MULTICAST(v4a) || IN_EXPERIMENTAL(v4a))
flags |= NI_NUMERICHOST;
v4a >>= IN_CLASSA_NSHIFT;
if (v4a == 0)
flags |= NI_NUMERICHOST;
break;
#ifdef IPV6
case AF_INET6:
{
const struct sockaddr_in6 *sin6;
sin6 = (const struct sockaddr_in6 *)sa;
switch (sin6->sin6_addr.s6_addr[0]) {
case 0x00:
if (IN6_IS_ADDR_V4MAPPED(&sin6->sin6_addr))
;
else if (IN6_IS_ADDR_LOOPBACK(&sin6->sin6_addr))
;
else
flags |= NI_NUMERICHOST;
break;
default:
if (IN6_IS_ADDR_LINKLOCAL(&sin6->sin6_addr)) {
flags |= NI_NUMERICHOST;
}
else if (IN6_IS_ADDR_MULTICAST(&sin6->sin6_addr))
flags |= NI_NUMERICHOST;
break;
}
}
break;
#endif
}
if (host == NULL || hostlen == 0) {
/*
* do nothing in this case.
* in case you are wondering if "&&" is more correct than
* "||" here: rfc2553bis-03 says that host == NULL or
* hostlen == 0 means that the caller does not want the result.
*/
} else if (flags & NI_NUMERICHOST) {
size_t numaddrlen;
/* NUMERICHOST and NAMEREQD conflicts with each other */
if (flags & NI_NAMEREQD)
return EAI_NONAME;
switch(afd->a_af) {
#ifdef IPV6
case AF_INET6:
{
int error;
if ((error = ip6_parsenumeric(sa, addr, host,
hostlen, flags)) != 0)
return(error);
break;
}
#endif
default:
if (rb_inet_ntop(afd->a_af, addr, numaddr, sizeof(numaddr))
== NULL)
return EAI_SYSTEM;
numaddrlen = strlen(numaddr);
if (numaddrlen + 1 > hostlen) /* don't forget terminator */
return EAI_MEMORY;
rb_strlcpy(host, numaddr, hostlen);
break;
}
}
return(0);
}
#ifdef IPV6
static int
ip6_parsenumeric(const struct sockaddr *sa, const char *addr,
char *host, size_t hostlen, int flags)
{
size_t numaddrlen;
char numaddr[512];
if (rb_inet_ntop(AF_INET6, addr, numaddr, sizeof(numaddr)) == NULL)
return(EAI_SYSTEM);
numaddrlen = strlen(numaddr);
if (numaddrlen + 1 > hostlen) /* don't forget terminator */
return(EAI_MEMORY);
if (*numaddr == ':')
{
*host = '0';
rb_strlcpy(host+1, numaddr, hostlen-1);
}
else
rb_strlcpy(host, numaddr, hostlen);
return(0);
}
#endif
#endif

41
authd/getnameinfo.h Normal file
View file

@ -0,0 +1,41 @@
/*
* Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of the project nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $Id$
*/
int rb_getnameinfo(const struct sockaddr *sa, rb_socklen_t salen, char *host,
size_t hostlen, char *serv, size_t servlen, int flags);
#ifndef IN_MULTICAST
#define IN_MULTICAST(a) ((((long int) (a)) & 0xf0000000) == 0xe0000000)
#endif
#ifndef IN_EXPERIMENTAL
#define IN_EXPERIMENTAL(a) ((((long int) (a)) & 0xe0000000) == 0xe0000000)
#endif

View file

@ -98,7 +98,6 @@ static int check_question(struct reslist *request, HEADER * header, char *buf, c
static int proc_answer(struct reslist *request, HEADER * header, char *, char *);
static struct reslist *find_id(int id);
static struct DNSReply *make_dnsreply(struct reslist *request);
static int generate_random_port(void);
static uint16_t generate_random_id(void);
#ifdef RES_MIN
@ -107,55 +106,6 @@ static uint16_t generate_random_id(void);
#define RES_MIN(a, b) ((a) < (b) ? (a) : (b))
static rb_fde_t *
random_socket(int family)
{
rb_fde_t *F;
int nport;
int i;
rb_socklen_t len;
struct rb_sockaddr_storage sockaddr;
F = rb_socket(family, SOCK_DGRAM, 0, "UDP resolver socket");
if(F == NULL)
return NULL;
memset(&sockaddr, 0, sizeof(sockaddr));
SET_SS_FAMILY(&sockaddr, family);
#ifdef RB_IPV6
if(family == AF_INET6)
{
struct sockaddr_in6 *in6 = (struct sockaddr_in6 *)&sockaddr;
memcpy(&in6->sin6_addr, &ipv6_addr, sizeof(struct in6_addr));
len = (rb_socklen_t) sizeof(struct sockaddr_in6);
}
else
#endif
{
struct sockaddr_in *in = (struct sockaddr_in *)&sockaddr;
in->sin_addr.s_addr = ipv4_addr.s_addr;
len = (rb_socklen_t) sizeof(struct sockaddr_in);
}
for(i = 0; i < 10; i++)
{
nport = htons(generate_random_port());
if(family == AF_INET)
((struct sockaddr_in *)&sockaddr)->sin_port = nport;
#ifdef RB_IPV6
else
((struct sockaddr_in6 *)&sockaddr)->sin6_port = nport;
#endif
if(bind(rb_get_fd(F), (struct sockaddr *)&sockaddr, len) == 0)
return F;
}
rb_close(F);
return NULL;
}
/*
* int
* res_ourserver(inp)
@ -167,7 +117,8 @@ random_socket(int family)
* revised for ircd, cryogen(stu) may03
* slightly modified for charybdis, mr_flea oct12
*/
static int res_ourserver(const struct rb_sockaddr_storage *inp)
static int
res_ourserver(const struct rb_sockaddr_storage *inp)
{
#ifdef RB_IPV6
const struct sockaddr_in6 *v6;
@ -177,49 +128,43 @@ static int res_ourserver(const struct rb_sockaddr_storage *inp)
const struct sockaddr_in *v4in = (const struct sockaddr_in *)inp;
int ns;
for (ns = 0; ns < irc_nscount; ns++)
for(ns = 0; ns < irc_nscount; ns++)
{
const struct rb_sockaddr_storage *srv = &irc_nsaddr_list[ns];
if (srv->ss_family != inp->ss_family)
continue;
#ifdef RB_IPV6
v6 = (const struct sockaddr_in6 *)srv;
#endif
v4 = (const struct sockaddr_in *)srv;
/* could probably just memcmp(srv, inp, srv.ss_len) here
* but we'll err on the side of caution - stu
* but we'll air on the side of caution - stu
*/
switch (srv->ss_family)
switch (GET_SS_FAMILY(srv))
{
#ifdef RB_IPV6
case AF_INET6:
if (v6->sin6_port == v6in->sin6_port)
if ((memcmp(&v6->sin6_addr.s6_addr, &v6in->sin6_addr.s6_addr,
if(GET_SS_FAMILY(srv) == GET_SS_FAMILY(inp))
if(v6->sin6_port == v6in->sin6_port)
if((memcmp(&v6->sin6_addr.s6_addr, &v6in->sin6_addr.s6_addr,
sizeof(struct in6_addr)) == 0) ||
(memcmp(&v6->sin6_addr.s6_addr, &in6addr_any,
sizeof(struct in6_addr)) == 0))
{
return ns;
}
return 1;
break;
#endif
case AF_INET:
if (v4->sin_port == v4in->sin_port)
if ((v4->sin_addr.s_addr == INADDR_ANY)
if(GET_SS_FAMILY(srv) == GET_SS_FAMILY(inp))
if(v4->sin_port == v4in->sin_port)
if((v4->sin_addr.s_addr == INADDR_ANY)
|| (v4->sin_addr.s_addr == v4in->sin_addr.s_addr))
{
return ns;
}
return 1;
break;
default:
break;
}
}
return -1;
return 0;
}
/*
@ -280,7 +225,7 @@ static void start_resolver(void)
if (res_fd == NULL)
{
if ((res_fd = rb_socket(irc_nsaddr_list[0].ss_family, SOCK_DGRAM, 0,
if ((res_fd = rb_socket(GET_SS_FAMILY(&irc_nsaddr_list[0]), SOCK_DGRAM, 0,
"UDP resolver socket")) == NULL)
return;
@ -472,20 +417,6 @@ generate_random_id(void)
return id;
}
static int
generate_random_port(void)
{
uint16_t port;
while(1)
{
rb_get_random(&port, sizeof(port));
if(port > 1024)
break;
}
return (int)port;
}
/*
* gethost_byname_type - get host address from name, adding domain if needed
*/
@ -549,7 +480,7 @@ static void do_query_number(struct DNSQuery *query, const struct rb_sockaddr_sto
request->name = (char *)rb_malloc(IRCD_RES_HOSTLEN + 1);
}
if (addr->ss_family == AF_INET)
if (GET_SS_FAMILY(addr) == AF_INET)
{
const struct sockaddr_in *v4 = (const struct sockaddr_in *)addr;
cp = (const unsigned char *)&v4->sin_addr.s_addr;
@ -558,7 +489,7 @@ static void do_query_number(struct DNSQuery *query, const struct rb_sockaddr_sto
(unsigned int)(cp[2]), (unsigned int)(cp[1]), (unsigned int)(cp[0]));
}
#ifdef RB_IPV6
else if (addr->ss_family == AF_INET6)
else if (GET_SS_FAMILY(addr) == AF_INET6)
{
const struct sockaddr_in6 *v6 = (const struct sockaddr_in6 *)addr;
cp = (const unsigned char *)&v6->sin6_addr.s6_addr;
@ -918,7 +849,7 @@ static int res_read_single_reply(rb_fde_t *F, void *data)
* ip#.
*/
#ifdef RB_IPV6
if (request->addr.ss_family == AF_INET6)
if (GET_SS_FAMILY(&request->addr) == AF_INET6)
gethost_byname_type_fqdn(request->name, request->query, T_AAAA);
else
#endif

View file

@ -76,6 +76,25 @@
* - Dianora
*/
#include <rb_lib.h>
#ifndef _WIN32
#include <netdb.h>
typedef struct addrinfo rb_addrinfo;
#else
#include "getaddrinfo.h"
#include "getnameinfo.h"
#define getaddrinfo rb_getaddrinfo
#define getnameinfo rb_getnameinfo
#define freeaddrinfo rb_freeaddrinfo
extern const char * get_windows_nameservers(void);
typedef struct rb_addrinfo rb_addrinfo;
#endif
#include "stdinc.h"
#include "ircd_defs.h"
#include "common.h"
@ -112,7 +131,12 @@ static const char digitvalue[256] = {
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, /*256*/
};
#ifndef _WIN32
static int parse_resvconf(void);
#else
static void parse_windows_resolvers(void);
#endif
static void add_nameserver(const char *);
static const char digits[] = "0123456789";
@ -139,12 +163,31 @@ int
irc_res_init(void)
{
irc_nscount = 0;
#ifndef _WIN32
parse_resvconf();
#else
parse_windows_resolvers();
#endif
if (irc_nscount == 0)
add_nameserver("127.0.0.1");
return 0;
}
#ifdef _WIN32
static void
parse_windows_resolvers(void)
{
const char *ns = get_windows_nameservers();
char *server;
char *p;
char *buf = rb_strdup(ns);
for(server = rb_strtok_r(buf, " ", &p); server != NULL;server = rb_strtok_r(NULL, " ", &p))
{
add_nameserver(server);
}
rb_free(buf);
}
#else
/* parse_resvconf()
*
* inputs - NONE
@ -210,6 +253,7 @@ parse_resvconf(void)
fclose(file);
return 0;
}
#endif
/* add_nameserver()
*
@ -221,7 +265,7 @@ parse_resvconf(void)
static void
add_nameserver(const char *arg)
{
struct addrinfo hints, *res;
rb_addrinfo hints, *res;
/* Done max number of nameservers? */
if (irc_nscount >= IRCD_MAXNS)

276
authd/reslist.c Normal file
View file

@ -0,0 +1,276 @@
/*
* reslist.c - get nameservers from windows *
*
* ircd-ratbox related changes are as follows
*
* Copyright (C) 2008 Aaron Sethman <androsyn@ratbox.org>
* Copyright (C) 2008-2012 ircd-ratbox development team
*
* pretty much all of this was yanked from c-ares ares_init.c here is the original
* header from there --
*
* Id: ares_init.c,v 1.72 2008-05-15 00:00:19 yangtse Exp $
* Copyright 1998 by the Massachusetts Institute of Technology.
* Copyright (C) 2007-2008 by Daniel Stenberg
*
* Permission to use, copy, modify, and distribute this
* software and its documentation for any purpose and without
* fee is hereby granted, provided that the above copyright
* notice appear in all copies and that both that copyright
* notice and this permission notice appear in supporting
* documentation, and that the name of M.I.T. not be used in
* advertising or publicity pertaining to distribution of the
* software without specific, written prior permission.
* M.I.T. makes no representations about the suitability of
* this software for any purpose. It is provided "as is"
* without express or implied warranty.
*
*
*/
#ifdef _WIN32
#include <rb_lib.h>
#include <windows.h>
#include <iphlpapi.h>
const char *get_windows_nameservers(void);
#define IS_NT() ((int)GetVersion() > 0)
#define WIN_NS_9X "System\\CurrentControlSet\\Services\\VxD\\MSTCP"
#define WIN_NS_NT_KEY "System\\CurrentControlSet\\Services\\Tcpip\\Parameters"
#define NAMESERVER "NameServer"
#define DHCPNAMESERVER "DhcpNameServer"
#define DATABASEPATH "DatabasePath"
#define WIN_PATH_HOSTS "\\hosts"
static int
get_iphlpapi_dns_info(char *ret_buf, size_t ret_size)
{
FIXED_INFO *fi = alloca(sizeof(*fi));
DWORD size = sizeof(*fi);
typedef DWORD(WINAPI * get_net_param_func) (FIXED_INFO *, DWORD *);
get_net_param_func xxGetNetworkParams; /* available only on Win-98/2000+ */
HMODULE handle;
IP_ADDR_STRING *ipAddr;
int i, count = 0;
int debug = 0;
size_t ip_size = sizeof("255.255.255.255,") - 1;
size_t left = ret_size;
char *ret = ret_buf;
HRESULT res;
if(!fi)
return (0);
handle = LoadLibrary("iphlpapi.dll");
if(!handle)
return (0);
xxGetNetworkParams = (get_net_param_func) GetProcAddress(handle, "GetNetworkParams");
if(!xxGetNetworkParams)
goto quit;
res = (*xxGetNetworkParams) (fi, &size);
if((res != ERROR_BUFFER_OVERFLOW) && (res != ERROR_SUCCESS))
goto quit;
fi = alloca(size);
if(!fi || (*xxGetNetworkParams) (fi, &size) != ERROR_SUCCESS)
goto quit;
if(debug)
{
printf("Host Name: %s\n", fi->HostName);
printf("Domain Name: %s\n", fi->DomainName);
printf("DNS Servers:\n" " %s (primary)\n", fi->DnsServerList.IpAddress.String);
}
if(strlen(fi->DnsServerList.IpAddress.String) > 0 &&
inet_addr(fi->DnsServerList.IpAddress.String) != INADDR_NONE && left > ip_size)
{
ret += sprintf(ret, "%s,", fi->DnsServerList.IpAddress.String);
left -= ret - ret_buf;
count++;
}
for(i = 0, ipAddr = fi->DnsServerList.Next; ipAddr && left > ip_size;
ipAddr = ipAddr->Next, i++)
{
if(inet_addr(ipAddr->IpAddress.String) != INADDR_NONE)
{
ret += sprintf(ret, "%s,", ipAddr->IpAddress.String);
left -= ret - ret_buf;
count++;
}
if(debug)
printf(" %s (secondary %d)\n", ipAddr->IpAddress.String, i + 1);
}
quit:
if(handle)
FreeLibrary(handle);
if(debug && left <= ip_size)
printf("Too many nameservers. Truncating to %d addressess", count);
if(ret > ret_buf)
ret[-1] = '\0';
return (count);
}
/*
* Warning: returns a dynamically allocated buffer, the user MUST
* use free() / rb_free() if the function returns 1
*/
static int
get_res_nt(HKEY hKey, const char *subkey, char **obuf)
{
/* Test for the size we need */
DWORD size = 0;
int result;
result = RegQueryValueEx(hKey, subkey, 0, NULL, NULL, &size);
if((result != ERROR_SUCCESS && result != ERROR_MORE_DATA) || !size)
return 0;
*obuf = rb_malloc(size + 1);
if(!*obuf)
return 0;
if(RegQueryValueEx(hKey, subkey, 0, NULL, (LPBYTE) * obuf, &size) != ERROR_SUCCESS)
{
rb_free(*obuf);
return 0;
}
if(size == 1)
{
rb_free(*obuf);
return 0;
}
return 1;
}
static int
get_res_interfaces_nt(HKEY hKey, const char *subkey, char **obuf)
{
char enumbuf[39]; /* GUIDs are 38 chars + 1 for NULL */
DWORD enum_size = 39;
int idx = 0;
HKEY hVal;
while(RegEnumKeyEx(hKey, idx++, enumbuf, &enum_size, 0,
NULL, NULL, NULL) != ERROR_NO_MORE_ITEMS)
{
int rc;
enum_size = 39;
if(RegOpenKeyEx(hKey, enumbuf, 0, KEY_QUERY_VALUE, &hVal) != ERROR_SUCCESS)
continue;
rc = get_res_nt(hVal, subkey, obuf);
RegCloseKey(hVal);
if(rc)
return 1;
}
return 0;
}
const char *
get_windows_nameservers(void)
{
/*
NameServer info via IPHLPAPI (IP helper API):
GetNetworkParams() should be the trusted source for this.
Available in Win-98/2000 and later. If that fail, fall-back to
registry information.
NameServer Registry:
On Windows 9X, the DNS server can be found in:
HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\VxD\MSTCP\NameServer
On Windows NT/2000/XP/2003:
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters\NameServer
or
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters\DhcpNameServer
or
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters\{AdapterID}\
NameServer
or
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters\{AdapterID}\
DhcpNameServer
*/
static char namelist[512];
HKEY mykey;
HKEY subkey;
DWORD data_type;
DWORD bytes;
DWORD result;
char *line = NULL;
memset(&namelist, 0, sizeof(namelist));
if(get_iphlpapi_dns_info(namelist, sizeof(namelist)) > 0)
{
return namelist;
}
if(IS_NT())
{
if(RegOpenKeyEx(HKEY_LOCAL_MACHINE, WIN_NS_NT_KEY, 0,
KEY_READ, &mykey) == ERROR_SUCCESS)
{
RegOpenKeyEx(mykey, "Interfaces", 0,
KEY_QUERY_VALUE | KEY_ENUMERATE_SUB_KEYS, &subkey);
if(get_res_nt(mykey, NAMESERVER, &line))
{
rb_strlcpy(namelist, line, sizeof(namelist));
return namelist;
}
else if(get_res_nt(mykey, DHCPNAMESERVER, &line))
{
rb_strlcpy(namelist, line, sizeof(namelist));
rb_free(line);
}
/* Try the interfaces */
else if(get_res_interfaces_nt(subkey, NAMESERVER, &line))
{
rb_strlcpy(namelist, line, sizeof(namelist));
rb_free(line);
}
else if(get_res_interfaces_nt(subkey, DHCPNAMESERVER, &line))
{
rb_strlcpy(namelist, line, sizeof(namelist));
rb_free(line);
}
RegCloseKey(subkey);
RegCloseKey(mykey);
}
}
else
{
if(RegOpenKeyEx(HKEY_LOCAL_MACHINE, WIN_NS_9X, 0,
KEY_READ, &mykey) == ERROR_SUCCESS)
{
if((result = RegQueryValueEx(mykey, NAMESERVER, NULL, &data_type,
NULL, &bytes)) == ERROR_SUCCESS ||
result == ERROR_MORE_DATA)
{
if(bytes)
{
line = (char *)rb_malloc(bytes + 1);
if(RegQueryValueEx(mykey, NAMESERVER, NULL, &data_type,
(unsigned char *)line, &bytes) ==
ERROR_SUCCESS)
{
rb_strlcpy(namelist, line, sizeof(namelist));
}
free(line);
}
}
}
RegCloseKey(mykey);
}
if(strlen(namelist) > 0)
return namelist;
return NULL;
}
#endif

View file

@ -255,7 +255,7 @@ dummy_handler(int sig)
static void
setup_signals(void)
{
#ifndef WINDOWS
#ifndef _WIN32
struct sigaction act;
act.sa_flags = 0;

View file

@ -19,6 +19,7 @@ fi
AC_PREFIX_DEFAULT($HOME/ircd)
AC_CONFIG_MACRO_DIR([m4])
AC_CONFIG_HEADER(include/setup.h)
AC_CONFIG_SUBDIRS([librb])
AC_CONFIG_AUX_DIR([libltdl/config])
@ -33,6 +34,24 @@ LTDL_INIT
build_ltdl=$with_included_ltdl
AM_CONDITIONAL([BUILD_LTDL], [test x"$build_ltdl" = x"yes"])
case "$host_os" in
*cygwin*)
AC_DEFINE_UNQUOTED(CYGWIN,1,[This is a Cygwin system])
AC_DEFINE_UNQUOTED(WINDOWS,1,[This is a Windows system])
;;
*mingw* | *msys*)
AC_DEFINE_UNQUOTED(MINGW,1,[This is a MinGW system])
AC_DEFINE_UNQUOTED(WINDOWS,1,[This is a Windows system])
AC_CHECK_HEADER(winsock2.h, , [AC_MSG_ERROR([** MinGW and no winsock2.h. I give up.])])
LIBS="$LIBS -lws2_32 -liphlpapi"
is_mingw="yes"
;;
*)
;;
esac
AM_CONDITIONAL([MINGW], [test "$is_mingw" = "yes"])
if test "$ac_cv_c_compiler_gnu" = yes; then
IRC_CFLAGS="$IRC_CFLAGS -O0 -Wall"
fi
@ -141,19 +160,13 @@ AC_CHECK_SIZEOF(long long)
dnl Networking Functions
dnl ====================
AC_SEARCH_LIBS(socket, socket, , [AC_MSG_ERROR([You have no socket()! Aborting.])])
AC_SEARCH_LIBS(socket, [socket ws2_32], , [AC_MSG_ERROR([You have no socket()! Aborting.])])
dnl SunOS/Solaris required libnsl for inet_ntoa()
if test x"$SUN" = xyes; then
AC_SEARCH_LIBS(inet_ntoa, nsl,, [AC_MSG_ERROR([libnsl not found! Aborting.])])
fi
AC_CHECK_TYPE(socklen_t, ,
[AC_DEFINE([socklen_t], [unsigned int],
[If we don't have a real socklen_t, unsigned int is good enough.])],
[#include <sys/types.h>
#include <sys/socket.h>])
AC_ARG_ENABLE(ipv6,
AC_HELP_STRING([--enable-ipv6],[Enable IPv6 support]),[ipv6=$enableval],[ipv6=no])
@ -509,18 +522,6 @@ if test "$operchghost" = yes; then
AC_DEFINE(ENABLE_OPER_CHGHOST, 1, [Define this to enable opers to use the CHGHOST command.])
fi
dnl **********************************************************************
dnl Enable ignoring of bogus timestamps
dnl **********************************************************************
AC_ARG_ENABLE(ignore-bogus-ts,
AC_HELP_STRING([--enable-ignore-bogus-ts],[Enable the reset of timestamps in channels to current time if set to 0. Set this network wide or not at all.]),
[ignorebogusts=$enableval],[ignorebogusts=no])
if test "$ignorebogusts" = yes; then
AC_DEFINE(IGNORE_BOGUS_TS, 1, [Define this to enable the reset of timestamps in channels to current time if set to 0.])
fi
dnl Debug-related options
dnl =====================

View file

@ -51,7 +51,6 @@ serverinfo {
sid = "42X";
description = "charybdis test server";
network_name = "StaticBox";
hub = yes;
/* On multi-homed hosts you may need the following. These define
* the addresses we connect from to other servers. */

View file

@ -134,11 +134,6 @@ serverinfo {
*/
network_name = "MyNet";
/* hub: allow this server to act as a hub and have multiple servers
* connected to it.
*/
hub = no;
/* vhost: the IP to bind to when we connect outward to ipv4 servers.
* This should be an ipv4 IP only.
*/

View file

@ -17,8 +17,6 @@
+----------------------------+
| 'e' | USE_EXCEPT |
|------+---------------------|
| 'H' | HUB |
|------+---------------------|
| 'I' | USE_INVEX |
|------+---------------------|
| 'K' | USE_KNOCK |
@ -29,8 +27,6 @@
|------+---------------------|
| 'S' | OPERS_SEE_ALL_USERS |
|------+---------------------|
| 'T' | IGNORE_BOGUS_TS |
|------+---------------------|
| 'Z' | ZIPLINKS |
|------+---------------------|
| '6' | IPv6 |

View file

@ -56,7 +56,7 @@ eb_hostmask(const char *banstr, struct Client *client_p, struct Channel *chptr,
#ifdef RB_IPV6
/* handle Teredo if necessary */
if (client_p->localClient->ip.ss_family == AF_INET6 && ipv4_from_ipv6((const struct sockaddr_in6 *) &client_p->localClient->ip, &ip4))
if (GET_SS_FAMILY(&client_p->localClient->ip) == AF_INET6 && ipv4_from_ipv6((const struct sockaddr_in6 *) &client_p->localClient->ip, &ip4))
{
sprintf(src_ip4host, "%s!%s@", client_p->name, client_p->username);
s4 = src_ip4host + strlen(src_ip4host);

View file

@ -91,7 +91,7 @@ mo_sendbans(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *sou
{
struct ConfItem *aconf;
rb_dlink_node *ptr;
int i, count;
int count;
const char *target, *mask2;
struct Client *server_p;
struct rb_radixtree_iteration_state state;

View file

@ -92,7 +92,7 @@ mr_webirc(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *sourc
IsGotId(client_p) ? client_p->username : "webirc",
IsGotId(client_p) ? client_p->username : "webirc",
(struct sockaddr *) &client_p->localClient->ip,
client_p->localClient->ip.ss_family, NULL);
GET_SS_FAMILY(&client_p->localClient->ip), NULL);
if (aconf == NULL || !(aconf->status & CONF_CLIENT))
return;
if (!IsConfDoSpoofIp(aconf) || irccmp(aconf->info.name, "webirc."))
@ -145,7 +145,7 @@ mr_webirc(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *sourc
/* Check dlines now, klines will be checked on registration */
if((aconf = find_dline((struct sockaddr *)&source_p->localClient->ip,
source_p->localClient->ip.ss_family)))
GET_SS_FAMILY(&source_p->localClient->ip))))
{
if(!(aconf->status & CONF_EXEMPTDLINE))
{

View file

@ -26,11 +26,7 @@
#ifndef INCLUDED_client_h
#define INCLUDED_client_h
#include "config.h"
#if !defined(CONFIG_CHARYBDIS_LEVEL_1)
#error Incorrect config.h for this revision of ircd.
#endif
#include "defaults.h"
#include "ircd_defs.h"
#include "channel.h"

View file

@ -1,107 +0,0 @@
/*
* ircd-ratbox: A slightly useful ircd.
* config.h: The ircd compile-time-configurable header.
*
* Copyright (C) 1990 Jarkko Oikarinen and University of Oulu, Co Center
* Copyright (C) 1996-2002 Hybrid Development Team
* Copyright (C) 2002-2004 ircd-ratbox development team
*
* This program 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.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
* USA
*/
#ifndef INCLUDED_config_h
#define INCLUDED_config_h
#include "setup.h"
/*
* Directory paths and filenames for UNIX systems.
* IRCD_PREFIX is set using ./configure --prefix, see INSTALL.
* The other defaults should be fine.
*
* NOTE: CHANGING THESE WILL NOT ALTER THE DIRECTORY THAT FILES WILL
* BE INSTALLED TO. IF YOU CHANGE THESE, DO NOT USE MAKE INSTALL,
* BUT COPY THE FILES MANUALLY TO WHERE YOU WANT THEM.
*
* IRCD_PREFIX = prefix for all directories,
* DPATH = root directory of installation,
* BINPATH = directory for binary files,
* ETCPATH = directory for configuration files,
* LOGPATH = directory for logfiles,
* MODPATH = directory for modules,
* AUTOMODPATH = directory for autoloaded modules
*/
/* dirs */
#define DPATH IRCD_PREFIX
#define BINPATH IRCD_PREFIX "/bin/"
#define MODPATH MODULE_DIR
#define AUTOMODPATH MODULE_DIR "/autoload/"
#define ETCPATH ETC_DIR
#define LOGPATH LOG_DIR
#define UHPATH HELP_DIR "/users"
#define HPATH HELP_DIR "/opers"
/* files */
#define SPATH BINPATH "/" PROGRAM_PREFIX "charybdis" /* ircd executable */
#define CPATH ETCPATH "/ircd.conf" /* ircd.conf file */
#define MPATH ETCPATH "/ircd.motd" /* MOTD file */
#define LPATH LOGPATH "/ircd.log" /* ircd logfile */
#define PPATH PKGRUNDIR "/ircd.pid" /* pid file */
#define OPATH ETCPATH "/opers.motd" /* oper MOTD file */
#define DBPATH PKGLOCALSTATEDIR "/ban.db" /* bandb file */
/* HANGONGOODLINK and HANGONRETRYDELAY
* Often net breaks for a short time and it's useful to try to
* establishing the same connection again faster than CONNECTFREQUENCY
* would allow. But, to keep trying on bad connection, we require
* that connection has been open for certain minimum time
* (HANGONGOODLINK) and we give the net few seconds to steady
* (HANGONRETRYDELAY). This latter has to be long enough that the
* other end of the connection has time to notice it broke too.
*/
#define HANGONRETRYDELAY 60 /* Recommended value: 30-60 seconds */
#define HANGONGOODLINK 3600 /* Recommended value: 30-60 minutes */
/* KILLCHASETIMELIMIT -
* Max time from the nickname change that still causes KILL
* automatically to switch for the current nick of that user. (seconds)
*/
#define KILLCHASETIMELIMIT 90 /* Recommended value: 90 */
/* CHARYBDIS_SOMAXCONN
* Use SOMAXCONN if OS has it, otherwise use this value for the
* listen(); backlog. 5 for AIX/SUNOS, 25 for other OSs.
*/
#define CHARYBDIS_SOMAXCONN 25
/* MAX_BUFFER
* The amount of fds to reserve for clients exempt from limits
* and dns lookups.
*/
#define MAX_BUFFER 60
/* ----------------------------------------------------------------
* STOPSTOPSTOPSTOPSTOPSTOPSTOPSTOPSTOPSTOPSTOPSTOPSTOPSTOPSTOPSTOP
* ----------------------------------------------------------------
* The options below this line should NOT be modified.
* ----------------------------------------------------------------
*/
#define CONFIG_CHARYBDIS_LEVEL_2
#include "defaults.h"
#endif /* INCLUDED_config_h */

View file

@ -1,107 +0,0 @@
/*
* ircd-ratbox: A slightly useful ircd.
* config.h: The ircd compile-time-configurable header.
*
* Copyright (C) 1990 Jarkko Oikarinen and University of Oulu, Co Center
* Copyright (C) 1996-2002 Hybrid Development Team
* Copyright (C) 2002-2004 ircd-ratbox development team
*
* This program 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.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
* USA
*/
#ifndef INCLUDED_config_h
#define INCLUDED_config_h
#include "setup.h"
/*
* Directory paths and filenames for UNIX systems.
* IRCD_PREFIX is set using ./configure --prefix, see INSTALL.
* The other defaults should be fine.
*
* NOTE: CHANGING THESE WILL NOT ALTER THE DIRECTORY THAT FILES WILL
* BE INSTALLED TO. IF YOU CHANGE THESE, DO NOT USE MAKE INSTALL,
* BUT COPY THE FILES MANUALLY TO WHERE YOU WANT THEM.
*
* IRCD_PREFIX = prefix for all directories,
* DPATH = root directory of installation,
* BINPATH = directory for binary files,
* ETCPATH = directory for configuration files,
* LOGPATH = directory for logfiles,
* MODPATH = directory for modules,
* AUTOMODPATH = directory for autoloaded modules
*/
/* dirs */
#define DPATH IRCD_PREFIX
#define BINPATH IRCD_PREFIX "/bin/"
#define MODPATH MODULE_DIR
#define AUTOMODPATH MODULE_DIR "/autoload/"
#define ETCPATH ETC_DIR
#define LOGPATH LOG_DIR
#define UHPATH HELP_DIR "/users"
#define HPATH HELP_DIR "/opers"
/* files */
#define SPATH BINPATH "/" PROGRAM_PREFIX "charybdis" /* ircd executable */
#define CPATH ETCPATH "/ircd.conf" /* ircd.conf file */
#define MPATH ETCPATH "/ircd.motd" /* MOTD file */
#define LPATH LOGPATH "/ircd.log" /* ircd logfile */
#define PPATH PKGRUNDIR "/ircd.pid" /* pid file */
#define OPATH ETCPATH "/opers.motd" /* oper MOTD file */
#define DBPATH PKGLOCALSTATEDIR "/ban.db" /* bandb file */
/* HANGONGOODLINK and HANGONRETRYDELAY
* Often net breaks for a short time and it's useful to try to
* establishing the same connection again faster than CONNECTFREQUENCY
* would allow. But, to keep trying on bad connection, we require
* that connection has been open for certain minimum time
* (HANGONGOODLINK) and we give the net few seconds to steady
* (HANGONRETRYDELAY). This latter has to be long enough that the
* other end of the connection has time to notice it broke too.
*/
#define HANGONRETRYDELAY 60 /* Recommended value: 30-60 seconds */
#define HANGONGOODLINK 3600 /* Recommended value: 30-60 minutes */
/* KILLCHASETIMELIMIT -
* Max time from the nickname change that still causes KILL
* automatically to switch for the current nick of that user. (seconds)
*/
#define KILLCHASETIMELIMIT 90 /* Recommended value: 90 */
/* CHARYBDIS_SOMAXCONN
* Use SOMAXCONN if OS has it, otherwise use this value for the
* listen(); backlog. 5 for AIX/SUNOS, 25 for other OSs.
*/
#define CHARYBDIS_SOMAXCONN 25
/* MAX_BUFFER
* The amount of fds to reserve for clients exempt from limits
* and dns lookups.
*/
#define MAX_BUFFER 60
/* ----------------------------------------------------------------
* STOPSTOPSTOPSTOPSTOPSTOPSTOPSTOPSTOPSTOPSTOPSTOPSTOPSTOPSTOPSTOP
* ----------------------------------------------------------------
* The options below this line should NOT be modified.
* ----------------------------------------------------------------
*/
#define CONFIG_CHARYBDIS_LEVEL_2
#include "defaults.h"
#endif /* INCLUDED_config_h */

View file

@ -25,10 +25,13 @@
#ifndef INCLUDED_defaults_h
#define INCLUDED_defaults_h
/* this file is included (only) at the end of config.h, to supply default
* values for things which are now configurable at runtime.
/* /!\ DANGER WILL ROBINSON! DANGER! /!\
*
* Do not mess with these values unless you know what you are doing!
*/
#include "setup.h"
/*
* First, set other fd limits based on values from user
*/
@ -59,5 +62,64 @@
#define JOIN_LEAVE_COUNT_EXPIRE_TIME 120
#define MIN_SPAM_NUM 5
#define MIN_SPAM_TIME 60
#define CONFIG_CHARYBDIS_LEVEL_1
/*
* Directory paths and filenames for UNIX systems.
* IRCD_PREFIX is set using ./configure --prefix, see INSTALL.
*
* IRCD_PREFIX = prefix for all directories,
* DPATH = root directory of installation,
* BINPATH = directory for binary files,
* ETCPATH = directory for configuration files,
* LOGPATH = directory for logfiles,
* MODPATH = directory for modules,
* AUTOMODPATH = directory for autoloaded modules
*/
#define DPATH IRCD_PREFIX
#define BINPATH IRCD_PREFIX "/bin/"
#define MODPATH MODULE_DIR
#define AUTOMODPATH MODULE_DIR "/autoload/"
#define ETCPATH ETC_DIR
#define LOGPATH LOG_DIR
#define UHPATH HELP_DIR "/users"
#define HPATH HELP_DIR "/opers"
#define SPATH BINPATH "/" PROGRAM_PREFIX "charybdis" /* ircd executable */
#define CPATH ETCPATH "/ircd.conf" /* ircd.conf file */
#define MPATH ETCPATH "/ircd.motd" /* MOTD file */
#define LPATH LOGPATH "/ircd.log" /* ircd logfile */
#define PPATH PKGRUNDIR "/ircd.pid" /* pid file */
#define OPATH ETCPATH "/opers.motd" /* oper MOTD file */
#define DBPATH PKGLOCALSTATEDIR "/ban.db" /* bandb file */
/* HANGONGOODLINK and HANGONRETRYDELAY
* Often net breaks for a short time and it's useful to try to
* establishing the same connection again faster than CONNECTFREQUENCY
* would allow. But, to keep trying on bad connection, we require
* that connection has been open for certain minimum time
* (HANGONGOODLINK) and we give the net few seconds to steady
* (HANGONRETRYDELAY). This latter has to be long enough that the
* other end of the connection has time to notice it broke too.
*/
#define HANGONRETRYDELAY 60 /* Recommended value: 30-60 seconds */
#define HANGONGOODLINK 3600 /* Recommended value: 30-60 minutes */
/* KILLCHASETIMELIMIT -
* Max time from the nickname change that still causes KILL
* automatically to switch for the current nick of that user. (seconds)
*/
#define KILLCHASETIMELIMIT 90 /* Recommended value: 90 */
/* MAX_BUFFER
* The amount of fds to reserve for clients exempt from limits
* and dns lookups.
*/
#define MAX_BUFFER 60
/* CHARYBDIS_SOMAXCONN
* Use SOMAXCONN if OS has it, otherwise use this value for the
* listen(); backlog. 5 for AIX/SUNOS, 25 for other OSs.
*/
#define CHARYBDIS_SOMAXCONN 25
#endif /* INCLUDED_defaults_h */

View file

@ -54,7 +54,7 @@ struct ConfItem *find_dline(struct sockaddr *, int);
#define find_kline(x) (find_conf_by_address((x)->host, (x)->sockhost, \
(x)->orighost, \
(struct sockaddr *)&(x)->localClient->ip, CONF_KILL,\
(x)->localClient->ip.ss_family, (x)->username, NULL))
GET_SS_FAMILY(&(x)->localClient->ip), (x)->username, NULL))
void report_auth(struct Client *);
#ifdef RB_IPV6

View file

@ -25,7 +25,7 @@
#ifndef INCLUDED_ircd_h
#define INCLUDED_ircd_h
#include "config.h"
#include "defaults.h"
struct Client;
struct rb_dlink_list;

View file

@ -35,7 +35,7 @@
#ifndef INCLUDED_ircd_defs_h
#define INCLUDED_ircd_defs_h
#include "config.h"
#include "defaults.h"
/* For those unfamiliar with GNU format attributes, a is the 1 based
* argument number of the format string, and b is the 1 based argument
@ -56,10 +56,6 @@
#define IRC_DEPRECATED
#endif
#if !defined(CONFIG_CHARYBDIS_LEVEL_1)
# error Incorrect config.h for this revision of ircd.
#endif
#define HOSTLEN 63 /* Length of hostname. Updated to */
/* comply with RFC1123 */

View file

@ -25,7 +25,7 @@
#ifndef INCLUDED_m_info_h
#define INCLUDED_m_info_h
#include "config.h"
#include "defaults.h"
typedef struct Information
{

View file

@ -25,7 +25,7 @@
#ifndef INCLUDED_modules_h
#define INCLUDED_modules_h
#include "serno.h"
#include "config.h"
#include "defaults.h"
#include "setup.h"
#include "parse.h"

View file

@ -25,7 +25,7 @@
#ifndef INCLUDED_msg_h
#define INCLUDED_msg_h
#include "config.h"
#include "defaults.h"
#include "msgbuf.h"
struct Client;

View file

@ -1,5 +1,4 @@
/* This code is in the public domain.
* $Nightmare: nightmare/include/config.h,v 1.32.2.2.2.2 2002/07/02 03:41:28 ejb Exp $
*/
#ifndef _NEWCONF_H_INCLUDED

View file

@ -25,7 +25,7 @@
#ifndef INCLUDED_numeric_h
#define INCLUDED_numeric_h
#include "config.h"
#include "defaults.h"
#include "messages.h"
/*

View file

@ -26,7 +26,7 @@
#ifndef INCLUDED_s_assert_h
#define INCLUDED_s_assert_h
#include "config.h"
#include "defaults.h"
#ifdef SOFT_ASSERT

View file

@ -393,7 +393,7 @@ extern char conffilebuf[IRCD_BUFSIZE + 1];
extern int lineno;
#define NOT_AUTHORISED (-1)
#define SOCKET_ERROR (-2)
#define I_SOCKET_ERROR (-2)
#define I_LINE_FULL (-3)
#define BANNED_CLIENT (-4)
#define TOO_MANY_LOCAL (-6)

View file

@ -25,7 +25,7 @@
#ifndef INCLUDED_serv_h
#define INCLUDED_serv_h
#include "config.h"
#include "defaults.h"
#include "capability.h"
/*

View file

@ -25,7 +25,7 @@
#ifndef INCLUDED_s_user_h
#define INCLUDED_s_user_h
#include "config.h"
#include "defaults.h"
struct Client;
struct User;

View file

@ -27,7 +27,6 @@
#include "rb_lib.h"
#include "ircd_defs.h"
#include "config.h" /* HAVE_STDARG_H */
struct Client;
struct Channel;

View file

@ -22,7 +22,6 @@
*/
#include "rb_lib.h"
#include "config.h" /* Gotta pull in the autoconf stuff */
#include "ircd_defs.h" /* Needed for some reasons here -- dwr */
/* AIX requires this to be the first thing in the file. */
@ -93,7 +92,6 @@ typedef bool _Bool;
#include <stdio.h>
#include <time.h>
#include <fcntl.h>
#include <netdb.h>
#include <stdarg.h>
#include <signal.h>
#include <dirent.h>
@ -113,16 +111,11 @@ typedef bool _Bool;
#endif
#include <sys/socket.h>
#include <sys/stat.h>
#include <sys/wait.h>
#ifdef HAVE_SYS_PARAM_H
#include <sys/param.h>
#endif
#include <netinet/in.h>
#include <netinet/tcp.h>
#include <arpa/inet.h>
#ifdef HAVE_ERRNO_H
#include <errno.h>

View file

@ -14,6 +14,10 @@ version.c: version.c.SH ../CREDITS ../include/patchlevel.h ../include/serno.h
$(CP) version.c version.c.last
touch version.c.SH
if MINGW
EXTRA_FLAGS = -Wl,--enable-runtime-pseudo-reloc -export-symbols-regex '*'
endif
libircd_la_SOURCES = \
authd.c \
bandbi.c \

View file

@ -156,7 +156,7 @@ static void initiate_blacklist_dnsquery(struct Blacklist *blptr, struct Client *
blcptr->client_p = client_p;
/* IPv4 */
if ((client_p->localClient->ip.ss_family == AF_INET) && blptr->ipv4)
if ((GET_SS_FAMILY(&client_p->localClient->ip) == AF_INET) && blptr->ipv4)
{
ip = (uint8_t *)&((struct sockaddr_in *)&client_p->localClient->ip)->sin_addr.s_addr;
@ -168,8 +168,9 @@ static void initiate_blacklist_dnsquery(struct Blacklist *blptr, struct Client *
(unsigned int) ip[0],
blptr->host);
}
#ifdef RB_IPV6
/* IPv6 */
else if ((client_p->localClient->ip.ss_family == AF_INET6) && blptr->ipv6)
else if ((GET_SS_FAMILY(&client_p->localClient->ip) == AF_INET6) && blptr->ipv6)
{
/* Split up for rDNS lookup
* ex: ip[0] = 0x00, ip[1] = 0x00... ip[16] = 0x01 for localhost
@ -197,6 +198,7 @@ static void initiate_blacklist_dnsquery(struct Blacklist *blptr, struct Client *
/* Tack host on */
strcpy(bufptr, blptr->host);
}
#endif
/* This shouldn't happen... */
else
return;

View file

@ -581,7 +581,7 @@ is_banned_list(struct Channel *chptr, rb_dlink_list *list,
}
}
#ifdef RB_IPV6
if(who->localClient->ip.ss_family == AF_INET6 &&
if(GET_SS_FAMILY(&who->localClient->ip) == AF_INET6 &&
ipv4_from_ipv6((const struct sockaddr_in6 *)&who->localClient->ip, &ip4))
{
sprintf(src_ip4host, "%s!%s@", who->name, who->username);

View file

@ -23,7 +23,7 @@
*/
#include "stdinc.h"
#include "config.h"
#include "defaults.h"
#include "class.h"
#include "client.h"

View file

@ -23,7 +23,7 @@
* USA
*/
#include "stdinc.h"
#include "config.h"
#include "defaults.h"
#include "client.h"
#include "class.h"
@ -542,7 +542,7 @@ check_dlines(void)
if(IsMe(client_p))
continue;
if((aconf = find_dline((struct sockaddr *)&client_p->localClient->ip,client_p->localClient->ip.ss_family)) != NULL)
if((aconf = find_dline((struct sockaddr *)&client_p->localClient->ip, GET_SS_FAMILY(&client_p->localClient->ip))) != NULL)
{
if(aconf->status & CONF_EXEMPTDLINE)
continue;
@ -561,7 +561,7 @@ check_dlines(void)
{
client_p = ptr->data;
if((aconf = find_dline((struct sockaddr *)&client_p->localClient->ip,client_p->localClient->ip.ss_family)) != NULL)
if((aconf = find_dline((struct sockaddr *)&client_p->localClient->ip, GET_SS_FAMILY(&client_p->localClient->ip))) != NULL)
{
if(aconf->status & CONF_EXEMPTDLINE)
continue;
@ -1802,15 +1802,15 @@ free_user(struct User *user, struct Client *client_p)
if(user->refcnt < 0 || user->invited.head || user->channel.head)
{
sendto_realops_snomask(SNO_GENERAL, L_ALL,
"* %#lx user (%s!%s@%s) %#lx %#lx %#lx %lu %d *",
(unsigned long) client_p,
"* %p user (%s!%s@%s) %p %p %p %lu %d *",
client_p,
client_p ? client_p->
name : "<noname>",
client_p->username,
client_p->host,
(unsigned long) user,
(unsigned long) user->invited.head,
(unsigned long) user->channel.head,
user,
user->invited.head,
user->channel.head,
rb_dlink_list_length(&user->channel),
user->refcnt);
s_assert(!user->refcnt);

View file

@ -228,7 +228,7 @@ dns_stats_results_callback(const char *callid, const char *status, int resc, con
{
struct dnsstatreq *req;
uint32_t qid;
int st, i;
int st;
long lqid = strtol(callid, NULL, 16);
if(lqid > UINT32_MAX)

View file

@ -26,7 +26,7 @@
#include "rb_lib.h"
#include "stdinc.h"
#include "setup.h"
#include "config.h"
#include "defaults.h"
#include "ircd.h"
#include "channel.h"
#include "class.h"
@ -156,6 +156,7 @@ print_startup(int pid)
{
int fd;
#ifndef _WIN32
close(1);
fd = open("/dev/null", O_RDWR);
if (fd == -1) {
@ -166,27 +167,24 @@ print_startup(int pid)
fd = dup(fd);
if (fd != 1)
abort();
#endif
inotice("runtime path: %s", rb_path_to_self());
inotice("now running in %s mode from %s as pid %d ...",
!server_state_foreground ? "background" : "foreground",
ConfigFileEntry.dpath, pid);
#ifndef _WIN32
/* let the parent process know the initialization was successful
* -- jilles */
if (!server_state_foreground)
{
if(write(0, ".", 1) < 1)
/* The circumstances in which this could fail are pretty implausible.
* However, this shuts GCC up about warning the result of write is unused,
* and is "standards compliant" behaviour.
* --Elizabeth
*/
abort();
(void) write(0, ".", 1);
}
if (dup2(1, 0) == -1)
abort();
if (dup2(1, 2) == -1)
abort();
#endif
}
/*
@ -199,7 +197,7 @@ print_startup(int pid)
static void
init_sys(void)
{
#if defined(RLIMIT_NOFILE) && defined(HAVE_SYS_RESOURCE_H)
#if !defined(_WIN32) && defined(RLIMIT_NOFILE) && defined(HAVE_SYS_RESOURCE_H)
struct rlimit limit;
if(!getrlimit(RLIMIT_NOFILE, &limit))
@ -220,6 +218,7 @@ init_sys(void)
static int
make_daemon(void)
{
#ifndef _WIN32
int pid;
int pip[2];
char c;
@ -254,7 +253,7 @@ make_daemon(void)
/* fclose(stdin);
fclose(stdout);
fclose(stderr); */
#endif
return 0;
}
@ -420,7 +419,7 @@ check_pidfile(const char *filename)
if(fgets(buff, 20, fb) != NULL)
{
pidfromfile = atoi(buff);
if(!kill(pidfromfile, 0))
if(!rb_kill(pidfromfile, 0))
{
printf("ircd: daemon is already running\n");
exit(-1);
@ -547,12 +546,14 @@ charybdis_main(int argc, char *argv[])
{
int fd;
#ifndef _WIN32
/* Check to see if the user is running us as root, which is a nono */
if(geteuid() == 0)
{
fprintf(stderr, "Don't run ircd as root!!!\n");
return -1;
}
#endif
init_sys();
@ -615,6 +616,7 @@ charybdis_main(int argc, char *argv[])
if (testing_conf)
server_state_foreground = true;
#ifndef _WIN32
/* Make sure fd 0, 1 and 2 are in use -- jilles */
do
{
@ -624,6 +626,7 @@ charybdis_main(int argc, char *argv[])
close(fd);
else if (fd == -1)
exit(1);
#endif
/* Check if there is pidfile and daemon already running */
if(!testing_conf)

File diff suppressed because it is too large Load diff

View file

@ -25,8 +25,6 @@
#include <sys/types.h>
#include <sys/stat.h>
#include <netinet/in.h>
#include <string.h>
#include <errno.h>
#include <limits.h>
@ -36,7 +34,7 @@
#include "stdinc.h"
#include "ircd_defs.h"
#include "common.h"
#include "config.h"
#include "defaults.h"
#include "logger.h"
#include "s_conf.h"
#include "newconf.h"

File diff suppressed because it is too large Load diff

View file

@ -1,86 +0,0 @@
/* A Bison parser, made by GNU Bison 3.0.4. */
/* Bison interface for Yacc-like parsers in C
Copyright (C) 1984, 1989-1990, 2000-2015 Free Software Foundation, Inc.
This program 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 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */
/* As a special exception, you may create a larger work that contains
part or all of the Bison parser skeleton and distribute that work
under terms of your choice, so long as that work isn't itself a
parser generator using the skeleton or a modified version thereof
as a parser skeleton. Alternatively, if you modify or redistribute
the parser skeleton itself, you may (at your option) remove this
special exception, which will cause the skeleton and the resulting
Bison output files to be licensed under the GNU General Public
License without this special exception.
This special exception was added by the Free Software Foundation in
version 2.2 of Bison. */
#ifndef YY_YY_IRCD_PARSER_H_INCLUDED
# define YY_YY_IRCD_PARSER_H_INCLUDED
/* Debug traces. */
#ifndef YYDEBUG
# define YYDEBUG 0
#endif
#if YYDEBUG
extern int yydebug;
#endif
/* Token type. */
#ifndef YYTOKENTYPE
# define YYTOKENTYPE
enum yytokentype
{
LOADMODULE = 258,
TWODOTS = 259,
QSTRING = 260,
STRING = 261,
NUMBER = 262
};
#endif
/* Tokens. */
#define LOADMODULE 258
#define TWODOTS 259
#define QSTRING 260
#define STRING 261
#define NUMBER 262
/* Value type. */
#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
union YYSTYPE
{
#line 164 "ircd_parser.y" /* yacc.c:1909 */
int number;
char string[IRCD_BUFSIZE + 1];
conf_parm_t * conf_parm;
#line 74 "ircd_parser.h" /* yacc.c:1909 */
};
typedef union YYSTYPE YYSTYPE;
# define YYSTYPE_IS_TRIVIAL 1
# define YYSTYPE_IS_DECLARED 1
#endif
extern YYSTYPE yylval;
int yyparse (void);
#endif /* !YY_YY_IRCD_PARSER_H_INCLUDED */

View file

@ -6,8 +6,6 @@
#include <sys/types.h>
#include <sys/stat.h>
#include <netinet/in.h>
#include <string.h>
#include <stdlib.h>
#include <stdarg.h>
@ -17,7 +15,7 @@
#include "setup.h"
#include "common.h"
#include "ircd_defs.h"
#include "config.h"
#include "defaults.h"
#include "client.h"
#include "modules.h"
#include "newconf.h"

View file

@ -27,6 +27,11 @@
#include "client.h"
#include "send.h"
#ifndef _WIN32
#include <sys/types.h>
#include <sys/wait.h>
/*
* dummy_handler - don't know if this is really needed but if alarm is still
* being used we probably will
@ -171,3 +176,17 @@ setup_signals()
sigprocmask(SIG_UNBLOCK, &sigs, NULL);
}
#else
void
setup_signals()
{
/* this is a stub for mingw32 */
}
void
setup_reboot_signals()
{
/* this is a stub for mingw32 */
}
#endif

View file

@ -106,7 +106,7 @@ static uint16_t
get_listener_port(const struct Listener *listener)
{
#ifdef RB_IPV6
if(listener->addr.ss_family == AF_INET6)
if(GET_SS_FAMILY(&listener->addr) == AF_INET6)
return ntohs(((const struct sockaddr_in6 *)&listener->addr)->sin6_port);
else
#endif
@ -180,7 +180,7 @@ inetport(struct Listener *listener)
F = rb_socket(GET_SS_FAMILY(&listener->addr), SOCK_STREAM, 0, "Listener socket");
#ifdef RB_IPV6
if(listener->addr.ss_family == AF_INET6)
if(GET_SS_FAMILY(&listener->addr) == AF_INET6)
{
struct sockaddr_in6 *in6 = (struct sockaddr_in6 *)&listener->addr;
if(!IN6_ARE_ADDR_EQUAL(&in6->sin6_addr, &in6addr_any))
@ -279,10 +279,10 @@ find_listener(struct rb_sockaddr_storage *addr)
for (listener = ListenerPollList; listener; listener = listener->next)
{
if(addr->ss_family != listener->addr.ss_family)
if(GET_SS_FAMILY(addr) != GET_SS_FAMILY(&listener->addr))
continue;
switch(addr->ss_family)
switch(GET_SS_FAMILY(addr))
{
case AF_INET:
{
@ -342,7 +342,7 @@ add_listener(int port, const char *vhost_ip, int family, int ssl, int defer_acce
if(port == 0)
return;
memset(&vaddr, 0, sizeof(vaddr));
vaddr.ss_family = family;
SET_SS_FAMILY(&vaddr, family);
if(vhost_ip != NULL)
{

View file

@ -18,7 +18,7 @@
*
*/
#include "stdinc.h"
#include "config.h"
#include "defaults.h"
#include "client.h"
#include "ircd.h"
#include "match.h"

View file

@ -206,12 +206,20 @@ int
findmodule_byname(const char *name)
{
int i;
char name_ext[PATH_MAX + 1];
rb_strlcpy(name_ext, name, sizeof name_ext);
rb_strlcat(name_ext, LT_MODULE_EXT, sizeof name_ext);
for (i = 0; i < num_mods; i++)
{
if(!irccmp(modlist[i]->name, name))
return i;
if(!irccmp(modlist[i]->name, name_ext))
return i;
}
return -1;
}
@ -245,7 +253,6 @@ load_all_modules(int warn)
while ((ldirent = readdir(system_module_dir)) != NULL)
{
struct stat s;
size_t len;
len = strlen(ldirent->d_name);
@ -274,8 +281,8 @@ load_core_modules(int warn)
for (i = 0; core_module_table[i]; i++)
{
snprintf(module_name, sizeof(module_name), "%s/%s", MODPATH,
core_module_table[i]);
snprintf(module_name, sizeof(module_name), "%s/%s%s", MODPATH,
core_module_table[i], LT_MODULE_EXT);
if(load_a_module(module_name, warn, MAPI_ORIGIN_CORE, 1) == -1)
{
@ -299,7 +306,6 @@ load_one_module(const char *path, int origin, int coremodule)
char modpath[PATH_MAX];
rb_dlink_node *pathst;
const char *mpath;
struct stat statbuf;
if (server_state_foreground)
@ -315,7 +321,7 @@ load_one_module(const char *path, int origin, int coremodule)
{
mpath = pathst->data;
snprintf(modpath, sizeof(modpath), "%s/%s", mpath, path);
snprintf(modpath, sizeof(modpath), "%s/%s%s", mpath, path, LT_MODULE_EXT);
if((strstr(modpath, "../") == NULL) && (strstr(modpath, "/..") == NULL))
{
if(stat(modpath, &statbuf) == 0)
@ -1033,11 +1039,11 @@ load_a_module(const char *path, int warn, int origin, int core)
}
sendto_realops_snomask(SNO_GENERAL, L_ALL,
"Module %s [version: %s; MAPI version: %d; origin: %s; description: \"%s\"] loaded at 0x%lx",
"Module %s [version: %s; MAPI version: %d; origin: %s; description: \"%s\"] loaded at %p",
mod_basename, ver, MAPI_VERSION(*mapi_version), o, description,
(unsigned long) tmpptr);
ilog(L_MAIN, "Module %s [version: %s; MAPI version: %d; origin: %s; description: \"%s\"] loaded at 0x%lx",
mod_basename, ver, MAPI_VERSION(*mapi_version), o, description, (unsigned long) tmpptr);
(void *) tmpptr);
ilog(L_MAIN, "Module %s [version: %s; MAPI version: %d; origin: %s; description: \"%s\"] loaded at %p",
mod_basename, ver, MAPI_VERSION(*mapi_version), o, description, (void *) tmpptr);
}
rb_free(mod_basename);
return 0;

View file

@ -162,8 +162,6 @@ msgbuf_unparse_tags(char *buf, size_t buflen, struct MsgBuf *msgbuf, unsigned in
void
msgbuf_unparse_prefix(char *buf, size_t buflen, struct MsgBuf *msgbuf, unsigned int capmask)
{
int i;
memset(buf, 0, buflen);
if (msgbuf->n_tags > 0)

View file

@ -2265,7 +2265,6 @@ remove_conf_item(const char *topconf, const char *name)
static struct ConfEntry conf_serverinfo_table[] =
{
{ "description", CF_QSTRING, NULL, 0, &ServerInfo.description },
{ "hub", CF_YESNO, NULL, 0, &ServerInfo.hub },
{ "network_name", CF_QSTRING, conf_set_serverinfo_network_name, 0, NULL },
{ "name", CF_QSTRING, conf_set_serverinfo_name, 0, NULL },

View file

@ -45,9 +45,6 @@
struct Dictionary *cmd_dict = NULL;
struct Dictionary *alias_dict = NULL;
/* parv[0] is not used, and parv[LAST] == NULL */
static char *para[MAXPARA + 2];
static void cancel_clients(struct Client *, struct Client *);
static void remove_unknown(struct Client *, const char *, char *);
@ -82,7 +79,7 @@ parse(struct Client *client_p, char *pbuffer, char *bufend)
{
struct Client *from = client_p;
char *end;
int i = 1, res;
int res;
int numeric = 0;
struct Message *mptr;
struct MsgBuf msgbuf;
@ -107,7 +104,7 @@ parse(struct Client *client_p, char *pbuffer, char *bufend)
return;
}
if (msgbuf.origin != NULL)
if (msgbuf.origin != NULL && IsServer(client_p))
{
from = find_client(msgbuf.origin);
@ -186,7 +183,7 @@ parse(struct Client *client_p, char *pbuffer, char *bufend)
/* Its expected this nasty code can be removed
* or rewritten later if still needed.
*/
if((unsigned long) (p + 8) > (unsigned long) end)
if((p + 8) > end)
{
for (; p <= end; p++)
{

View file

@ -34,7 +34,7 @@
* --Bleep Thomas Helvey <tomh@inxpress.net>
*/
#include "stdinc.h"
#include "config.h"
#include "defaults.h"
#include "s_auth.h"
#include "s_conf.h"
#include "client.h"
@ -269,7 +269,7 @@ start_auth_query(struct AuthRequest *auth)
if(IsAnyDead(auth->client))
return 0;
family = auth->client->localClient->ip.ss_family;
family = GET_SS_FAMILY(&auth->client->localClient->ip);
if((F = rb_socket(family, SOCK_STREAM, 0, "ident")) == NULL)
{
ilog_error("creating auth stream socket");
@ -302,7 +302,7 @@ start_auth_query(struct AuthRequest *auth)
/* XXX mangle_mapped_sockaddr((struct sockaddr *)&localaddr); */
#ifdef RB_IPV6
if(localaddr.ss_family == AF_INET6)
if(GET_SS_FAMILY(&localaddr) == AF_INET6)
{
auth->lport = ntohs(((struct sockaddr_in6 *)&localaddr)->sin6_port);
((struct sockaddr_in6 *)&localaddr)->sin6_port = 0;
@ -316,7 +316,7 @@ start_auth_query(struct AuthRequest *auth)
destaddr = auth->client->localClient->ip;
#ifdef RB_IPV6
if(localaddr.ss_family == AF_INET6)
if(GET_SS_FAMILY(&localaddr) == AF_INET6)
{
auth->rport = ntohs(((struct sockaddr_in6 *)&destaddr)->sin6_port);
((struct sockaddr_in6 *)&destaddr)->sin6_port = htons(113);

View file

@ -169,7 +169,7 @@ free_conf(struct ConfItem *aconf)
* inputs - pointer to client
* output - 0 = Success
* NOT_AUTHORISED (-1) = Access denied (no I line match)
* SOCKET_ERROR (-2) = Bad socket.
* I_SOCKET_ERROR (-2) = Bad socket.
* I_LINE_FULL (-3) = I-line is full
* TOO_MANY (-4) = Too many connections from hostname
* BANNED_CLIENT (-5) = K-lined
@ -190,7 +190,7 @@ check_client(struct Client *client_p, struct Client *source_p, const char *usern
switch (i)
{
case SOCKET_ERROR:
case I_SOCKET_ERROR:
exit_client(client_p, source_p, &me, "Socket Error");
break;
@ -261,7 +261,7 @@ check_client(struct Client *client_p, struct Client *source_p, const char *usern
{
int port = -1;
#ifdef RB_IPV6
if(source_p->localClient->ip.ss_family == AF_INET6)
if(GET_SS_FAMILY(&source_p->localClient->ip) == AF_INET6)
port = ntohs(((struct sockaddr_in6 *)&source_p->localClient->listener->addr)->sin6_port);
else
#endif
@ -394,7 +394,7 @@ find_address_conf_by_client(struct Client *client_p, const char *username)
aconf = find_address_conf(client_p->host, client_p->sockhost,
client_p->username, client_p->username,
(struct sockaddr *) &client_p->localClient->ip,
client_p->localClient->ip.ss_family,
GET_SS_FAMILY(&client_p->localClient->ip),
client_p->localClient->auth_user);
}
else
@ -404,7 +404,7 @@ find_address_conf_by_client(struct Client *client_p, const char *username)
aconf = find_address_conf(client_p->host, client_p->sockhost,
non_ident, client_p->username,
(struct sockaddr *) &client_p->localClient->ip,
client_p->localClient->ip.ss_family,
GET_SS_FAMILY(&client_p->localClient->ip),
client_p->localClient->auth_user);
}
return aconf;
@ -690,8 +690,6 @@ set_default_conf(void)
ServerInfo.specific_ipv6_vhost = 0;
#endif
/* Don't reset hub, as that will break lazylinks */
/* ServerInfo.hub = false; */
AdminInfo.name = NULL;
AdminInfo.email = NULL;
AdminInfo.description = NULL;

View file

@ -305,7 +305,7 @@ find_oper_conf(const char *username, const char *host, const char *locip, const
if(parse_netmask(addr, &ip, &bits) != HM_HOST)
{
if(ip.ss_family == cip.ss_family &&
if(GET_SS_FAMILY(&ip) == GET_SS_FAMILY(&cip) &&
comp_with_mask_sock((struct sockaddr *)&ip, (struct sockaddr *)&cip, bits))
return oper_p;
}
@ -685,7 +685,6 @@ expire_temp_rxlines(void *unused)
struct ConfItem *aconf;
rb_dlink_node *ptr;
rb_dlink_node *next_ptr;
int i;
struct rb_radixtree_iteration_state state;
RB_RADIXTREE_FOREACH(aconf, &state, resv_tree)

View file

@ -797,19 +797,6 @@ server_estab(struct Client *client_p)
/* Its got identd , since its a server */
SetGotId(client_p);
/* If there is something in the serv_list, it might be this
* connecting server..
*/
if(!ServerInfo.hub && serv_list.head)
{
if(client_p != serv_list.head->data || serv_list.head->next)
{
ServerStats.is_ref++;
sendto_one(client_p, "ERROR :I'm a leaf not a hub");
return exit_client(client_p, client_p, client_p, "I'm a leaf");
}
}
if(IsUnknown(client_p))
{
/* the server may be linking based on certificate fingerprint now. --nenolod */

View file

@ -1464,10 +1464,8 @@ change_nick_user_host(struct Client *target_p, const char *nick, const char *use
target_p->info);
if(*mode)
sendto_channel_local_butone(target_p, ALL_MEMBERS, chptr,
":%s MODE %s +%s %s",
target_p->servptr->name,
chptr->chname, mode, modeval);
sendto_channel_local_with_capability_butone(target_p, ALL_MEMBERS, NOCAPS, CLICAP_CHGHOST, chptr,
":%s MODE %s +%s %s", target_p->servptr->name, chptr->chname, mode, modeval);
*modeval = '\0';
}

View file

@ -38,8 +38,13 @@ dnl RB_PROTO_INET6
AC_DEFUN([RB_PROTO_INET6],[
AC_CACHE_CHECK([for INET6 protocol support], [rb_cv_proto_inet6],[
AC_TRY_CPP([
#ifndef _WIN32
#include <sys/types.h>
#include <sys/socket.h>
#else
#include <winsock2.h>
#include <ws2tcpip.h>
#endif
#ifndef PF_INET6
#error Missing PF_INET6
@ -69,9 +74,14 @@ AC_DEFUN([RB_TYPE_STRUCT_SOCKADDR_IN6],[
],[
rb_have_sockaddr_in6=no
],[
#ifndef _WIN32
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#else
#include <winsock2.h>
#include <ws2tcpip.h>
#endif
])
if test "X$rb_have_sockaddr_in6" = "Xyes"; then :

View file

@ -62,7 +62,7 @@ case "$host_os" in
AC_DEFINE_UNQUOTED(CYGWIN,1,[This is a Cygwin system])
AC_DEFINE_UNQUOTED(WINDOWS,1,[This is a Windows system])
;;
*mingw*)
*mingw* | *msys*)
AC_DEFINE_UNQUOTED(MINGW,1,[This is a MinGW system])
AC_DEFINE_UNQUOTED(WINDOWS,1,[This is a Windows system])
AC_CHECK_HEADER(windows.h, , [AC_MSG_ERROR([** MinGW and no windows.h. I give up.])])
@ -144,6 +144,7 @@ AC_CHECK_TYPE([socklen_t], rb_cv_socklen_t=socklen_t,[
#endif
#ifdef HAVE_WINSOCK2_H
#include <winsock2.h>
#include <ws2tcpip.h>
#endif
int getpeername (int, $arg2 *, $t *);
],[
@ -210,8 +211,9 @@ AC_CHECK_TYPE([sa_family_t], [],
dnl check for various functions...
AC_CHECK_FUNCS([snprintf vsnprintf socketpair gettimeofday writev sendmsg gmtime_r strtok_r usleep posix_spawn strlcpy strlcat strnlen fstat signalfd select poll kevent port_create epoll_ctl arc4random getrusage timerfd_create])
AC_CHECK_FUNCS([snprintf vsnprintf socketpair gettimeofday writev sendmsg gmtime_r strtok_r usleep posix_spawn getexecname strlcpy strlcat strnlen fstat signalfd select poll kevent port_create epoll_ctl arc4random getrusage timerfd_create])
AC_SEARCH_LIBS(dlinfo, dl, AC_DEFINE(HAVE_DLINFO, 1, [Define if you have dlinfo]))
AC_SEARCH_LIBS(nanosleep, rt posix4, AC_DEFINE(HAVE_NANOSLEEP, 1, [Define if you have nanosleep]))
AC_SEARCH_LIBS(timer_create, rt, AC_DEFINE(HAVE_TIMER_CREATE, 1, [Define if you have timer_create]))
RB_CHECK_TIMER_CREATE
@ -496,6 +498,7 @@ if test "x$rb_windows_h" = "xyes"; then
echo '#define WIN32_LEAN_AND_MEAN 1' >> $outfile
echo '#include <windows.h>' >> $outfile
echo '#include <winsock2.h>' >> $outfile
echo '#include <ws2tcpip.h>' >> $outfile
echo '#include <iphlpapi.h>' >> $outfile
fi

View file

@ -33,13 +33,6 @@
#define FD_DESC_SZ 128 /* hostlen + comment */
#ifdef _WIN32
#define rb_get_errno() do { errno = WSAGetLastError(); WSASetLastError(errno); } while(0)
#else
#define rb_get_errno()
#endif
#define rb_hash_fd(x) ((x ^ (x >> RB_FD_HASH_BITS) ^ (x >> (RB_FD_HASH_BITS * 2))) & RB_FD_HASH_MASK)
#ifdef HAVE_WRITEV
@ -104,7 +97,7 @@ struct _fde
* filedescriptor. Think though: when do you think we'll need more?
*/
rb_dlink_node node;
int fd; /* So we can use the rb_fde_t as a callback ptr */
rb_platform_fd_t fd; /* So we can use the rb_fde_t as a callback ptr */
uint8_t flags;
uint8_t type;
int pflags;
@ -136,7 +129,7 @@ typedef struct timer_data
extern rb_dlink_list *rb_fd_table;
static inline rb_fde_t *
rb_find_fd(int fd)
rb_find_fd(rb_platform_fd_t fd)
{
rb_dlink_list *hlist;
rb_dlink_node *ptr;

View file

@ -88,7 +88,7 @@ struct rb_iovec
void rb_fdlist_init(int closeall, int maxfds, size_t heapsize);
rb_fde_t *rb_open(int, uint8_t, const char *);
rb_fde_t *rb_open(rb_platform_fd_t, uint8_t, const char *);
void rb_close(rb_fde_t *);
void rb_dump_fd(DUMPCB *, void *xdata);
void rb_note(rb_fde_t *, const char *);
@ -150,11 +150,11 @@ void rb_setselect(rb_fde_t *, unsigned int type, PF * handler, void *client_data
void rb_init_netio(void);
int rb_select(unsigned long);
int rb_fd_ssl(rb_fde_t *F);
int rb_get_fd(rb_fde_t *F);
rb_platform_fd_t rb_get_fd(rb_fde_t *F);
const char *rb_get_ssl_strerror(rb_fde_t *F);
int rb_get_ssl_certfp(rb_fde_t *F, uint8_t certfp[RB_SSL_CERTFP_LEN], int method);
rb_fde_t *rb_get_fde(int fd);
rb_fde_t *rb_get_fde(rb_platform_fd_t fd);
int rb_send_fd_buf(rb_fde_t *xF, rb_fde_t **F, int count, void *data, size_t datasize, pid_t pid);
int rb_recv_fd_buf(rb_fde_t *F, void *data, size_t datasize, rb_fde_t **xF, int count);

View file

@ -153,17 +153,23 @@ extern unsigned int rb_dictionary_size(struct Dictionary *dtree);
void rb_dictionary_stats(struct Dictionary *dict, void (*cb)(const char *line, void *privdata), void *privdata);
void rb_dictionary_stats_walk(void (*cb)(const char *line, void *privdata), void *privdata);
#ifndef _WIN32
#define RB_POINTER_TO_INT(x) ((int32_t) (long) (x))
#define RB_INT_TO_POINTER(x) ((void *) (long) (int32_t) (x))
#define RB_POINTER_TO_UINT(x) ((uint32_t) (unsigned long) (x))
#define RB_UINT_TO_POINTER(x) ((void *) (unsigned long) (uint32_t) (x))
#define RB_POINTER_TO_LONG(x) ((int64_t) (unsigned long long) (x))
#define RB_LONG_TO_POINTER(x) ((void *) (unsigned long long) (int64_t) (x))
#else
#define RB_POINTER_TO_ULONG(x) ((uint64_t) (unsigned long long) (x))
#define RB_ULONG_TO_POINTER(x) ((void *) (unsigned long long) (uint64_t) (x))
#define RB_POINTER_TO_INT(x) ((int32_t) (unsigned long long) (x))
#define RB_INT_TO_POINTER(x) ((void *) (unsigned long long) (int32_t) (x))
#define RB_POINTER_TO_UINT(x) ((uint32_t) (unsigned long long) (x))
#define RB_UINT_TO_POINTER(x) ((void *) (unsigned long long) (uint32_t) (x))
#endif
static inline int rb_int32cmp(const void *a, const void *b)
{
@ -175,14 +181,4 @@ static inline int rb_uint32cmp(const void *a, const void *b)
return RB_POINTER_TO_UINT(b) - RB_POINTER_TO_UINT(a);
}
static inline int rb_int64cmp(const void *a, const void *b)
{
return RB_POINTER_TO_LONG(b) - RB_POINTER_TO_LONG(a);
}
static inline int rb_uint64cmp(const void *a, const void *b)
{
return RB_POINTER_TO_ULONG(b) - RB_POINTER_TO_ULONG(a);
}
#endif

View file

@ -66,7 +66,13 @@ char *alloca();
#define rb_unlikely(x) (x)
#endif
#ifdef _WIN32
#define rb_get_errno() do { errno = WSAGetLastError(); WSASetLastError(errno); } while(0)
typedef SOCKET rb_platform_fd_t;
#else
#define rb_get_errno()
typedef int rb_platform_fd_t;
#endif
#ifdef _WIN32
#include <process.h>
@ -82,14 +88,28 @@ char *alloca();
#define strerror(x) rb_strerror(x)
char *rb_strerror(int error);
#undef ENOBUFS
#define ENOBUFS WSAENOBUFS
#undef EINPROGRESS
#define EINPROGRESS WSAEINPROGRESS
#undef EWOULDBLOCK
#define EWOULDBLOCK WSAEWOULDBLOCK
#undef EMSGSIZE
#define EMSGSIZE WSAEMSGSIZE
#undef EALREADY
#define EALREADY WSAEALREADY
#undef EISCONN
#define EISCONN WSAEISCONN
#undef EADDRINUSE
#define EADDRINUSE WSAEADDRINUSE
#undef EAFNOSUPPORT
#define EAFNOSUPPORT WSAEAFNOSUPPORT
#define pipe(x) _pipe(x, 1024, O_BINARY)

View file

@ -371,5 +371,6 @@ void rb_zstring_append_from_c(rb_zstring_t *zs, const char *buf, size_t len);
char *rb_zstring_to_c(rb_zstring_t *zs, char *buf, size_t len);
char *rb_zstring_to_c_alloc(rb_zstring_t *zs);
size_t rb_zstring_to_ptr(rb_zstring_t *zs, void **ptr);
const char *rb_path_to_self(void);
#endif /* __TOOLS_H__ */

View file

@ -74,12 +74,12 @@ static void mangle_mapped_sockaddr(struct sockaddr *in);
#endif
#ifndef HAVE_SOCKETPAIR
static int rb_inet_socketpair(int d, int type, int protocol, int sv[2]);
static int rb_inet_socketpair(int d, int type, int protocol, rb_platform_fd_t sv[2]);
static int rb_inet_socketpair_udp(rb_fde_t **newF1, rb_fde_t **newF2);
#endif
static inline rb_fde_t *
add_fd(int fd)
add_fd(rb_platform_fd_t fd)
{
rb_fde_t *F = rb_find_fd(fd);
@ -230,7 +230,7 @@ rb_set_nb(rb_fde_t *F)
{
int nonb = 0;
int res;
int fd;
rb_platform_fd_t fd;
if(F == NULL)
return 0;
fd = F->fd;
@ -409,7 +409,7 @@ rb_accept_tcp(rb_fde_t *F, ACPRE * precb, ACCB * callback, void *data)
}
/*
* void rb_connect_tcp(int fd, struct sockaddr *dest,
* void rb_connect_tcp(rb_platform_fd_t fd, struct sockaddr *dest,
* struct sockaddr *clocal, int socklen,
* CNCB *callback, void *data, int timeout)
* Input: An fd to connect with, a host and port to connect to,
@ -496,7 +496,7 @@ rb_connect_timeout(rb_fde_t *F, void *notused)
rb_connect_callback(F, RB_ERR_TIMEOUT);
}
/* static void rb_connect_tryconnect(int fd, void *notused)
/* static void rb_connect_tryconnect(rb_platform_fd_t fd, void *notused)
* Input: The fd, the handler data(unused).
* Output: None.
* Side-effects: Try and connect with pending connect data for the FD. If
@ -564,7 +564,7 @@ rb_errstr(int error)
int
rb_socketpair(int family, int sock_type, int proto, rb_fde_t **F1, rb_fde_t **F2, const char *note)
{
int nfd[2];
rb_platform_fd_t nfd[2];
if(number_fd >= rb_maxconnections)
{
errno = ENFILE;
@ -627,7 +627,7 @@ int
rb_pipe(rb_fde_t **F1, rb_fde_t **F2, const char *desc)
{
#ifndef _WIN32
int fd[2];
rb_platform_fd_t fd[2];
if(number_fd >= rb_maxconnections)
{
errno = ENFILE;
@ -677,7 +677,7 @@ rb_fde_t *
rb_socket(int family, int sock_type, int proto, const char *note)
{
rb_fde_t *F;
int fd;
rb_platform_fd_t fd;
/* First, make sure we aren't going to run out of file descriptors */
if(rb_unlikely(number_fd >= rb_maxconnections))
{
@ -703,7 +703,7 @@ rb_socket(int family, int sock_type, int proto, const char *note)
if(family == AF_INET6)
{
int off = 1;
if(setsockopt(fd, IPPROTO_IPV6, IPV6_V6ONLY, &off, sizeof(off)) == -1)
if(setsockopt(fd, IPPROTO_IPV6, IPV6_V6ONLY, (void *) &off, sizeof(off)) == -1)
{
rb_lib_log("rb_socket: Could not set IPV6_V6ONLY option to 1 on FD %d: %s",
fd, strerror(errno));
@ -821,7 +821,7 @@ rb_fdlist_init(int closeall, int maxfds, size_t heapsize)
/* Called to open a given filedescriptor */
rb_fde_t *
rb_open(int fd, uint8_t type, const char *desc)
rb_open(rb_platform_fd_t fd, uint8_t type, const char *desc)
{
rb_fde_t *F;
lrb_assert(fd >= 0);
@ -970,7 +970,7 @@ rb_fd_ssl(rb_fde_t *F)
return 0;
}
int
rb_platform_fd_t
rb_get_fd(rb_fde_t *F)
{
if(F == NULL)
@ -979,7 +979,7 @@ rb_get_fd(rb_fde_t *F)
}
rb_fde_t *
rb_get_fde(int fd)
rb_get_fde(rb_platform_fd_t fd)
{
return rb_find_fd(fd);
}
@ -1609,7 +1609,7 @@ rb_inet_socketpair_udp(rb_fde_t **newF1, rb_fde_t **newF2)
struct sockaddr_in addr[2];
rb_socklen_t size = sizeof(struct sockaddr_in);
rb_fde_t *F[2];
unsigned int fd[2];
rb_platform_fd_t fd[2];
int i, got;
unsigned short port;
struct timeval wait = { 0, 100000 };
@ -1693,7 +1693,9 @@ rb_inet_socketpair_udp(rb_fde_t **newF1, rb_fde_t **newF2)
return 0;
#ifdef _WIN32
#ifndef ECONNABORTED
#define ECONNABORTED WSAECONNABORTED
#endif
#endif
abort_failed:
@ -1713,7 +1715,7 @@ rb_inet_socketpair_udp(rb_fde_t **newF1, rb_fde_t **newF2)
int
rb_inet_socketpair(int family, int type, int protocol, int fd[2])
rb_inet_socketpair(int family, int type, int protocol, rb_platform_fd_t fd[2])
{
int listener = -1;
int connector = -1;
@ -2136,7 +2138,7 @@ rb_recv_fd_buf(rb_fde_t *F, void *data, size_t datasize, rb_fde_t **xF, int nfds
struct stat st;
uint8_t stype = RB_FD_UNKNOWN;
const char *desc;
int fd, len, x, rfds;
rb_platform_fd_t fd, len, x, rfds;
int control_len = CMSG_SPACE(sizeof(int) * nfds);
@ -2221,6 +2223,7 @@ rb_send_fd_buf(rb_fde_t *xF, rb_fde_t **F, int count, void *data, size_t datasiz
if(count > 0)
{
size_t ucount = (size_t)count;
int len = CMSG_SPACE(sizeof(int) * count);
char buf[len];
@ -2231,7 +2234,7 @@ rb_send_fd_buf(rb_fde_t *xF, rb_fde_t **F, int count, void *data, size_t datasiz
cmsg->cmsg_type = SCM_RIGHTS;
cmsg->cmsg_len = CMSG_LEN(sizeof(int) * count);
for(unsigned int i = 0; i < count; i++)
for(size_t i = 0; i < ucount; i++)
{
((int *)CMSG_DATA(cmsg))[i] = rb_get_fd(F[i]);
}

View file

@ -188,3 +188,4 @@ rb_zstring_serialized
rb_zstring_to_c
rb_zstring_to_c_alloc
rb_zstring_to_ptr
rb_path_to_self

View file

@ -78,7 +78,7 @@ rb_helper_child(rb_helper_cb * read_cb, rb_helper_cb * error_cb, log_cb * ilog,
if(x > 2) /* don't undo what we just did */
close(x);
#else
x = 0; /* shut gcc up */
(void) x; /* shut gcc up */
#endif
rb_lib_init(ilog, irestart, idie, 0, maxfd, dh_size, fd_heap_size);

View file

@ -210,12 +210,10 @@ rb_strnlen(const char *s, size_t count)
int
rb_snprintf_append(char *str, size_t len, const char *format, ...)
{
int x;
if(len == 0)
return 0;
x = strlen(str);
size_t x = strlen(str);
if(len < x)
{
@ -225,10 +223,10 @@ rb_snprintf_append(char *str, size_t len, const char *format, ...)
va_list ap;
va_start(ap, format);
x = (vsnprintf(str + x, len - x, format, ap) + (int)x);
int y = (vsnprintf(str + x, len - x, format, ap) + (int)x);
va_end(ap);
return (x);
return (y);
}
/* rb_basename

View file

@ -26,19 +26,23 @@
#include <librb_config.h>
#include <rb_lib.h>
#ifndef _WIN32
#include <sys/wait.h>
#ifdef HAVE_DLINFO
# include <link.h>
# include <dlfcn.h>
#endif
#ifdef __APPLE__
#include <mach-o/dyld.h>
#include <crt_externs.h>
#endif
#if defined(HAVE_SPAWN_H) && defined(HAVE_POSIX_SPAWN)
#include <spawn.h>
#ifdef __APPLE__
#include <crt_externs.h>
#endif
#ifndef __APPLE__
extern char **environ;
#endif
@ -151,5 +155,36 @@ rb_getpid(void)
return getpid();
}
const char *
rb_path_to_self(void)
{
static char path_buf[4096];
#if defined(HAVE_GETEXECNAME)
char *s = getexecname();
if (s == NULL)
return NULL;
realpath(s, path_buf);
return path_buf;
#elif defined(__linux__)
if (readlink("/proc/self/exe", path_buf, sizeof path_buf) != -1)
return path_buf;
return NULL;
#elif defined(HAVE_DLINFO)
struct link_map *map = NULL;
dlinfo(RTLD_SELF, RTLD_DI_LINKMAP, &map);
if (map == NULL)
return NULL;
realpath(map->l_name, path_buf);
#elif defined(__APPLE__)
char tmp_path[4096];
uint32_t pathlen = 4096;
if (_NSGetExecutablePath(tmp_path, &pathlen) < 0)
return NULL;
realpath(tmp_path, path_buf);
return path_buf;
#endif
}
#endif /* !WIN32 */

View file

@ -94,7 +94,7 @@ rb_spawn_process(const char *path, const char **argv)
}
pid_t
rb_waitpid(int pid, int *status, int flags)
rb_waitpid(pid_t pid, int *status, int flags)
{
DWORD timeout = (flags & WNOHANG) ? 0 : INFINITE;
HANDLE hProcess;
@ -152,7 +152,7 @@ rb_setenv(const char *name, const char *value, int overwrite)
}
int
rb_kill(int pid, int sig)
rb_kill(pid_t pid, int sig)
{
HANDLE hProcess;
int ret = -1;
@ -614,6 +614,15 @@ rb_strerror(int error)
rb_strlcpy(buf, _rb_strerror(error), sizeof(buf));
return buf;
}
const char *
rb_path_to_self(void)
{
static char path_buf[MAX_PATH];
GetModuleFileName(NULL, path_buf, MAX_PATH);
return path_buf;
}
#else /* win32 not supported */
int
rb_init_netio_win32(void)

View file

@ -32,7 +32,7 @@
#include "channel.h"
#include "client.h"
#include "common.h"
#include "config.h"
#include "defaults.h"
#include "ircd.h"
#include "match.h"
#include "s_conf.h"

View file

@ -427,15 +427,6 @@ ms_join(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_
newts = atol(parv[1]);
oldts = chptr->channelts;
#ifdef IGNORE_BOGUS_TS
if(newts < 800000000)
{
sendto_realops_snomask(SNO_DEBUG, L_ALL,
"*** Bogus TS %ld on %s ignored from %s",
(long) newts, chptr->chname, client_p->name);
newts = (oldts == 0) ? oldts : 800000000;
}
#else
/* making a channel TS0 */
if(!isnew && !newts && oldts)
{
@ -446,7 +437,6 @@ ms_join(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_
"Server %s changing TS on %s from %ld to 0",
source_p->name, chptr->chname, (long) oldts);
}
#endif
if(isnew)
chptr->channelts = newts;
@ -614,16 +604,6 @@ ms_sjoin(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source
oldts = chptr->channelts;
oldmode = &chptr->mode;
#ifdef IGNORE_BOGUS_TS
if(newts < 800000000)
{
sendto_realops_snomask(SNO_DEBUG, L_ALL,
"*** Bogus TS %ld on %s ignored from %s",
(long) newts, chptr->chname, client_p->name);
newts = (oldts == 0) ? oldts : 800000000;
}
#else
if(!isnew && !newts && oldts)
{
sendto_channel_local(ALL_MEMBERS, chptr,
@ -634,7 +614,6 @@ ms_sjoin(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source
"Server %s changing TS on %s from %ld to 0",
source_p->name, chptr->chname, (long) oldts);
}
#endif
if(isnew)
chptr->channelts = newts;

View file

@ -146,17 +146,16 @@ clicap_find(const char *data, int *negate, int *finished)
* Generates a list of capabilities.
*
* Inputs: client to send to, subcmd to send,
* flags to match against: 0 to do none, -1 if client has no flags,
* int to whether we are doing CAP CLEAR
* flags to match against: 0 to do none, -1 if client has no flags
* Outputs: None
*/
static void
clicap_generate(struct Client *source_p, const char *subcmd, int flags, int clear)
clicap_generate(struct Client *source_p, const char *subcmd, int flags)
{
char buf[BUFSIZE] = { 0 };
char capbuf[BUFSIZE] = { 0 };
int buflen = 0;
int curlen, mlen;
int mlen;
struct CapabilityEntry *entry;
struct DictionaryIter iter;
@ -178,14 +177,8 @@ clicap_generate(struct Client *source_p, const char *subcmd, int flags, int clea
struct ClientCapability *clicap = entry->ownerdata;
const char *data = NULL;
if(flags)
{
if(!IsCapableEntry(source_p, entry))
if(flags && !IsCapableEntry(source_p, entry))
continue;
/* they are capable of this, check sticky */
else if(clear && HasCapabilityFlag(entry, CLICAP_FLAGS_STICKY))
continue;
}
if (!clicap_visible(source_p, entry))
continue;
@ -211,8 +204,8 @@ clicap_generate(struct Client *source_p, const char *subcmd, int flags, int clea
memset(capbuf, 0, sizeof capbuf);
}
buflen = rb_snprintf_append(capbuf, sizeof capbuf, "%s%s%s%s ",
clear ? "-" : "", entry->cap, data != NULL ? "=" : "", data != NULL ? data : "");
buflen = rb_snprintf_append(capbuf, sizeof capbuf, "%s%s%s ",
entry->cap, data != NULL ? "=" : "", data != NULL ? data : "");
}
/* remove trailing space */
@ -254,15 +247,6 @@ cap_ack(struct Client *source_p, const char *arg)
source_p->localClient->caps &= ~capdel;
}
static void
cap_clear(struct Client *source_p, const char *arg)
{
clicap_generate(source_p, "ACK",
source_p->localClient->caps ? source_p->localClient->caps : -1, 1);
source_p->localClient->caps = 0;
}
static void
cap_end(struct Client *source_p, const char *arg)
{
@ -282,7 +266,7 @@ cap_list(struct Client *source_p, const char *arg)
{
/* list of what theyre currently using */
clicap_generate(source_p, "LIST",
source_p->localClient->caps ? source_p->localClient->caps : -1, 0);
source_p->localClient->caps ? source_p->localClient->caps : -1);
}
static void
@ -298,7 +282,7 @@ cap_ls(struct Client *source_p, const char *arg)
}
/* list of what we support */
clicap_generate(source_p, "LS", 0, 0);
clicap_generate(source_p, "LS", 0);
}
static void
@ -404,7 +388,6 @@ static struct clicap_cmd
} clicap_cmdlist[] = {
/* This list *MUST* be in alphabetical order */
{ "ACK", cap_ack },
{ "CLEAR", cap_clear },
{ "END", cap_end },
{ "LIST", cap_list },
{ "LS", cap_ls },

View file

@ -14,7 +14,7 @@
#include "channel.h"
#include "client.h"
#include "common.h"
#include "config.h"
#include "defaults.h"
#include "ircd.h"
#include "numeric.h"
#include "s_conf.h"

View file

@ -32,7 +32,7 @@
#include "channel.h"
#include "client.h"
#include "common.h"
#include "config.h"
#include "defaults.h"
#include "ircd.h"
#include "numeric.h"
#include "s_serv.h"

View file

@ -165,8 +165,8 @@ do_etrace(struct Client *source_p, int ipv4, int ipv6)
target_p = ptr->data;
#ifdef RB_IPV6
if((!ipv4 && target_p->localClient->ip.ss_family == AF_INET) ||
(!ipv6 && target_p->localClient->ip.ss_family == AF_INET6))
if((!ipv4 && GET_SS_FAMILY(&target_p->localClient->ip) == AF_INET) ||
(!ipv6 && GET_SS_FAMILY(&target_p->localClient->ip) == AF_INET6))
continue;
#endif

View file

@ -285,12 +285,6 @@ static struct InfoStruct info_table[] = {
&ConfigFileEntry.hide_spoof_ips,
"Hide IPs of spoofed users"
},
{
"hub",
OUTPUT_BOOLEAN_YN,
&ServerInfo.hub,
"Server is a hub"
},
{
"kline_delay",
OUTPUT_DECIMAL,
@ -779,7 +773,7 @@ send_conf_options(struct Client *source_p)
/*
* Now send them a list of all our configuration options
* (mostly from config.h)
* (mostly from defaults.h)
*/
for (infoptr = MyInformation; infoptr->name; infoptr++)
{

View file

@ -32,7 +32,7 @@
#include "channel.h"
#include "client.h"
#include "common.h"
#include "config.h"
#include "defaults.h"
#include "ircd.h"
#include "numeric.h"
#include "s_serv.h"

View file

@ -200,7 +200,6 @@ rehash_tresvs(struct Client *source_p)
struct rb_radixtree_iteration_state iter;
rb_dlink_node *ptr;
rb_dlink_node *next_ptr;
int i;
sendto_realops_snomask(SNO_GENERAL, L_ALL, "%s is clearing temp resvs",
get_oper_name(source_p));

View file

@ -59,10 +59,6 @@ DECLARE_MODULE_AV2(restart, NULL, NULL, restart_clist, NULL, NULL, NULL, NULL, r
static void
mo_restart(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
{
char buf[BUFSIZE];
rb_dlink_node *ptr;
struct Client *target_p;
if(!IsOperDie(source_p))
{
sendto_one(source_p, form_str(ERR_NOPRIVS),

View file

@ -33,7 +33,7 @@
#include "channel.h"
#include "client.h"
#include "common.h"
#include "config.h"
#include "defaults.h"
#include "ircd.h"
#include "numeric.h"
#include "s_conf.h"

View file

@ -33,7 +33,7 @@
#include "channel.h"
#include "client.h"
#include "common.h"
#include "config.h"
#include "defaults.h"
#include "ircd.h"
#include "numeric.h"
#include "s_conf.h"

View file

@ -142,53 +142,53 @@ static void stats_capability(struct Client *);
*/
static struct stats_cmd stats_cmd_table[256] = {
/* letter handler/handler_parv parv oper admin */
['a'] = { stats_dns_servers, false, true, true, },
['A'] = { stats_dns_servers, false, true, true, },
['b'] = { stats_delay, false, true, true, },
['B'] = { stats_hash, false, true, true, },
['c'] = { stats_connect, false, false, false, },
['C'] = { stats_capability, false, true, false, },
['d'] = { stats_tdeny, false, true, false, },
['D'] = { stats_deny, false, true, false, },
['e'] = { stats_exempt, false, true, false, },
['E'] = { stats_events, false, true, true, },
['f'] = { stats_comm, false, true, true, },
['F'] = { stats_comm, false, true, true, },
['g'] = { stats_prop_klines, false, true, false, },
['h'] = { stats_hubleaf, false, false, false, },
['H'] = { stats_hubleaf, false, false, false, },
['i'] = { stats_auth, false, false, false, },
['I'] = { stats_auth, false, false, false, },
['k'] = { stats_tklines, false, false, false, },
['K'] = { stats_klines, false, false, false, },
['l'] = { .handler_parv = stats_ltrace, true, false, false, },
['L'] = { .handler_parv = stats_ltrace, true, false, false, },
['m'] = { stats_messages, false, false, false, },
['M'] = { stats_messages, false, false, false, },
['n'] = { stats_dnsbl, false, false, false, },
['o'] = { stats_oper, false, false, false, },
['O'] = { stats_privset, false, true, false, },
['p'] = { stats_operedup, false, false, false, },
['P'] = { stats_ports, false, false, false, },
['q'] = { stats_tresv, false, true, false, },
['Q'] = { stats_resv, false, true, false, },
['r'] = { stats_usage, false, true, false, },
['R'] = { stats_usage, false, true, false, },
['s'] = { stats_ssld, false, true, true, },
['S'] = { stats_ssld, false, true, true, },
['t'] = { stats_tstats, false, true, false, },
['T'] = { stats_tstats, false, true, false, },
['u'] = { stats_uptime, false, false, false, },
['U'] = { stats_shared, false, true, false, },
['v'] = { stats_servers, false, false, false, },
['V'] = { stats_servers, false, false, false, },
['x'] = { stats_tgecos, false, true, false, },
['X'] = { stats_gecos, false, true, false, },
['y'] = { stats_class, false, false, false, },
['Y'] = { stats_class, false, false, false, },
['z'] = { stats_memory, false, true, false, },
['Z'] = { stats_ziplinks, false, true, false, },
['?'] = { stats_servlinks, false, false, false, },
['a'] = { { stats_dns_servers }, false, true, true, },
['A'] = { { stats_dns_servers }, false, true, true, },
['b'] = { { stats_delay }, false, true, true, },
['B'] = { { stats_hash }, false, true, true, },
['c'] = { { stats_connect }, false, false, false, },
['C'] = { { stats_capability }, false, true, false, },
['d'] = { { stats_tdeny }, false, true, false, },
['D'] = { { stats_deny }, false, true, false, },
['e'] = { { stats_exempt }, false, true, false, },
['E'] = { { stats_events }, false, true, true, },
['f'] = { { stats_comm }, false, true, true, },
['F'] = { { stats_comm }, false, true, true, },
['g'] = { { stats_prop_klines }, false, true, false, },
['h'] = { { stats_hubleaf }, false, false, false, },
['H'] = { { stats_hubleaf }, false, false, false, },
['i'] = { { stats_auth }, false, false, false, },
['I'] = { { stats_auth }, false, false, false, },
['k'] = { { stats_tklines }, false, false, false, },
['K'] = { { stats_klines }, false, false, false, },
['l'] = { { .handler_parv = stats_ltrace }, true, false, false, },
['L'] = { { .handler_parv = stats_ltrace }, true, false, false, },
['m'] = { { stats_messages }, false, false, false, },
['M'] = { { stats_messages }, false, false, false, },
['n'] = { { stats_dnsbl }, false, false, false, },
['o'] = { { stats_oper }, false, false, false, },
['O'] = { { stats_privset }, false, true, false, },
['p'] = { { stats_operedup }, false, false, false, },
['P'] = { { stats_ports }, false, false, false, },
['q'] = { { stats_tresv }, false, true, false, },
['Q'] = { { stats_resv }, false, true, false, },
['r'] = { { stats_usage }, false, true, false, },
['R'] = { { stats_usage }, false, true, false, },
['s'] = { { stats_ssld }, false, true, true, },
['S'] = { { stats_ssld }, false, true, true, },
['t'] = { { stats_tstats }, false, true, false, },
['T'] = { { stats_tstats }, false, true, false, },
['u'] = { { stats_uptime }, false, false, false, },
['U'] = { { stats_shared }, false, true, false, },
['v'] = { { stats_servers }, false, false, false, },
['V'] = { { stats_servers }, false, false, false, },
['x'] = { { stats_tgecos }, false, true, false, },
['X'] = { { stats_gecos }, false, true, false, },
['y'] = { { stats_class }, false, false, false, },
['Y'] = { { stats_class }, false, false, false, },
['z'] = { { stats_memory }, false, true, false, },
['Z'] = { { stats_ziplinks }, false, true, false, },
['?'] = { { stats_servlinks }, false, false, false, },
};
/*
@ -204,9 +204,8 @@ static void
m_stats(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
{
static time_t last_used = 0;
int i;
struct stats_cmd *cmd;
char statchar;
unsigned char statchar;
int did_stats = 0;
statchar = parv[1][0];
@ -566,7 +565,7 @@ stats_auth (struct Client *source_p)
aconf = find_conf_by_address (source_p->host, source_p->sockhost, NULL,
(struct sockaddr *)&source_p->localClient->ip,
CONF_CLIENT,
source_p->localClient->ip.ss_family,
GET_SS_FAMILY(&source_p->localClient->ip),
source_p->username, NULL);
else
aconf = find_conf_by_address (source_p->host, NULL, NULL, NULL, CONF_CLIENT,
@ -608,7 +607,7 @@ stats_tklines(struct Client *source_p)
aconf = find_conf_by_address (source_p->host, source_p->sockhost, NULL,
(struct sockaddr *)&source_p->localClient->ip,
CONF_KILL,
source_p->localClient->ip.ss_family,
GET_SS_FAMILY(&source_p->localClient->ip),
source_p->username, NULL);
else
aconf = find_conf_by_address (source_p->host, NULL, NULL, NULL, CONF_KILL,
@ -711,7 +710,7 @@ stats_klines(struct Client *source_p)
aconf = find_conf_by_address (source_p->host, source_p->sockhost, NULL,
(struct sockaddr *)&source_p->localClient->ip,
CONF_KILL,
source_p->localClient->ip.ss_family,
GET_SS_FAMILY(&source_p->localClient->ip),
source_p->username, NULL);
else
aconf = find_conf_by_address (source_p->host, NULL, NULL, NULL, CONF_KILL,
@ -873,7 +872,6 @@ stats_tresv(struct Client *source_p)
struct ConfItem *aconf;
struct rb_radixtree_iteration_state state;
rb_dlink_node *ptr;
int i;
RB_DLINK_FOREACH(ptr, resv_conf_list.head)
{
@ -900,7 +898,6 @@ stats_resv(struct Client *source_p)
struct ConfItem *aconf;
struct rb_radixtree_iteration_state state;
rb_dlink_node *ptr;
int i;
RB_DLINK_FOREACH(ptr, resv_conf_list.head)
{
@ -942,6 +939,7 @@ stats_ssld(struct Client *source_p)
static void
stats_usage (struct Client *source_p)
{
#ifndef _WIN32
struct rusage rus;
time_t secs;
time_t rup;
@ -993,6 +991,7 @@ stats_usage (struct Client *source_p)
"R :Signals %d Context Vol. %d Invol %d",
(int) rus.ru_nsignals, (int) rus.ru_nvcsw,
(int) rus.ru_nivcsw);
#endif
}
static void

View file

@ -33,7 +33,7 @@
#include "channel.h"
#include "client.h"
#include "common.h"
#include "config.h"
#include "defaults.h"
#include "ircd.h"
#include "match.h"
#include "s_conf.h"

View file

@ -124,10 +124,6 @@ confopts(void)
if(ConfigChannel.use_except)
*p++ = 'e';
/* might wanna hide this :P */
if(ServerInfo.hub)
*p++ = 'H';
if(ConfigChannel.use_invex)
*p++ = 'I';
@ -139,9 +135,6 @@ confopts(void)
if(opers_see_all_users || ConfigFileEntry.operspy_dont_care_user_info)
*p++ = 'S';
#ifdef IGNORE_BOGUS_TS
*p++ = 'T';
#endif
#ifdef HAVE_LIBZ
*p++ = 'Z';

View file

@ -367,7 +367,7 @@ single_whois(struct Client *source_p, struct Client *target_p, int operspy)
target_p->name, target_p->sockhost);
#ifdef RB_IPV6
if (target_p->localClient->ip.ss_family == AF_INET6 &&
if (GET_SS_FAMILY(&target_p->localClient->ip) == AF_INET6 &&
(show_ip(source_p, target_p) ||
(source_p == target_p && !IsIPSpoof(target_p))) &&
ipv4_from_ipv6((struct sockaddr_in6 *)&target_p->localClient->ip, &ip4))

View file

@ -33,7 +33,7 @@
#include "channel.h"
#include "client.h"
#include "common.h"
#include "config.h"
#include "defaults.h"
#include "class.h"
#include "ircd.h"
#include "numeric.h"

View file

@ -24,10 +24,13 @@ if [ "x$TIP" = "x" ]; then
exit
fi
# Charybdis wants the hg tip to be in include/serno.h, in its own format.
MYTIP=`git log -1 --date=short --pretty=format:%cd_%h 2>/dev/null | sed -e s/-//g -e s/_/-/`
# Charybdis wants the git head to be in include/serno.h, in its own format.
SERNO=`git log -1 --date=format:%Y%m%d --pretty=format:%cd-%h`
DATECODE=`git log -1 --pretty=format:%ct`
echo "[charybdis] Generating include/serno.h for tip $MYTIP."
cat << _EOF_ > include/serno.h
/* Generated automatically by makepackage. Any changes made here will be lost. */
#define SERNO "$MYTIP"
#define SERNO "$SERNO"
#define DATECODE "$DATECODE"
_EOF_

View file

@ -20,16 +20,12 @@
#
if [ "x$1" = "x" ]; then
echo "usage: $0 releasename [--automatic]"
echo "usage: $0 releasename"
exit
else
RELEASENAME="$1"
fi
if [ "x$2" = "x--automatic" ]; then
AUTOMATIC="yes"
fi
TIP=`git log -1 --pretty=oneline | cut -d" " -f1`
WRKDIR=`pwd`
@ -66,41 +62,6 @@ echo "Building $RELEASENAME.tbz2 from $RELEASENAME/"
tar jcf $RELEASENAME.tar.bz2 $RELEASENAME/
rm $RELEASENAME-working.tar.gz
rm -rf $RELEASENAME
PUBLISH="yes"
ok="0"
if [ "x$AUTOMATIC" != "xyes" ]; then
echo
echo "Would you like to publish these releases now?"
while [ $ok -eq 0 ]; do
echo -n "[$PUBLISH] "
read INPUT
case $INPUT in
[Yy]*)
PUBLISH="yes"
ok=1
;;
[Nn]*)
PUBLISH="no"
ok=1
;;
esac
done
fi
if [ "x$PUBLISH" = "xyes" ]; then
scp $RELEASENAME.tgz hg.atheme.org:/srv/distfiles
scp $RELEASENAME.tbz2 hg.atheme.org:/srv/distfiles
echo
echo "The releases have been published, and will be available to the entire"
echo "distribution network within 15 minutes."
fi
echo
echo "Done. If you have any bugs to report, report them against"
echo "the distfiles.atheme.org component at http://jira.atheme.org"
echo "Thanks!"
echo
echo "Done. $RELEASENAME.tar.gz and $RELEASENAME.tar.bz2 built."

View file

@ -3,56 +3,36 @@ mkpasswd.c documentation
This is documentation for the updated mkpasswd.c included with a number
of ircd, irc services, and non-IRC related programs
This version of mkpasswd can create DES, Extended DES, Blowfish, and MD5
This version of mkpasswd can create Blowfish, MD5, SHA256, and SHA512 crypted
passwords, with either randomly generated or user provided salts.
Options:
-x Generate a SHA256 password
-y Generate a SHA512 password
-m Generate an MD5 password
-d Generate a DES password
-b Generate a Blowfish password
-e Generate an Extended (BSDi) DES password
-l Specify a length for a random MD5 or Blowfish salt
-r Specify a number of rounds for a Blowfish or Extended DES password
Blowfish: no more than 6 recommended, no less than 4 accepted
Extended DES: default of 25
-s Specify a salt, 2 alphanumeric characters for DES, up to 16 for MD5,
up to 22 for Blowfish, 2 for Extended DES
-r Specify a number of rounds for a Blowfish password
Default 4, no more than 6 recommended
-s Specify a salt, up to 16 for MD5, SHA256, and SHA512
up to 22 for Blowfish
-p Specify a plaintext password to use
-? Get brief help
-h Get extended help
Without the presence of any parameters, it'll behave like the old mkpasswd,
creating a DES password with a randomly generated salt and prompting for
the password (without echo).
Without the presence of any parameters, it'll generate a SHA512 hash with a
randomly generated salt and prompting for the password (without echo).
A DES salt is a pair of alphanumeric characters ('.' and '/' are permitted
as well), such as 'a4' or 'Td'.
An MD5 salt consists of up to 16 (though most implementations limit you to
8) alphanumeric characters (plus '.' and '/'),
such as 'tGd' or 'J6d4dfG'.
An MD5, SHA256, and SHA512 salt consists of up to 16 alphanumeric characters
(plus '.' and '/'), such as 'tGd' or 'J6d4dfG'.
A Blowfish salt consists of up to 22 alphanumeric characters (plus '.' and
'/'). Blowfish also specifies a number of rounds*, by default 4.
Known bugs:
The encryption algorithms supported depend on your system's crypt()
implementation.
The maximum length of an MD5 salt is limited to your systems crypt()
implementation, typically 8.
Blowfish may not always be available, but MD5, SHA256, and SHA512 are
guaranteed to be.
Supported Platforms (Known and tested):
Linux glibc (DES and MD5)
FreeBSD 3.x (DES (MD5 maybe))
FreeBSD 4.x (DES, MD5, Blowfish, Extended DES)
Solaris 2.5-2.6 (DES only)
Cygwin 1.1.4 (DES only)
Prior Cygwin with the MD5 libcrypt (MD5 only)
OpenBSD 2.7 (don't link with -lcrypt) (DES, MD5, Blowfish)
Mac OS-X (Darwin) (don't link with -lcrypt) (DES only)
This program should work anywhere Charybdis does; if you find otherwise, file
a bug.
An MMK build script is included, as well as an MD5 crypt() implementation
Other systems probably work, but they haven't been amply tested.
* Blowfish's rounds parameter is a logarithm, not an integer value
* Blowfish's rounds parameter is a logarithm, not an integer value

Some files were not shown because too many files have changed in this diff Show more