librb: Fix type of dst for rb_inet_pton_sock()
This commit is contained in:
parent
8b96670079
commit
17809d2db7
14 changed files with 26 additions and 25 deletions
|
@ -73,7 +73,7 @@ lookup_hostname(const char *ip, DNSCB callback, void *data)
|
||||||
struct dns_query *query = rb_malloc(sizeof(struct dns_query));
|
struct dns_query *query = rb_malloc(sizeof(struct dns_query));
|
||||||
int aftype;
|
int aftype;
|
||||||
|
|
||||||
if(!rb_inet_pton_sock(ip, (struct sockaddr *)&query->addr))
|
if(!rb_inet_pton_sock(ip, &query->addr))
|
||||||
{
|
{
|
||||||
rb_free(query);
|
rb_free(query);
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
|
@ -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));
|
rb_strlcpy(auth->l_ip, l_ip, sizeof(auth->l_ip));
|
||||||
auth->l_port = (uint16_t)atoi(l_port); /* should be safe */
|
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));
|
SET_SS_PORT(&auth->l_addr, htons(auth->l_port));
|
||||||
|
|
||||||
rb_strlcpy(auth->c_ip, c_ip, sizeof(auth->c_ip));
|
rb_strlcpy(auth->c_ip, c_ip, sizeof(auth->c_ip));
|
||||||
auth->c_port = (uint16_t)atoi(c_port);
|
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));
|
SET_SS_PORT(&auth->c_addr, htons(auth->c_port));
|
||||||
|
|
||||||
rb_strlcpy(auth->hostname, "*", sizeof(auth->hostname));
|
rb_strlcpy(auth->hostname, "*", sizeof(auth->hostname));
|
||||||
|
|
|
@ -457,7 +457,7 @@ create_listener(const char *ip, uint16_t port)
|
||||||
rb_fde_t *F;
|
rb_fde_t *F;
|
||||||
int opt = 1;
|
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);
|
warn_opers(L_CRIT, "OPM: got a bad listener: %s:%hu", ip, port);
|
||||||
exit(EX_PROVIDER_ERROR);
|
exit(EX_PROVIDER_ERROR);
|
||||||
|
|
|
@ -112,7 +112,7 @@ mr_webirc(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *sourc
|
||||||
return;
|
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");
|
sendto_one(source_p, "NOTICE * :Invalid IP");
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -243,6 +243,7 @@ make_client(struct Client *from)
|
||||||
SetUnknown(client_p);
|
SetUnknown(client_p);
|
||||||
rb_strlcpy(client_p->username, "unknown", sizeof(client_p->username));
|
rb_strlcpy(client_p->username, "unknown", sizeof(client_p->username));
|
||||||
|
|
||||||
|
printf("client_p=%p (%zu)\n", client_p, sizeof(client_p));
|
||||||
return client_p;
|
return client_p;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -76,7 +76,7 @@ parse_netmask(const char *text, struct rb_sockaddr_storage *naddr, int *nb)
|
||||||
return HM_HOST;
|
return HM_HOST;
|
||||||
} else
|
} else
|
||||||
*b = 128;
|
*b = 128;
|
||||||
if(rb_inet_pton_sock(ip, (struct sockaddr *)addr) > 0)
|
if(rb_inet_pton_sock(ip, addr) > 0)
|
||||||
return HM_IPV6;
|
return HM_IPV6;
|
||||||
else
|
else
|
||||||
return HM_HOST;
|
return HM_HOST;
|
||||||
|
@ -94,7 +94,7 @@ parse_netmask(const char *text, struct rb_sockaddr_storage *naddr, int *nb)
|
||||||
return HM_HOST;
|
return HM_HOST;
|
||||||
} else
|
} else
|
||||||
*b = 32;
|
*b = 32;
|
||||||
if(rb_inet_pton_sock(ip, (struct sockaddr *)addr) > 0)
|
if(rb_inet_pton_sock(ip, addr) > 0)
|
||||||
return HM_IPV4;
|
return HM_IPV4;
|
||||||
else
|
else
|
||||||
return HM_HOST;
|
return HM_HOST;
|
||||||
|
|
|
@ -389,11 +389,11 @@ add_sctp_listener(int port, const char *vhost_ip1, const char *vhost_ip2, int ss
|
||||||
memset(&vaddr, 0, sizeof(vaddr));
|
memset(&vaddr, 0, sizeof(vaddr));
|
||||||
|
|
||||||
if (vhost_ip1 != NULL) {
|
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;
|
return;
|
||||||
|
|
||||||
if (vhost_ip2 != NULL) {
|
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;
|
return;
|
||||||
} else {
|
} else {
|
||||||
SET_SS_FAMILY(&vaddr[1], AF_UNSPEC);
|
SET_SS_FAMILY(&vaddr[1], AF_UNSPEC);
|
||||||
|
|
|
@ -246,7 +246,7 @@ conf_set_serverinfo_vhost(void *data)
|
||||||
{
|
{
|
||||||
struct rb_sockaddr_storage addr;
|
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);
|
conf_report_error("Invalid IPv4 address for server vhost (%s)", (char *) data);
|
||||||
return;
|
return;
|
||||||
|
@ -261,7 +261,7 @@ conf_set_serverinfo_vhost6(void *data)
|
||||||
|
|
||||||
struct rb_sockaddr_storage addr;
|
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);
|
conf_report_error("Invalid IPv6 address for server vhost (%s)", (char *) data);
|
||||||
return;
|
return;
|
||||||
|
@ -1357,7 +1357,7 @@ conf_set_connect_host(void *data)
|
||||||
{
|
{
|
||||||
struct rb_sockaddr_storage addr;
|
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);
|
rb_free(yy_server->connect_host);
|
||||||
yy_server->connect_host = rb_strdup(data);
|
yy_server->connect_host = rb_strdup(data);
|
||||||
|
@ -1383,7 +1383,7 @@ conf_set_connect_vhost(void *data)
|
||||||
{
|
{
|
||||||
struct rb_sockaddr_storage addr;
|
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);
|
rb_free(yy_server->bind_host);
|
||||||
yy_server->bind_host = rb_strdup(data);
|
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");
|
const char *confstr = (ipv6 ? "opm::listen_ipv6" : "opm::listen_ipv4");
|
||||||
char *ip = data;
|
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);
|
conf_report_error("%s is an invalid address: %s", confstr, ip);
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -387,14 +387,14 @@ conf_connect_dns_callback(const char *result, int status, int aftype, void *data
|
||||||
if(aftype == AF_INET)
|
if(aftype == AF_INET)
|
||||||
{
|
{
|
||||||
if(status == 1)
|
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;
|
server_p->dns_query_connect4 = 0;
|
||||||
}
|
}
|
||||||
else if(aftype == AF_INET6)
|
else if(aftype == AF_INET6)
|
||||||
{
|
{
|
||||||
if(status == 1)
|
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;
|
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(aftype == AF_INET)
|
||||||
{
|
{
|
||||||
if(status == 1)
|
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;
|
server_p->dns_query_bind4 = 0;
|
||||||
}
|
}
|
||||||
else if(aftype == AF_INET6)
|
else if(aftype == AF_INET6)
|
||||||
{
|
{
|
||||||
if(status == 1)
|
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;
|
server_p->dns_query_bind6 = 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -372,7 +372,7 @@ check_server(const char *name, struct Client *client_p)
|
||||||
|
|
||||||
name_matched = true;
|
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);
|
SET_SS_FAMILY(&client_addr, AF_UNSPEC);
|
||||||
|
|
||||||
if((tmp_p->connect_host && match(tmp_p->connect_host, client_p->host))
|
if((tmp_p->connect_host && match(tmp_p->connect_host, client_p->host))
|
||||||
|
|
|
@ -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);
|
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);
|
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);
|
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_getmaxconnect(void);
|
||||||
int rb_ignore_errno(int);
|
int rb_ignore_errno(int);
|
||||||
|
|
||||||
|
|
|
@ -1584,7 +1584,7 @@ inet_ntop6(const unsigned char *src, char *dst, unsigned int size)
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
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));
|
memset(dst, 0, sizeof(*dst));
|
||||||
if(rb_inet_pton(AF_INET, src, &((struct sockaddr_in *)dst)->sin_addr))
|
if(rb_inet_pton(AF_INET, src, &((struct sockaddr_in *)dst)->sin_addr))
|
||||||
|
|
|
@ -81,7 +81,7 @@ struct Client *make_local_person_full(const char *nick, const char *username, co
|
||||||
make_user(client);
|
make_user(client);
|
||||||
SetClient(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->name, nick, sizeof(client->name));
|
||||||
rb_strlcpy(client->username, username, sizeof(client->username));
|
rb_strlcpy(client->username, username, sizeof(client->username));
|
||||||
rb_strlcpy(client->host, hostname, sizeof(client->host));
|
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 *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 Client *client;
|
||||||
struct sockaddr addr;
|
struct sockaddr_storage addr;
|
||||||
|
|
||||||
client = make_client(server);
|
client = make_client(server);
|
||||||
make_user(client);
|
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->name, nick, sizeof(client->name));
|
||||||
rb_strlcpy(client->username, username, sizeof(client->username));
|
rb_strlcpy(client->username, username, sizeof(client->username));
|
||||||
rb_strlcpy(client->host, hostname, sizeof(client->host));
|
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));
|
rb_strlcpy(client->info, realname, sizeof(client->info));
|
||||||
|
|
||||||
add_to_client_hash(nick, client);
|
add_to_client_hash(nick, client);
|
||||||
|
|
|
@ -45,7 +45,7 @@ static void common_sasl_test(bool aborted, bool by_user)
|
||||||
struct Client *server = make_remote_server(&me);
|
struct Client *server = make_remote_server(&me);
|
||||||
struct Client *remote = make_remote_person(server);
|
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_strlcpy(user->host, TEST_HOSTNAME, sizeof(user->host));
|
||||||
rb_inet_ntop_sock((struct sockaddr *)&user->localClient->ip, user->sockhost, sizeof(user->sockhost));
|
rb_inet_ntop_sock((struct sockaddr *)&user->localClient->ip, user->sockhost, sizeof(user->sockhost));
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue