}
static void
-check_need_password(const char *authmethod)
+check_need_password(const char *authmethodlocal, const char *authmethodhost)
{
- if ((strcmp(authmethod, "md5") == 0 ||
- strcmp(authmethod, "password") == 0) &&
+ if ((strcmp(authmethodlocal, "md5") == 0 ||
+ strcmp(authmethodlocal, "password") == 0) &&
+ (strcmp(authmethodhost, "md5") == 0 ||
+ strcmp(authmethodhost, "password") == 0) &&
!(pwprompt || pwfilename))
{
- fprintf(stderr, _("%s: must specify a password for the superuser to enable %s authentication\n"), progname, authmethod);
+ fprintf(stderr, _("%s: must specify a password for the superuser to enable %s authentication\n"), progname,
+ (strcmp(authmethodlocal, "md5") == 0 ||
+ strcmp(authmethodlocal, "password") == 0)
+ ? authmethodlocal
+ : authmethodhost);
exit(1);
}
}
check_authmethod_valid(authmethodlocal, auth_methods_local, "local");
check_authmethod_valid(authmethodhost, auth_methods_host, "host");
- check_need_password(authmethodlocal);
- check_need_password(authmethodhost);
+ check_need_password(authmethodlocal, authmethodhost);
if (strlen(pg_data) == 0)
{