summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMagnus Hagander2007-12-04 13:02:53 +0000
committerMagnus Hagander2007-12-04 13:02:53 +0000
commit3fba65ca33814bb71aa3c4b5591dffcdab22ac77 (patch)
tree799fd2ad9dd5a86bbe784795edbd8a3ed9e9787b
parenta19431f03d761d27c4c675559ed487d46eb96d59 (diff)
Don't send an empty SSPI negotiation packet at the end of the negotiation.
Fixes bug #3750
-rw-r--r--src/interfaces/libpq/fe-auth.c15
1 files changed, 11 insertions, 4 deletions
diff --git a/src/interfaces/libpq/fe-auth.c b/src/interfaces/libpq/fe-auth.c
index 14124623ed..fd6684bae7 100644
--- a/src/interfaces/libpq/fe-auth.c
+++ b/src/interfaces/libpq/fe-auth.c
@@ -618,11 +618,18 @@ pg_SSPI_continue(PGconn *conn)
return STATUS_ERROR;
}
- if (pqPacketSend(conn, 'p',
- outbuf.pBuffers[0].pvBuffer, outbuf.pBuffers[0].cbBuffer))
+ /*
+ * If the negotiation is complete, there may be zero bytes to send. The server is
+ * at this point not expecting any more data, so don't send it.
+ */
+ if (outbuf.pBuffers[0].cbBuffer > 0)
{
- FreeContextBuffer(outbuf.pBuffers[0].pvBuffer);
- return STATUS_ERROR;
+ if (pqPacketSend(conn, 'p',
+ outbuf.pBuffers[0].pvBuffer, outbuf.pBuffers[0].cbBuffer))
+ {
+ FreeContextBuffer(outbuf.pBuffers[0].pvBuffer);
+ return STATUS_ERROR;
+ }
}
FreeContextBuffer(outbuf.pBuffers[0].pvBuffer);
}