22#if defined(HAVE_SYS_EPOLL_H)
24#include <sys/timerfd.h>
25#elif defined(HAVE_SYS_EVENT_H)
28#error libpq-oauth is not supported on this platform
36#ifdef USE_DYNAMIC_OAUTH
53#define conn_errorMessage(CONN) (&CONN->errorMessage)
54#define conn_oauth_client_id(CONN) (CONN->oauth_client_id)
55#define conn_oauth_client_secret(CONN) (CONN->oauth_client_secret)
56#define conn_oauth_discovery_uri(CONN) (CONN->oauth_discovery_uri)
57#define conn_oauth_issuer_id(CONN) (CONN->oauth_issuer_id)
58#define conn_oauth_scope(CONN) (CONN->oauth_scope)
59#define conn_sasl_state(CONN) (CONN->sasl_state)
61#define set_conn_altsock(CONN, VAL) do { CONN->altsock = VAL; } while (0)
62#define set_conn_oauth_token(CONN, VAL) do { CONN->oauth_token = VAL; } while (0)
67#if defined(USE_DYNAMIC_OAUTH) && defined(LIBPQ_INT_H)
68#error do not rely on libpq-int.h in dynamic builds of libpq-oauth
83#define MAX_OAUTH_RESPONSE_SIZE (256 * 1024)
288 CURLMcode
err = curl_multi_remove_handle(actx->
curlm, actx->
curl);
292 "libcurl easy handle removal failed: %s",
293 curl_multi_strerror(
err));
303 curl_easy_cleanup(actx->
curl);
308 CURLMcode
err = curl_multi_cleanup(actx->
curlm);
312 "libcurl multi handle cleanup failed: %s",
313 curl_multi_strerror(
err));
319 curl_slist_free_all(actx->
headers);
344 if (
state->async_ctx)
347 state->async_ctx = NULL;
359#define actx_error(ACTX, FMT, ...) \
360 appendPQExpBuffer(&(ACTX)->errbuf, libpq_gettext(FMT), ##__VA_ARGS__)
362#define actx_error_str(ACTX, S) \
363 appendPQExpBufferStr(&(ACTX)->errbuf, S)
370#define CHECK_MSETOPT(ACTX, OPT, VAL, FAILACTION) \
372 struct async_ctx *_actx = (ACTX); \
373 CURLMcode _setopterr = curl_multi_setopt(_actx->curlm, OPT, VAL); \
375 actx_error(_actx, "failed to set %s on OAuth connection: %s",\
376 #OPT, curl_multi_strerror(_setopterr)); \
381#define CHECK_SETOPT(ACTX, OPT, VAL, FAILACTION) \
383 struct async_ctx *_actx = (ACTX); \
384 CURLcode _setopterr = curl_easy_setopt(_actx->curl, OPT, VAL); \
386 actx_error(_actx, "failed to set %s on OAuth connection: %s",\
387 #OPT, curl_easy_strerror(_setopterr)); \
392#define CHECK_GETINFO(ACTX, INFO, OUT, FAILACTION) \
394 struct async_ctx *_actx = (ACTX); \
395 CURLcode _getinfoerr = curl_easy_getinfo(_actx->curl, INFO, OUT); \
397 actx_error(_actx, "failed to get %s from OAuth response: %s",\
398 #INFO, curl_easy_strerror(_getinfoerr)); \
433#define PG_OAUTH_REQUIRED true
434#define PG_OAUTH_OPTIONAL false
446#define oauth_parse_set_error(ctx, fmt, ...) \
447 appendPQExpBuffer((ctx)->errbuf, libpq_gettext(fmt), ##__VA_ARGS__)
463 msgfmt =
"field \"%s\" must be a string";
467 msgfmt =
"field \"%s\" must be a number";
471 msgfmt =
"field \"%s\" must be an array of strings";
476 msgfmt =
"field \"%s\" has unexpected type";
519 "internal error: started field '%s' before field '%s' was finished",
571 "internal error: field '%s' still active at end of object",
621 "internal error: found unexpected array end while parsing field '%s'",
663 if (
type != expected)
676 "internal error: scalar target found at nesting level %d",
686 "internal error: scalar field '%s' would be assigned twice",
701 struct curl_slist *temp;
708 "internal error: array member found at nesting level %d",
736 const size_t type_len = strlen(
type);
739 CHECK_GETINFO(actx, CURLINFO_CONTENT_TYPE, &content_type,
return false);
743 actx_error(actx,
"no content type was provided");
755 Assert(strlen(content_type) >= type_len);
756 if (content_type[type_len] ==
'\0')
764 for (
size_t i = type_len; content_type[
i]; ++
i)
766 switch (content_type[
i])
782 actx_error(actx,
"unexpected content type: \"%s\"", content_type);
805 if (strlen(resp->
data) != resp->
len)
807 actx_error(actx,
"response contains embedded NULLs");
817 actx_error(actx,
"response is not valid UTF-8");
920 cnt = sscanf(s,
"%lf", &parsed);
951 parsed = ceil(parsed);
956 else if (parsed >= INT_MAX)
977 parsed = floor(parsed);
979 if (parsed >= INT_MAX)
981 else if (parsed <= INT_MIN)
1063 actx->
errctx =
"failed to parse token error response";
1075 if (
err->error_description)
1086 CHECK_GETINFO(actx, CURLINFO_RESPONSE_CODE, &response_code, response_code = 0);
1088 if (response_code == 401)
1091 ?
"provider rejected the oauth_client_secret"
1092 :
"provider requires client authentication, and no oauth_client_secret is set");
1149#if defined(HAVE_SYS_EPOLL_H)
1150 struct epoll_event ev = {.events = EPOLLIN};
1152 actx->
mux = epoll_create1(EPOLL_CLOEXEC);
1155 actx_error(actx,
"failed to create epoll set: %m");
1159 actx->
timerfd = timerfd_create(CLOCK_MONOTONIC, TFD_CLOEXEC);
1162 actx_error(actx,
"failed to create timerfd: %m");
1166 if (epoll_ctl(actx->
mux, EPOLL_CTL_ADD, actx->
timerfd, &ev) < 0)
1168 actx_error(actx,
"failed to add timerfd to epoll set: %m");
1173#elif defined(HAVE_SYS_EVENT_H)
1174 actx->
mux = kqueue();
1178 actx_error(actx,
"failed to create kqueue: %m");
1191 actx_error(actx,
"failed to create timer kqueue: %m");
1197#error setup_multiplexer is not implemented on this platform
1211#if defined(HAVE_SYS_EPOLL_H)
1212 struct epoll_event ev = {0};
1214 int op = EPOLL_CTL_ADD;
1219 ev.events = EPOLLIN;
1223 ev.events = EPOLLOUT;
1226 case CURL_POLL_INOUT:
1227 ev.events = EPOLLIN | EPOLLOUT;
1230 case CURL_POLL_REMOVE:
1235 actx_error(actx,
"unknown libcurl socket operation: %d", what);
1239 res = epoll_ctl(actx->
mux, op,
socket, &ev);
1240 if (res < 0 && errno == EEXIST)
1244 res = epoll_ctl(actx->
mux, op,
socket, &ev);
1252 actx_error(actx,
"could not add to epoll set: %m");
1256 actx_error(actx,
"could not delete from epoll set: %m");
1260 actx_error(actx,
"could not update epoll set: %m");
1267#elif defined(HAVE_SYS_EVENT_H)
1268 struct kevent ev[2] = {0};
1269 struct kevent ev_out[2];
1270 struct timespec timeout = {0};
1277 EV_SET(&ev[nev],
socket, EVFILT_READ, EV_ADD | EV_RECEIPT, 0, 0, 0);
1282 EV_SET(&ev[nev],
socket, EVFILT_WRITE, EV_ADD | EV_RECEIPT, 0, 0, 0);
1286 case CURL_POLL_INOUT:
1287 EV_SET(&ev[nev],
socket, EVFILT_READ, EV_ADD | EV_RECEIPT, 0, 0, 0);
1289 EV_SET(&ev[nev],
socket, EVFILT_WRITE, EV_ADD | EV_RECEIPT, 0, 0, 0);
1293 case CURL_POLL_REMOVE:
1300 EV_SET(&ev[nev],
socket, EVFILT_READ, EV_DELETE | EV_RECEIPT, 0, 0, 0);
1302 EV_SET(&ev[nev],
socket, EVFILT_WRITE, EV_DELETE | EV_RECEIPT, 0, 0, 0);
1307 actx_error(actx,
"unknown libcurl socket operation: %d", what);
1311 res = kevent(actx->
mux, ev, nev, ev_out,
lengthof(ev_out), &timeout);
1314 actx_error(actx,
"could not modify kqueue: %m");
1323 for (
int i = 0;
i < res; ++
i)
1330 Assert(ev_out[
i].flags & EV_ERROR);
1332 errno = ev_out[
i].data;
1333 if (errno && errno != ENOENT)
1337 case CURL_POLL_REMOVE:
1338 actx_error(actx,
"could not delete from kqueue: %m");
1341 actx_error(actx,
"could not add to kqueue: %m");
1349#error register_socket is not implemented on this platform
1369#if defined(HAVE_SYS_EPOLL_H)
1370 struct itimerspec spec = {0};
1376 else if (timeout == 0)
1383 spec.it_value.tv_nsec = 1;
1387 spec.it_value.tv_sec = timeout / 1000;
1388 spec.it_value.tv_nsec = (timeout % 1000) * 1000000;
1391 if (timerfd_settime(actx->
timerfd, 0 , &spec, NULL) < 0)
1393 actx_error(actx,
"setting timerfd to %ld: %m", timeout);
1398#elif defined(HAVE_SYS_EVENT_H)
1420 EV_SET(&ev, 1, EVFILT_TIMER, EV_DELETE, 0, 0, 0);
1421 if (kevent(actx->
timerfd, &ev, 1, NULL, 0, NULL) < 0 && errno != ENOENT)
1423 actx_error(actx,
"deleting kqueue timer: %m");
1427 EV_SET(&ev, actx->
timerfd, EVFILT_READ, EV_DELETE, 0, 0, 0);
1428 if (kevent(actx->
mux, &ev, 1, NULL, 0, NULL) < 0 && errno != ENOENT)
1430 actx_error(actx,
"removing kqueue timer from multiplexer: %m");
1438 EV_SET(&ev, 1, EVFILT_TIMER, (EV_ADD | EV_ONESHOT), 0, timeout, 0);
1439 if (kevent(actx->
timerfd, &ev, 1, NULL, 0, NULL) < 0)
1441 actx_error(actx,
"setting kqueue timer to %ld: %m", timeout);
1445 EV_SET(&ev, actx->
timerfd, EVFILT_READ, EV_ADD, 0, 0, 0);
1446 if (kevent(actx->
mux, &ev, 1, NULL, 0, NULL) < 0)
1448 actx_error(actx,
"adding kqueue timer to multiplexer: %m");
1454#error set_timer is not implemented on this platform
1466#if defined(HAVE_SYS_EPOLL_H)
1467 struct itimerspec spec = {0};
1469 if (timerfd_gettime(actx->
timerfd, &spec) < 0)
1471 actx_error(actx,
"getting timerfd value: %m");
1480 Assert(spec.it_interval.tv_sec == 0
1481 && spec.it_interval.tv_nsec == 0);
1484 return (spec.it_value.tv_sec == 0
1485 && spec.it_value.tv_nsec == 0);
1486#elif defined(HAVE_SYS_EVENT_H)
1493 actx_error(actx,
"checking kqueue for timeout: %m");
1499#error timer_expired is not implemented on this platform
1536 bool printed_prefix =
false;
1546 case CURLINFO_HEADER_IN:
1547 case CURLINFO_DATA_IN:
1551 case CURLINFO_HEADER_OUT:
1552 case CURLINFO_DATA_OUT:
1567 for (
int i = 0;
i < size;
i++)
1571 if (!printed_prefix)
1574 printed_prefix =
true;
1577 if (
c >= 0x20 &&
c <= 0x7E)
1579 else if ((
type == CURLINFO_HEADER_IN
1580 ||
type == CURLINFO_HEADER_OUT
1581 ||
type == CURLINFO_TEXT)
1582 && (
c ==
'\r' ||
c ==
'\n'))
1595 printed_prefix =
false;
1621 actx->
curlm = curl_multi_init();
1625 actx_error(actx,
"failed to create libcurl multi handle");
1634 CHECK_MSETOPT(actx, CURLMOPT_SOCKETDATA, actx,
return false);
1636 CHECK_MSETOPT(actx, CURLMOPT_TIMERDATA, actx,
return false);
1642 actx->
curl = curl_easy_init();
1645 actx_error(actx,
"failed to create libcurl handle");
1664 CHECK_SETOPT(actx, CURLOPT_NOSIGNAL, 1L,
return false);
1688#if CURL_AT_LEAST_VERSION(7, 85, 0)
1689 const CURLoption popt = CURLOPT_PROTOCOLS_STR;
1690 const char *protos =
"https";
1691 const char *
const unsafe =
"https,http";
1693 const CURLoption popt = CURLOPT_PROTOCOLS;
1694 long protos = CURLPROTO_HTTPS;
1695 const long unsafe = CURLPROTO_HTTPS | CURLPROTO_HTTP;
1716 if ((env = getenv(
"PGOAUTHCAFILE")) != NULL)
1752 size_t len = size * nmemb;
1794 CHECK_SETOPT(actx, CURLOPT_WRITEDATA, actx,
return false);
1799 actx_error(actx,
"failed to queue HTTP request: %s",
1800 curl_multi_strerror(
err));
1813 err = curl_multi_socket_action(actx->
curlm, CURL_SOCKET_TIMEOUT, 0, &actx->
running);
1816 actx_error(actx,
"asynchronous HTTP request failed: %s",
1817 curl_multi_strerror(
err));
1828#ifndef CURL_IGNORE_DEPRECATION
1829#define CURL_IGNORE_DEPRECATION(x) x
1869 actx_error(actx,
"asynchronous HTTP request failed: %s",
1870 curl_multi_strerror(
err));
1882 while ((msg = curl_multi_info_read(actx->
curlm, &msgs_left)) != NULL)
1884 if (msg->msg != CURLMSG_DONE)
1894 if (msg->data.result != CURLE_OK)
1907 err = curl_multi_remove_handle(actx->
curlm, msg->easy_handle);
1910 actx_error(actx,
"libcurl easy handle removal failed: %s",
1911 curl_multi_strerror(
err));
1921 actx_error(actx,
"no result was retrieved for the finished handle");
1944 escaped = curl_easy_escape(NULL, s, 0);
1959 while ((match = strstr(haystack,
"%20")) != NULL)
1966 haystack = match + 3 ;
2027 CHECK_SETOPT(actx, CURLOPT_URL, discovery_uri,
return false);
2050 CHECK_GETINFO(actx, CURLINFO_RESPONSE_CODE, &response_code,
return false);
2052 if (response_code != 200)
2054 actx_error(actx,
"unexpected response code %ld", response_code);
2061 actx->
errctx =
"failed to parse OpenID discovery document";
2075 temp = curl_slist_append(temp,
"authorization_code");
2078 temp = curl_slist_append(temp,
"implicit");
2126 "the issuer identifier (%s) does not match oauth_issuer (%s)",
2134#define HTTPS_SCHEME "https://"
2135#define OAUTH_GRANT_TYPE_DEVICE_CODE "urn:ietf:params:oauth:grant-type:device_code"
2153 "issuer \"%s\" does not provide a device authorization endpoint",
2179 "device authorization endpoint \"%s\" must use HTTPS",
2188 "token endpoint \"%s\" must use HTTPS",
2211 if (oauth_client_secret)
2293 Assert(device_authz_uri);
2297 if (oauth_scope && oauth_scope[0])
2310 CHECK_SETOPT(actx, CURLOPT_URL, device_authz_uri,
return false);
2311 CHECK_SETOPT(actx, CURLOPT_COPYPOSTFIELDS, work_buffer->
data,
return false);
2321 CHECK_GETINFO(actx, CURLINFO_RESPONSE_CODE, &response_code,
return false);
2327 if (response_code == 200)
2329 actx->
errctx =
"failed to parse device authorization";
2342 if (response_code == 400 || response_code == 401)
2360 actx_error(actx,
"unexpected response code %ld", response_code);
2399 CHECK_SETOPT(actx, CURLOPT_URL, token_uri,
return false);
2400 CHECK_SETOPT(actx, CURLOPT_COPYPOSTFIELDS, work_buffer->
data,
return false);
2410 CHECK_GETINFO(actx, CURLINFO_RESPONSE_CODE, &response_code,
return false);
2415 if (response_code == 200)
2417 actx->
errctx =
"failed to parse access token response";
2430 if (response_code == 400 || response_code == 401)
2439 actx_error(actx,
"unexpected response code %ld", response_code);
2456 struct token tok = {0};
2479 if (strcmp(
err->error,
"authorization_pending") != 0 &&
2480 strcmp(
err->error,
"slow_down") != 0)
2490 if (strcmp(
err->error,
"slow_down") == 0)
2497 actx_error(actx,
"slow_down interval overflow");
2568#if HAVE_THREADSAFE_CURL_GLOBAL_INIT
2569 curl_version_info_data *info;
2572#if !HAVE_THREADSAFE_CURL_GLOBAL_INIT
2594 "curl_global_init previously failed during OAuth setup");
2610 if (curl_global_init(CURL_GLOBAL_ALL & ~CURL_GLOBAL_WIN32) != CURLE_OK)
2613 "curl_global_init failed during OAuth setup");
2618#if HAVE_THREADSAFE_CURL_GLOBAL_INIT
2627 info = curl_version_info(CURLVERSION_NOW);
2628 if (!(info->features & CURL_VERSION_THREADSAFE))
2635 "\tCurl initialization was reported thread-safe when libpq\n"
2636 "\twas compiled, but the currently installed version of\n"
2637 "\tlibcurl reports that it is not. Recompile libpq against\n"
2638 "\tthe installed version of libcurl.");
2647#if !HAVE_THREADSAFE_CURL_GLOBAL_INIT
2672 char *oauth_token = NULL;
2678 if (!
state->async_ctx)
2685 actx =
calloc(1,
sizeof(*actx));
2698 state->async_ctx = actx;
2710 actx =
state->async_ctx;
2770 actx->
errctx =
"failed to fetch OpenID discovery document";
2784 actx->
errctx =
"cannot run OAuth device authorization";
2788 actx->
errctx =
"failed to obtain device authorization";
2799 actx->
errctx =
"failed to obtain access token";
2850 actx->
errctx =
"failed to obtain access token";
2863 }
while (!oauth_token && !actx->
running);
2911 bool sigpipe_pending;
static void cleanup(void)
#define fprintf(file, fmt, msg)
void err(int eval, const char *fmt,...)
PQauthDataHook_type PQgetAuthDataHook(void)
int PQsocketPoll(int sock, int forRead, int forWrite, pg_usec_time_t end_time)
Assert(PointerIsAligned(start, uint64))
JsonParseErrorType pg_parse_json(JsonLexContext *lex, const JsonSemAction *sem)
JsonLexContext * makeJsonLexContextCstringLen(JsonLexContext *lex, const char *json, size_t len, int encoding, bool need_escapes)
void setJsonLexContextOwnsTokens(JsonLexContext *lex, bool owned_by_context)
char * json_errdetail(JsonParseErrorType error, JsonLexContext *lex)
void freeJsonLexContext(JsonLexContext *lex)
int(* PQauthDataHook_type)(PGauthData type, PGconn *conn, void *data)
PostgresPollingStatusType
@ PQAUTHDATA_PROMPT_OAUTH_DEVICE
PostgresPollingStatusType pg_fe_run_oauth_flow(PGconn *conn)
static char * urlencode(const char *s)
static bool setup_multiplexer(struct async_ctx *actx)
static bool finish_token_request(struct async_ctx *actx, struct token *tok)
static JsonParseErrorType oauth_json_array_end(void *state)
static void append_urlencoded(PQExpBuffer buf, const char *s)
static bool start_token_request(struct async_ctx *actx, PGconn *conn)
static bool initialize_curl(PGconn *conn)
#define MAX_OAUTH_RESPONSE_SIZE
static bool parse_token_error(struct async_ctx *actx, struct token_error *err)
void pg_fe_cleanup_oauth_flow(PGconn *conn)
static bool add_client_identification(struct async_ctx *actx, PQExpBuffer reqbody, PGconn *conn)
static int parse_interval(struct async_ctx *actx, const char *interval_str)
static void free_provider(struct provider *provider)
static void build_urlencoded(PQExpBuffer buf, const char *key, const char *value)
#define conn_oauth_issuer_id(CONN)
static void record_token_error(struct async_ctx *actx, const struct token_error *err)
static bool parse_device_authz(struct async_ctx *actx, struct device_authz *authz)
static void report_type_mismatch(struct oauth_parse *ctx)
static int register_socket(CURL *curl, curl_socket_t socket, int what, void *ctx, void *socketp)
#define PG_OAUTH_OPTIONAL
static bool set_timer(struct async_ctx *actx, long timeout)
static bool parse_access_token(struct async_ctx *actx, struct token *tok)
static int timer_expired(struct async_ctx *actx)
static PostgresPollingStatusType drive_request(struct async_ctx *actx)
static bool start_device_authz(struct async_ctx *actx, PGconn *conn)
static bool prompt_user(struct async_ctx *actx, PGconn *conn)
#define CHECK_MSETOPT(ACTX, OPT, VAL, FAILACTION)
static bool finish_discovery(struct async_ctx *actx)
static double parse_json_number(const char *s)
#define conn_oauth_discovery_uri(CONN)
static bool start_discovery(struct async_ctx *actx, const char *discovery_uri)
static JsonParseErrorType oauth_json_object_field_start(void *state, char *name, bool isnull)
static JsonParseErrorType oauth_json_scalar(void *state, char *token, JsonTokenType type)
static void free_token_error(struct token_error *err)
#define actx_error_str(ACTX, S)
static bool finish_device_authz(struct async_ctx *actx)
#define conn_oauth_scope(CONN)
static size_t append_data(char *buf, size_t size, size_t nmemb, void *userdata)
#define CHECK_SETOPT(ACTX, OPT, VAL, FAILACTION)
static PostgresPollingStatusType pg_fe_run_oauth_flow_impl(PGconn *conn)
static bool parse_oauth_json(struct async_ctx *actx, const struct json_field *fields)
#define OAUTH_GRANT_TYPE_DEVICE_CODE
#define conn_oauth_client_id(CONN)
#define CURL_IGNORE_DEPRECATION(x)
static JsonParseErrorType oauth_json_array_start(void *state)
static JsonParseErrorType oauth_json_object_end(void *state)
#define set_conn_altsock(CONN, VAL)
static int debug_callback(CURL *handle, curl_infotype type, char *data, size_t size, void *clientp)
static void free_token(struct token *tok)
#define oauth_parse_set_error(ctx, fmt,...)
@ OAUTH_STEP_DEVICE_AUTHORIZATION
@ OAUTH_STEP_WAIT_INTERVAL
@ OAUTH_STEP_TOKEN_REQUEST
static int register_timer(CURLM *curlm, long timeout, void *ctx)
#define conn_oauth_client_secret(CONN)
#define set_conn_oauth_token(CONN, VAL)
#define CHECK_GETINFO(ACTX, INFO, OUT, FAILACTION)
static bool check_content_type(struct async_ctx *actx, const char *type)
static bool check_issuer(struct async_ctx *actx, PGconn *conn)
#define actx_error(ACTX, FMT,...)
static bool parse_provider(struct async_ctx *actx, struct provider *provider)
static bool start_request(struct async_ctx *actx)
static int parse_expires_in(struct async_ctx *actx, const char *expires_in_str)
static void free_async_ctx(PGconn *conn, struct async_ctx *actx)
static void free_device_authz(struct device_authz *authz)
#define conn_sasl_state(CONN)
#define conn_errorMessage(CONN)
static bool handle_token_response(struct async_ctx *actx, char **token)
static JsonParseErrorType oauth_json_object_start(void *state)
#define PG_OAUTH_REQUIRED
static bool check_for_device_flow(struct async_ctx *actx)
static bool setup_curl_handles(struct async_ctx *actx)
void pq_reset_sigpipe(sigset_t *osigset, bool sigpipe_pending, bool got_epipe)
int pq_block_sigpipe(sigset_t *osigset, bool *sigpipe_pending)
void libpq_append_conn_error(PGconn *conn, const char *fmt,...)
bool oauth_unsafe_debugging_enabled(void)
#define pgunlock_thread()
int pg_strncasecmp(const char *s1, const char *s2, size_t n)
void initPQExpBuffer(PQExpBuffer str)
void resetPQExpBuffer(PQExpBuffer str)
void appendPQExpBuffer(PQExpBuffer str, const char *fmt,...)
void appendBinaryPQExpBuffer(PQExpBuffer str, const char *data, size_t datalen)
void appendPQExpBufferChar(PQExpBuffer str, char ch)
void appendPQExpBufferStr(PQExpBuffer str, const char *data)
void termPQExpBuffer(PQExpBuffer str)
#define PQExpBufferBroken(str)
#define PQExpBufferDataBroken(buf)
json_struct_action array_end
json_struct_action object_start
json_ofield_action object_field_start
json_scalar_action scalar
json_struct_action array_start
json_struct_action object_end
const char * verification_uri
struct device_authz authz
PQExpBufferData work_data
char curl_err[CURL_ERROR_SIZE]
struct curl_slist * headers
char * verification_uri_complete
struct curl_slist ** array
union json_field::@188 target
const struct json_field * active
const struct json_field * fields
char * device_authorization_endpoint
struct curl_slist * grant_types_supported
int pg_encoding_verifymbstr(int encoding, const char *mbstr, int len)
#define socket(af, type, protocol)