aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMagnus Hagander <magnus@hagander.net>2007-12-04 13:02:53 +0000
committerMagnus Hagander <magnus@hagander.net>2007-12-04 13:02:53 +0000
commit024014a448518408dd66ed33351e8a896835fb1f (patch)
treefc0d5b908f512193d716bfc351b93c329fe6ce35 /src
parent4c128303e0097096735ed461b194e76702a46ae2 (diff)
downloadpostgresql-024014a448518408dd66ed33351e8a896835fb1f.tar.gz
postgresql-024014a448518408dd66ed33351e8a896835fb1f.zip
Don't send an empty SSPI negotiation packet at the end of the negotiation.
Fixes bug #3750
Diffstat (limited to 'src')
-rw-r--r--src/interfaces/libpq/fe-auth.c17
1 files changed, 12 insertions, 5 deletions
diff --git a/src/interfaces/libpq/fe-auth.c b/src/interfaces/libpq/fe-auth.c
index 38cae4de917..f3a177c985e 100644
--- a/src/interfaces/libpq/fe-auth.c
+++ b/src/interfaces/libpq/fe-auth.c
@@ -7,7 +7,7 @@
* Portions Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/interfaces/libpq/fe-auth.c,v 1.133 2007/11/15 21:14:46 momjian Exp $
+ * $PostgreSQL: pgsql/src/interfaces/libpq/fe-auth.c,v 1.134 2007/12/04 13:02:53 mha Exp $
*
*-------------------------------------------------------------------------
*/
@@ -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);
}