29 .
name =
"passwordcheck",
58 const char *shadow_pass,
60 Datum validuntil_time,
65 password_type, validuntil_time,
78 const char *logdetail = NULL;
82 (
errcode(ERRCODE_INVALID_PARAMETER_VALUE),
83 errmsg(
"password must not equal user name")));
102 (
errcode(ERRCODE_INVALID_PARAMETER_VALUE),
103 errmsg(
"password is too short"),
104 errdetail(
"password must be at least \"passwordcheck.min_password_length\" (%d) bytes long",
110 (
errcode(ERRCODE_INVALID_PARAMETER_VALUE),
111 errmsg(
"password must not contain user name")));
114 pwd_has_letter =
false;
115 pwd_has_nonletter =
false;
116 for (
i = 0;
i < pwdlen;
i++)
122 if (isalpha((
unsigned char)
password[
i]))
123 pwd_has_letter =
true;
125 pwd_has_nonletter =
true;
127 if (!pwd_has_letter || !pwd_has_nonletter)
129 (
errcode(ERRCODE_INVALID_PARAMETER_VALUE),
130 errmsg(
"password must contain both letters and nonletters")));
134 if ((reason = FascistCheck(
password, CRACKLIB_DICTPATH)))
136 (
errcode(ERRCODE_INVALID_PARAMETER_VALUE),
137 errmsg(
"password is easily cracked"),
153 "Minimum allowed password length.",
int plain_crypt_verify(const char *role, const char *shadow_pass, const char *client_pass, const char **logdetail)
@ PASSWORD_TYPE_PLAINTEXT
int errdetail(const char *fmt,...)
int errcode(int sqlerrcode)
int errmsg(const char *fmt,...)
int errdetail_log(const char *fmt,...)
#define ereport(elevel,...)
void MarkGUCPrefixReserved(const char *className)
void DefineCustomIntVariable(const char *name, const char *short_desc, const char *long_desc, int *valueAddr, int bootValue, int minValue, int maxValue, GucContext context, int flags, GucIntCheckHook check_hook, GucIntAssignHook assign_hook, GucShowHook show_hook)
static int min_password_length
static void check_password(const char *username, const char *shadow_pass, PasswordType password_type, Datum validuntil_time, bool validuntil_null)
static check_password_hook_type prev_check_password_hook
PG_MODULE_MAGIC_EXT(.name="passwordcheck",.version=PG_VERSION)
check_password_hook_type check_password_hook
void(* check_password_hook_type)(const char *username, const char *shadow_pass, PasswordType password_type, Datum validuntil_time, bool validuntil_null)