Re: Patches for Class: File_Passwd

From: Date: Wed, 11 Apr 2001 23:07:51 +0000
Subject: Re: Patches for Class: File_Passwd
References: 1  Groups: php.pear.dev 
Request: Send a blank email to pear-dev+get-210@lists.php.net to get a copy of this message
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 There is another bug, which I do not have time to write the patch. I am trying use the FILE_Passwd to manage an .htaccess file. If you add more than one user to the .htaccess file, the file is corrupted and none of the users can be authenticated. It works great if there is only one user written to the .htaccess file by the FILE_Passwd. I have written two simple test cases. One writes the .htaccess file manually. Using this .htaccess file, apache will authenticate either user when given the matching passwd. (see below) The second writes the .htaccess file using the FILE_Passwd class. Adding a second user to the .htaccess file using the second method will corrupt the .htaccess file. When the second user is added, the class will add another newline '\n' to any existing records. This is not the problem -- I removed the blank lines and Apache still does not authenticate. A single user added to a blank .htaccess file by FILE_Passwd will authenticate. (see below) Sorry that I have no patch, it is not an obvious fix and I have a deadline to get my authentication stuff working by tomorrow, so I cannot spare any more time on it. Jeff BTW - I was testing the following version of FILE_Passwd: $Id: Passwd.php,v 1.3 2001/01/10 01:01:55 ssb Exp $ - ---------------------------------- Test Case 1 - manual .htaccess writes <?php $user = 'admin'; $pass = 'admin1'; print "adding user ($user) passwd ($pass)<br>"; write( $user, $pass ); $user = 'jeff'; $pass = 'jeff1'; print "adding user ($user) passwd ($pass)<br>"; write( $user, $pass ); function write( $u, $p ) { $fp = fopen('data/.htpasswd','a'); if ($fp) { $epass = crypt($p); fputs($fp, "$u:$epass\n"); fclose($fp); } } ?> - ----------------------------------------- Test Case 2 - FILE_Passwd .htaccess writes (broken) <?php include_once( 'File/Passwd.php' ); $user = 'admin'; $pass = 'admin1'; print "adding user ($user) passwd ($pass)<br>"; write( $user, $pass ); $user = 'jeff'; $pass = 'jeff1'; print "adding user ($user) passwd ($pass)<br>"; write( $user, $pass ); function write( $u, $p ) { $p = new File_Passwd( 'data/.htpasswd' ); $p->addUser( $u, $p, $cvs ); $p->close(); } ?> -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.0.4 (GNU/Linux) Comment: For info see http://www.gnupg.org iEYEARECAAYFAjrU48sACgkQt0J81Q+7BCC6wACfXLag+UutlixkZUmP9++oFsSP dXsAnAq4QeLK1/BE75avqpk+pHGjMl3g =UZ7n -----END PGP SIGNATURE-----

« previous php.pear.dev (#210) next »