From f169fc88422c27c0512aeaebfa216b81022d3c11 Mon Sep 17 00:00:00 2001 From: Elizabeth Myers Date: Thu, 10 Mar 2016 05:40:21 -0600 Subject: [PATCH] authd: add address families to provider processing. ircd knows about them so let's not reinvent checking for address types and stuff. --- authd/provider.c | 10 +++++++--- authd/provider.h | 5 +++-- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/authd/provider.c b/authd/provider.c index a36fc0c47..b31cd37b3 100644 --- a/authd/provider.c +++ b/authd/provider.c @@ -184,7 +184,9 @@ void notice_client(struct auth_client *auth, const char *notice) } /* Begin authenticating user */ -void start_auth(const char *cid, const char *l_ip, const char *l_port, const char *c_ip, const char *c_port) +static void start_auth(const char *cid, const char *l_ip, const char *l_port, + const char *l_family, const char *c_ip, const char *c_port, + const char *c_family) { rb_dlink_node *ptr; struct auth_provider *provider; @@ -203,9 +205,11 @@ void start_auth(const char *cid, const char *l_ip, const char *l_port, const cha rb_strlcpy(auth->l_ip, l_ip, sizeof(auth->l_ip)); auth->l_port = (uint16_t)atoi(l_port); /* Safe cast, port shouldn't exceed 16 bits */ + auth->l_family = atoi(l_family); rb_strlcpy(auth->c_ip, c_ip, sizeof(auth->c_ip)); auth->c_port = (uint16_t)atoi(c_port); + auth->c_family = atoi(c_family); RB_DLINK_FOREACH(ptr, auth_providers.head) { @@ -228,8 +232,8 @@ void start_auth(const char *cid, const char *l_ip, const char *l_port, const cha /* Callback for the initiation */ void handle_new_connection(int parc, char *parv[]) { - if(parc < 5) + if(parc < 7) return; - start_auth(parv[1], parv[2], parv[3], parv[4], parv[5]); + start_auth(parv[1], parv[2], parv[3], parv[4], parv[5], parv[6], parv[7]); } diff --git a/authd/provider.h b/authd/provider.h index 0b2161dac..63016f7ee 100644 --- a/authd/provider.h +++ b/authd/provider.h @@ -24,7 +24,7 @@ #include "stdinc.h" /* Arbitrary limit */ -#define MAX_CLIENTS 1024 +#define MAX_CLIENTS 4096 /* Registered providers */ typedef enum @@ -41,9 +41,11 @@ struct auth_client char l_ip[HOSTIPLEN + 1]; /* Listener IP address */ uint16_t l_port; /* Listener port */ + int l_family; /* AF_INET or AF_INET6 */ char c_ip[HOSTIPLEN + 1]; /* Client IP address */ uint16_t c_port; /* Client port */ + int c_family; /* AF_INET or AF_INET6 */ char hostname[IRCD_RES_HOSTLEN + 1]; /* Used for DNS lookup */ char username[USERLEN + 1]; /* Used for ident lookup */ @@ -89,7 +91,6 @@ void accept_client(struct auth_client *auth, provider_t provider); void notice_client(struct auth_client *auth, const char *notice); -void start_auth(const char *cid, const char *l_ip, const char *l_port, const char *c_ip, const char *c_port); void handle_new_connection(int parc, char *parv[]); /* Provider is operating on this auth_client (set this if you have async work to do) */