libpq-sasl-cleanup.patch
application/octet-stream
Filename: libpq-sasl-cleanup.patch
Type: application/octet-stream
Part: 0
Patch
Format: unified
| File | + | − |
|---|---|---|
| src/interfaces/libpq/fe-connect.c | 10 | 9 |
diff --git a/src/interfaces/libpq/fe-connect.c b/src/interfaces/libpq/fe-connect.c
index f2c9bf7a88..0fab50ff07 100644
--- a/src/interfaces/libpq/fe-connect.c
+++ b/src/interfaces/libpq/fe-connect.c
@@ -413,6 +413,16 @@ pqDropConnection(PGconn *conn, bool flushInput)
/* Optionally discard any unread data */
if (flushInput)
conn->inStart = conn->inCursor = conn->inEnd = 0;
+ /* Discard authentication states */
+ if (conn->sasl_state)
+ {
+ /*
+ * XXX: if support for more authentication mechanisms is added, this
+ * needs to call the right 'free' function.
+ */
+ pg_fe_scram_free(conn->sasl_state);
+ conn->sasl_state = NULL;
+ }
/* Always discard any unsent data */
conn->outCount = 0;
}
@@ -3502,15 +3512,6 @@ closePGconn(PGconn *conn)
conn->sspictx = NULL;
}
#endif
- if (conn->sasl_state)
- {
- /*
- * XXX: if support for more authentication mechanisms is added, this
- * needs to call the right 'free' function.
- */
- pg_fe_scram_free(conn->sasl_state);
- conn->sasl_state = NULL;
- }
}
/*