Skip to content

Commit b1802d1

Browse files
committedNov 1, 2018
fix(auth-process): use canonicalized hostname in client init
1 parent 334ca9c commit b1802d1

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed
 

‎lib/auth_processes/mongodb.js

+7-5
Original file line numberDiff line numberDiff line change
@@ -9,17 +9,14 @@ class MongoAuthProcess {
99
this.port = port;
1010

1111
// Set up service name
12-
serviceName = serviceName || options.gssapiServiceName || 'mongodb';
12+
this.serviceName = serviceName || options.gssapiServiceName || 'mongodb';
1313

1414
// Options
1515
this.canonicalizeHostName =
1616
typeof options.gssapiCanonicalizeHostName === 'boolean'
1717
? options.gssapiCanonicalizeHostName
1818
: false;
1919

20-
this.service =
21-
process.platform === 'win32' ? `${serviceName}/${host}` : `${serviceName}@${host}`;
22-
2320
// Set up first transition
2421
this._transition = firstTransition(this);
2522

@@ -58,7 +55,12 @@ class MongoAuthProcess {
5855
Object.assign(initOptions, { user: username, password });
5956
}
6057

61-
kerberos.initializeClient(self.service, initOptions, (err, client) => {
58+
const service =
59+
process.platform === 'win32'
60+
? `${this.serviceName}/${this.host}`
61+
: `${this.serviceName}@${this.host}`;
62+
63+
kerberos.initializeClient(service, initOptions, (err, client) => {
6264
if (err) return callback(err, null);
6365

6466
self.client = client;

0 commit comments

Comments
 (0)
Please sign in to comment.