/* * GSSAPI errors contain two parts; put both into conn->errorMessage. */ static void pg_GSS_error(const char *mprefix, PGconn *conn, OM_uint32 maj_stat, OM_uint32 min_stat) { resetPQExpBuffer(&conn->errorMessage); /* Fetch major error codes */ pg_GSS_error_int(&conn->errorMessage, mprefix, maj_stat, GSS_C_GSS_CODE); /* Add the minor codes as well */ pg_GSS_error_int(&conn->errorMessage, mprefix, min_stat, GSS_C_MECH_CODE); }
/* * Fetch and report all error messages from GSSAPI. To avoid allocation, * total error size is capped (at 128 bytes for each of major and minor). No * known mechanisms will produce error messages beyond this cap. */ void pg_GSS_error(int severity, const char *errmsg, OM_uint32 maj_stat, OM_uint32 min_stat) { char msg_major[128], msg_minor[128]; /* Fetch major status message */ pg_GSS_error_int(msg_major, sizeof(msg_major), maj_stat, GSS_C_GSS_CODE); /* Fetch mechanism minor status message */ pg_GSS_error_int(msg_minor, sizeof(msg_minor), min_stat, GSS_C_MECH_CODE); /* * errmsg_internal, since translation of the first part must be done * before calling this function anyway. */ ereport(severity, (errmsg_internal("%s", errmsg), errdetail_internal("%s: %s", msg_major, msg_minor))); }