mirror of
https://github.com/postgres/postgres.git
synced 2025-07-28 23:42:10 +03:00
From: Dan McGuirk <mcguirk@indirect.com>
Subject: [HACKERS] password authentication This patch adds support for plaintext password authentication. To use it, you add a line like host all 0.0.0.0 0.0.0.0 password pg_pwd.conf to your pg_hba.conf, where 'pg_pwd.conf' is the name of a file containing the usernames and password hashes in the format of the first two fields of a Unix /etc/passwd file. (Of course, you can use a specific database name or IP instead.) Then, to connect with a password through libpq, you use the PQconnectdb() function, specifying the "password=" tag in the connect string and also adding the tag "authtype=password". I also added a command-line switch '-u' to psql that tells it to prompt for a username and password and use password authentication.
This commit is contained in:
@ -7,7 +7,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/libpq/pqcomm.c,v 1.11 1997/02/14 04:15:29 momjian Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/libpq/pqcomm.c,v 1.12 1997/03/12 21:17:58 scrappy Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -703,3 +703,29 @@ StreamOpen(char *hostName, short portName, Port *port)
|
||||
|
||||
return(STATUS_OK);
|
||||
}
|
||||
|
||||
static char *authentication_type_name[] = {
|
||||
0, 0, 0, 0, 0, 0, 0,
|
||||
"the default authentication type",
|
||||
0, 0,
|
||||
"Kerberos v4",
|
||||
"Kerberos v5",
|
||||
"host-based authentication",
|
||||
"unauthenication",
|
||||
"plaintext password authentication"
|
||||
};
|
||||
|
||||
char *name_of_authentication_type(int type)
|
||||
{
|
||||
char *result = 0;
|
||||
|
||||
if(type >= 1 && type <= LAST_AUTHENTICATION_TYPE) {
|
||||
result = authentication_type_name[type];
|
||||
}
|
||||
|
||||
if(result == 0) {
|
||||
result = "<unknown authentication type>";
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
Reference in New Issue
Block a user