From owner-cvs-all Tue Feb 5 20:41:13 2002 Delivered-To: cvs-all@freebsd.org Received: from fledge.watson.org (fledge.watson.org [204.156.12.50]) by hub.freebsd.org (Postfix) with ESMTP id A4D9537B41C; Tue, 5 Feb 2002 20:40:58 -0800 (PST) Received: from fledge.watson.org (fledge.pr.watson.org [192.0.2.3]) by fledge.watson.org (8.11.6/8.11.5) with SMTP id g164ecD72378; Tue, 5 Feb 2002 23:40:38 -0500 (EST) (envelope-from robert@fledge.watson.org) Date: Tue, 5 Feb 2002 23:40:38 -0500 (EST) From: Robert Watson X-Sender: robert@fledge.watson.org To: Alfred Perlstein Cc: "Daniel O'Connor" , cvs-all@freebsd.org, cvs-committers@freebsd.org, des@freebsd.org, Mark Murray , "Andrey A. Chernov" Subject: Re: cvs commit: src/lib/libpam/modules/pam_unix pam_unix.c In-Reply-To: <20020205172633.B59017@elvis.mu.org> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-cvs-all@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG Mind you, none of this is thread safe, but thread safe is not exactly a feature of many of our library interfaces :-). Robert N M Watson FreeBSD Core Team, TrustedBSD Project robert@fledge.watson.org NAI Labs, Safeport Network Services On Tue, 5 Feb 2002, Alfred Perlstein wrote: > * Daniel O'Connor [020205 17:25] wrote: > > > > On 05-Feb-2002 Alfred Perlstein wrote: > > >> To see the bug, run following test application with "call_pam" set to 1 > > >> and 0 > > > > > > I understand the issue you're bringing up, would it make sense > > > to create/utilize a save/restore random() context function? > > > > No need to create one.. > > setstate() returns the old state which can then be passed back to setstate(). > > Andrey, can you use this then? > > > > > eg.. > > #include > > #include > > > > void foo(void); > > > > int > > main(int argc, char **argv) { > > printf("%ld\n", random()); > > foo(); > > printf("%ld\n", random()); > > printf("%ld\n", random()); > > foo(); > > printf("%ld\n", random()); > > } > > > > void > > foo(void) { > > char *rndstate; > > char state[16]; > > > > rndstate = initstate(123456789, state, sizeof(state)); > > if (rndstate == NULL) { > > printf("Unable to reseed\n"); > > exit(1); > > } > > srandomdev(); > > > > printf("foo - %ld\n", random()); > > > > setstate(rndstate); > > } > > > > --- > > Daniel O'Connor software and network engineer > > for Genesis Software - http://www.gsoft.com.au > > "The nice thing about standards is that there > > are so many of them to choose from." > > -- Andrew Tanenbaum > > -- > -Alfred Perlstein [alfred@freebsd.org] > 'Instead of asking why a piece of software is using "1970s technology," > start asking why software is ignoring 30 years of accumulated wisdom.' > Tax deductable donations for FreeBSD: http://www.freebsdfoundation.org/ > To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe cvs-all" in the body of the message