Skip to content

Commit

Permalink
Always fail if IPv6 socket cannot be created
Browse files Browse the repository at this point in the history
IPv6 socket creation is not fatal unless a v6 src_ip has been passed,
but that is an optional value that is not tied to the server address,
which can still be IPv6 if no src_ip was passed at all.
In the talk_radius() function, in case the server address is v6, the
v6 socket is selected regardless of the src_ip.
  • Loading branch information
bluca committed Oct 10, 2017
1 parent 4c6a6bf commit c8c4790
Showing 1 changed file with 0 additions and 4 deletions.
4 changes: 0 additions & 4 deletions src/pam_radius_auth.c
Original file line number Diff line number Diff line change
Expand Up @@ -536,7 +536,6 @@ static int initialize(radius_conf_t *conf, int accounting)
int timeout;
int line = 0;
char src_ip[MAX_IP_LEN];
int seen_v6 = 0;

memset(&salocal4, 0, sizeof(salocal4));
memset(&salocal6, 0, sizeof(salocal6));
Expand Down Expand Up @@ -615,7 +614,6 @@ static int initialize(radius_conf_t *conf, int accounting)
memcpy(&salocal4, &salocal, sizeof(salocal));
break;
case AF_INET6:
seen_v6 = 1;
memcpy(&salocal6, &salocal, sizeof(salocal));
break;
}
Expand Down Expand Up @@ -664,8 +662,6 @@ static int initialize(radius_conf_t *conf, int accounting)
/* open a IPv6 socket. Dies if it fails */
conf->sockfd6 = socket(AF_INET6, SOCK_DGRAM, 0);
if (conf->sockfd6 < 0) {
if (!seen_v6)
return PAM_SUCCESS;
char error_string[BUFFER_SIZE];
get_error_string(errno, error_string, sizeof(error_string));
_pam_log(LOG_ERR, "Failed to open RADIUS IPv6 socket: %s\n", error_string);
Expand Down

0 comments on commit c8c4790

Please sign in to comment.