Welcome! Log In Create A New Profile

Advanced

Re[2]: [PARTIAL SOLVED] Re: Auth user with postgresql

Max
February 21, 2012 09:04PM
21 февраля 2012, 23:22 от Giuseppe Tofoni <gt0057@gmail.com>:
>
> The password is correct, the problem is postgresql vers. 9.0.3 not "nginx",
> es:
>
> authuser=# select crypt('multilab', '1$'), pwd from usertable where
> user ='multilab' ;
> crypt | pwd
> ---------------+---------------
> 1$2NVPu8Urs82 | 1$Ln7ocLxd/.k
> (1 row)
>
> pwd =1$Ln7ocLxd/.k
> salt =1$
> PHP calculated and in python crypt.crypt('multilab', pwd[:2] are are correct)

No, they are not, because PHP and Python are using invalid salts, despite
the fact that they shouldn't. Each value in the 0-63 range is represented
by a printable salt character in the "./0-9A-Za-z" range. You are using an
invalid salt character ('$'), which the Postgresql crypt() function silently
maps to value 0, which is represented by the character '.' in the salt, so
your '1$2NVPu8Urs82' hash is actually the result of crypt('multilab', '1.'),
but with the original invalid salt '1$' prepended.

According to the official PHP documentation, the PHP crypt() function
should fail if the salt contains at least one invalid character, but
it obviously doesn't, so you should make sure to verify the salt
validity before calling the crypt() function.

If your users are likely to have usernames that contain characters
other than "./0-9A-Za-z", then you should use the Postgresql function
gen_salt() instead of substr($user, 1, 2) when setting passwords:

postgres_query "UPDATE usertable SET pwd=crypt($pass, gen_salt('des'))
WHERE user=$user";

Max
_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx
Subject Author Posted

Auth user with postgresql

Giuseppe Tofoni February 17, 2012 07:40AM

Re: Auth user with postgresql

Piotr Sikora February 17, 2012 07:50AM

Re: Auth user with postgresql

Francis Daly February 17, 2012 07:56AM

Re: Auth user with postgresql

Giuseppe Tofoni February 17, 2012 02:14PM

Re: Auth user with postgresql

Piotr Sikora February 17, 2012 02:28PM

Re: Auth user with postgresql

Giuseppe Tofoni February 17, 2012 03:26PM

Re: Auth user with postgresql

Piotr Sikora February 17, 2012 04:06PM

Re: Auth user with postgresql

Giuseppe Tofoni February 17, 2012 06:30PM

Re: Auth user with postgresql

Piotr Sikora February 17, 2012 07:08PM

Re: Auth user with postgresql

Giuseppe Tofoni February 18, 2012 05:50AM

Re: Auth user with postgresql

Piotr Sikora February 18, 2012 09:20AM

Re: Auth user with postgresql

Giuseppe Tofoni February 18, 2012 01:46PM

Re: Auth user with postgresql

Piotr Sikora February 18, 2012 02:12PM

[PARTIAL SOLVED] Re: Auth user with postgresql

Giuseppe Tofoni February 20, 2012 06:40PM

Re: [PARTIAL SOLVED] Re: Auth user with postgresql

ktm2 February 21, 2012 11:04AM

Re: [PARTIAL SOLVED] Re: Auth user with postgresql

Giuseppe Tofoni February 21, 2012 11:46AM

Re: [PARTIAL SOLVED] Re: Auth user with postgresql

ktm2 February 21, 2012 12:04PM

Re[2]: [PARTIAL SOLVED] Re: Auth user with postgresql

Max February 21, 2012 02:12PM

Re: [PARTIAL SOLVED] Re: Auth user with postgresql

Piotr Sikora February 21, 2012 02:20PM

Re: [PARTIAL SOLVED] Re: Auth user with postgresql

Giuseppe Tofoni February 21, 2012 02:24PM

Re[2]: [PARTIAL SOLVED] Re: Auth user with postgresql

Max February 21, 2012 09:04PM

Re: Re[2]: [PARTIAL SOLVED] Re: Auth user with postgresql

Edho Arief February 21, 2012 10:56PM

[SOLVED] Re: Auth user with postgresql

Giuseppe Tofoni February 22, 2012 05:34PM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 164
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready