0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-12-26 15:33:54 +01:00

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 f438bd836a
commit f7e2c5b340
20 changed files with 620 additions and 648 deletions

View file

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

View file

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

View file

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

View file

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

View file

@ -23,7 +23,7 @@
struct DNSReply
{
char *h_name;
struct irc_sockaddr_storage addr;
struct rb_sockaddr_storage addr;
};
struct DNSQuery
@ -32,14 +32,14 @@ struct DNSQuery
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 void init_resolver(void);
extern void restart_resolver(void);
extern void delete_resolver_queries(const struct DNSQuery *);
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 report_dns_servers(struct Client *);

View file

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

View file

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

View file

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

View file

@ -695,7 +695,7 @@ remove_temp_gline(const char *user, const char *host)
{
struct ConfItem *aconf;
rb_dlink_node *ptr;
struct irc_sockaddr_storage addr, caddr;
struct rb_sockaddr_storage addr, caddr;
int bits, cbits;
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)
{
const char *reason, *p;
struct irc_sockaddr_storage iphost, *piphost;
struct rb_sockaddr_storage iphost, *piphost;
struct ConfItem *aconf;
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 *resv_p;
struct irc_sockaddr_storage ip;
struct rb_sockaddr_storage ip;
char user_trunc[USERLEN + 1], notildeuser_trunc[USERLEN + 1];
const char *name = 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);
/* 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.
* Output: An integer describing whether it is an IPV4, IPV6 address or a
* 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 *ptr;
struct irc_sockaddr_storage *addr, xaddr;
struct rb_sockaddr_storage *addr, xaddr;
int *b, xb;
if(nb == NULL)
b = &xb;
@ -59,9 +59,9 @@ parse_netmask(const char *text, struct sockaddr *naddr, int *nb)
b = nb;
if(naddr == NULL)
addr = (struct irc_sockaddr_storage *)&xaddr;
addr = (struct rb_sockaddr_storage *)&xaddr;
else
addr = (struct irc_sockaddr_storage *)naddr;
addr = (struct rb_sockaddr_storage *)naddr;
#ifdef IPV6
if(strchr(ip, ':'))
@ -109,7 +109,7 @@ init_host_hash(void)
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.
* Output: A hash value of the IP address.
* Side effects: None
@ -128,7 +128,7 @@ hash_ipv4(struct sockaddr *saddr, int bits)
return 0;
}
/* unsigned long hash_ipv6(struct irc_sockaddr_storage*)
/* unsigned long hash_ipv6(struct rb_sockaddr_storage*)
* Input: An IP address.
* Output: A hash value of the IP address.
* Side effects: None
@ -196,7 +196,7 @@ get_mask_hash(const char *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)
* Input: The hostname, the address, the type of mask to find, the address
* 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 irc_sockaddr_storage*, int);
* struct rb_sockaddr_storage*, int);
* Input: The hostname, username, address, address family.
* Output: The applicable ConfItem.
* Side-effects: None
@ -416,7 +416,7 @@ find_address_conf(const char *host, const char *sockhost, const char *user,
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.
* Output: The best matching D-line or exempt line.
* Side effects: None.
@ -442,7 +442,7 @@ find_exact_conf_by_address(const char *address, int type, const char *username)
int masktype, bits;
unsigned long hv;
struct AddressRec *arec;
struct irc_sockaddr_storage addr;
struct rb_sockaddr_storage addr;
if(address == NULL)
address = "/NOMATCH!/";
@ -548,7 +548,7 @@ delete_one_address_conf(const char *address, struct ConfItem *aconf)
int masktype, bits;
unsigned long hv;
struct AddressRec *arec, *arecl = NULL;
struct irc_sockaddr_storage addr;
struct rb_sockaddr_storage addr;
masktype = parse_netmask(address, (struct sockaddr *)&addr, &bits);
#ifdef 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_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;
}
#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_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;
}
#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)
{
struct irc_sockaddr_storage ipaddr, maskaddr;
struct rb_sockaddr_storage ipaddr, maskaddr;
char mask[BUFSIZE];
char address[HOSTLEN + 1];
char *len;
@ -380,7 +380,7 @@ int match_ips(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 address[NICKLEN + USERLEN + HOSTLEN + 6];
char *ipmask;

View file

@ -79,7 +79,7 @@ struct reslist
char resend; /* send flag. 0 == dont resend */
time_t sentat;
time_t timeout;
struct irc_sockaddr_storage addr;
struct rb_sockaddr_storage addr;
char *name;
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 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_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);
static void query_name(struct reslist *request);
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 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 char irc_domain[HOSTLEN + 1];
@ -116,7 +116,7 @@ extern char irc_domain[HOSTLEN + 1];
* paul vixie, 29may94
* 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
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++)
{
const struct irc_sockaddr_storage *srv = &irc_nsaddr_list[ns];
const struct rb_sockaddr_storage *srv = &irc_nsaddr_list[ns];
#ifdef IPV6
v6 = (struct sockaddr_in6 *)srv;
#endif
@ -392,7 +392,7 @@ void gethost_byname_type(const char *name, struct DNSQuery *query, int type)
/*
* 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);
}
@ -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.
*/
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)
{
const unsigned char *cp;
@ -432,7 +432,7 @@ static void do_query_number(struct DNSQuery *query, const struct irc_sockaddr_st
if (request == NULL)
{
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);
}
@ -734,8 +734,8 @@ static void res_readreply(int fd, void *data)
struct DNSReply *reply = NULL;
int rc;
int answer_count;
socklen_t len = sizeof(struct irc_sockaddr_storage);
struct irc_sockaddr_storage lsin;
socklen_t len = sizeof(struct rb_sockaddr_storage);
struct rb_sockaddr_storage lsin;
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 $ */
/* 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;
char irc_domain[HOSTLEN + 1];

View file

@ -265,8 +265,8 @@ auth_error(struct AuthRequest *auth)
static int
start_auth_query(struct AuthRequest *auth)
{
struct irc_sockaddr_storage localaddr;
socklen_t locallen = sizeof(struct irc_sockaddr_storage);
struct rb_sockaddr_storage localaddr;
socklen_t locallen = sizeof(struct rb_sockaddr_storage);
int fd;
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)
{
struct oper_conf *oper_p;
struct irc_sockaddr_storage ip, cip;
struct rb_sockaddr_storage ip, cip;
char addr[HOSTLEN+1];
int bits, cbits;
rb_dlink_node *ptr;

View file

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