PostgreSQL Source Code
git master
|
#include "postgres_fe.h"
#include <unistd.h>
#include <fcntl.h>
#include <sys/param.h>
#include <sys/socket.h>
#include <netdb.h>
#include "common/md5.h"
#include "common/scram-common.h"
#include "fe-auth.h"
#include "fe-auth-sasl.h"
#include "libpq-fe.h"
Go to the source code of this file.
Macros | |
#define | MAX_ALGORITHM_NAME_LEN 50 |
Functions | |
static int | pg_SASL_init (PGconn *conn, int payloadlen) |
static int | pg_SASL_continue (PGconn *conn, int payloadlen, bool final) |
static int | pg_local_sendauth (PGconn *conn) |
static int | pg_password_sendauth (PGconn *conn, const char *password, AuthRequest areq) |
static bool | check_expected_areq (AuthRequest areq, PGconn *conn) |
int | pg_fe_sendauth (AuthRequest areq, int payloadlen, PGconn *conn) |
char * | pg_fe_getusername (uid_t user_id, PQExpBuffer errorMessage) |
char * | pg_fe_getauthname (PQExpBuffer errorMessage) |
char * | PQencryptPassword (const char *passwd, const char *user) |
char * | PQencryptPasswordConn (PGconn *conn, const char *passwd, const char *user, const char *algorithm) |
#define MAX_ALGORITHM_NAME_LEN 50 |
|
static |
Definition at line 845 of file fe-auth.c.
References appendPQExpBufferStr(), AUTH_REQ_OK, AUTH_REQ_SASL, AUTH_REQ_SASL_CONT, AUTH_REQ_SASL_FIN, pg_conn::channel_binding, pg_fe_sasl_mech::channel_bound, conn, pg_conn::errorMessage, libpq_gettext, pg_conn::sasl, and pg_conn::sasl_state.
Referenced by pg_fe_sendauth().
char* pg_fe_getauthname | ( | PQExpBuffer | errorMessage | ) |
Definition at line 1168 of file fe-auth.c.
References pg_fe_getusername().
Referenced by connectOptions2(), and conninfo_add_defaults().
char* pg_fe_getusername | ( | uid_t | user_id, |
PQExpBuffer | errorMessage | ||
) |
Definition at line 1111 of file fe-auth.c.
References appendPQExpBuffer(), appendPQExpBufferStr(), libpq_gettext, name, pg_get_user_name(), pglock_thread, pgunlock_thread, and username.
Referenced by pg_fe_getauthname(), and PQconnectPoll().
int pg_fe_sendauth | ( | AuthRequest | areq, |
int | payloadlen, | ||
PGconn * | conn | ||
) |
Definition at line 895 of file fe-auth.c.
References appendPQExpBuffer(), appendPQExpBufferStr(), AUTH_REQ_CRYPT, AUTH_REQ_GSS, AUTH_REQ_GSS_CONT, AUTH_REQ_KRB4, AUTH_REQ_KRB5, AUTH_REQ_MD5, AUTH_REQ_OK, AUTH_REQ_PASSWORD, AUTH_REQ_SASL, AUTH_REQ_SASL_CONT, AUTH_REQ_SASL_FIN, AUTH_REQ_SCM_CREDS, AUTH_REQ_SSPI, check_expected_areq(), conn, pg_conn::connhost, pg_conn::errorMessage, pg_conn::gsslib, PQExpBufferData::len, libpq_gettext, password, pg_conn_host::password, pg_conn::password_needed, pg_local_sendauth(), pg_password_sendauth(), pg_SASL_continue(), pg_SASL_init(), pg_strcasecmp(), pglock_thread, pg_conn::pgpass, pgunlock_thread, PQnoPasswordSupplied, pg_conn::sasl_state, STATUS_ERROR, STATUS_OK, and pg_conn::whichhost.
Referenced by PQconnectPoll().
|
static |
Definition at line 719 of file fe-auth.c.
References appendPQExpBuffer(), appendPQExpBufferStr(), buf, conn, pg_conn::errorMessage, iovec::iov_base, iovec::iov_len, libpq_gettext, PG_STRERROR_R_BUFLEN, pg_conn::sock, STATUS_ERROR, STATUS_OK, and strerror_r.
Referenced by pg_fe_sendauth().
|
static |
Definition at line 771 of file fe-auth.c.
References appendPQExpBuffer(), appendPQExpBufferStr(), AUTH_REQ_MD5, AUTH_REQ_PASSWORD, conn, pg_conn::errorMessage, free, libpq_gettext, malloc, MD5_PASSWD_LEN, password, pg_md5_encrypt(), pg_conn::pguser, pqGetnchar(), pqPacketSend(), and STATUS_ERROR.
Referenced by pg_fe_sendauth().
Definition at line 633 of file fe-auth.c.
References appendPQExpBuffer(), appendPQExpBufferStr(), conn, pg_conn::errorMessage, pg_fe_sasl_mech::exchange, free, libpq_gettext, malloc, output(), pqGetnchar(), pqPacketSend(), res, pg_conn::sasl, pg_conn::sasl_state, STATUS_ERROR, STATUS_OK, and success.
Referenced by pg_fe_sendauth().
|
static |
Definition at line 417 of file fe-auth.c.
References appendPQExpBufferStr(), Assert(), pg_conn::channel_binding, conn, pg_conn::connhost, PQExpBufferData::data, error(), pg_conn::errorMessage, pg_fe_sasl_mech::exchange, free, pg_fe_sasl_mech::init, initPQExpBuffer(), libpq_gettext, password, pg_conn_host::password, pg_conn::password_needed, pg_scram_mech, pg_conn::pgpass, PQExpBufferDataBroken, pqFlush(), pqGets(), PQnoPasswordSupplied, pqPutInt(), pqPutMsgEnd(), pqPutMsgStart(), pqPutnchar(), pqPuts(), pg_conn::sasl, pg_conn::sasl_state, SCRAM_SHA_256_NAME, SCRAM_SHA_256_PLUS_NAME, pg_conn::ssl_in_use, STATUS_ERROR, STATUS_OK, success, termPQExpBuffer(), and pg_conn::whichhost.
Referenced by pg_fe_sendauth().
char* PQencryptPassword | ( | const char * | passwd, |
const char * | user | ||
) |
Definition at line 1187 of file fe-auth.c.
References free, malloc, MD5_PASSWD_LEN, pg_md5_encrypt(), and user.
char* PQencryptPasswordConn | ( | PGconn * | conn, |
const char * | passwd, | ||
const char * | user, | ||
const char * | algorithm | ||
) |
Definition at line 1230 of file fe-auth.c.
References appendPQExpBuffer(), appendPQExpBufferStr(), conn, pg_conn::errorMessage, free, libpq_gettext, malloc, MAX_ALGORITHM_NAME_LEN, MD5_PASSWD_LEN, pg_fe_scram_build_secret(), pg_md5_encrypt(), PGRES_TUPLES_OK, PQclear(), pqClearConnErrorState, PQexec(), PQgetvalue(), PQnfields(), PQntuples(), PQresultStatus(), res, user, and val.
Referenced by exec_command_password(), and main().