@@ -1204,12 +1204,18 @@ setup_config(void)
1204
1204
"#update_process_title = off" );
1205
1205
#endif
1206
1206
1207
- if (strcmp (authmethodlocal , "scram-sha-256" ) == 0 ||
1208
- strcmp (authmethodhost , "scram-sha-256" ) == 0 )
1207
+ /*
1208
+ * Change password_encryption setting to md5 if md5 was chosen as an
1209
+ * authentication method, unless scram-sha-256 was also chosen.
1210
+ */
1211
+ if ((strcmp (authmethodlocal , "md5" ) == 0 &&
1212
+ strcmp (authmethodhost , "scram-sha-256" ) != 0 ) ||
1213
+ (strcmp (authmethodhost , "md5" ) == 0 &&
1214
+ strcmp (authmethodlocal , "scram-sha-256" ) != 0 ))
1209
1215
{
1210
1216
conflines = replace_token (conflines ,
1211
- "#password_encryption = md5 " ,
1212
- "password_encryption = scram-sha-256 " );
1217
+ "#password_encryption = scram-sha-256 " ,
1218
+ "password_encryption = md5 " );
1213
1219
}
1214
1220
1215
1221
/*
@@ -2373,12 +2379,7 @@ check_need_password(const char *authmethodlocal, const char *authmethodhost)
2373
2379
strcmp (authmethodhost , "scram-sha-256" ) == 0 ) &&
2374
2380
!(pwprompt || pwfilename ))
2375
2381
{
2376
- pg_log_error ("must specify a password for the superuser to enable %s authentication" ,
2377
- (strcmp (authmethodlocal , "md5" ) == 0 ||
2378
- strcmp (authmethodlocal , "password" ) == 0 ||
2379
- strcmp (authmethodlocal , "scram-sha-256" ) == 0 )
2380
- ? authmethodlocal
2381
- : authmethodhost );
2382
+ pg_log_error ("must specify a password for the superuser to enable password authentication" );
2382
2383
exit (1 );
2383
2384
}
2384
2385
}
0 commit comments