librb: Fix type of dst for rb_inet_pton_sock()

This commit is contained in:
Simon Arlott 2019-08-31 16:10:50 +01:00
parent 8b96670079
commit 17809d2db7
No known key found for this signature in database
GPG Key ID: 49BFFEEFD4C3ED53
14 changed files with 26 additions and 25 deletions

View File

@ -73,7 +73,7 @@ lookup_hostname(const char *ip, DNSCB callback, void *data)
struct dns_query *query = rb_malloc(sizeof(struct dns_query));
int aftype;
if(!rb_inet_pton_sock(ip, (struct sockaddr *)&query->addr))
if(!rb_inet_pton_sock(ip, &query->addr))
{
rb_free(query);
return NULL;

View File

@ -319,12 +319,12 @@ start_auth(const char *cid, const char *l_ip, const char *l_port, const char *c_
rb_strlcpy(auth->l_ip, l_ip, sizeof(auth->l_ip));
auth->l_port = (uint16_t)atoi(l_port); /* should be safe */
(void) rb_inet_pton_sock(l_ip, (struct sockaddr *)&auth->l_addr);
(void) rb_inet_pton_sock(l_ip, &auth->l_addr);
SET_SS_PORT(&auth->l_addr, htons(auth->l_port));
rb_strlcpy(auth->c_ip, c_ip, sizeof(auth->c_ip));
auth->c_port = (uint16_t)atoi(c_port);
(void) rb_inet_pton_sock(c_ip, (struct sockaddr *)&auth->c_addr);
(void) rb_inet_pton_sock(c_ip, &auth->c_addr);
SET_SS_PORT(&auth->c_addr, htons(auth->c_port));
rb_strlcpy(auth->hostname, "*", sizeof(auth->hostname));

View File

@ -457,7 +457,7 @@ create_listener(const char *ip, uint16_t port)
rb_fde_t *F;
int opt = 1;
if(!rb_inet_pton_sock(ip, (struct sockaddr *)&addr))
if(!rb_inet_pton_sock(ip, &addr))
{
warn_opers(L_CRIT, "OPM: got a bad listener: %s:%hu", ip, port);
exit(EX_PROVIDER_ERROR);

View File

@ -112,7 +112,7 @@ mr_webirc(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *sourc
return;
}
if (rb_inet_pton_sock(parv[4], (struct sockaddr *)&addr) <= 0)
if (rb_inet_pton_sock(parv[4], &addr) <= 0)
{
sendto_one(source_p, "NOTICE * :Invalid IP");
return;

View File

@ -243,6 +243,7 @@ make_client(struct Client *from)
SetUnknown(client_p);
rb_strlcpy(client_p->username, "unknown", sizeof(client_p->username));
printf("client_p=%p (%zu)\n", client_p, sizeof(client_p));
return client_p;
}

View File

@ -76,7 +76,7 @@ parse_netmask(const char *text, struct rb_sockaddr_storage *naddr, int *nb)
return HM_HOST;
} else
*b = 128;
if(rb_inet_pton_sock(ip, (struct sockaddr *)addr) > 0)
if(rb_inet_pton_sock(ip, addr) > 0)
return HM_IPV6;
else
return HM_HOST;
@ -94,7 +94,7 @@ parse_netmask(const char *text, struct rb_sockaddr_storage *naddr, int *nb)
return HM_HOST;
} else
*b = 32;
if(rb_inet_pton_sock(ip, (struct sockaddr *)addr) > 0)
if(rb_inet_pton_sock(ip, addr) > 0)
return HM_IPV4;
else
return HM_HOST;

View File

@ -389,11 +389,11 @@ add_sctp_listener(int port, const char *vhost_ip1, const char *vhost_ip2, int ss
memset(&vaddr, 0, sizeof(vaddr));
if (vhost_ip1 != NULL) {
if (rb_inet_pton_sock(vhost_ip1, (struct sockaddr *)&vaddr[0]) <= 0)
if (rb_inet_pton_sock(vhost_ip1, &vaddr[0]) <= 0)
return;
if (vhost_ip2 != NULL) {
if (rb_inet_pton_sock(vhost_ip2, (struct sockaddr *)&vaddr[1]) <= 0)
if (rb_inet_pton_sock(vhost_ip2, &vaddr[1]) <= 0)
return;
} else {
SET_SS_FAMILY(&vaddr[1], AF_UNSPEC);

View File

@ -246,7 +246,7 @@ conf_set_serverinfo_vhost(void *data)
{
struct rb_sockaddr_storage addr;
if(rb_inet_pton_sock(data, (struct sockaddr *)&addr) <= 0 || GET_SS_FAMILY(&addr) != AF_INET)
if(rb_inet_pton_sock(data, &addr) <= 0 || GET_SS_FAMILY(&addr) != AF_INET)
{
conf_report_error("Invalid IPv4 address for server vhost (%s)", (char *) data);
return;
@ -261,7 +261,7 @@ conf_set_serverinfo_vhost6(void *data)
struct rb_sockaddr_storage addr;
if(rb_inet_pton_sock(data, (struct sockaddr *)&addr) <= 0 || GET_SS_FAMILY(&addr) != AF_INET6)
if(rb_inet_pton_sock(data, &addr) <= 0 || GET_SS_FAMILY(&addr) != AF_INET6)
{
conf_report_error("Invalid IPv6 address for server vhost (%s)", (char *) data);
return;
@ -1357,7 +1357,7 @@ conf_set_connect_host(void *data)
{
struct rb_sockaddr_storage addr;
if(rb_inet_pton_sock(data, (struct sockaddr *)&addr) <= 0)
if(rb_inet_pton_sock(data, &addr) <= 0)
{
rb_free(yy_server->connect_host);
yy_server->connect_host = rb_strdup(data);
@ -1383,7 +1383,7 @@ conf_set_connect_vhost(void *data)
{
struct rb_sockaddr_storage addr;
if(rb_inet_pton_sock(data, (struct sockaddr *)&addr) <= 0)
if(rb_inet_pton_sock(data, &addr) <= 0)
{
rb_free(yy_server->bind_host);
yy_server->bind_host = rb_strdup(data);
@ -2191,7 +2191,7 @@ conf_set_opm_listen_address_both(void *data, bool ipv6)
const char *confstr = (ipv6 ? "opm::listen_ipv6" : "opm::listen_ipv4");
char *ip = data;
if(!rb_inet_pton_sock(ip, (struct sockaddr *)&addr))
if(!rb_inet_pton_sock(ip, &addr))
{
conf_report_error("%s is an invalid address: %s", confstr, ip);
return;

View File

@ -387,14 +387,14 @@ conf_connect_dns_callback(const char *result, int status, int aftype, void *data
if(aftype == AF_INET)
{
if(status == 1)
rb_inet_pton_sock(result, (struct sockaddr *)&server_p->connect4);
rb_inet_pton_sock(result, &server_p->connect4);
server_p->dns_query_connect4 = 0;
}
else if(aftype == AF_INET6)
{
if(status == 1)
rb_inet_pton_sock(result, (struct sockaddr *)&server_p->connect6);
rb_inet_pton_sock(result, &server_p->connect6);
server_p->dns_query_connect6 = 0;
}
@ -418,14 +418,14 @@ conf_bind_dns_callback(const char *result, int status, int aftype, void *data)
if(aftype == AF_INET)
{
if(status == 1)
rb_inet_pton_sock(result, (struct sockaddr *)&server_p->bind4);
rb_inet_pton_sock(result, &server_p->bind4);
server_p->dns_query_bind4 = 0;
}
else if(aftype == AF_INET6)
{
if(status == 1)
rb_inet_pton_sock(result, (struct sockaddr *)&server_p->bind6);
rb_inet_pton_sock(result, &server_p->bind6);
server_p->dns_query_bind6 = 0;
}

View File

@ -372,7 +372,7 @@ check_server(const char *name, struct Client *client_p)
name_matched = true;
if(rb_inet_pton_sock(client_p->sockhost, (struct sockaddr *)&client_addr) <= 0)
if(rb_inet_pton_sock(client_p->sockhost, &client_addr) <= 0)
SET_SS_FAMILY(&client_addr, AF_UNSPEC);
if((tmp_p->connect_host && match(tmp_p->connect_host, client_p->host))

View File

@ -152,7 +152,7 @@ int rb_listen(rb_fde_t *, int backlog, int defer_accept);
const char *rb_inet_ntop(int af, const void *src, char *dst, unsigned int size);
int rb_inet_pton(int af, const char *src, void *dst);
const char *rb_inet_ntop_sock(struct sockaddr *src, char *dst, unsigned int size);
int rb_inet_pton_sock(const char *src, struct sockaddr *dst);
int rb_inet_pton_sock(const char *src, struct sockaddr_storage *dst);
int rb_getmaxconnect(void);
int rb_ignore_errno(int);

View File

@ -1584,7 +1584,7 @@ inet_ntop6(const unsigned char *src, char *dst, unsigned int size)
}
int
rb_inet_pton_sock(const char *src, struct sockaddr *dst)
rb_inet_pton_sock(const char *src, struct sockaddr_storage *dst)
{
memset(dst, 0, sizeof(*dst));
if(rb_inet_pton(AF_INET, src, &((struct sockaddr_in *)dst)->sin_addr))

View File

@ -81,7 +81,7 @@ struct Client *make_local_person_full(const char *nick, const char *username, co
make_user(client);
SetClient(client);
rb_inet_pton_sock(ip, (struct sockaddr *)&client->localClient->ip);
rb_inet_pton_sock(ip, &client->localClient->ip);
rb_strlcpy(client->name, nick, sizeof(client->name));
rb_strlcpy(client->username, username, sizeof(client->username));
rb_strlcpy(client->host, hostname, sizeof(client->host));
@ -154,7 +154,7 @@ struct Client *make_remote_person_nick(struct Client *server, const char *nick)
struct Client *make_remote_person_full(struct Client *server, const char *nick, const char *username, const char *hostname, const char *ip, const char *realname)
{
struct Client *client;
struct sockaddr addr;
struct sockaddr_storage addr;
client = make_client(server);
make_user(client);
@ -167,7 +167,7 @@ struct Client *make_remote_person_full(struct Client *server, const char *nick,
rb_strlcpy(client->name, nick, sizeof(client->name));
rb_strlcpy(client->username, username, sizeof(client->username));
rb_strlcpy(client->host, hostname, sizeof(client->host));
rb_inet_ntop_sock(&addr, client->sockhost, sizeof(client->sockhost));
rb_inet_ntop_sock((struct sockaddr *)&addr, client->sockhost, sizeof(client->sockhost));
rb_strlcpy(client->info, realname, sizeof(client->info));
add_to_client_hash(nick, client);

View File

@ -45,7 +45,7 @@ static void common_sasl_test(bool aborted, bool by_user)
struct Client *server = make_remote_server(&me);
struct Client *remote = make_remote_person(server);
rb_inet_pton_sock(TEST_IP, (struct sockaddr *)&user->localClient->ip);
rb_inet_pton_sock(TEST_IP, &user->localClient->ip);
rb_strlcpy(user->host, TEST_HOSTNAME, sizeof(user->host));
rb_inet_ntop_sock((struct sockaddr *)&user->localClient->ip, user->sockhost, sizeof(user->sockhost));