Justtechjobs.com Find a programming school near you






Online Campus Both


php3-list | 199903

Re: [PHP3] .htpaaswd final (was:Re: [PHP3] .htpasswd) From: Sascha Schumann (sas <email protected>)
Date: 03/06/99

On Sat, Mar 06, 1999 at 02:58:18PM -0500, Matthew Joseff wrote:
>
> Here's the final (working) script I came up with:
>
> I took my values out. Now, I'm working with procmail to split this script
> up to only run the htpasswd part when the user replies to the email
> ($message).
>
> while (file_exists($htpasswdfile.".lock")) {
> sleep(1);
> clearstatcache();
> }
>
> symlink($htpasswdfile,$htpasswdfile.".lock");

You don't even check, if symlink is successful.

How about (A and B are different processes):

A: Does file exists? no
B: Does file exists? no
A: symlink - success
B: symlink - error (EEXIST) (it should reenter the above check again)
A: opens file, reads entries, closes
B: open, read, close, open, writes half of all entries
A: open, writes some data...

You will end up with corrupted data. Sure, it will work for some time, but on
one unlucky day, all your data will be gone. Hopefully, backups are available.

-- 

Regards,

Sascha Schumann | Consultant | finger sas <email protected> | for PGP public key

-- PHP 3 Mailing List http://www.php.net/ To unsubscribe send an empty message to php3-unsubscribe <email protected> To subscribe to the digest list: php3-digest-subscribe <email protected> For help: php3-help <email protected> Archive: http://www.php.net/mailsearch.php3 List administrator: zeev-list-admin <email protected>