Re: [GENERAL] problems with non-trust authentication methods in 7.3devel? - Mailing list pgsql-patches
From | Bruce Momjian |
---|---|
Subject | Re: [GENERAL] problems with non-trust authentication methods in 7.3devel? |
Date | |
Msg-id | 200204250056.g3P0uAZ27086@candle.pha.pa.us Whole thread Raw |
List | pgsql-patches |
Hubert depesz Lubaczewski wrote: > hi > i have strange error. > none (except trust) auythorization methods do work under 7.3devel. > i tried: password, crypt and md5. i set passwords using: > alter user pgdba with password 'aaa'; > and > alter user pgdba with encrypted password 'aaa'; > > none combination works. > in fact (since password is required when starting postmaster) i can not > even start postmaster. what could be the reason? > my machine is intel celeron with linux: > > $ rpm -q glibc gcc > glibc-2.2.5-7 > gcc-2.95.4-0.20010823.3 > > what else should i tell for you to be able to help me? OK, I have applied the following patch to fix the failure. Thanks for finding this. I had modified the code to handle quoted strings better and didn't re-test the password code. -- Bruce Momjian | http://candle.pha.pa.us pgman@candle.pha.pa.us | (610) 853-3000 + If your life is a hard drive, | 830 Blythe Avenue + Christ can be your backup. | Drexel Hill, Pennsylvania 19026 Index: src/backend/libpq/crypt.c =================================================================== RCS file: /cvsroot/pgsql/src/backend/libpq/crypt.c,v retrieving revision 1.45 diff -c -r1.45 crypt.c *** src/backend/libpq/crypt.c 4 Apr 2002 04:25:47 -0000 1.45 --- src/backend/libpq/crypt.c 25 Apr 2002 00:30:33 -0000 *************** *** 31,48 **** int md5_crypt_verify(const Port *port, const char *user, const char *pgpass) { ! char *passwd, ! *valuntil, *crypt_pwd; int retval = STATUS_ERROR; List **line; ! if ((line = get_user_line(user)) == NULL) return STATUS_ERROR; ! passwd = lfirst(lnext(lnext(*line))); ! valuntil = lfirst(lnext(lnext(lnext(*line)))); ! if (passwd == NULL || *passwd == '\0') { if (passwd) --- 31,56 ---- int md5_crypt_verify(const Port *port, const char *user, const char *pgpass) { ! char *passwd = NULL, ! *valuntil = NULL, *crypt_pwd; int retval = STATUS_ERROR; List **line; ! List *token; ! if ((line = get_user_line(user)) == NULL) return STATUS_ERROR; ! /* Skip over line number and username */ ! token = lnext(lnext(*line)); ! if (token) ! { ! passwd = lfirst(token); ! token = lnext(token); ! if (token) ! valuntil = lfirst(token); ! } ! if (passwd == NULL || *passwd == '\0') { if (passwd) *************** *** 120,126 **** AbsoluteTime vuntil, current; ! if (!valuntil || strcmp(valuntil, "\\N") == 0) vuntil = INVALID_ABSTIME; else vuntil = DatumGetAbsoluteTime(DirectFunctionCall1(nabstimein, --- 128,134 ---- AbsoluteTime vuntil, current; ! if (!valuntil) vuntil = INVALID_ABSTIME; else vuntil = DatumGetAbsoluteTime(DirectFunctionCall1(nabstimein, Index: src/backend/libpq/hba.c =================================================================== RCS file: /cvsroot/pgsql/src/backend/libpq/hba.c,v retrieving revision 1.81 diff -c -r1.81 hba.c *** src/backend/libpq/hba.c 4 Apr 2002 04:25:47 -0000 1.81 --- src/backend/libpq/hba.c 25 Apr 2002 00:30:34 -0000 *************** *** 109,117 **** while (c != EOF && c != '\n' && (!isblank(c) || in_quote == true)) { - if (c == '"') - in_quote = !in_quote; - /* skip comments to EOL */ if (c == '#' && !in_quote) { --- 109,114 ---- *************** *** 138,147 **** break; /* Literal double-quote is two double-quotes */ ! if (c == '"') was_quote = !was_quote; else was_quote = false; c = getc(fp); } --- 135,147 ---- break; /* Literal double-quote is two double-quotes */ ! if (in_quote && c == '"') was_quote = !was_quote; else was_quote = false; + + if (c == '"') + in_quote = !in_quote; c = getc(fp); }
pgsql-patches by date: