Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 0 additions & 16 deletions common/os.h
Original file line number Diff line number Diff line change
Expand Up @@ -673,8 +673,6 @@ extern int h_errno;
* IPv4 or IPv6 structures?
*/

#ifdef INET6

# define AND16(x) ((x)[0]&(x)[1]&(x)[2]&(x)[3]&(x)[4]&(x)[5]&(x)[6]&(x)[7]&(x)[8]&(x)[9]&(x)[10]&(x)[11]&(x)[12]&(x)[13]&(x)[14]&(x)[15])
extern unsigned char minus_one[];
# define WHOSTENTP(x) ((x)[0]|(x)[1]|(x)[2]|(x)[3]|(x)[4]|(x)[5]|(x)[6]|(x)[7]|(x)[8]|(x)[9]|(x)[10]|(x)[11]|(x)[12]|(x)[13]|(x)[14]|(x)[15])
Expand All @@ -692,20 +690,6 @@ extern unsigned char minus_one[];
#define INET6_ADDRSTRLEN 46
#endif

#else /* INET6 */

# define AFINET AF_INET
# define SOCKADDR_IN sockaddr_in
# define SOCKADDR sockaddr
# define SIN_FAMILY sin_family
# define SIN_PORT sin_port
# define SIN_ADDR sin_addr
# define S_ADDR s_addr
# define IN_ADDR in_addr

# define WHOSTENTP(x) (x)
#endif

/* Courtesy of AC_CHECK_TYPES autoconf macro in configure */
#if !defined(HAVE_INT16_T)
typedef short int16_t;
Expand Down
4 changes: 0 additions & 4 deletions common/send.c
Original file line number Diff line number Diff line change
Expand Up @@ -1361,11 +1361,7 @@ void sendto_flog(aClient *cptr, char msg, char *username, char *hostname)
cptr->auth ? cptr->auth : "?",
/* client IP */
cptr->user ? cptr->user->sip :
#ifdef INET6
inetntop(AF_INET6, (char *)&cptr->ip, ipv6string, sizeof(ipv6string)),
#else
inetntoa((char *)&cptr->ip),
#endif
/* client (remote) port */
cptr->port,
/* server sockhost (IP plus port or unix socket path) */
Expand Down
2 changes: 1 addition & 1 deletion common/struct_def.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ typedef struct LineItem aExtData;
#define HOSTLEN 63 /* Length of hostname. Updated to */
/* comply with RFC1123 */

#if defined(INET6) && (INET6_ADDRSTRLEN > HOSTLEN)
#if (INET6_ADDRSTRLEN > HOSTLEN)
#error HOSTLEN must not be smaller than INET6_ADDRSTRLEN
#endif

Expand Down
4 changes: 0 additions & 4 deletions common/support.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,7 @@ static const volatile char rcsid[] = "@(#)$Id: support.c,v 1.46 2009/03/15 01:25
#include "s_externs.h"
#undef SUPPORT_C

#ifdef INET6
char ipv6string[INET6_ADDRSTRLEN];
#endif

unsigned char minus_one[]={ 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 0};
Expand Down Expand Up @@ -217,7 +215,6 @@ char *mybasename(char *path)
return path;
}

