Print

Print


Andy,

In the latest release (20050623-0016) I found a serious bug in src/ 
XrdOlb/XrdOlbConfig.cc which needs to be addressed fairly quickly, if  
you haven't already fixed it.
I also found a pair of unnecessary casts that can be removed from src/ 
XrdNet/XrdNetDNS.cc in the process of figuring out the bug.

BTW, I did the diffs backwards below. Sorry...

The BUG:
You go past the end of the InetAddr array when resolving the hostname  
of the master. The solution is to move the i--; line to before the  
reference to InetAddr[i]. I also threw in a warning message. There is  
probably a better way to log the warning, but I'll leave that to you.

diff src/XrdOlb/XrdOlbConfig.cc ../xrootd.sol/src/XrdOlb/
2033,2038c2033
<            {i--;
<           char *mp = XrdNetDNS::getHostName(InetAddr[i]);
<           if (strcmp(mp, mbuff) != 0) {
<               eDest->Emsg("Config: WARNING reverse lookup mismatch:  
host =", mbuff,
<                           " rev = ", mp);
<           }
---
 >            {char *mp = XrdNetDNS::getHostName(InetAddr[i]);
2040a2036
 >             i--;


The casts:
**********
diff src/XrdNet/XrdNetDNS.cc ../xrootd.sol/src/XrdNet/XrdNetDNS.cc
467c467
<       sz = snprintf(buff,blen,"%s",   inet_ntoa(in));
---
 >       sz = snprintf(buff,blen,"%s",   inet_ntoa((const struct  
in_addr)in));
469c469
<       sz = snprintf(buff,blen,"%s:%d",inet_ntoa(in),port);
---
 >       sz = snprintf(buff,blen,"%s:%d",inet_ntoa((const struct  
in_addr)in),port);

--
Gregory J. Sharp                   email: [log in to unmask]
Wilson Synchrotron Laboratory      url: http://www.lepp.cornell.edu/ 
~gregor
Dryden Rd                          ph:  +1 607 255 4882
Ithaca, NY 14853                   fax: +1 607 255 8062