svn: web/php-bugs/trunk/include/
| From: | Jani Taskinen | Date: | Sun, 12 Jul 2009 20:49:12 +0000 |
| Subject: | svn: web/php-bugs/trunk/include/ | ||
| Groups: | php.webmaster | ||
| Request: | Send a blank email to php-webmaster+get-5329@lists.php.net to get a copy of this message | ||
jani Sun, 12 Jul 2009 20:49:12 +0000
ViewVC URL: http://svn.php.net/viewvc?view=revision&revision=283981
Changed paths:
U web/php-bugs/trunk/include/cvs-auth.inc
Log:
- Fix authentication to use master.php.net instead
Modified: web/php-bugs/trunk/include/cvs-auth.inc
===================================================================
--- web/php-bugs/trunk/include/cvs-auth.inc 2009-07-12 20:40:53 UTC (rev 283980)
+++ web/php-bugs/trunk/include/cvs-auth.inc 2009-07-12 20:49:12 UTC (rev 283981)
@@ -1,41 +1,41 @@
<?php
/* $Id$ */
-$ignore_password = false;
-$passwd_file = "/repository/CVSROOT/passwd";
+function verify_password($user, $pass)
+{
+ $post = http_build_query(
+ array(
+ "token" => getenv("TOKEN"),
+ "username" => $user,
+ "password" => $pass,
+ )
+ );
-function find_password($user) {
- global $passwd_file, $ignore_password;
- if ($ignore_password) return " "; // can't be ""
- $fp=fopen($passwd_file,"r");
- if (!$fp) {
- return ("");
+ $opts = array(
+ "method" => "POST",
+ "header" => "Content-type: application/x-www-form-urlencoded",
+ "content" => $post,
+ );
+
+ $ctx = stream_context_create(array("http" => $opts));
+
+ $s = file_get_contents("https://master.php.net/fetch/cvsauth.php",
false, $ctx);
+
+ $a = @unserialize($s);
+ if (!is_array($a)) {
+ echo "Unknown authentication error\n";
+ exit;
}
- while(!feof($fp)) {
- $line=fgets($fp,120);
- list($luser,$passwd,$junk) = explode(":",$line);
- if($user==$luser) {
- fclose($fp);
- return($passwd);
- }
+ if (isset($a["errno"])) {
+ echo "Authentication failed: ", $a["errstr"], "\n";
+ return false;
}
- fclose($fp);
- return("");
-}
-function verify_password($user, $pass) {
- global $ignore_password;
- $psw = find_password($user);
- if (strlen($psw) > 0) {
- if ($ignore_password || crypt($pass,substr($psw,0,2)) == $psw) {
- return true;
- }
- }
- return false;
+ return true;
}
-function is_cvs_user () {
-
+function is_cvs_user ()
+{
if (empty($_COOKIE['MAGIC_COOKIE'])) {
return false;
}