authd/provider: use rb_sockaddr_storage for IP addresses.

This commit is contained in:
Elizabeth Myers 2016-03-10 07:25:22 -06:00
parent b3265d7afb
commit 5bfc606fa4
2 changed files with 7 additions and 13 deletions

View file

@ -184,9 +184,7 @@ void notice_client(struct auth_client *auth, const char *notice)
}
/* Begin authenticating user */
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)
static void start_auth(const char *cid, const char *l_ip, const char *l_port, const char *c_ip, const char *c_port)
{
rb_dlink_node *ptr;
struct auth_provider *provider;
@ -203,13 +201,11 @@ static void start_auth(const char *cid, const char *l_ip, const char *l_port,
auth->cid = (uint16_t)lcid;
rb_strlcpy(auth->l_ip, l_ip, sizeof(auth->l_ip));
(void)rb_inet_pton_sock(l_ip, (struct sockaddr *)&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));
(void)rb_inet_pton_sock(c_ip, (struct sockaddr *)&auth->c_ip);
auth->c_port = (uint16_t)atoi(c_port);
auth->c_family = atoi(c_family);
RB_DLINK_FOREACH(ptr, auth_providers.head)
{
@ -235,5 +231,5 @@ void handle_new_connection(int parc, char *parv[])
if(parc < 7)
return;
start_auth(parv[1], parv[2], parv[3], parv[4], parv[5], parv[6], parv[7]);
start_auth(parv[1], parv[2], parv[3], parv[4], parv[5]);
}

View file

@ -39,15 +39,13 @@ struct auth_client
{
uint16_t cid; /* Client ID */
char l_ip[HOSTIPLEN + 1]; /* Listener IP address */
struct rb_sockaddr_storage l_ip; /* 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 */
struct rb_sockaddr_storage c_ip; /* 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 hostname[HOSTLEN + 1]; /* Used for DNS lookup */
char username[USERLEN + 1]; /* Used for ident lookup */
unsigned int providers; /* Providers at work,