Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-114566

Microsoft Negotiate Handshake terminated too early

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • P2: Important
    • None
    • 6.5.0
    • None
    • Visual Studio Professional V17.6.1
      Windows 10
    • Windows

    Description

      I am using QAuthenticator for Negotiate Authentication in a client application. To enable Kerberos authentication, I set the UPN (User Principle Name) before the handshake. But the conversation with the server is terminated by QAuthenticator before it is completed.

      The issue lies in the way, QAuthenticator determines the end of the Server-Client-Handshake in the file "qauthenticator.cpp". When using the Windows-Function 'InitializeSecurityContext' in line 1670, the return status is processed, but incorrectly. Like the Documentation in...

      https://learn.microsoft.com/en-us/windows/win32/api/sspi/nf-sspi-initializesecuritycontextw

      ...suggests, the handshake has completed successfully, when neither 
      'SEC_I_CONTINUE_NEEDED', nor 'SEC_I_COMPLETE_AND_CONTINUE' are true (See attached: Return_Values.png).
       
      Then and only then should the code determine, the Conversation is done. However these return parameters are not correctly processed.

      To fix this issue, an if-statement is added in line 1693 of 'qSspiContinue' method that checks, if the handshake is complete. In order to process the Boolean outside of the method, the 'qSspiContinue' method is now of type QPair as a makeshift solution. This results in several changes all over the file (See attached "code_changes.pdf").

      A working solution is attached ("qauthenticator_mod.cpp").

      Thank you for addressing this issue.

      Sincerely,

      Emil Wipplinger

      Attachments

        1. code_changes.pdf
          568 kB
        2. qauthenticator_mod.cpp
          57 kB
        3. return_values.png
          return_values.png
          141 kB
        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            manordheim Mårten Nordheim
            codemil Emil Wipplinger
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes