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)
97#define MAX_OAUTH_NESTING_LEVEL 16
302 CURLMcode
err = curl_multi_remove_handle(actx->
curlm, actx->
curl);
306 "libcurl easy handle removal failed: %s",
307 curl_multi_strerror(
err));
317 curl_easy_cleanup(actx->
curl);
322 CURLMcode
err = curl_multi_cleanup(actx->
curlm);
326 "libcurl multi handle cleanup failed: %s",
327 curl_multi_strerror(
err));
333 curl_slist_free_all(actx->
headers);
358 if (
state->async_ctx)
361 state->async_ctx = NULL;
373#define actx_error(ACTX, FMT, ...) \
374 appendPQExpBuffer(&(ACTX)->errbuf, libpq_gettext(FMT), ##__VA_ARGS__)
376#define actx_error_str(ACTX, S) \
377 appendPQExpBufferStr(&(ACTX)->errbuf, S)
384#define CHECK_MSETOPT(ACTX, OPT, VAL, FAILACTION) \
386 struct async_ctx *_actx = (ACTX); \
387 CURLMcode _setopterr = curl_multi_setopt(_actx->curlm, OPT, VAL); \
389 actx_error(_actx, "failed to set %s on OAuth connection: %s",\
390 #OPT, curl_multi_strerror(_setopterr)); \
395#define CHECK_SETOPT(ACTX, OPT, VAL, FAILACTION) \
397 struct async_ctx *_actx = (ACTX); \
398 CURLcode _setopterr = curl_easy_setopt(_actx->curl, OPT, VAL); \
400 actx_error(_actx, "failed to set %s on OAuth connection: %s",\
401 #OPT, curl_easy_strerror(_setopterr)); \
406#define CHECK_GETINFO(ACTX, INFO, OUT, FAILACTION) \
408 struct async_ctx *_actx = (ACTX); \
409 CURLcode _getinfoerr = curl_easy_getinfo(_actx->curl, INFO, OUT); \
411 actx_error(_actx, "failed to get %s from OAuth response: %s",\
412 #INFO, curl_easy_strerror(_getinfoerr)); \
447#define PG_OAUTH_REQUIRED true
448#define PG_OAUTH_OPTIONAL false
460#define oauth_parse_set_error(ctx, fmt, ...) \
461 appendPQExpBuffer((ctx)->errbuf, libpq_gettext(fmt), ##__VA_ARGS__)
477 msgfmt =
"field \"%s\" must be a string";
481 msgfmt =
"field \"%s\" must be a number";
485 msgfmt =
"field \"%s\" must be an array of strings";
490 msgfmt =
"field \"%s\" has unexpected type";
539 "internal error: started field '%s' before field '%s' was finished",
591 "internal error: field '%s' still active at end of object",
647 "internal error: found unexpected array end while parsing field '%s'",
689 if (
type != expected)
702 "internal error: scalar target found at nesting level %d",
712 "internal error: scalar field '%s' would be assigned twice",
727 struct curl_slist *temp;
734 "internal error: array member found at nesting level %d",
762 const size_t type_len = strlen(
type);
765 CHECK_GETINFO(actx, CURLINFO_CONTENT_TYPE, &content_type,
return false);
769 actx_error(actx,
"no content type was provided");
781 Assert(strlen(content_type) >= type_len);
782 if (content_type[type_len] ==
'\0')
790 for (
size_t i = type_len; content_type[
i]; ++
i)
792 switch (content_type[
i])
808 actx_error(actx,
"unexpected content type: \"%s\"", content_type);
831 if (strlen(resp->
data) != resp->
len)
833 actx_error(actx,
"response contains embedded NULLs");
843 actx_error(actx,
"response is not valid UTF-8");
946 cnt = sscanf(s,
"%lf", &parsed);
977 parsed = ceil(parsed);
982 else if (parsed >= INT_MAX)
1003 parsed = floor(parsed);
1005 if (parsed >= INT_MAX)
1007 else if (parsed <= INT_MIN)
1089 actx->
errctx =
"failed to parse token error response";
1101 if (
err->error_description)
1112 CHECK_GETINFO(actx, CURLINFO_RESPONSE_CODE, &response_code, response_code = 0);
1114 if (response_code == 401)
1117 ?
"provider rejected the oauth_client_secret"
1118 :
"provider requires client authentication, and no oauth_client_secret is set");
1175#if defined(HAVE_SYS_EPOLL_H)
1176 struct epoll_event ev = {.events = EPOLLIN};
1178 actx->
mux = epoll_create1(EPOLL_CLOEXEC);
1181 actx_error(actx,
"failed to create epoll set: %m");
1185 actx->
timerfd = timerfd_create(CLOCK_MONOTONIC, TFD_CLOEXEC);
1188 actx_error(actx,
"failed to create timerfd: %m");
1192 if (epoll_ctl(actx->
mux, EPOLL_CTL_ADD, actx->
timerfd, &ev) < 0)
1194 actx_error(actx,
"failed to add timerfd to epoll set: %m");
1199#elif defined(HAVE_SYS_EVENT_H)
1200 actx->
mux = kqueue();
1204 actx_error(actx,
"failed to create kqueue: %m");
1217 actx_error(actx,
"failed to create timer kqueue: %m");
1223#error setup_multiplexer is not implemented on this platform
1237#if defined(HAVE_SYS_EPOLL_H)
1238 struct epoll_event ev = {0};
1240 int op = EPOLL_CTL_ADD;
1245 ev.events = EPOLLIN;
1249 ev.events = EPOLLOUT;
1252 case CURL_POLL_INOUT:
1253 ev.events = EPOLLIN | EPOLLOUT;
1256 case CURL_POLL_REMOVE:
1261 actx_error(actx,
"unknown libcurl socket operation: %d", what);
1265 res = epoll_ctl(actx->
mux, op,
socket, &ev);
1266 if (res < 0 && errno == EEXIST)
1270 res = epoll_ctl(actx->
mux, op,
socket, &ev);
1278 actx_error(actx,
"could not add to epoll set: %m");
1282 actx_error(actx,
"could not delete from epoll set: %m");
1286 actx_error(actx,
"could not update epoll set: %m");
1293#elif defined(HAVE_SYS_EVENT_H)
1294 struct kevent ev[2] = {0};
1295 struct kevent ev_out[2];
1296 struct timespec timeout = {0};
1303 EV_SET(&ev[nev],
socket, EVFILT_READ, EV_ADD | EV_RECEIPT, 0, 0, 0);
1308 EV_SET(&ev[nev],
socket, EVFILT_WRITE, EV_ADD | EV_RECEIPT, 0, 0, 0);
1312 case CURL_POLL_INOUT:
1313 EV_SET(&ev[nev],
socket, EVFILT_READ, EV_ADD | EV_RECEIPT, 0, 0, 0);
1315 EV_SET(&ev[nev],
socket, EVFILT_WRITE, EV_ADD | EV_RECEIPT, 0, 0, 0);
1319 case CURL_POLL_REMOVE:
1326 EV_SET(&ev[nev],
socket, EVFILT_READ, EV_DELETE | EV_RECEIPT, 0, 0, 0);
1328 EV_SET(&ev[nev],
socket, EVFILT_WRITE, EV_DELETE | EV_RECEIPT, 0, 0, 0);
1333 actx_error(actx,
"unknown libcurl socket operation: %d", what);
1337 res = kevent(actx->
mux, ev, nev, ev_out,
lengthof(ev_out), &timeout);
1340 actx_error(actx,
"could not modify kqueue: %m");
1349 for (
int i = 0;
i < res; ++
i)
1356 Assert(ev_out[
i].flags & EV_ERROR);
1358 errno = ev_out[
i].data;
1359 if (errno && errno != ENOENT)
1363 case CURL_POLL_REMOVE:
1364 actx_error(actx,
"could not delete from kqueue: %m");
1367 actx_error(actx,
"could not add to kqueue: %m");
1375#error register_socket is not implemented on this platform
1395#if defined(HAVE_SYS_EPOLL_H)
1396 struct itimerspec spec = {0};
1402 else if (timeout == 0)
1409 spec.it_value.tv_nsec = 1;
1413 spec.it_value.tv_sec = timeout / 1000;
1414 spec.it_value.tv_nsec = (timeout % 1000) * 1000000;
1417 if (timerfd_settime(actx->
timerfd, 0 , &spec, NULL) < 0)
1419 actx_error(actx,
"setting timerfd to %ld: %m", timeout);
1424#elif defined(HAVE_SYS_EVENT_H)
1446 EV_SET(&ev, 1, EVFILT_TIMER, EV_DELETE, 0, 0, 0);
1447 if (kevent(actx->
timerfd, &ev, 1, NULL, 0, NULL) < 0 && errno != ENOENT)
1449 actx_error(actx,
"deleting kqueue timer: %m");
1453 EV_SET(&ev, actx->
timerfd, EVFILT_READ, EV_DELETE, 0, 0, 0);
1454 if (kevent(actx->
mux, &ev, 1, NULL, 0, NULL) < 0 && errno != ENOENT)
1456 actx_error(actx,
"removing kqueue timer from multiplexer: %m");
1464 EV_SET(&ev, 1, EVFILT_TIMER, (EV_ADD | EV_ONESHOT), 0, timeout, 0);
1465 if (kevent(actx->
timerfd, &ev, 1, NULL, 0, NULL) < 0)
1467 actx_error(actx,
"setting kqueue timer to %ld: %m", timeout);
1471 EV_SET(&ev, actx->
timerfd, EVFILT_READ, EV_ADD, 0, 0, 0);
1472 if (kevent(actx->
mux, &ev, 1, NULL, 0, NULL) < 0)
1474 actx_error(actx,
"adding kqueue timer to multiplexer: %m");
1480#error set_timer is not implemented on this platform
1492#if defined(HAVE_SYS_EPOLL_H)
1493 struct itimerspec spec = {0};
1495 if (timerfd_gettime(actx->
timerfd, &spec) < 0)
1497 actx_error(actx,
"getting timerfd value: %m");
1506 Assert(spec.it_interval.tv_sec == 0
1507 && spec.it_interval.tv_nsec == 0);
1510 return (spec.it_value.tv_sec == 0
1511 && spec.it_value.tv_nsec == 0);
1512#elif defined(HAVE_SYS_EVENT_H)
1519 actx_error(actx,
"checking kqueue for timeout: %m");
1525#error timer_expired is not implemented on this platform
1562 bool printed_prefix =
false;
1572 case CURLINFO_HEADER_IN:
1573 case CURLINFO_DATA_IN:
1577 case CURLINFO_HEADER_OUT:
1578 case CURLINFO_DATA_OUT:
1593 for (
int i = 0;
i < size;
i++)
1597 if (!printed_prefix)
1600 printed_prefix =
true;
1603 if (
c >= 0x20 &&
c <= 0x7E)
1605 else if ((
type == CURLINFO_HEADER_IN
1606 ||
type == CURLINFO_HEADER_OUT
1607 ||
type == CURLINFO_TEXT)
1608 && (
c ==
'\r' ||
c ==
'\n'))
1621 printed_prefix =
false;
1647 actx->
curlm = curl_multi_init();
1651 actx_error(actx,
"failed to create libcurl multi handle");
1660 CHECK_MSETOPT(actx, CURLMOPT_SOCKETDATA, actx,
return false);
1662 CHECK_MSETOPT(actx, CURLMOPT_TIMERDATA, actx,
return false);
1668 actx->
curl = curl_easy_init();
1671 actx_error(actx,
"failed to create libcurl handle");
1690 CHECK_SETOPT(actx, CURLOPT_NOSIGNAL, 1L,
return false);
1714#if CURL_AT_LEAST_VERSION(7, 85, 0)
1715 const CURLoption popt = CURLOPT_PROTOCOLS_STR;
1716 const char *protos =
"https";
1717 const char *
const unsafe =
"https,http";
1719 const CURLoption popt = CURLOPT_PROTOCOLS;
1720 long protos = CURLPROTO_HTTPS;
1721 const long unsafe = CURLPROTO_HTTPS | CURLPROTO_HTTP;
1742 if ((env = getenv(
"PGOAUTHCAFILE")) != NULL)
1778 size_t len = size * nmemb;
1820 CHECK_SETOPT(actx, CURLOPT_WRITEDATA, actx,
return false);
1825 actx_error(actx,
"failed to queue HTTP request: %s",
1826 curl_multi_strerror(
err));
1839 err = curl_multi_socket_action(actx->
curlm, CURL_SOCKET_TIMEOUT, 0, &actx->
running);
1842 actx_error(actx,
"asynchronous HTTP request failed: %s",
1843 curl_multi_strerror(
err));
1854#ifndef CURL_IGNORE_DEPRECATION
1855#define CURL_IGNORE_DEPRECATION(x) x
1895 actx_error(actx,
"asynchronous HTTP request failed: %s",
1896 curl_multi_strerror(
err));
1908 while ((msg = curl_multi_info_read(actx->
curlm, &msgs_left)) != NULL)
1910 if (msg->msg != CURLMSG_DONE)
1920 if (msg->data.result != CURLE_OK)
1933 err = curl_multi_remove_handle(actx->
curlm, msg->easy_handle);
1936 actx_error(actx,
"libcurl easy handle removal failed: %s",
1937 curl_multi_strerror(
err));
1947 actx_error(actx,
"no result was retrieved for the finished handle");
1970 escaped = curl_easy_escape(NULL, s, 0);
1985 while ((match = strstr(haystack,
"%20")) != NULL)
1992 haystack = match + 3 ;
2053 CHECK_SETOPT(actx, CURLOPT_URL, discovery_uri,
return false);
2076 CHECK_GETINFO(actx, CURLINFO_RESPONSE_CODE, &response_code,
return false);
2078 if (response_code != 200)
2080 actx_error(actx,
"unexpected response code %ld", response_code);
2087 actx->
errctx =
"failed to parse OpenID discovery document";
2101 temp = curl_slist_append(temp,
"authorization_code");
2104 temp = curl_slist_append(temp,
"implicit");
2152 "the issuer identifier (%s) does not match oauth_issuer (%s)",
2160#define HTTPS_SCHEME "https://"
2161#define OAUTH_GRANT_TYPE_DEVICE_CODE "urn:ietf:params:oauth:grant-type:device_code"
2179 "issuer \"%s\" does not provide a device authorization endpoint",
2205 "device authorization endpoint \"%s\" must use HTTPS",
2214 "token endpoint \"%s\" must use HTTPS",
2237 if (oauth_client_secret)
2319 Assert(device_authz_uri);
2323 if (oauth_scope && oauth_scope[0])
2336 CHECK_SETOPT(actx, CURLOPT_URL, device_authz_uri,
return false);
2337 CHECK_SETOPT(actx, CURLOPT_COPYPOSTFIELDS, work_buffer->
data,
return false);
2347 CHECK_GETINFO(actx, CURLINFO_RESPONSE_CODE, &response_code,
return false);
2353 if (response_code == 200)
2355 actx->
errctx =
"failed to parse device authorization";
2368 if (response_code == 400 || response_code == 401)
2386 actx_error(actx,
"unexpected response code %ld", response_code);
2425 CHECK_SETOPT(actx, CURLOPT_URL, token_uri,
return false);
2426 CHECK_SETOPT(actx, CURLOPT_COPYPOSTFIELDS, work_buffer->
data,
return false);
2436 CHECK_GETINFO(actx, CURLINFO_RESPONSE_CODE, &response_code,
return false);
2441 if (response_code == 200)
2443 actx->
errctx =
"failed to parse access token response";
2456 if (response_code == 400 || response_code == 401)
2465 actx_error(actx,
"unexpected response code %ld", response_code);
2482 struct token tok = {0};
2505 if (strcmp(
err->error,
"authorization_pending") != 0 &&
2506 strcmp(
err->error,
"slow_down") != 0)
2516 if (strcmp(
err->error,
"slow_down") == 0)
2523 actx_error(actx,
"slow_down interval overflow");
2594#if HAVE_THREADSAFE_CURL_GLOBAL_INIT
2595 curl_version_info_data *info;
2598#if !HAVE_THREADSAFE_CURL_GLOBAL_INIT
2620 "curl_global_init previously failed during OAuth setup");
2636 if (curl_global_init(CURL_GLOBAL_ALL & ~CURL_GLOBAL_WIN32) != CURLE_OK)
2639 "curl_global_init failed during OAuth setup");
2644#if HAVE_THREADSAFE_CURL_GLOBAL_INIT
2653 info = curl_version_info(CURLVERSION_NOW);
2654 if (!(info->features & CURL_VERSION_THREADSAFE))
2661 "\tCurl initialization was reported thread-safe when libpq\n"
2662 "\twas compiled, but the currently installed version of\n"
2663 "\tlibcurl reports that it is not. Recompile libpq against\n"
2664 "\tthe installed version of libcurl.");
2673#if !HAVE_THREADSAFE_CURL_GLOBAL_INIT
2698 char *oauth_token = NULL;
2704 if (!
state->async_ctx)
2711 actx =
calloc(1,
sizeof(*actx));
2724 state->async_ctx = actx;
2736 actx =
state->async_ctx;
2796 actx->
errctx =
"failed to fetch OpenID discovery document";
2810 actx->
errctx =
"cannot run OAuth device authorization";
2814 actx->
errctx =
"failed to obtain device authorization";
2825 actx->
errctx =
"failed to obtain access token";
2876 actx->
errctx =
"failed to obtain access token";
2889 }
while (!oauth_token && !actx->
running);
2937 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 MAX_OAUTH_NESTING_LEVEL
#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)