35 printf(
"usage: %s [flags] CONNINFO\n\n", argv[0]);
37 printf(
"recognized flags:\n");
38 printf(
" -h, --help show this message\n");
39 printf(
" --expected-scope SCOPE fail if received scopes do not match SCOPE\n");
40 printf(
" --expected-uri URI fail if received configuration link does not match URI\n");
41 printf(
" --misbehave=MODE have the hook fail required postconditions\n"
42 " (MODEs: no-hook, fail-async, no-token, no-socket)\n");
43 printf(
" --no-hook don't install OAuth hooks\n");
44 printf(
" --hang-forever don't ever return a token (combine with connect_timeout)\n");
45 printf(
" --token TOKEN use the provided TOKEN value\n");
46 printf(
" --stress-async busy-loop on PQconnectPoll rather than polling\n");
59main(
int argc,
char *argv[])
163 printf(
"connection succeeded\n");
196 if (!
req->openid_configuration)
249 perror(
"WSAStartup failed");
256 perror(
"failed to create datagram socket");
#define fprintf(file, fmt, msg)
void err(int eval, const char *fmt,...)
void PQsetAuthDataHook(PQauthDataHook_type hook)
PGconn * PQconnectdb(const char *conninfo)
PostgresPollingStatusType PQconnectPoll(PGconn *conn)
ConnStatusType PQstatus(const PGconn *conn)
PGconn * PQconnectStart(const char *conninfo)
void PQfinish(PGconn *conn)
char * PQerrorMessage(const PGconn *conn)
int getopt_long(int argc, char *const argv[], const char *optstring, const struct option *longopts, int *longindex)
#define required_argument
PostgresPollingStatusType
@ PQAUTHDATA_OAUTH_BEARER_TOKEN
static PostgresPollingStatusType misbehave_cb(PGconn *conn, PGoauthBearerRequest *req, pgsocket *altsock)
static const char * expected_scope
static const char * expected_uri
static const char * misbehave_mode
static PostgresPollingStatusType async_cb(PGconn *conn, PGoauthBearerRequest *req, pgsocket *altsock)
static int handle_auth_data(PGauthData type, PGconn *conn, void *data)
PGDLLIMPORT char * optarg
PostgresPollingStatusType(* async)(PGconn *conn, struct PGoauthBearerRequest *request, PQ_SOCKTYPE *altsock)
#define socket(af, type, protocol)