File tree Expand file tree Collapse file tree 1 file changed +14
-7
lines changed Expand file tree Collapse file tree 1 file changed +14
-7
lines changed Original file line number Diff line number Diff line change @@ -7,6 +7,7 @@ import type { Document } from '../../bson';
77type MechanismProperties = {
88 gssapiCanonicalizeHostName ?: boolean ;
99 SERVICE_NAME ?: string ;
10+ SERVICE_REALM ?: string ;
1011} ;
1112
1213import * as dns from 'dns' ;
@@ -90,14 +91,20 @@ function makeKerberosClient(authContext: AuthContext, callback: Callback<Kerbero
9091 Object . assign ( initOptions , { user : username , password : password } ) ;
9192 }
9293
93- initializeClient (
94- `${ serviceName } ${ process . platform === 'win32' ? '/' : '@' } ${ host } ` ,
95- initOptions ,
96- ( err : string , client : KerberosClient ) : void => {
97- if ( err ) return callback ( new MongoDriverError ( err ) ) ;
98- callback ( undefined , client ) ;
94+ let spn : string ;
95+ if ( process . platform === 'win32' ) {
96+ spn = `${ serviceName } /${ host } ` ;
97+ if ( 'SERVICE_REALM' in mechanismProperties ) {
98+ spn = `${ spn } @${ mechanismProperties . SERVICE_REALM } ` ;
9999 }
100- ) ;
100+ } else {
101+ spn = `${ serviceName } @${ host } ` ;
102+ }
103+
104+ initializeClient ( spn , initOptions , ( err : string , client : KerberosClient ) : void => {
105+ if ( err ) return callback ( new MongoDriverError ( err ) ) ;
106+ callback ( undefined , client ) ;
107+ } ) ;
101108 }
102109 ) ;
103110}
You can’t perform that action at this time.
0 commit comments