#ifdef INET6
/*
* inetntop: return the : notation of a given IPv6 internet number.
* or the dotted-decimal notation for IPv4
Expand Down Expand Up @@ -322,7 +319,6 @@ int inetpton(int af, const char *src, void *dst)
}
return inet_pton(af, src, dst);
}
#endif

#if !defined(HAVE_INET_NTOA)
/*
Expand Down
4 changes: 0 additions & 4 deletions common/support_ext.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,7 @@
#else /* SUPPORT_C */
#define EXTERN
#endif /* SUPPORT_C */
#ifdef INET6
EXTERN char ipv6string[INET6_ADDRSTRLEN];
#endif
EXTERN char *mystrdup (char *s);
#if !defined(HAVE_STRTOKEN)
EXTERN char *strtoken (char **save, char *str, char *fs);
Expand All @@ -48,10 +46,8 @@ EXTERN char *strerror (int err_no);
#endif /* HAVE_STRERROR */
EXTERN char *myctime (time_t value);
EXTERN char *mybasename (char *);
#ifdef INET6
EXTERN char *inetntop(int af, const void *in, char *local_dummy, size_t the_size);
EXTERN int inetpton(int af, const char *src, void *dst);
#endif
#if !defined(HAVE_INET_NTOA)
EXTERN char *inetntoa (char *in);
#endif /* HAVE_INET_NTOA */
Expand Down
3 changes: 0 additions & 3 deletions doc/INSTALL.info
Original file line number Diff line number Diff line change
Expand Up @@ -97,9 +97,6 @@ default behaviour:
tells "configure" not to look for the zlib. Defining this will
keep you from using server link compression.

`--enable-ip6'
Enable IPv6 support (See notes below)

`--enable-dsm'
Enable Dynamically Shared Modules support for iauth

Expand Down
1 change: 0 additions & 1 deletion doc/INSTALL.sgml
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ it. This does NOT mean you can use server link compression,
for this you also need to define ZIP_LINKS (see section below).
<tag/--without-zlib/ tells ``configure'' not to look for the zlib.
Defining this will keep you from using server link compression.
<tag/--enable-ip6/ Enable IPv6 support (See notes below)
<tag/--enable-dsm/ Enable Dynamically Shared Modules support for iauth
</descrip>

Expand Down
12 changes: 0 additions & 12 deletions doc/iauth.conf.5
Original file line number Diff line number Diff line change
Expand Up @@ -134,11 +134,6 @@ This module is for authentication TCP connections using the protocol
defined in RFC 1413 (which obsoletes RFC 931). It is always loaded, and
does not recognize the \fIhost\fP nor \fIip\fP fields.
.TP
.B lhex
This module acts as a proxy, communicating with a LHEx server to perform
authentication of client connections. It takes a single (mandatory)
option, which is the IP-address of the LHEx server to use.
.TP
.B webproxy
This module performs a basic HTTP CONNECT to verify that the host where the
connection originated from doesn't run an open WWW proxy.
Expand Down Expand Up @@ -181,18 +176,11 @@ originating from a system where an open proxy is running for hosts within
*.fr and *.enserb.u-bordeaux.fr but not for other hosts matching
*.u-bordeaux.fr. For all connections, an ident lookup (RFC 1413) will be
performed as well as checking for WWW proxy on port 8080 and 3128.
In addition, every connection is authenticated with the LHEx
server at IP-address 127.0.0.1. Client will be let in after ident and
lhex are done but if socks or webproxy finds an open proxy, client will
be removed asap.

.RS
.nf
module rfc931

module lhex
option = 127.0.0.1

delayed

