Trying again - this will need ssld integration from me

This commit is contained in:
Valery Yatsko 2008-04-02 13:32:14 +04:00
parent 55eeaea101
commit 79edef0918
20 changed files with 620 additions and 648 deletions

View File

@ -233,7 +233,7 @@ struct LocalUser
conf_item_t *att_conf; /* attached conf */ conf_item_t *att_conf; /* attached conf */
struct server_conf *att_sconf; struct server_conf *att_sconf;
struct irc_sockaddr_storage ip; struct rb_sockaddr_storage ip;
time_t last_nick_change; time_t last_nick_change;
int number_of_nick_changes; int number_of_nick_changes;

View File

@ -85,7 +85,7 @@ struct AddressRec
struct struct
{ {
/* Pointer into ConfItem... -A1kmm */ /* Pointer into ConfItem... -A1kmm */
struct irc_sockaddr_storage addr; struct rb_sockaddr_storage addr;
int bits; int bits;
} }
ipa; ipa;

View File

@ -154,9 +154,9 @@
#ifdef IPV6 #ifdef IPV6
#define irc_sockaddr_storage sockaddr_storage #define rb_sockaddr_storage sockaddr_storage
#else #else
#define irc_sockaddr_storage sockaddr #define rb_sockaddr_storage sockaddr
#define ss_family sa_family #define ss_family sa_family
#ifdef SOCKADDR_IN_HAS_LEN #ifdef SOCKADDR_IN_HAS_LEN
#define ss_len sa_len #define ss_len sa_len

View File

@ -27,28 +27,25 @@
#ifndef INCLUDED_listener_h #ifndef INCLUDED_listener_h
#define INCLUDED_listener_h #define INCLUDED_listener_h
#include "ircd_defs.h" struct Client;
struct Client; struct Listener
{
struct Listener rb_dlink_node node;
{ const char *name; /* listener name */
struct Listener *next; /* list node pointer */ rb_fde_t *F; /* file descriptor */
const char *name; /* listener name */ int ref_count; /* number of connection references */
int fd; /* file descriptor */ int active; /* current state of listener */
int ref_count; /* number of connection references */ int ssl; /* ssl listener */
int active; /* current state of listener */ struct rb_sockaddr_storage addr;
int index; /* index into poll array */ char vhost[HOSTLEN + 1]; /* virtual name of listener */
struct irc_sockaddr_storage addr; };
struct DNSQuery *dns_query;
char vhost[HOSTLEN + 1]; /* virtual name of listener */ void add_listener(int port, const char *vaddr_ip, int family, int ssl);
}; void close_listener(struct Listener *listener);
void close_listeners(void);
extern void add_listener(int port, const char *vaddr_ip, int family); const char *get_listener_name(struct Listener *listener);
extern void close_listener(struct Listener *listener); void show_ports(struct Client *client);
extern void close_listeners(void); void free_listener(struct Listener *);
extern const char *get_listener_name(const struct Listener *listener);
extern void show_ports(struct Client *client);
extern void free_listener(struct Listener *);
#endif /* INCLUDED_listener_h */ #endif /* INCLUDED_listener_h */

View File

@ -23,7 +23,7 @@
struct DNSReply struct DNSReply
{ {
char *h_name; char *h_name;
struct irc_sockaddr_storage addr; struct rb_sockaddr_storage addr;
}; };
struct DNSQuery struct DNSQuery
@ -32,14 +32,14 @@ struct DNSQuery
void (*callback)(void* vptr, struct DNSReply *reply); /* callback to call */ void (*callback)(void* vptr, struct DNSReply *reply); /* callback to call */
}; };
extern struct irc_sockaddr_storage irc_nsaddr_list[]; extern struct rb_sockaddr_storage irc_nsaddr_list[];
extern int irc_nscount; extern int irc_nscount;
extern void init_resolver(void); extern void init_resolver(void);
extern void restart_resolver(void); extern void restart_resolver(void);
extern void delete_resolver_queries(const struct DNSQuery *); extern void delete_resolver_queries(const struct DNSQuery *);
extern void gethost_byname_type(const char *, struct DNSQuery *, int); extern void gethost_byname_type(const char *, struct DNSQuery *, int);
extern void gethost_byaddr(const struct irc_sockaddr_storage *, struct DNSQuery *); extern void gethost_byaddr(const struct rb_sockaddr_storage *, struct DNSQuery *);
extern void add_local_domain(char *, size_t); extern void add_local_domain(char *, size_t);
extern void report_dns_servers(struct Client *); extern void report_dns_servers(struct Client *);

