Skip to content

Commit

Permalink
fix(auth-process): use canonicalized hostname in client init
Browse files Browse the repository at this point in the history
  • Loading branch information
mbroadst committed Nov 1, 2018
1 parent 334ca9c commit b1802d1
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions lib/auth_processes/mongodb.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,14 @@ class MongoAuthProcess {
this.port = port;

// Set up service name
serviceName = serviceName || options.gssapiServiceName || 'mongodb';
this.serviceName = serviceName || options.gssapiServiceName || 'mongodb';

// Options
this.canonicalizeHostName =
typeof options.gssapiCanonicalizeHostName === 'boolean'
? options.gssapiCanonicalizeHostName
: false;

this.service =
process.platform === 'win32' ? `${serviceName}/${host}` : `${serviceName}@${host}`;

// Set up first transition
this._transition = firstTransition(this);

Expand Down Expand Up @@ -58,7 +55,12 @@ class MongoAuthProcess {
Object.assign(initOptions, { user: username, password });
}

kerberos.initializeClient(self.service, initOptions, (err, client) => {
const service =
process.platform === 'win32'
? `${this.serviceName}/${this.host}`
: `${this.serviceName}@${this.host}`;

kerberos.initializeClient(service, initOptions, (err, client) => {
if (err) return callback(err, null);

self.client = client;
Expand Down

0 comments on commit b1802d1

Please sign in to comment.