module socks
Expand Down
113 changes: 59 additions & 54 deletions iauth/a_conf.c
Original file line number Diff line number Diff line change
Expand Up @@ -48,19 +48,62 @@ static void conf_err(u_int nb, char *msg, char *chk)
/*
* Match address by #IP bitmask (10.11.12.128/27)
*/
static int match_ipmask(aTarget *mask, char *ipaddr)
static int match_ipmask(char *mask, char *ip)
{
#ifdef INET6
return 1;
#else
int i1, i2, i3, i4;
u_long iptested;
int m, j;
u_long lmask;
char *p, dummy[128];
struct IN_ADDR mask_addr, ip_addr;

if (sscanf(ipaddr, "%d.%d.%d.%d", &i1, &i2, &i3, &i4) != 4)
if (inetpton(AF_INET6, ip, (void *) ip_addr.s6_addr) != 1)
return -1;
iptested = htonl(i1 * 0x1000000 + i2 * 0x10000 + i3 * 0x100 + i4);
return ((iptested & mask->lmask) == mask->baseip) ? 0 : 1;
#endif

strncpyzt(dummy, mask, sizeof(dummy));
mask = dummy;

if (!(p = index(mask, '/')))
return -1;

*p = '\0';

if (sscanf(p + 1, "%d", &m) != 1)
return -1;

if (!m)
return 0; /* x.x.x.x/0 always matches */

if (m < 0 || m > 128)
return -1;

if (inetpton(AF_INET6, mask, (void *) mask_addr.s6_addr) != 1)
return -1;

/* Make sure that the ipv4 notation still works. */
if (IN6_IS_ADDR_V4MAPPED(&mask_addr))
{
if (m <= 32)
m += 96;
if (m <= 96)
return -1;
}

j = m & 0x1F; /* number not multiple of 32 bits */
m >>= 5; /* number of 32 bits */

if (m && memcmp((void *) (mask_addr.s6_addr),
(void *) (ip_addr.s6_addr), m << 2))
return 1;

if (j)
{
lmask = htonl((u_long) 0xffffffffL << (32 - j));
if ((((u_int32_t *) (mask_addr.s6_addr))[m] ^
((u_int32_t *) (ip_addr.s6_addr))[m]) &
lmask)
return 1;
}

return 0;
}

