mirror of
https://github.com/postgres/postgres.git
synced 2025-09-03 15:22:11 +03:00
Remove auth-options support from initdb
When --auth was added to initdb in commite7029b2127
it had support for auth options separated by space from the auth type, like: --auth pam <servicename> --auth ident sameuser Passing an option to the ident auth type was removed in01c1a12a5b
which left the pam auth-options support in place.8a02339e9b
broke this by inverting a calculation in the strncmp arguments, which went unnoticed for a long time. The ability to pass options to the auth type was never documented. Rather than fixing the support for an undocumented feature which has been broken for all supported versions, and which only supports one out of many auth types which can take options, it is removed. Reported-by: Jingxian Li <aqktjcm@qq.com> Reviewed-by: Michael Paquier <michael@paquier.xyz> Reviewed-by: Aleksander Alekseev <aleksander@timescale.com> Discussion: https://postgr.es/m/tencent_29731C7C7E6A2F9FB807C3A1DC3D81293C06@qq.com
This commit is contained in:
@@ -102,7 +102,7 @@ static const char *const auth_methods_host[] = {
|
||||
"sspi",
|
||||
#endif
|
||||
#ifdef USE_PAM
|
||||
"pam", "pam ",
|
||||
"pam",
|
||||
#endif
|
||||
#ifdef USE_BSD_AUTH
|
||||
"bsd",
|
||||
@@ -118,7 +118,7 @@ static const char *const auth_methods_host[] = {
|
||||
static const char *const auth_methods_local[] = {
|
||||
"trust", "reject", "scram-sha-256", "md5", "password", "peer", "radius",
|
||||
#ifdef USE_PAM
|
||||
"pam", "pam ",
|
||||
"pam",
|
||||
#endif
|
||||
#ifdef USE_BSD_AUTH
|
||||
"bsd",
|
||||
@@ -2512,10 +2512,6 @@ check_authmethod_valid(const char *authmethod, const char *const *valid_methods,
|
||||
{
|
||||
if (strcmp(authmethod, *p) == 0)
|
||||
return;
|
||||
/* with space = param */
|
||||
if (strchr(authmethod, ' '))
|
||||
if (strncmp(authmethod, *p, (authmethod - strchr(authmethod, ' '))) == 0)
|
||||
return;
|
||||
}
|
||||
|
||||
pg_fatal("invalid authentication method \"%s\" for \"%s\" connections",
|
||||
|
Reference in New Issue
Block a user