From: Dan McGuirk <mcguirk@indirect.com>
Marc G. Fournier <scrappy@hub.org>
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.
Files
| Path | Change | +/− |
|---|---|---|
| src/backend/libpq/auth.c | modified | +42 −5 |
| src/backend/libpq/hba.c | modified | +45 −55 |
| src/backend/libpq/Makefile | modified | +3 −2 |
| src/backend/libpq/pqcomm.c | modified | +27 −1 |
| src/backend/postmaster/postmaster.c | modified | +3 −3 |
| src/bin/psql/psql.c | modified | +117 −3 |
| src/include/config.h.in | modified | +5 −2 |
| src/include/libpq/hba.h | modified | +31 −1 |
| src/include/libpq/pqcomm.h | modified | +8 −3 |
| src/interfaces/libpq/fe-auth.c | modified | +25 −3 |
| src/interfaces/libpq/fe-auth.h | modified | +4 −2 |
| src/interfaces/libpq/fe-connect.c | modified | +32 −4 |
| src/interfaces/libpq/libpq-fe.h | modified | +3 −1 |