@@ -2574,13 +2574,19 @@ check_authmethod_valid(const char *authmethod, const char **valid_methods, const
2574
2574
}
2575
2575
2576
2576
static void
2577
- check_need_password (const char * authmethod )
2577
+ check_need_password (const char * authmethodlocal , const char * authmethodhost )
2578
2578
{
2579
- if ((strcmp (authmethod ,"md5" )== 0 ||
2580
- strcmp (authmethod ,"password" )== 0 )&&
2579
+ if ((strcmp (authmethodlocal ,"md5" )== 0 ||
2580
+ strcmp (authmethodlocal ,"password" )== 0 )&&
2581
+ (strcmp (authmethodhost ,"md5" )== 0 ||
2582
+ strcmp (authmethodhost ,"password" )== 0 )&&
2581
2583
!(pwprompt || pwfilename ))
2582
2584
{
2583
- fprintf (stderr ,_ ("%s: must specify a password for the superuser to enable %s authentication\n" ),progname ,authmethod );
2585
+ fprintf (stderr ,_ ("%s: must specify a password for the superuser to enable %s authentication\n" ),progname ,
2586
+ (strcmp (authmethodlocal ,"md5" )== 0 ||
2587
+ strcmp (authmethodlocal ,"password" )== 0 )
2588
+ ?authmethodlocal
2589
+ :authmethodhost );
2584
2590
exit (1 );
2585
2591
}
2586
2592
}
@@ -2792,8 +2798,7 @@ main(int argc, char *argv[])
2792
2798
check_authmethod_valid (authmethodlocal ,auth_methods_local ,"local" );
2793
2799
check_authmethod_valid (authmethodhost ,auth_methods_host ,"host" );
2794
2800
2795
- check_need_password (authmethodlocal );
2796
- check_need_password (authmethodhost );
2801
+ check_need_password (authmethodlocal ,authmethodhost );
2797
2802
2798
2803
if (strlen (pg_data )== 0 )
2799
2804
{