Skip to content

Commit 32d5dce

Browse files
committed
Fix GSSAPI packet data
1 parent 881102c commit 32d5dce

2 files changed

Lines changed: 3 additions & 11 deletions

File tree

singlestoredb/mysql/_auth.py

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22
"""
33
Implements auth methods
44
"""
5-
import getpass
6-
75
from .err import OperationalError
86

97
try:
@@ -276,7 +274,7 @@ def caching_sha2_password_auth(conn, pkt):
276274
pkt = _roundtrip(conn, data)
277275

278276

279-
def gssapi_auth(user):
277+
def gssapi_auth(data):
280278
try:
281279
import gssapi.raw
282280
except ImportError:
@@ -285,13 +283,10 @@ def gssapi_auth(user):
285283
'installed for Kerberos authentication',
286284
)
287285

288-
if not user:
289-
user = getpass.getuser()
290-
291286
ctx = None
292287
try:
293288
ctx = gssapi.raw.init_sec_context(
294-
gssapi.raw.import_name(user, gssapi.raw.NameType.user),
289+
gssapi.raw.import_name(data, gssapi.raw.NameType.user),
295290
flags=[0], lifetime=0,
296291
)
297292
return ctx.token

singlestoredb/mysql/connection.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1111,9 +1111,6 @@ def _request_authentication(self): # noqa: C901
11111111
authresp = b'\1' # request public key
11121112
else:
11131113
authresp = b'\0' # empty password
1114-
elif self._auth_plugin_name == b'auth_gssapi_client':
1115-
plugin_name = b'auth_gssapi_client'
1116-
authresp = _auth.gssapi_auth(self.user)
11171114

11181115
if self.server_capabilities & CLIENT.PLUGIN_AUTH_LENENC_CLIENT_DATA:
11191116
data += _lenenc_int(len(authresp)) + authresp
@@ -1203,7 +1200,7 @@ def _process_auth(self, plugin_name, auth_packet):
12031200
# https://dev.mysql.com/doc/internals/en/clear-text-authentication.html
12041201
data = self.password + b'\0'
12051202
elif plugin_name == b'auth_gssapi_client':
1206-
data = _auth.gssapi_auth(self.user)
1203+
data = _auth.gssapi_auth(auth_packet.read_all())
12071204
elif plugin_name == b'dialog':
12081205
pkt = auth_packet
12091206
while True:

0 commit comments

Comments
 (0)