mirror of
https://github.com/postgres/postgres.git
synced 2025-06-14 18:42:34 +03:00
Fix assorted minor bogosity in GSSAPI transport error messages.
I noted that some buildfarm members were complaining about %ld being used to format values that are (probably) declared size_t. Use %zu instead, and insert a cast just in case some versions of the GSSAPI API declare the length field differently. While at it, clean up gratuitous differences in wording of equivalent messages, show the complained-of length in all relevant messages not just some, include trailing newline where needed, adjust random deviations from project-standard code layout and message style, etc.
This commit is contained in:
@ -16,7 +16,6 @@
|
||||
#include "libpq-fe.h"
|
||||
#include "libpq-int.h"
|
||||
#include "fe-gssapi-common.h"
|
||||
|
||||
#include "port/pg_bswap.h"
|
||||
|
||||
/*
|
||||
@ -163,15 +162,16 @@ pg_GSS_write(PGconn *conn, const void *ptr, size_t len)
|
||||
}
|
||||
else if (conf == 0)
|
||||
{
|
||||
printfPQExpBuffer(&conn->errorMessage, libpq_gettext(
|
||||
"GSSAPI did not provide confidentiality\n"));
|
||||
printfPQExpBuffer(&conn->errorMessage,
|
||||
libpq_gettext("GSSAPI did not provide confidentiality\n"));
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
if (output.length > PQ_GSS_SEND_BUFFER_SIZE - sizeof(uint32))
|
||||
{
|
||||
printfPQExpBuffer(&conn->errorMessage, libpq_gettext(
|
||||
"GSSAPI attempt to send oversize packet\n"));
|
||||
printfPQExpBuffer(&conn->errorMessage,
|
||||
libpq_gettext("client tried to send oversize GSSAPI packet: %zu bytes\n"),
|
||||
(size_t) output.length);
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
@ -286,8 +286,8 @@ pg_GSS_read(PGconn *conn, void *ptr, size_t len)
|
||||
/* Check for over-length packet */
|
||||
if (input.length > PQ_GSS_RECV_BUFFER_SIZE - sizeof(uint32))
|
||||
{
|
||||
printfPQExpBuffer(&conn->errorMessage, libpq_gettext(
|
||||
"GSSAPI did not provide confidentiality\n"));
|
||||
printfPQExpBuffer(&conn->errorMessage,
|
||||
libpq_gettext("GSSAPI did not provide confidentiality\n"));
|
||||
ret = -1;
|
||||
goto cleanup;
|
||||
}
|
||||
@ -328,8 +328,8 @@ pg_GSS_read(PGconn *conn, void *ptr, size_t len)
|
||||
}
|
||||
else if (conf == 0)
|
||||
{
|
||||
printfPQExpBuffer(&conn->errorMessage, libpq_gettext(
|
||||
"GSSAPI did not provide confidentiality\n"));
|
||||
printfPQExpBuffer(&conn->errorMessage,
|
||||
libpq_gettext("GSSAPI did not provide confidentiality\n"));
|
||||
ret = -1;
|
||||
goto cleanup;
|
||||
}
|
||||
@ -476,7 +476,7 @@ pqsecure_open_gss(PGconn *conn)
|
||||
|
||||
PqGSSRecvLength += ret;
|
||||
|
||||
printfPQExpBuffer(&conn->errorMessage, "%s", PqGSSRecvBuffer + 1);
|
||||
printfPQExpBuffer(&conn->errorMessage, "%s\n", PqGSSRecvBuffer + 1);
|
||||
|
||||
return PGRES_POLLING_FAILED;
|
||||
}
|
||||
@ -490,7 +490,9 @@ pqsecure_open_gss(PGconn *conn)
|
||||
input.length = ntohl(*(uint32 *) PqGSSRecvBuffer);
|
||||
if (input.length > PQ_GSS_RECV_BUFFER_SIZE - sizeof(uint32))
|
||||
{
|
||||
printfPQExpBuffer(&conn->errorMessage, libpq_gettext("Over-size GSSAPI packet sent by the server: %ld"), input.length);
|
||||
printfPQExpBuffer(&conn->errorMessage,
|
||||
libpq_gettext("oversize GSSAPI packet sent by the server: %zu bytes\n"),
|
||||
(size_t) input.length);
|
||||
return PGRES_POLLING_FAILED;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user