|
11 | 11 | *
|
12 | 12 | *
|
13 | 13 | * IDENTIFICATION
|
14 |
| - * $Header: /cvsroot/pgsql/src/backend/libpq/be-secure.c,v 1.39 2003/08/04 02:39:59 momjian Exp $ |
| 14 | + * $Header: /cvsroot/pgsql/src/backend/libpq/be-secure.c,v 1.40 2003/08/04 17:58:14 tgl Exp $ |
15 | 15 | *
|
16 | 16 | * Since the server static private key ($DataDir/server.key)
|
17 | 17 | * will normally be stored unencrypted so that the database
|
@@ -273,24 +273,28 @@ secure_read(Port *port, void *ptr, size_t len)
|
273 | 273 | (errcode_for_socket_access(),
|
274 | 274 | errmsg("SSL SYSCALL error: %m")));
|
275 | 275 | else
|
| 276 | + { |
276 | 277 | ereport(COMMERROR,
|
277 | 278 | (errcode(ERRCODE_PROTOCOL_VIOLATION),
|
278 | 279 | errmsg("SSL SYSCALL error: EOF detected")));
|
| 280 | + errno = ECONNRESET; |
| 281 | + n = -1; |
| 282 | + } |
279 | 283 | break;
|
280 | 284 | case SSL_ERROR_SSL:
|
281 | 285 | ereport(COMMERROR,
|
282 | 286 | (errcode(ERRCODE_PROTOCOL_VIOLATION),
|
283 | 287 | errmsg("SSL error: %s", SSLerrmessage())));
|
284 | 288 | /* fall through */
|
285 | 289 | case SSL_ERROR_ZERO_RETURN:
|
286 |
| - secure_close(port); |
287 | 290 | errno = ECONNRESET;
|
288 | 291 | n = -1;
|
289 | 292 | break;
|
290 | 293 | default:
|
291 | 294 | ereport(COMMERROR,
|
292 | 295 | (errcode(ERRCODE_PROTOCOL_VIOLATION),
|
293 | 296 | errmsg("unrecognized SSL error code")));
|
| 297 | + n = -1; |
294 | 298 | break;
|
295 | 299 | }
|
296 | 300 | }
|
@@ -353,24 +357,28 @@ secure_write(Port *port, void *ptr, size_t len)
|
353 | 357 | (errcode_for_socket_access(),
|
354 | 358 | errmsg("SSL SYSCALL error: %m")));
|
355 | 359 | else
|
| 360 | + { |
356 | 361 | ereport(COMMERROR,
|
357 | 362 | (errcode(ERRCODE_PROTOCOL_VIOLATION),
|
358 | 363 | errmsg("SSL SYSCALL error: EOF detected")));
|
| 364 | + errno = ECONNRESET; |
| 365 | + n = -1; |
| 366 | + } |
359 | 367 | break;
|
360 | 368 | case SSL_ERROR_SSL:
|
361 | 369 | ereport(COMMERROR,
|
362 | 370 | (errcode(ERRCODE_PROTOCOL_VIOLATION),
|
363 | 371 | errmsg("SSL error: %s", SSLerrmessage())));
|
364 | 372 | /* fall through */
|
365 | 373 | case SSL_ERROR_ZERO_RETURN:
|
366 |
| - secure_close(port); |
367 | 374 | errno = ECONNRESET;
|
368 | 375 | n = -1;
|
369 | 376 | break;
|
370 | 377 | default:
|
371 | 378 | ereport(COMMERROR,
|
372 | 379 | (errcode(ERRCODE_PROTOCOL_VIOLATION),
|
373 | 380 | errmsg("unrecognized SSL error code")));
|
| 381 | + n = -1; |
374 | 382 | break;
|
375 | 383 | }
|
376 | 384 | }
|
|
0 commit comments