#1 2021-12-02 12:23:58

juwo
Member
Registered: 2014-09-05
Posts: 21

Windows authentication 64bit

Hi,
I'm fighting with this problem:
Mormot1 sources from 25.11.2021.
Delphi Seattle.
Client server app (TSQLHttpClient) tested also locally (TSQLRestClientDB) with the same error
- on 32bit all works fine
- compiled to 64bit can't login with windows auth (via SetUser('','')).
When debugging (screenshots from my breakpoints):
- https://gyazo.com/3f5bbb2422c26828a0ec898318d4bd5a
- https://gyazo.com/2a7fa19ddfcfa03f80ac8e460b7cf53f
- error coming from F8 in function Base64ToBinSafe on last "End":
https://gyazo.com/1f3613f6f9515ed6ff04e3693b9b5105

I will be grateful for any hint.

Best Regards

Offline

#2 2021-12-02 13:05:43

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,657
Website

Re: Windows authentication 64bit

I am sorry, but I can't see the screenshots: the pages are void once loaded...
The JS of this website fails to load and initialize.
sad

Do you have any plain URI of the pictures to share?

Offline

#3 2021-12-02 13:20:46

juwo
Member
Registered: 2014-09-05
Posts: 21

Re: Windows authentication 64bit

Offline

#4 2021-12-02 21:03:14

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,657
Website

Re: Windows authentication 64bit

Is the base64 content really valid?

Could you paste it somewhere so that I could try to reproduce?

Offline

#5 2021-12-03 05:31:40

Chaa
Member
Registered: 2011-03-26
Posts: 249

Re: Windows authentication 64bit

There is a bug in SecDecrypt.

Documentation says that "encrypted message is decrypted in place, overwriting the original contents of its buffer" when we pass SECBUFFER_DATA. But we pass SECBUFFER_STREAM and empty SECBUFFER_DATA and expect that provider allocate memory for SECBUFFER_DATA. But it does not. So call to FreeContextBuffer fails.

I will investigate further and make a patch.

juwo, try remove line

FreeContextBuffer(InBuf[1].pvBuffer);

from the end of function SecDecrypt (SynSSPI.pas). This should solve your problem.

Online

#6 2021-12-03 07:23:58

Chaa
Member
Registered: 2011-03-26
Posts: 249

Re: Windows authentication 64bit

Online

#7 2021-12-03 08:25:20

juwo
Member
Registered: 2014-09-05
Posts: 21

Re: Windows authentication 64bit

Chaa wrote:

There is a bug in SecDecrypt.


juwo, try remove line

FreeContextBuffer(InBuf[1].pvBuffer);

from the end of function SecDecrypt (SynSSPI.pas). This should solve your problem.

Yes, this is it!
ab, Chaa, many, many thanks for help.

Special statement to ab:
i'm impressed what is going on in mormot world. Your (and other mormot devs) work, have a big impact on my professional live. I think not only my. So, thank you one more time (with small danation for today dinner smile ).

Last edited by juwo (2021-12-03 08:26:42)

Offline

#8 2021-12-03 09:30:48

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,657
Website

Re: Windows authentication 64bit

Nice catch.
I have merged it for both mORMot 1 and mORMot 2 (also affected).

And thanks for the nice feedback, juwo - even if there are bugs in our little mORMot!

Offline

Board footer

Powered by FluxBB