Search squid archive

Re: User Authentication Begins Failing

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On fre, 2007-09-07 at 09:50 +0800, Adrian Chadd wrote:
> On Thu, Sep 06, 2007, Henrik Nordstrom wrote:
> 
> > With a 2 seconds or so margin on the stat time you should not need to
> > care. Also solves the double password change within the same second
> > problem... but yes checking the size as well do not hurt.
> > 
> > Patch adding a 2 seconds margin to the stat time is attached. 
> 
> Yup, sounds good. But!
> 
> >  	if (stat(argv[1], &sb) == 0) {
> >  	    if (sb.st_mtime != change_time) {
> > -		read_passwd_file(argv[1]);
> > -		change_time = sb.st_mtime;
> > +		int diff = time(NULL) - sb.st_mtime;
> > +		if (diff > 2 || diff < 0) {
> > +		    read_passwd_file(argv[1]);
> > +		    change_time = sb.st_mtime;
> > +		}
> 
> Could you explain to me the intent of this? The 2 second time check only
> kicks in if the file's already been read because the mtime has changed.
> Thats just possibly reading the file twice in quick succession if its been
> < 2 seconds since it last changed? I can't see how that fixes the race
> condition.

It's a filter ignoring the file change time if it's less than 2 seconds
ago, only rereading the file if it's changed since last read and not
modified in the last 2 seconds..

  sb.st_mtime is from the stat() call.

  change_time is from when the file was last read.

Regards
Henrik

Attachment: signature.asc
Description: This is a digitally signed message part


[Index of Archives]     [Linux Audio Users]     [Samba]     [Big List of Linux Books]     [Linux USB]     [Yosemite News]

  Powered by Linux