View File

@ -46,7 +46,7 @@ struct hostent;
struct ip_value struct ip_value
{ {
struct irc_sockaddr_storage ip; struct rb_sockaddr_storage ip;
int ip_mask; int ip_mask;
int type; int type;
}; };

View File

@ -203,7 +203,7 @@ struct server_conf
time_t hold; time_t hold;
int aftype; int aftype;
struct irc_sockaddr_storage my_ipnum; struct rb_sockaddr_storage my_ipnum;
char *class_name; char *class_name;
struct Class *class; struct Class *class;

View File

@ -76,7 +76,7 @@ mo_dline(struct Client *client_p, struct Client *source_p,
const char *dlhost; const char *dlhost;
char *oper_reason; char *oper_reason;
char *reason = def; char *reason = def;
struct irc_sockaddr_storage daddr; struct rb_sockaddr_storage daddr;
char cidr_form_host[HOSTLEN + 1]; char cidr_form_host[HOSTLEN + 1];
struct ConfItem *aconf; struct ConfItem *aconf;
int bits; int bits;

View File

@ -695,7 +695,7 @@ remove_temp_gline(const char *user, const char *host)
{ {
struct ConfItem *aconf; struct ConfItem *aconf;
rb_dlink_node *ptr; rb_dlink_node *ptr;
struct irc_sockaddr_storage addr, caddr; struct rb_sockaddr_storage addr, caddr;
int bits, cbits; int bits, cbits;
int mtype, gtype; int mtype, gtype;

View File

@ -691,7 +691,7 @@ static int
already_placed_kline(struct Client *source_p, const char *luser, const char *lhost, int tkline) already_placed_kline(struct Client *source_p, const char *luser, const char *lhost, int tkline)
{ {
const char *reason, *p; const char *reason, *p;
struct irc_sockaddr_storage iphost, *piphost; struct rb_sockaddr_storage iphost, *piphost;
struct ConfItem *aconf; struct ConfItem *aconf;
int t, bits; int t, bits;

View File

@ -61,7 +61,7 @@ mo_testline(struct Client *client_p, struct Client *source_p, int parc, const ch
{ {
struct ConfItem *aconf; struct ConfItem *aconf;
struct ConfItem *resv_p; struct ConfItem *resv_p;
struct irc_sockaddr_storage ip; struct rb_sockaddr_storage ip;
char user_trunc[USERLEN + 1], notildeuser_trunc[USERLEN + 1]; char user_trunc[USERLEN + 1], notildeuser_trunc[USERLEN + 1];
const char *name = NULL; const char *name = NULL;
const char *username = NULL; const char *username = NULL;

View File

@ -39,7 +39,7 @@ static unsigned long hash_ipv6(struct sockaddr *, int);
static unsigned long hash_ipv4(struct sockaddr *, int); static unsigned long hash_ipv4(struct sockaddr *, int);
/* int parse_netmask(const char *, struct irc_sockaddr_storage *, int *); /* int parse_netmask(const char *, struct rb_sockaddr_storage *, int *);
* Input: A hostmask, or an IPV4/6 address. * Input: A hostmask, or an IPV4/6 address.
* Output: An integer describing whether it is an IPV4, IPV6 address or a * Output: An integer describing whether it is an IPV4, IPV6 address or a
* hostmask, an address(if it is an IP mask), * hostmask, an address(if it is an IP mask),
@ -51,7 +51,7 @@ parse_netmask(const char *text, struct sockaddr *naddr, int *nb)
{ {
char *ip = LOCAL_COPY(text); char *ip = LOCAL_COPY(text);
char *ptr; char *ptr;
struct irc_sockaddr_storage *addr, xaddr; struct rb_sockaddr_storage *addr, xaddr;
int *b, xb; int *b, xb;
if(nb == NULL) if(nb == NULL)
b = &xb; b = &xb;
@ -59,9 +59,9 @@ parse_netmask(const char *text, struct sockaddr *naddr, int *nb)
b = nb; b = nb;
if(naddr == NULL) if(naddr == NULL)
addr = (struct irc_sockaddr_storage *)&xaddr; addr = (struct rb_sockaddr_storage *)&xaddr;
else else
addr = (struct irc_sockaddr_storage *)naddr; addr = (struct rb_sockaddr_storage *)naddr;
#ifdef IPV6 #ifdef IPV6
if(strchr(ip, ':')) if(strchr(ip, ':'))
@ -109,7 +109,7 @@ init_host_hash(void)
memset(&atable, 0, sizeof(atable)); memset(&atable, 0, sizeof(atable));
} }
/* unsigned long hash_ipv4(struct irc_sockaddr_storage*) /* unsigned long hash_ipv4(struct rb_sockaddr_storage*)
* Input: An IP address. * Input: An IP address.
* Output: A hash value of the IP address. * Output: A hash value of the IP address.
* Side effects: None * Side effects: None
@ -128,7 +128,7 @@ hash_ipv4(struct sockaddr *saddr, int bits)
return 0; return 0;
} }
/* unsigned long hash_ipv6(struct irc_sockaddr_storage*) /* unsigned long hash_ipv6(struct rb_sockaddr_storage*)
* Input: An IP address. * Input: An IP address.
* Output: A hash value of the IP address. * Output: A hash value of the IP address.
* Side effects: None * Side effects: None
@ -196,7 +196,7 @@ get_mask_hash(const char *text)
return hash_text(text); return hash_text(text);
} }
/* struct ConfItem* find_conf_by_address(const char*, struct irc_sockaddr_storage*, /* struct ConfItem* find_conf_by_address(const char*, struct rb_sockaddr_storage*,
* int type, int fam, const char *username) * int type, int fam, const char *username)
* Input: The hostname, the address, the type of mask to find, the address * Input: The hostname, the address, the type of mask to find, the address
* family, the username. * family, the username.
@ -343,7 +343,7 @@ find_conf_by_address(const char *name, const char *sockhost,
} }
/* struct ConfItem* find_address_conf(const char*, const char*, /* struct ConfItem* find_address_conf(const char*, const char*,
* struct irc_sockaddr_storage*, int); * struct rb_sockaddr_storage*, int);
* Input: The hostname, username, address, address family. * Input: The hostname, username, address, address family.
* Output: The applicable ConfItem. * Output: The applicable ConfItem.
* Side-effects: None * Side-effects: None
@ -416,7 +416,7 @@ find_address_conf(const char *host, const char *sockhost, const char *user,
return iconf; return iconf;
} }
/* struct ConfItem* find_dline(struct irc_sockaddr_storage*, int) /* struct ConfItem* find_dline(struct rb_sockaddr_storage*, int)
* Input: An address, an address family. * Input: An address, an address family.
* Output: The best matching D-line or exempt line. * Output: The best matching D-line or exempt line.
* Side effects: None. * Side effects: None.
@ -442,7 +442,7 @@ find_exact_conf_by_address(const char *address, int type, const char *username)
int masktype, bits; int masktype, bits;
unsigned long hv; unsigned long hv;
struct AddressRec *arec; struct AddressRec *arec;
struct irc_sockaddr_storage addr; struct rb_sockaddr_storage addr;
if(address == NULL) if(address == NULL)
address = "/NOMATCH!/"; address = "/NOMATCH!/";
@ -548,7 +548,7 @@ delete_one_address_conf(const char *address, struct ConfItem *aconf)
int masktype, bits; int masktype, bits;
unsigned long hv; unsigned long hv;
struct AddressRec *arec, *arecl = NULL; struct AddressRec *arec, *arecl = NULL;
struct irc_sockaddr_storage addr; struct rb_sockaddr_storage addr;
masktype = parse_netmask(address, (struct sockaddr *)&addr, &bits); masktype = parse_netmask(address, (struct sockaddr *)&addr, &bits);
#ifdef IPV6 #ifdef IPV6
if(masktype == HM_IPV6) if(masktype == HM_IPV6)

View File

@ -539,7 +539,7 @@ inetpton_sock(const char *src, struct sockaddr *dst)
{ {
((struct sockaddr_in *) dst)->sin_port = 0; ((struct sockaddr_in *) dst)->sin_port = 0;
((struct sockaddr_in *) dst)->sin_family = AF_INET; ((struct sockaddr_in *) dst)->sin_family = AF_INET;
SET_SS_LEN((struct irc_sockaddr_storage *) dst, sizeof(struct sockaddr_in)); SET_SS_LEN((struct rb_sockaddr_storage *) dst, sizeof(struct sockaddr_in));
return 1; return 1;
} }
#ifdef IPV6 #ifdef IPV6
@ -547,7 +547,7 @@ inetpton_sock(const char *src, struct sockaddr *dst)
{ {
((struct sockaddr_in6 *) dst)->sin6_port = 0; ((struct sockaddr_in6 *) dst)->sin6_port = 0;
((struct sockaddr_in6 *) dst)->sin6_family = AF_INET6; ((struct sockaddr_in6 *) dst)->sin6_family = AF_INET6;
SET_SS_LEN((struct irc_sockaddr_storage *) dst, sizeof(struct sockaddr_in6)); SET_SS_LEN((struct rb_sockaddr_storage *) dst, sizeof(struct sockaddr_in6));
return 1; return 1;
} }
#endif #endif

File diff suppressed because it is too large Load Diff

View File

@ -326,7 +326,7 @@ int comp_with_mask_sock(struct sockaddr *addr, struct sockaddr *dest, u_int mask
*/ */
int match_ips(const char *s1, const char *s2) int match_ips(const char *s1, const char *s2)
{ {
struct irc_sockaddr_storage ipaddr, maskaddr; struct rb_sockaddr_storage ipaddr, maskaddr;
char mask[BUFSIZE]; char mask[BUFSIZE];
char address[HOSTLEN + 1]; char address[HOSTLEN + 1];
char *len; char *len;
@ -380,7 +380,7 @@ int match_ips(const char *s1, const char *s2)
int match_cidr(const char *s1, const char *s2) int match_cidr(const char *s1, const char *s2)
{ {
struct irc_sockaddr_storage ipaddr, maskaddr; struct rb_sockaddr_storage ipaddr, maskaddr;
char mask[BUFSIZE]; char mask[BUFSIZE];
char address[NICKLEN + USERLEN + HOSTLEN + 6]; char address[NICKLEN + USERLEN + HOSTLEN + 6];
char *ipmask; char *ipmask;

View File

@ -79,7 +79,7 @@ struct reslist
char resend; /* send flag. 0 == dont resend */ char resend; /* send flag. 0 == dont resend */
time_t sentat; time_t sentat;
time_t timeout; time_t timeout;
struct irc_sockaddr_storage addr; struct rb_sockaddr_storage addr;
char *name; char *name;
struct DNSQuery *query; /* query callback for this request */ struct DNSQuery *query; /* query callback for this request */
}; };
@ -90,7 +90,7 @@ static rb_dlink_list request_list = { NULL, NULL, 0 };
static void rem_request(struct reslist *request); static void rem_request(struct reslist *request);
static struct reslist *make_request(struct DNSQuery *query); static struct reslist *make_request(struct DNSQuery *query);
static void do_query_name(struct DNSQuery *query, const char *name, struct reslist *request, int); static void do_query_name(struct DNSQuery *query, const char *name, struct reslist *request, int);
static void do_query_number(struct DNSQuery *query, const struct irc_sockaddr_storage *, static void do_query_number(struct DNSQuery *query, const struct rb_sockaddr_storage *,
struct reslist *request); struct reslist *request);
static void query_name(struct reslist *request); static void query_name(struct reslist *request);
static int send_res_msg(const char *buf, int len, int count); static int send_res_msg(const char *buf, int len, int count);
@ -100,7 +100,7 @@ static int proc_answer(struct reslist *request, HEADER * header, char *, char *)
static struct reslist *find_id(int id); static struct reslist *find_id(int id);
static struct DNSReply *make_dnsreply(struct reslist *request); static struct DNSReply *make_dnsreply(struct reslist *request);
extern struct irc_sockaddr_storage irc_nsaddr_list[IRCD_MAXNS]; extern struct rb_sockaddr_storage irc_nsaddr_list[IRCD_MAXNS];
extern int irc_nscount; extern int irc_nscount;
extern char irc_domain[HOSTLEN + 1]; extern char irc_domain[HOSTLEN + 1];
@ -116,7 +116,7 @@ extern char irc_domain[HOSTLEN + 1];
* paul vixie, 29may94 * paul vixie, 29may94
* revised for ircd, cryogen(stu) may03 * revised for ircd, cryogen(stu) may03
*/ */
static int res_ourserver(const struct irc_sockaddr_storage *inp) static int res_ourserver(const struct rb_sockaddr_storage *inp)
{ {
#ifdef IPV6 #ifdef IPV6
struct sockaddr_in6 *v6; struct sockaddr_in6 *v6;
@ -128,7 +128,7 @@ static int res_ourserver(const struct irc_sockaddr_storage *inp)
for (ns = 0; ns < irc_nscount; ns++) for (ns = 0; ns < irc_nscount; ns++)
{ {
const struct irc_sockaddr_storage *srv = &irc_nsaddr_list[ns]; const struct rb_sockaddr_storage *srv = &irc_nsaddr_list[ns];
#ifdef IPV6 #ifdef IPV6
v6 = (struct sockaddr_in6 *)srv; v6 = (struct sockaddr_in6 *)srv;
#endif #endif
@ -392,7 +392,7 @@ void gethost_byname_type(const char *name, struct DNSQuery *query, int type)
/* /*
* gethost_byaddr - get host name from address * gethost_byaddr - get host name from address
*/ */
void gethost_byaddr(const struct irc_sockaddr_storage *addr, struct DNSQuery *query) void gethost_byaddr(const struct rb_sockaddr_storage *addr, struct DNSQuery *query)
{ {
do_query_number(query, addr, NULL); do_query_number(query, addr, NULL);
} }
@ -424,7 +424,7 @@ static void do_query_name(struct DNSQuery *query, const char *name, struct resli
/* /*
* do_query_number - Use this to do reverse IP# lookups. * do_query_number - Use this to do reverse IP# lookups.
*/ */
static void do_query_number(struct DNSQuery *query, const struct irc_sockaddr_storage *addr, static void do_query_number(struct DNSQuery *query, const struct rb_sockaddr_storage *addr,
struct reslist *request) struct reslist *request)
{ {
const unsigned char *cp; const unsigned char *cp;
@ -432,7 +432,7 @@ static void do_query_number(struct DNSQuery *query, const struct irc_sockaddr_st
if (request == NULL) if (request == NULL)
{ {
request = make_request(query); request = make_request(query);
memcpy(&request->addr, addr, sizeof(struct irc_sockaddr_storage)); memcpy(&request->addr, addr, sizeof(struct rb_sockaddr_storage));
request->name = (char *)rb_malloc(HOSTLEN + 1); request->name = (char *)rb_malloc(HOSTLEN + 1);
} }
@ -734,8 +734,8 @@ static void res_readreply(int fd, void *data)
struct DNSReply *reply = NULL; struct DNSReply *reply = NULL;
int rc; int rc;
int answer_count; int answer_count;
socklen_t len = sizeof(struct irc_sockaddr_storage); socklen_t len = sizeof(struct rb_sockaddr_storage);
struct irc_sockaddr_storage lsin; struct rb_sockaddr_storage lsin;
rc = recvfrom(fd, buf, sizeof(buf), 0, (struct sockaddr *)&lsin, &len); rc = recvfrom(fd, buf, sizeof(buf), 0, (struct sockaddr *)&lsin, &len);

View File

@ -96,7 +96,7 @@
/* $Id: reslib.c 1695 2006-06-27 15:11:23Z jilles $ */ /* $Id: reslib.c 1695 2006-06-27 15:11:23Z jilles $ */
/* from Hybrid Id: reslib.c 177 2005-10-22 09:05:05Z michael $ */ /* from Hybrid Id: reslib.c 177 2005-10-22 09:05:05Z michael $ */
struct irc_sockaddr_storage irc_nsaddr_list[IRCD_MAXNS]; struct rb_sockaddr_storage irc_nsaddr_list[IRCD_MAXNS];
int irc_nscount = 0; int irc_nscount = 0;
char irc_domain[HOSTLEN + 1]; char irc_domain[HOSTLEN + 1];

View File

@ -265,8 +265,8 @@ auth_error(struct AuthRequest *auth)
static int static int
start_auth_query(struct AuthRequest *auth) start_auth_query(struct AuthRequest *auth)
{ {
struct irc_sockaddr_storage localaddr; struct rb_sockaddr_storage localaddr;
socklen_t locallen = sizeof(struct irc_sockaddr_storage); socklen_t locallen = sizeof(struct rb_sockaddr_storage);
int fd; int fd;
int family; int family;

View File

@ -284,7 +284,7 @@ struct oper_conf *
find_oper_conf(const char *username, const char *host, const char *locip, const char *name) find_oper_conf(const char *username, const char *host, const char *locip, const char *name)
{ {
struct oper_conf *oper_p; struct oper_conf *oper_p;
struct irc_sockaddr_storage ip, cip; struct rb_sockaddr_storage ip, cip;
char addr[HOSTLEN+1]; char addr[HOSTLEN+1];
int bits, cbits; int bits, cbits;
rb_dlink_node *ptr; rb_dlink_node *ptr;

View File

@ -1469,7 +1469,7 @@ int
serv_connect(struct server_conf *server_p, struct Client *by) serv_connect(struct server_conf *server_p, struct Client *by)
{ {
struct Client *client_p; struct Client *client_p;
struct irc_sockaddr_storage myipnum; struct rb_sockaddr_storage myipnum;
int fd; int fd;
char vhoststr[HOSTIPLEN]; char vhoststr[HOSTIPLEN];