r99999 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r99998‎ | r99999 | r100000 >
Date:22:41, 16 October 2011
Author:laner
Status:deferred
Tags:
Comment:
Ensure secret and access keys don't get overwritten on login
Modified paths:
  • /trunk/extensions/OpenStackManager/OpenStackNovaUser.php (modified) (history)

Diff [purge]

Index: trunk/extensions/OpenStackManager/OpenStackNovaUser.php
@@ -495,8 +495,13 @@
496496 */
497497 static function LDAPSetNovaInfo( $auth ) {
498498 OpenStackNovaUser::connect();
499 - if ( !isset( $auth->userInfo[0]['accesskey'] ) or !isset( $auth->userInfo[0]['secretkey'] ) ) {
500 - $objectclasses = $auth->userInfo[0]['objectclass'];
 499+ $dn = $auth->userInfo[0]['dn'];
 500+ wfSuppressWarnings();
 501+ $result = ldap_read( $auth->ldapconn, $auth->userInfo[0]['dn'], '(objectclass=*)', array( 'secretkey', 'accesskey', 'objectclass' ) );
 502+ $userInfo = ldap_get_entries( $auth->ldapconn, $result );
 503+ wfRestoreWarnings();
 504+ if ( !isset( $userInfo[0]['accesskey'] ) or !isset( $userInfo[0]['secretkey'] ) ) {
 505+ $objectclasses = $userInfo[0]['objectclass'];
501506 # First entry is a count
502507 array_shift( $objectclasses );
503508 if ( !in_array( 'novauser', $objectclasses ) ) {
@@ -523,6 +528,9 @@
524529 # Always return true, other hooks should still run, even if this fails
525530 return true;
526531 }
 532+ } else {
 533+ $auth->printDebug( "User has accesskey and secretkey set.", NONSENSITIVE );
 534+ return true;
527535 }
528536 }
529537

Status & tagging log