Menu

#701 pywintypes.error: The function requested is not supported

v1.0 (example)
closed-invalid
nobody
None
5
2016-01-03
2015-09-04
Luke Lovett
No

Environment
Python 2.7.8
Windows 7
Visual Studio 2008
pywin32 219
kerberos_sspi 0.2

When calling "PyCtxHandleType.EncryptMessage", I get the an Exception like this:

Traceback (most recent call last):
  File "quicktest.py", line 14, in <module>
    source='$external')
  File "c:\users\luke\code\mongo-python-driver\pymongo\database.py", line 988, in authenticate
    connect=True)
  File "c:\users\luke\code\mongo-python-driver\pymongo\mongo_client.py", line 401, in _cache_credentials
    sock_info.authenticate(credentials)
  File "c:\users\luke\code\mongo-python-driver\pymongo\pool.py", line 291, in authenticate
    auth.authenticate(credentials, self)
  File "c:\users\luke\code\mongo-python-driver\pymongo\auth.py", line 422, in authenticate
    auth_func(credentials, sock_info)
  File "c:\users\luke\code\mongo-python-driver\pymongo\auth.py", line 316, in _authenticate_gssapi
    username) != 1:
  File "c:\Python27\lib\site-packages\kerberos_sspi.py", line 309, in authGSSClientWrap
    ca.ctxt.EncryptMessage(0,encbuf, ca._get_next_seq_num())
pywintypes.error: (-2146893054, 'EncryptMessage', 'The function requested is not supported')

I'm not entirely sure what the meaning is of this error message. The context in which this happens is when calling "authGSSClientWrap" while attempting to authenticate a user.

Nota Bene
I also filed issue #700, in which I document a segmentation fault in ~PySecBuffer. For the sake of experimentation, I commented-out the contents of ~PySecBuffer. Only after having made that change am I able to reproduce the above Exception, since I would have hit a segfault in a previous step. Of course, the segmentation fault might indicate a deeper problem which could also explain the behavior in this ticket.

Reproduction

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#!/usr/bin/python
import kerberos_sspi as kerberos

# SERVICE = xxx
# HOST = xxx
# USERNAME = xxx

def repro():
    result, ctx = kerberos.authGSSClientInit(
        SERVICE + '@' + HOST, gssflags=kerberos.GSS_C_MUTUAL_FLAG)
    kerberos.authGSSClientStep(ctx, '')
    payload = kerberos.authGSSClientResponse(ctx)
    # Create response to intitiate SASL conversation
    response = make_sasl_start_response(payload)
    # Enter loop to catch protocol/library issues
    for _ in range(10):
        result = kerberos.authGSSClientStep(ctx, str(response['payload']))
        payload = kerberos.authGSSClientResponse(ctx) or ''
        response = make_sasl_continue_response(payload)
        if kerberos.AUTH_GSS_COMPLETE == result:
            break
    else:
        raise Exception("auth failed")
    # This causes a segmentation fault (see issue #700). I commented-out the
    # code inside of ~PySecBuffer to get past this line for experimentation.
    kerberos.authGSSClientUnwrap(ctx, str(response['payload']))
    # This line raises the "pywintypes.error" Exception:
    kerberos.authGSSClientWrap(
        ctx, kerberos.authGSSClientReponse(ctx),
        USERNAME)

Discussion

  • james so

    james so - 2016-01-02

    Hi,
    can i up vote to get this one fixed? we want to use python, mongo, kerberos togather in windows.
    Regards
    James

     
  • Mark Hammond

    Mark Hammond - 2016-01-03
    • status: open --> closed-invalid
     
  • Mark Hammond

    Mark Hammond - 2016-01-03

    This error is SEC_E_UNSUPPORTED_FUNCTION and comes from Windows itself - I've no reason to believe it is a bug in pywin32.