Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 83ae824

Browse files
Remove auth-options support from initdb
When --auth was added to initdb in commit e7029b2 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 in 01c1a12 which left the pam auth-options support in place. 8a02339 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
1 parent b362d14 commit 83ae824

File tree

1 file changed

+2
-6
lines changed

1 file changed

+2
-6
lines changed

src/bin/initdb/initdb.c

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ static const char *const auth_methods_host[] = {
102102
"sspi",
103103
#endif
104104
#ifdef USE_PAM
105-
"pam", "pam ",
105+
"pam",
106106
#endif
107107
#ifdef USE_BSD_AUTH
108108
"bsd",
@@ -118,7 +118,7 @@ static const char *const auth_methods_host[] = {
118118
static const char *const auth_methods_local[] = {
119119
"trust", "reject", "scram-sha-256", "md5", "password", "peer", "radius",
120120
#ifdef USE_PAM
121-
"pam", "pam ",
121+
"pam",
122122
#endif
123123
#ifdef USE_BSD_AUTH
124124
"bsd",
@@ -2512,10 +2512,6 @@ check_authmethod_valid(const char *authmethod, const char *const *valid_methods,
25122512
{
25132513
if (strcmp(authmethod, *p) == 0)
25142514
return;
2515-
/* with space = param */
2516-
if (strchr(authmethod, ' '))
2517-
if (strncmp(authmethod, *p, (authmethod - strchr(authmethod, ' '))) == 0)
2518-
return;
25192515
}
25202516

25212517
pg_fatal("invalid authentication method \"%s\" for \"%s\" connections",

0 commit comments

Comments
 (0)