On Thu, Jun 26, 2003 at 07:33:22AM +0200, Oliver Graf wrote:
> On Wed, Jun 25, 2003 at 01:52:25PM -0400, Alan DeKok wrote:
> > "Alan Litster" <[EMAIL PROTECTED]> wrote:
> > > When using radtest/radclient from 20030619 on the machine to test
> > > radiusd on a box running 20030625 it works. So it seems to me as if
> > > something has changed with the newer radclient?
> > 
> >   Yeah, I hate glibc.  There's no man page for gethostbyname_r, and
> > as a result, the code added recently to src/main/misc.c was wrong.
> > I've fixed it in the CVS head.
> 
> The same goes for gethostbyaddr_r in ip_hostname. It should return
> NULL if gethostbyaddr_r returns != 0.

�hm, not null, it should do as the other possible versions and return
the IP as string. Simply setting hp in error case to NULL should do
it.

Oliver.

Index: src/lib/misc.c
===================================================================
RCS file: /source/radiusd/src/lib/misc.c,v
retrieving revision 1.34
diff -u -r1.34 misc.c
--- src/lib/misc.c      25 Jun 2003 17:52:52 -0000      1.34
+++ src/lib/misc.c      26 Jun 2003 08:45:56 -0000
@@ -57,7 +57,10 @@
 #if GETHOSTBYADDRRSTYLE == SYSVSTYLE
        hp = gethostbyaddr_r((char *)&ipaddr, sizeof(struct in_addr), AF_INET, 
&result, buffer, sizeof(buffer), &error);
 #elif GETHOSTBYADDRRSTYLE == GNUSTYLE
-       gethostbyaddr_r((char *)&ipaddr, sizeof(struct in_addr), AF_INET, &result, 
buffer, sizeof(buffer), &hp, &error);
+       if (gethostbyaddr_r((char *)&ipaddr, sizeof(struct in_addr), AF_INET,
+                           &result, buffer, sizeof(buffer), &hp, &error)!=0) {
+               hp=NULL;
+       }
 #else
        hp = gethostbyaddr((char *)&ipaddr, sizeof(struct in_addr), AF_INET);
 #endif

Reply via email to