Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit d5bbe2a

Browse files
committed
From: Phil Thompson <phil@river-bank.demon.co.uk>
I've completed the patch to fix the protocol and authentication issues I was discussing a couple of weeks ago. The particular changes are: - the protocol has a version number - network byte order is used throughout - the pg_hba.conf file is used to specify what method is used to authenticate a frontend (either password, ident, trust, reject, krb4 or krb5) - support for multiplexed backends is removed - appropriate changes to man pages - the -a switch to many programs to specify an authentication service no longer has any effect - the libpq.so version number has changed to 1.1 The new backend still supports the old protocol so old interfaces won't break.
1 parent 91d983a commit d5bbe2a

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+1571
-2248
lines changed

src/backend/libpq/auth.c

Lines changed: 339 additions & 329 deletions
Large diffs are not rendered by default.

src/backend/libpq/be-dumpdata.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $Header: /cvsroot/pgsql/src/backend/libpq/Attic/be-dumpdata.c,v 1.9 1997/09/12 04:07:50 momjian Exp $
11+
* $Header: /cvsroot/pgsql/src/backend/libpq/Attic/be-dumpdata.c,v 1.10 1998/01/26 01:41:05 scrappy Exp $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
@@ -34,7 +34,7 @@
3434
#include <postgres.h>
3535

3636
#include <lib/dllist.h>
37-
#include <libpq/libpq-be.h>
37+
#include <libpq/libpq.h>
3838
#include <access/heapam.h>
3939
#include <access/htup.h>
4040
#include <storage/buf.h>

src/backend/libpq/be-pqexec.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $Header: /cvsroot/pgsql/src/backend/libpq/Attic/be-pqexec.c,v 1.13 1998/01/07 21:03:16 momjian Exp $
11+
* $Header: /cvsroot/pgsql/src/backend/libpq/Attic/be-pqexec.c,v 1.14 1998/01/26 01:41:06 scrappy Exp $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
@@ -27,7 +27,7 @@
2727
#include <tcop/fastpath.h>
2828
#include <tcop/tcopprot.h>
2929
#include <lib/dllist.h>
30-
#include <libpq/libpq-be.h>
30+
#include <libpq/libpq.h>
3131
#include <fmgr.h>
3232
#include <utils/exc.h>
3333
#include <utils/builtins.h>

src/backend/libpq/crypt.c

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,16 +17,17 @@
1717
#include <string.h>
1818
#include <stdlib.h>
1919
#include <unistd.h>
20-
#ifdef HAVE_CRYPT_H
21-
#include <crypt.h>
22-
#endif
2320

2421
#include "postgres.h"
2522
#include "miscadmin.h"
2623
#include "utils/nabstime.h"
2724
#include "storage/fd.h"
2825
#include "libpq/crypt.h"
2926

27+
#ifdef HAVE_CRYPT_H
28+
#include <crypt.h>
29+
#endif
30+
3031
char** pwd_cache = NULL;
3132
int pwd_cache_count = 0;
3233

@@ -219,6 +220,7 @@ int crypt_getloginfo(const char* user, char** passwd, char** valuntil) {
219220

220221
/*-------------------------------------------------------------------------*/
221222

223+
#ifdef 0
222224
MsgType crypt_salt(const char* user) {
223225

224226
char* passwd;
@@ -237,6 +239,7 @@ MsgType crypt_salt(const char* user) {
237239
if (valuntil) free((void*)valuntil);
238240
return STARTUP_SALT_MSG;
239241
}
242+
#endif
240243

241244
/*-------------------------------------------------------------------------*/
242245

@@ -258,7 +261,13 @@ int crypt_verify(Port* port, const char* user, const char* pgpass) {
258261
return STATUS_ERROR;
259262
}
260263

261-
crypt_pwd = crypt(passwd, port->salt);
264+
/*
265+
* Compare with the encrypted or plain password depending on the
266+
* authentication method being used for this connection.
267+
*/
268+
269+
crypt_pwd = (port->auth_method == uaCrypt ? crypt(passwd, port->salt) : passwd);
270+
262271
if (!strcmp(pgpass, crypt_pwd)) {
263272
/* check here to be sure we are not past valuntil
264273
*/

0 commit comments

Comments
 (0)