Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit c6d3158

Browse files
committed
Add some strings for translation and remove some cut'n'paste
that makes it impossible to translate to other languages.
1 parent 020ec16 commit c6d3158

File tree

1 file changed

+13
-11
lines changed

1 file changed

+13
-11
lines changed

src/backend/libpq/auth.c

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $PostgreSQL: pgsql/src/backend/libpq/auth.c,v 1.114 2003/12/20 18:24:52 tgl Exp $
11+
* $PostgreSQL: pgsql/src/backend/libpq/auth.c,v 1.115 2004/08/04 16:05:13 dennis Exp $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
@@ -345,7 +345,7 @@ pg_krb5_recvauth(Port *port)
345345
static void
346346
auth_failed(Port *port, int status)
347347
{
348-
const char *authmethod = "Unknown auth method:";
348+
const char *errstr;
349349

350350
/*
351351
* If we failed due to EOF from client, just quit; there's no point in
@@ -363,36 +363,38 @@ auth_failed(Port *port, int status)
363363
switch (port->auth_method)
364364
{
365365
case uaReject:
366-
authmethod = "Rejected host:";
366+
errstr = gettext("Rejected host: authentication failed for user \"%s\"");
367367
break;
368368
case uaKrb4:
369-
authmethod = "Kerberos4";
369+
errstr = gettext("Kerberos4 authentication failed for user \"%s\"");
370370
break;
371371
case uaKrb5:
372-
authmethod = "Kerberos5";
372+
errstr = gettext("Kerberos5 authentication failed for user \"%s\"");
373373
break;
374374
case uaTrust:
375-
authmethod = "Trusted";
375+
errstr = gettext("Trusted authentication failed for user \"%s\"");
376376
break;
377377
case uaIdent:
378-
authmethod = "IDENT";
378+
errstr = gettext("IDENT authentication failed for user \"%s\"");
379379
break;
380380
case uaMD5:
381381
case uaCrypt:
382382
case uaPassword:
383-
authmethod = "Password";
383+
errstr = gettext("Password authentication failed for user \"%s\"");
384384
break;
385385
#ifdef USE_PAM
386386
case uaPAM:
387-
authmethod = "PAM";
387+
errstr = gettext("PAM authentication failed for user \"%s\"");
388388
break;
389389
#endif /* USE_PAM */
390+
default :
391+
errstr = gettext("Unknown auth method: authentication failed for user \"%s\"");
392+
break;
390393
}
391394

392395
ereport(FATAL,
393396
(errcode(ERRCODE_INVALID_AUTHORIZATION_SPECIFICATION),
394-
errmsg("%s authentication failed for user \"%s\"",
395-
authmethod, port->user_name)));
397+
errmsg(errstr, port->user_name)));
396398
/* doesn't return */
397399
}
398400

0 commit comments

Comments
 (0)