/* conf_read: read the configuration file, instanciate modules */
Expand All @@ -80,7 +123,6 @@ char *conf_read(char *cfile)
Mlist[Mcnt++] = &Module_rfc931;
Mlist[Mcnt++] = &Module_socks;
Mlist[Mcnt++] = &Module_pipe;
Mlist[Mcnt++] = &Module_lhex;
Mlist[Mcnt++] = &Module_webproxy;
Mlist[Mcnt++] = &Module_dnsbl;
Mlist[Mcnt] = NULL;
Expand Down Expand Up @@ -268,7 +310,6 @@ char *conf_read(char *cfile)
while (fgets(buffer, 160, cfh))
{
aTarget **ttmp;
u_long baseip = 0, lmask = 0;
int inverse = 0;

if ((ch = index(buffer, '\n')))
Expand Down Expand Up @@ -331,40 +372,15 @@ char *conf_read(char *cfile)
}
}
else if (!strncasecmp(buffer+1, "ip = ", 5))
{
{
ttmp = &((*last)->address);
ch = buffer + 6;
if (*ch == '!')
{
inverse = 1;
ch++;
}
if (strchr(ch, '/'))
{
int i1, i2, i3, i4, m;

if (sscanf(ch,"%d.%d.%d.%d/%d",
&i1, &i2, &i3, &i4,
&m) != 5 ||
m < 1 || m > 31)
{
conf_err(lnnb,
"Bad mask.",
cfile);
continue;
}
lmask = htonl((u_long)0xffffffffL << (32 - m));
baseip = htonl(i1 * 0x1000000 +
i2 * 0x10000 +
i3 * 0x100 +
i4);
}
else
{
lmask = 0;
baseip = 0;
}
}
}
else if (!strncmp(buffer+1, "timeout = ", 10))
{
u_int local_timeout;
Expand Down Expand Up @@ -400,11 +416,6 @@ char *conf_read(char *cfile)
*ttmp = (aTarget *) malloc(sizeof(aTarget));
(*ttmp)->yes = inverse ? -1 : 0;
(*ttmp)->value = mystrdup(ch);
if ((*ttmp)->baseip)
{
(*ttmp)->lmask = lmask;
(*ttmp)->baseip = baseip;
}
(*ttmp)->nextt = NULL;
}
if ((*last)->port == 0 &&
Expand Down Expand Up @@ -586,19 +597,13 @@ int conf_match(u_int cl, AnInstance *inst)
{
while (ttmp)
{
if (ttmp->baseip)
if (match_ipmask(ttmp->value, cldata[cl].itsip) == 0)
{
if (match_ipmask(ttmp, cldata[cl].itsip) == 0)
{
return ttmp->yes;
}
return ttmp->yes;
}
else
if (match(ttmp->value, cldata[cl].itsip) == 0)
{
if (match(ttmp->value, cldata[cl].itsip) == 0)
{
return ttmp->yes;
}
return ttmp->yes;
}
ttmp = ttmp->nextt;
}
Expand Down
1 change: 0 additions & 1 deletion iauth/a_conf_def.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@ struct Instance
struct Target
{
char *value;
u_long baseip, lmask; /* a.b.c.d/z */
char yes;
aTarget *nextt;
};
4 changes: 1 addition & 3 deletions iauth/a_defines.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,7 @@
#include "dbuf_def.h" /* needed for struct_def.h, sigh */
#include "class_def.h" /* needed for struct_def.h, sigh */
#include "struct_def.h"
#ifdef INET6
# include "../ircd/nameser_def.h"
#endif
#include "../ircd/nameser_def.h"
#include "support_def.h"
#include "common_def.h" /* for isdigit, isalpha etc. */

Expand Down
1 change: 0 additions & 1 deletion iauth/a_externs.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@
#include "a_log_ext.h"

#include "mod_dnsbl_ext.h"
#include "mod_lhex_ext.h"
#include "mod_pipe_ext.h"
#include "mod_rfc931_ext.h"
#include "mod_socks_ext.h"
Expand Down
8 changes: 0 additions & 8 deletions iauth/a_io.c
Original file line number Diff line number Diff line change
Expand Up @@ -795,12 +795,8 @@ int tcp_connect(char *ourIP, char *theirIP, u_short port, char **error)
*/
bzero((char *)&sk, sizeof(sk));
sk.SIN_FAMILY = AFINET;
#if defined(INET6)
if(!inetpton(AF_INET6, ourIP, sk.sin6_addr.s6_addr))
bcopy(minus_one, sk.sin6_addr.s6_addr, IN6ADDRSZ);
#else
sk.sin_addr.s_addr = inetaddr(ourIP);
#endif
sk.SIN_PORT = htons(0);
if (bind(fd, (SAP)&sk, sizeof(sk)) < 0)
{
Expand All @@ -810,12 +806,8 @@ int tcp_connect(char *ourIP, char *theirIP, u_short port, char **error)
return -1;
}
set_non_blocking(fd, theirIP, port);
#if defined(INET6)
if(!inetpton(AF_INET6, theirIP, sk.sin6_addr.s6_addr))
bcopy(minus_one, sk.sin6_addr.s6_addr, IN6ADDRSZ);
#else
sk.sin_addr.s_addr = inetaddr(theirIP);
#endif
sk.SIN_PORT = htons(port);
if (connect(fd, (SAP)&sk, sizeof(sk)) < 0 && errno != EINPROGRESS)
{
Expand Down
7 changes: 3 additions & 4 deletions iauth/a_log_def.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@
#define ALOG_DSOCKS 0x020000 /* debug: module socks */
#define ALOG_DSOCKSC 0x040000 /* debug: module socks cache */
#define ALOG_DPIPE 0x080000 /* debug: module pipe */
#define ALOG_DLHEX 0x100000 /* debug: module pipe */
#define ALOG_DNSBL 0x200000 /* debug: module dnsbl */
#define ALOG_DNSBLC 0x400000 /* debug: module dnsbl cache */
#define ALOG_DALL 0x7F3700 /* any debug flag */
#define ALOG_DNSBL 0x100000 /* debug: module dnsbl */
#define ALOG_DNSBLC 0x200000 /* debug: module dnsbl cache */
#define ALOG_DALL 0x3f3700 /* any debug flag */
2 changes: 0 additions & 2 deletions iauth/iauth.c
Original file line number Diff line number Diff line change
Expand Up @@ -182,9 +182,7 @@ int main(int argc, char *argv[])
}
else
{
#if defined(INET6)
(void)printf("\t+INET6\n");
#endif
#if defined(IAUTH_DEBUG)
(void)printf("\t+IAUTH_DEBUG\n");
#endif
Expand Down
Loading
Loading