@@ -10,6 +10,7 @@ var Query = require('./query')
10
10
var defaults = require ( './defaults' )
11
11
var Connection = require ( './connection' )
12
12
const crypto = require ( './crypto/utils' )
13
+ const kerberos = require ( 'kerberos' ) . Kerberos
13
14
14
15
class Client extends EventEmitter {
15
16
constructor ( config ) {
@@ -20,6 +21,7 @@ class Client extends EventEmitter {
20
21
this . database = this . connectionParameters . database
21
22
this . port = this . connectionParameters . port
22
23
this . host = this . connectionParameters . host
24
+ this . principal = this . connectionParameters . principal
23
25
24
26
// "hiding" the password so it doesn't show up in stack traces
25
27
// or if the client is console.logged
@@ -204,8 +206,7 @@ class Client extends EventEmitter {
204
206
205
207
async _handleGSSInit ( msg ) {
206
208
try {
207
- // TODO: Below needs to be parameterized
208
- this . client = await kerberos . initializeClient ( '[email protected] ' , {
209
+ this . client = await kerberos . initializeClient ( `${ this . principal } @${ this . host } ` , {
209
210
mechOID : kerberos . GSS_MECH_OID_SPNEGO ,
210
211
} )
211
212
@@ -226,7 +227,7 @@ class Client extends EventEmitter {
226
227
227
228
// TODO: probably a better way to handle this.
228
229
if ( token == null ) {
229
- return
230
+ this . emit ( 'error' , 'Received null GSSAPI token on continue' )
230
231
}
231
232
const buf = Buffer . from ( token , 'base64' )
232
233
this . connection . sendBinaryPassword ( buf )
0 commit comments