PostgreSQL Source Code
git master
|
#include "postgres.h"
#include <unistd.h>
#include "catalog/pg_authid.h"
#include "common/md5.h"
#include "common/scram-common.h"
#include "libpq/crypt.h"
#include "libpq/scram.h"
#include "utils/builtins.h"
#include "utils/syscache.h"
#include "utils/timestamp.h"
Go to the source code of this file.
Functions | |
char * | get_role_password (const char *role, const char **logdetail) |
PasswordType | get_password_type (const char *shadow_pass) |
char * | encrypt_password (PasswordType target_type, const char *role, const char *password) |
int | md5_crypt_verify (const char *role, const char *shadow_pass, const char *client_pass, const char *md5_salt, int md5_salt_len, const char **logdetail) |
int | plain_crypt_verify (const char *role, const char *shadow_pass, const char *client_pass, const char **logdetail) |
Variables | |
bool | md5_password_warnings = true |
char* encrypt_password | ( | PasswordType | target_type, |
const char * | role, | ||
const char * | password | ||
) |
Definition at line 117 of file crypt.c.
References Assert, elog, ereport, errcode(), errdetail(), errhint(), errmsg(), ERROR, get_password_type(), MAX_ENCRYPTED_PASSWORD_LEN, MD5_PASSWD_LEN, md5_password_warnings, palloc(), password, PASSWORD_TYPE_MD5, PASSWORD_TYPE_PLAINTEXT, PASSWORD_TYPE_SCRAM_SHA_256, pg_be_scram_build_secret(), pg_md5_encrypt(), pstrdup(), and WARNING.
Referenced by AlterRole(), and CreateRole().
PasswordType get_password_type | ( | const char * | shadow_pass | ) |
Definition at line 90 of file crypt.c.
References iterations, MD5_PASSWD_CHARSET, MD5_PASSWD_LEN, parse_scram_secret(), PASSWORD_TYPE_MD5, PASSWORD_TYPE_PLAINTEXT, PASSWORD_TYPE_SCRAM_SHA_256, and SCRAM_MAX_KEY_LEN.
Referenced by AlterRole(), CheckPWChallengeAuth(), CreateRole(), encrypt_password(), md5_crypt_verify(), plain_crypt_verify(), RenameRole(), and scram_init().
char* get_role_password | ( | const char * | role, |
const char ** | logdetail | ||
) |
Definition at line 38 of file crypt.c.
References _, DatumGetTimestampTz(), GetCurrentTimestamp(), HeapTupleIsValid, PointerGetDatum(), psprintf(), ReleaseSysCache(), SearchSysCache1(), SysCacheGetAttr(), and TextDatumGetCString.
Referenced by CheckPasswordAuth(), and CheckPWChallengeAuth().
int md5_crypt_verify | ( | const char * | role, |
const char * | shadow_pass, | ||
const char * | client_pass, | ||
const char * | md5_salt, | ||
int | md5_salt_len, | ||
const char ** | logdetail | ||
) |
Definition at line 202 of file crypt.c.
References _, Assert, get_password_type(), MD5_PASSWD_LEN, PASSWORD_TYPE_MD5, pg_md5_encrypt(), psprintf(), STATUS_ERROR, and STATUS_OK.
Referenced by CheckMD5Auth().
int plain_crypt_verify | ( | const char * | role, |
const char * | shadow_pass, | ||
const char * | client_pass, | ||
const char ** | logdetail | ||
) |
Definition at line 256 of file crypt.c.
References _, get_password_type(), MD5_PASSWD_LEN, PASSWORD_TYPE_MD5, PASSWORD_TYPE_PLAINTEXT, PASSWORD_TYPE_SCRAM_SHA_256, pg_md5_encrypt(), psprintf(), scram_verify_plain_password(), STATUS_ERROR, and STATUS_OK.
Referenced by AlterRole(), check_password(), CheckPasswordAuth(), and CreateRole().
bool md5_password_warnings = true |
Definition at line 28 of file crypt.c.
Referenced by encrypt_password().