Skip to content

Commit

Permalink
fix(NODE-2939): use host on cname error
Browse files Browse the repository at this point in the history
  • Loading branch information
durran committed Feb 4, 2022
1 parent 392bb8e commit 342e819
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/cmap/auth/gssapi.ts
Expand Up @@ -184,11 +184,15 @@ function performGssapiCanonicalizeHostName(
if (mode === true || mode === 'forwardAndReverse') {
// Perform the lookup of the ip address.
dns.lookup(host, (error, address) => {
/* eslint no-console: 0 */
console.log('lookup', host, error, address);
// No ip found, return the error.
if (error) return callback(error);

// Perform a reverse ptr lookup on the ip address.
dns.resolvePtr(address, (err, results) => {
/* eslint no-console: 0 */
console.log('resolvePtr', err, results);
// This can error as ptr records may not exist for all ips. In this case
// fallback to a cname lookup as dns.lookup() does not return the
// cname.
Expand All @@ -208,7 +212,9 @@ function performGssapiCanonicalizeHostName(
function resolveCname(host: string, callback: Callback<string>): void {
// Attempt to resolve the host name
dns.resolveCname(host, (err, r) => {
if (err) return callback(err);
/* eslint no-console: 0 */
console.log('resolveCname', err, r);
if (err) return callback(undefined, host);

// Get the first resolve host id
if (r.length > 0) {
Expand Down

0 comments on commit 342e819

Please sign in to comment.