MCPcopy Create free account
hub / github.com/apache/cloudberry / gss_read

Function gss_read

src/interfaces/libpq/fe-secure-gssapi.c:442–478  ·  view source on GitHub ↗

* Simple wrapper for reading from pqsecure_raw_read. * * This takes the same arguments as pqsecure_raw_read, plus an output parameter * to return the number of bytes read. This handles if blocking would occur and * if we detect EOF on the connection. */

Source from the content-addressed store, hash-verified

440 * if we detect EOF on the connection.
441 */
442static PostgresPollingStatusType
443gss_read(PGconn *conn, void *recv_buffer, size_t length, ssize_t *ret)
444{
445 *ret = pqsecure_raw_read(conn, recv_buffer, length);
446 if (*ret < 0)
447 {
448 if (errno == EAGAIN || errno == EWOULDBLOCK || errno == EINTR)
449 return PGRES_POLLING_READING;
450 else
451 return PGRES_POLLING_FAILED;
452 }
453
454 /* Check for EOF */
455 if (*ret == 0)
456 {
457 int result = pqReadReady(conn);
458
459 if (result < 0)
460 return PGRES_POLLING_FAILED;
461
462 if (!result)
463 return PGRES_POLLING_READING;
464
465 *ret = pqsecure_raw_read(conn, recv_buffer, length);
466 if (*ret < 0)
467 {
468 if (errno == EAGAIN || errno == EWOULDBLOCK || errno == EINTR)
469 return PGRES_POLLING_READING;
470 else
471 return PGRES_POLLING_FAILED;
472 }
473 if (*ret == 0)
474 return PGRES_POLLING_FAILED;
475 }
476
477 return PGRES_POLLING_OK;
478}
479
480/*
481 * Negotiate GSSAPI transport for a connection. When complete, returns

Callers 1

pqsecure_open_gssFunction · 0.85

Calls 2

pqsecure_raw_readFunction · 0.85
pqReadReadyFunction · 0.85

Tested by

no test coverage detected