Re: [PATCHES] patch contrib/pgcrypto for win32 (2) - bug report

2004-12-06 Thread Korea PostgreSQL Users' Group
this bug is only for win32 system. On mingw32 random() function have to be initialized by srandom(). so, I put srandom(time(NULL)) line. and, Because random() function return integer (2byte), this return integer number need filtering. so, I changed random() % 255 line. on win32, original code

Re: [PATCHES] patch contrib/pgcrypto for win32 (2) - bug report

2004-12-06 Thread Tom Lane
Korea PostgreSQL Users' Group [EMAIL PROTECTED] writes: this bug is only for win32 system. On mingw32 random() function have to be initialized by srandom(). so, I put srandom(time(NULL)) line. But there is already an srandom() call during backend startup. Because random() function return

Re: [PATCHES] patch contrib/pgcrypto for win32 (2) - bug report

2004-12-06 Thread Marko Kreen
On Tue, Dec 07, 2004 at 01:18:41AM +0900, Korea PostgreSQL Users' Group wrote: this bug is only for win32 system. On mingw32 random() function have to be initialized by srandom(). so, I put srandom(time(NULL)) line. and, Because random() function return integer (2byte), this return integer

Re: [PATCHES] patch contrib/pgcrypto for win32 (2)

2004-12-05 Thread Andrew Dunstan
Korea PostgreSQL Users' Group wrote: I found that function gen_salt() in contrib/pgcrypto had bug on win32. I patched contrib/pgcrypto/random.c file. What is the purpose of this addition? + srandom(time(NULL)); + Is resetting the seed on each call a good idea? cheers andrew

Re: [PATCHES] patch contrib/pgcrypto for win32 (2)

2004-12-05 Thread Tom Lane
Korea PostgreSQL Users' Group [EMAIL PROTECTED] writes: SSBmb3VuZCB0aGF0IGZ1bmN0aW9uIGdlbl9zYWx0KCkgaW4gY29udHJpYi9w Z2NyeXB0byBoYWQgYnVnIG9uIHdpbjMyLg0KDQpJIHBhdGNoZWQgY29udHJp Yi9wZ2NyeXB0by9yYW5kb20uYyBmaWxlLg0KDQo= Unencoded text would be nicer to reply to ... But anyway, why are you

Re: [PATCHES] patch contrib/pgcrypto for win32 (2)

2004-12-05 Thread Marko Kreen
On Mon, Dec 06, 2004 at 12:51:28AM +0900, Korea PostgreSQL Users' Group wrote: I found that function gen_salt() in contrib/pgcrypto had bug on win32. I patched contrib/pgcrypto/random.c file. Could you describe the bug bit more? As for srandom, src/backend/postmaster/postmaster.c does it

Re: [PATCHES] patch contrib/pgcrypto for win32 (2)

2004-12-05 Thread Tom Lane
Marko Kreen [EMAIL PROTECTED] writes: As for srandom, src/backend/postmaster/postmaster.c does it already, and doing it more will make matters only worse. Yes. I think we had some discussion about that already, and concluded it was a bad idea to insert ad-hoc srandom calls. I would not

Re: [PATCHES] patch contrib/pgcrypto for win32 (2)

2004-12-05 Thread Marko Kreen
On Sun, Dec 05, 2004 at 06:36:38PM -0500, Tom Lane wrote: Marko Kreen [EMAIL PROTECTED] writes: I would not object to just sticking ' 255' there, The patch actually says '% 255' which is a whole different animal; it still requires explaining though. Yeah, I was hinting that ' 255' I could