提交 0886dde5 编写于 作者: M Magnus Hagander

Fix SSPI login when multiple roundtrips are required

This fixes SSPI login failures showing "The function
requested is not supported", often showing up when connecting
to localhost. The reason was not properly updating the SSPI
handle when multiple roundtrips were required to complete the
authentication sequence.

Report and analysis by Ahmed Shinwari, patch by Magnus Hagander
上级 d71197cd
......@@ -1349,16 +1349,22 @@ pg_SSPI_recvauth(Port *port)
_("could not accept SSPI security context"), r);
}
/*
* Overwrite the current context with the one we just received.
* If sspictx is NULL it was the first loop and we need to allocate
* a buffer for it. On subsequent runs, we can just overwrite the
* buffer contents since the size does not change.
*/
if (sspictx == NULL)
{
sspictx = malloc(sizeof(CtxtHandle));
if (sspictx == NULL)
ereport(ERROR,
(errmsg("out of memory")));
memcpy(sspictx, &newctx, sizeof(CtxtHandle));
}
memcpy(sspictx, &newctx, sizeof(CtxtHandle));
if (r == SEC_I_CONTINUE_NEEDED)
elog(DEBUG4, "SSPI continue needed");
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册