Skip to content

Commit

Permalink
fixed bug: PW_NAS_IPV6_ADDRESS check
Browse files Browse the repository at this point in the history
  • Loading branch information
ionutrazvanionita committed Jun 16, 2015
1 parent eaf88cc commit 0108065
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions lib/sendserver.c
Original file line number Diff line number Diff line change
Expand Up @@ -380,13 +380,13 @@ int rc_send_server (rc_handle *rh, SEND_DATA *data, char *msg, unsigned flags)
getnameinfo(SA(&our_sockaddr), SS_LEN(&our_sockaddr), NULL, 0, our_addr_txt, sizeof(our_addr_txt), NI_NUMERICHOST);
getnameinfo(auth_addr->ai_addr, auth_addr->ai_addrlen, NULL, 0, auth_addr_txt, sizeof(auth_addr_txt), NI_NUMERICHOST);

DEBUG(LOG_ERR, "DEBUG: local %s : 0, remote %s : %u\n",
DEBUG(LOG_ERR, "DEBUG: local %s : 0, remote %s : %u\n",
our_addr_txt, auth_addr_txt, data->svc_port);

for (;;)
{
do {
result = sendto (sockfd, (char *) auth, (unsigned int)total_length,
result = sendto (sockfd, (char *) auth, (unsigned int)total_length,
(int) 0, SA(auth_addr->ai_addr), auth_addr->ai_addrlen);
} while (result == -1 && errno == EINTR);
if (result == -1) {
Expand Down Expand Up @@ -669,7 +669,8 @@ int rc_send_server_async(rc_handle *rh, SEND_DATA *data, char *msg, unsigned fla
/*
* Fill in NAS-IP-Address (if needed)
*/
if (rc_avpair_get(data->send_pairs, PW_NAS_IP_ADDRESS, 0) == NULL) {
if (rc_avpair_get(data->send_pairs, PW_NAS_IP_ADDRESS, 0) == NULL &&
rc_avpair_get(data->send_pairs, PW_NAS_IPV6_ADDRESS, 0) == NULL) {
if (our_sockaddr.ss_family == AF_INET) {
uint32_t ip;
ip = *((uint32_t*)(&((struct sockaddr_in*)&our_sockaddr)->sin_addr));
Expand Down

0 comments on commit 0108065

Please sign in to comment.