Hello,

Here is a little patch to proto.c to make DNS resolving work
on a 64-bit machine like Digital Alpha running OSF1 V4.0C.

I'm running udmsearch-3.0.5, compiled with gcc 2.7.2.2.

The problem is that the indexer works only if URL contains
numeric IP address, but fails with: 'Can't connect to host tink.ijs.si:80'
when host name is specified.

The problem is in proto.c\open_host where sin.sin_addr.s_addr is
of type in_addr_t (/usr/include/netinet/in.h)
which in turn is unsigned int (/usr/include/sys/types.h:
  /* Spec 1170 says in_addr_t is unsigned integral of exactly 32 bits */
  typedef unsigned int    in_addr_t;
).

... so the expression:  (unsigned int)-1 != (unsigned long)-1
                                  ^^^                 ^^^^
is unfortunately true, leading to the wrong branch in the if statement.

Here is the patch:

--------------------
*** proto.c~    Sat Feb 19 18:40:10 2000
--- proto.c     Tue Feb 22 16:13:50 2000
***************
*** 334,340 ****
                return(UDM_NET_ERROR);
        }
  
!       if ((sin.sin_addr.s_addr=inet_addr(hostname)) != (unsigned long) -1){
                sin.sin_family=AF_INET;
        }else{
                host=gethostbyname(hostname);
--- 334,340 ----
                return(UDM_NET_ERROR);
        }
  
!       if ((sin.sin_addr.s_addr=inet_addr(hostname)) != (in_addr_t)-1){
                sin.sin_family=AF_INET;
        }else{
                host=gethostbyname(hostname);
--------------------

To confirm my claims the man page of inet_addr(3) defines the return value
of inet_addr to be of type in_addr_t:

  in_addr_t inet_addr(const char *string) ;

This is so both on OSF1 V4 and on Solaris 2.6, and even HP-UX 10.20
defines the in_addr_t so that it matches the return value of inet_addr.

Best regards
  Mark

-- 
  !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
  !!  Mark Martinec (system manager)     tel +386 61 177-3575 !!
  !!  J. Stefan Institute, Jamova 39     fax +386 61  219-385 !!
  !!  SI-1000 Ljubljana, Slovenia        [EMAIL PROTECTED] !!
  !!!!!!!!!!!!!!!!!!!!!!!!!! http://www.ijs.si/people/mark/ !!!!
______________
If you want to unsubscribe send "unsubscribe udmsearch"
to [EMAIL PROTECTED]

Reply via email to