STABLE14-windows-afsdb-fix-20050701

Fix AFSDB queries using DNSAPI to always terminate the query string with
a period.


(cherry picked from commit f6d99fbba133ba996610d0c00457408fede942dc)
This commit is contained in:
Jeffrey Altman 2005-07-02 03:46:28 +00:00
parent 08b798494e
commit 8b6b9ef33b

View File

@ -705,13 +705,20 @@ int getAFSServer(char *cellName, int *cellHostAddrs, char cellHostNames[][MAXHOS
PDNS_RECORD pDnsCell, pDnsIter, pDnsVol,pDnsVolIter, pDnsCIter;
DWORD i;
struct sockaddr_in vlSockAddr;
char query[1024];
*numServers = 0;
*ttl = 0;
/* query the AFSDB records of cell */
if (DnsQuery_A(cellName, DNS_TYPE_AFSDB, DNS_QUERY_STANDARD, NULL, &pDnsCell, NULL) == ERROR_SUCCESS) {
strncpy(query, cellName, 1024);
query[1023] = 0;
if (query[strlen(query)-1] != '.') {
strncat(query,".",1024);
query[1023] = 0;
}
if (DnsQuery_A(query, DNS_TYPE_AFSDB, DNS_QUERY_STANDARD, NULL, &pDnsCell, NULL) == ERROR_SUCCESS) {
memset((void*) &vlSockAddr, 0, sizeof(vlSockAddr));
/* go through the returned records */
@ -779,5 +786,4 @@ int getAFSServer(char *cellName, int *cellHostAddrs, char cellHostNames[][MAXHOS
return -1;
#endif /* DNSAPI_ENV */
}
#endif /* AFS_AFSDB_ENV */