File pam_radius-nas-ip-address-fix.patch of Package pam_radius.19457
Index: pam_radius-1.3.16/pam_radius_auth.c
===================================================================
--- pam_radius-1.3.16.orig/pam_radius_auth.c
+++ pam_radius-1.3.16/pam_radius_auth.c
@@ -160,15 +160,15 @@ void _int_free( pam_handle_t * pamh, voi
* Return an IP address in host long notation from
* one supplied in standard dot notation.
*/
-static UINT4 ipstr2long(char *ip_str) {
+static uint32_t ipstr2long(char *ip_str) {
char buf[6];
char *ptr;
int i;
int count;
- UINT4 ipaddr;
+ uint32_t ipaddr;
int cur_byte;
- ipaddr = (UINT4)0;
+ ipaddr = (uint32_t)0;
for(i = 0;i < 4;i++) {
ptr = buf;
@@ -177,24 +177,24 @@ static UINT4 ipstr2long(char *ip_str) {
while(*ip_str != '.' && *ip_str != '\0' && count < 4) {
if(!isdigit(*ip_str)) {
- return((UINT4)0);
+ return((uint32_t)0);
}
*ptr++ = *ip_str++;
count++;
}
if(count >= 4 || count == 0) {
- return((UINT4)0);
+ return((uint32_t)0);
}
*ptr = '\0';
cur_byte = atoi(buf);
if(cur_byte < 0 || cur_byte > 255) {
- return ((UINT4)0);
+ return ((uint32_t)0);
}
ip_str++;
- ipaddr = ipaddr << 8 | (UINT4)cur_byte;
+ ipaddr = ipaddr << 8 | (uint32_t)cur_byte;
}
return(ipaddr);
}
@@ -233,17 +233,17 @@ static int good_ipaddr(char *addr) {
* Return an IP address in host long notation from a host
* name or address in dot notation.
*/
-static UINT4 get_ipaddr(char *host) {
+static uint32_t get_ipaddr(char *host) {
struct hostent *hp;
if(good_ipaddr(host) == 0) {
return(ipstr2long(host));
} else if((hp = gethostbyname(host)) == (struct hostent *)NULL) {
- return((UINT4)0);
+ return((uint32_t)0);
}
- return(ntohl(*(UINT4 *)hp->h_addr));
+ return(ntohl(*(uint32_t *)hp->h_addr));
}
/*
@@ -259,7 +259,7 @@ host2server(radius_server_t *server)
*(p++) = '\0'; /* split the port off from the host name */
}
- if ((server->ip.s_addr = get_ipaddr(server->hostname)) == ((UINT4)0)) {
+ if ((server->ip.s_addr = get_ipaddr(server->hostname)) == ((uint32_t)0)) {
DPRINT(LOG_DEBUG, "DEBUG: get_ipaddr(%s) returned 0.\n", server->hostname);
return PAM_AUTHINFO_UNAVAIL;
}
@@ -693,7 +693,7 @@ static void
build_radius_packet(AUTH_HDR *request, CONST char *user, CONST char *password, radius_conf_t *conf)
{
char hostname[256];
- UINT4 ipaddr;
+ uint32_t ipaddr;
hostname[0] = '\0';
gethostname(hostname, sizeof(hostname) - 1);
@@ -728,7 +728,7 @@ build_radius_packet(AUTH_HDR *request, C
if ((hp = gethostbyname(hostname)) == (struct hostent *) NULL) {
ipaddr = 0x00000000; /* no client IP address */
} else {
- ipaddr = ntohl(*(UINT4 *) hp->h_addr); /* use the first one available */
+ ipaddr = ntohl(*(uint32_t *) hp->h_addr); /* use the first one available */
}
}
Index: pam_radius-1.3.16/radius.h
===================================================================
--- pam_radius-1.3.16.orig/radius.h
+++ pam_radius-1.3.16/radius.h
@@ -35,10 +35,6 @@
#define AUTH_PASS_LEN 16
#define AUTH_STRING_LEN 128 /* maximum of 254 */
-#ifndef UINT4
-typedef unsigned long UINT4;
-#endif
-
typedef struct pw_auth_hdr {
u_char code;
u_char id;
@@ -208,13 +204,13 @@ typedef struct value_pair {
char name[32];
int attribute;
int type;
- UINT4 lvalue;
+ uint32_t lvalue;
char strvalue[AUTH_STRING_LEN];
struct value_pair *next;
} VALUE_PAIR;
typedef struct auth_req {
- UINT4 ipaddr;
+ uint32_t ipaddr;
u_short udp_port;
u_char id;
u_char code;
@@ -222,7 +218,7 @@ typedef struct auth_req {
u_char secret[16];
VALUE_PAIR *request;
int child_pid; /* Process ID of child */
- UINT4 timestamp;
+ uint32_t timestamp;
struct auth_req *next; /* Next active request */
} AUTH_REQ;