Skip to content

Commit

Permalink
consistency between IPv4 and IPv6
Browse files Browse the repository at this point in the history
  • Loading branch information
DimitriPapadopoulos committed Apr 6, 2024
1 parent 032bc1c commit e975780
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/pam_radius_auth.c
Original file line number Diff line number Diff line change
Expand Up @@ -1577,15 +1577,16 @@ PAM_EXTERN int pam_sm_authenticate(pam_handle_t *pamh, UNUSED int flags, int arg

attribute_t *attr_fip;
if ((attr_fip = find_attribute(response, PW_FRAMED_ADDRESS))) {
char frameip[100];
const char name[] = "Framed-IP-Address";
char frameip[sizeof(name) + INET_ADDRSTRLEN];
struct in_addr ip_addr;

ip_addr.s_addr = *(int*) attr_fip->data;

snprintf(frameip, sizeof(frameip), "Framed-IP-Address=%s", inet_ntoa(ip_addr));
snprintf(frameip, sizeof(frameip), "%s=%s", name, inet_ntoa(ip_addr));
retval = pam_putenv(pamh, frameip);
if(retval != PAM_SUCCESS) {
_pam_log(LOG_ERR, "unable to set PAM environment variable : Framed-IP-Address");
if (retval != PAM_SUCCESS) {
_pam_log(LOG_ERR, "unable to set PAM environment variable : %s", name);
}
else {
_pam_log(LOG_DEBUG, "Set PAM environment variable : %s", frameip);
Expand Down

0 comments on commit e975780

Please sign in to comment.