Re: patch contrib/pgcrypto for win32 (2) - bug report - Mailing list pgsql-patches

From Marko Kreen
Subject Re: patch contrib/pgcrypto for win32 (2) - bug report
Date
Msg-id 20041206192045.GA12778@l-t.ee
Whole thread Raw
In response to Re: patch contrib/pgcrypto for win32 (2) - bug report  ("Korea PostgreSQL Users' Group" <pgsql-kr@postgresql.or.kr>)
List pgsql-patches
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 number need filtering.
> so, I changed random() % 255 line.
>
> on win32, original code gen_salt() function allways returned "$1$/2E./2E.".
> this string made by same return value by random() function. (sorry, I can't express in good English)

This seems really suspicious.  My explanation would be, that
Win32 starup somehow skips the srandom call.

Or could the (MyProcPid ^ port->session_start.tv_usec) be
constant on win32?

> plz, check and properly fix this bug.
>
> I tried "& 255" operation. but this bug is still.

I dont understand.  Does that mean that

    random()
    random() & 255

are buggy, but

    random() % 255

is not?

--
marko


pgsql-patches by date:

Previous
From: Tom Lane
Date:
Subject: Re: patch contrib/pgcrypto for win32 (2) - bug report
Next
From: Peter Eisentraut
Date:
Subject: Re: Translation updates for 8.0: pg_config-ru, initdb-ru, pg_ctl-ru, pg_dump-ru, psql-ru