]> jfr.im git - solanum.git/commitdiff
authd/provider: use rb_sockaddr_storage for IP addresses.
authorElizabeth Myers <redacted>
Thu, 10 Mar 2016 13:25:22 +0000 (07:25 -0600)
committerElizabeth Myers <redacted>
Thu, 10 Mar 2016 13:25:22 +0000 (07:25 -0600)
authd/provider.c
authd/provider.h

index b31cd37b334be736cffdb3d5588f7f97795b5d33..f63b9be8f913fd9f11c815b961fcf33598df59a6 100644 (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]);
 }
index 63016f7ee887f6743106f46f6a06047f64a33cc8..60aefd770ffca76d3e0a193980c35f8c398ccd59 100644 (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,