|
14 | 14 |
|
15 | 15 | #include "postgres.h"
|
16 | 16 |
|
17 |
| -#include "be-gssapi-common.h" |
| 17 | +#include <unistd.h> |
18 | 18 |
|
| 19 | +#include "be-gssapi-common.h" |
19 | 20 | #include "libpq/auth.h"
|
20 | 21 | #include "libpq/libpq.h"
|
21 | 22 | #include "libpq/libpq-be.h"
|
22 | 23 | #include "libpq/pqformat.h"
|
23 | 24 | #include "miscadmin.h"
|
24 | 25 | #include "pgstat.h"
|
25 | 26 |
|
26 |
| -#include <unistd.h> |
27 |
| - |
28 | 27 |
|
29 | 28 | /*
|
30 | 29 | * Handle the encryption/decryption of data using GSSAPI.
|
@@ -179,10 +178,13 @@ be_gssapi_write(Port *port, void *ptr, size_t len)
|
179 | 178 | pg_GSS_error(FATAL, gettext_noop("GSSAPI wrap error"), major, minor);
|
180 | 179 |
|
181 | 180 | if (conf == 0)
|
182 |
| - ereport(FATAL, (errmsg("GSSAPI did not provide confidentiality"))); |
| 181 | + ereport(FATAL, |
| 182 | + (errmsg("GSSAPI did not provide confidentiality"))); |
183 | 183 |
|
184 | 184 | if (output.length > PQ_GSS_SEND_BUFFER_SIZE - sizeof(uint32))
|
185 |
| - ereport(FATAL, (errmsg("GSSAPI tried to send packet of size: %ld", output.length))); |
| 185 | + ereport(FATAL, |
| 186 | + (errmsg("server tried to send oversize GSSAPI packet: %zu bytes", |
| 187 | + (size_t) output.length))); |
186 | 188 |
|
187 | 189 | bytes_encrypted += input.length;
|
188 | 190 | bytes_to_encrypt -= input.length;
|
@@ -297,7 +299,9 @@ be_gssapi_read(Port *port, void *ptr, size_t len)
|
297 | 299 |
|
298 | 300 | /* Check for over-length packet */
|
299 | 301 | if (input.length > PQ_GSS_RECV_BUFFER_SIZE - sizeof(uint32))
|
300 |
| - ereport(FATAL, (errmsg("Over-size GSSAPI packet sent by the client."))); |
| 302 | + ereport(FATAL, |
| 303 | + (errmsg("oversize GSSAPI packet sent by the client: %zu bytes", |
| 304 | + (size_t) input.length))); |
301 | 305 |
|
302 | 306 | /*
|
303 | 307 | * Read as much of the packet as we are able to on this call into
|
@@ -341,7 +345,8 @@ be_gssapi_read(Port *port, void *ptr, size_t len)
|
341 | 345 | major, minor);
|
342 | 346 |
|
343 | 347 | if (conf == 0)
|
344 |
| - ereport(FATAL, (errmsg("GSSAPI did not provide confidentiality"))); |
| 348 | + ereport(FATAL, |
| 349 | + (errmsg("GSSAPI did not provide confidentiality"))); |
345 | 350 |
|
346 | 351 | memcpy(PqGSSResultBuffer, output.value, output.length);
|
347 | 352 |
|
@@ -492,7 +497,9 @@ secure_open_gssapi(Port *port)
|
492 | 497 | * Verify on our side that the client doesn't do something funny.
|
493 | 498 | */
|
494 | 499 | if (input.length > PQ_GSS_RECV_BUFFER_SIZE)
|
495 |
| - ereport(FATAL, (errmsg("Over-size GSSAPI packet sent by the client: %ld", input.length))); |
| 500 | + ereport(FATAL, |
| 501 | + (errmsg("oversize GSSAPI packet sent by the client: %zu bytes", |
| 502 | + (size_t) input.length))); |
496 | 503 |
|
497 | 504 | /*
|
498 | 505 | * Get the rest of the packet so we can pass it to GSSAPI to accept
|
@@ -538,7 +545,9 @@ secure_open_gssapi(Port *port)
|
538 | 545 | uint32 netlen = htonl(output.length);
|
539 | 546 |
|
540 | 547 | if (output.length > PQ_GSS_SEND_BUFFER_SIZE - sizeof(uint32))
|
541 |
| - ereport(FATAL, (errmsg("GSSAPI tried to send oversize packet"))); |
| 548 | + ereport(FATAL, |
| 549 | + (errmsg("server tried to send oversize GSSAPI packet: %zu bytes", |
| 550 | + (size_t) output.length))); |
542 | 551 |
|
543 | 552 | memcpy(PqGSSSendBuffer, (char *) &netlen, sizeof(uint32));
|
544 | 553 | PqGSSSendPointer += sizeof(uint32);
|
|
0 commit comments