AW: [Nagios-devel] nrpe-2.5 and solaris 2.6

Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
Locked
Guest

AW: [Nagios-devel] nrpe-2.5 and solaris 2.6

Post by Guest »

This is a multi-part message in MIME format.

------=_NextPart_000_0075_01C6503C.83B62510
Content-Type: text/plain;
charset="us-ascii"
Content-Transfer-Encoding: 7bit


Hi Ethan,

> i just tried to compile the cvs version of nrpe on a solaris
> 2.6 machine.
i had a closer look at it, so i will answer myself...

The problem is the IPv6 support. What was a good intention prevents a
successful compilation of the is_an_allowed_host function. INET6_ADDRSTRLEN
and inet_ntop are not available in elder operating systems. (I do not say
deprecated, because you still find Solaris2.6 machines everywhere).
The IPv6-awareness also is a bit ahead, as throughout of nrpe.c inet_ntoa is
used.
So i made a patch which makes the DNS lookup in is_an_allowed_host IPv4-only
again.

Greetings from Munich,
Gerhard


------=_NextPart_000_0075_01C6503C.83B62510
Content-Type: application/octet-stream;
name="nrpe-2.5pre-allowedhosts.ipv4.patch"
Content-Transfer-Encoding: quoted-printable
Content-Disposition: attachment;
filename="nrpe-2.5pre-allowedhosts.ipv4.patch"

diff -Naur nrpe-2.5/src/nrpe.c nrpe-2.5.ipv4/src/nrpe.c=0A=
--- nrpe-2.5/src/nrpe.c 2006-03-25 15:23:32.000000000 +0100=0A=
+++ nrpe-2.5.ipv4/src/nrpe.c 2006-03-25 18:26:20.310220083 +0100=0A=
@@ -882,7 +882,8 @@=0A=
int result=3D0;=0A=
struct hostent *myhost;=0A=
char **pptr=3DNULL;=0A=
- char resolved_addr[INET6_ADDRSTRLEN]=3D"";=0A=
+ char *save_connecting_host;=0A=
+ struct in_addr addr;=0A=
=0A=
/* make sure we have something */=0A=
if(connecting_host=3D=3DNULL)=0A=
@@ -909,6 +910,7 @@=0A=
if((temp_buffer=3Dstrdup(allowed_hosts))=3D=3DNULL)=0A=
return 0;=0A=
=0A=
+ save_connecting_host =3D strdup(connecting_host);=0A=
=
for(temp_ptr=3Dstrtok(temp_buffer,",");temp_ptr!=3DNULL;temp_ptr=3Dstrtok=
(NULL,",")){=0A=
=0A=
myhost=3Dgethostbyname(temp_ptr);=0A=
@@ -916,9 +918,8 @@=0A=
=0A=
/* check all addresses for the host... */=0A=
for(pptr=3Dmyhost->h_addr_list;*pptr!=3DNULL;pptr++){=0A=
-=0A=
- =
inet_ntop(myhost->h_addrtype,*pptr,resolved_addr,sizeof(resolved_addr));=0A=
- if(!strcmp(resolved_addr,connecting_host)){=0A=
+ memcpy(&addr, *pptr, sizeof(addr));=0A=
+ if(!strcmp(save_connecting_host, inet_ntoa(addr))){=0A=
result=3D1;=0A=
break;=0A=
}=0A=
@@ -928,6 +929,8 @@=0A=
if(result=3D=3D1)=0A=
break;=0A=
}=0A=
+ strcpy(connecting_host, save_connecting_host);=0A=
+ free(save_connecting_host);=0A=
}=0A=
=0A=
free(temp_buffer);=0A=

------=_NextPart_000_0075_01C6503C.83B62510--






This post was automatically imported from historical nagios-devel mailing list archives
Original poster: [email protected]
Locked