(bug 39184) LDAP password leakage
authorcsteipp <csteipp@wikimedia.org>
Fri, 31 Aug 2012 03:38:05 +0000 (20:38 -0700)
committercsteipp <csteipp@wikimedia.org>
Fri, 31 Aug 2012 21:39:31 +0000 (14:39 -0700)
Allow AuthPlugin to determine if user passwords should be stored
locally.

* Released as part of 1.20wmf10, 1.19.2, 1.18.5

Change-Id: Ie41bed7ecf5390f8815128c227bae371880a6058

includes/AuthPlugin.php
includes/User.php

index c7fcf93..2e42439 100644 (file)
@@ -176,6 +176,15 @@ class AuthPlugin {
                return true;
        }
 
+       /**
+        * Should MediaWiki store passwords in its local database?
+        *
+        * @return bool
+        */
+       public function allowSetLocalPassword() {
+               return true;
+       }
+
        /**
         * Set the given password in the authentication database.
         * As a special case, the password may be set to null to request
index 13748de..0a3db4c 100644 (file)
@@ -2891,11 +2891,16 @@ class User {
         * @todo Only rarely do all these fields need to be set!
         */
        public function saveSettings() {
+               global $wgAuth;
+
                $this->load();
                if ( wfReadOnly() ) { return; }
                if ( 0 == $this->mId ) { return; }
 
                $this->mTouched = self::newTouchedTimestamp();
+               if ( !$wgAuth->allowSetLocalPassword() ) {
+                       $this->mPassword = '';
+               }
 
                $dbw = wfGetDB( DB_MASTER );
                $dbw->update( 'user',