X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=maintenance%2Flocking%2FLockServerDaemon.php;h=01fbac72d6f6080ec65257b482e40709ebf3e054;hb=0f14e09a596f59e0d0326d8960d10a7b384bea41;hp=c5916657b4375e87580c093d5d4107a18c62f242;hpb=5abe15bb9daa6197544087688d73ba11eb7fa801;p=lhc%2Fweb%2Fwiklou.git diff --git a/maintenance/locking/LockServerDaemon.php b/maintenance/locking/LockServerDaemon.php index c5916657b4..01fbac72d6 100644 --- a/maintenance/locking/LockServerDaemon.php +++ b/maintenance/locking/LockServerDaemon.php @@ -23,7 +23,7 @@ * @ingroup LockManager Maintenance */ -if ( php_sapi_name() !== 'cli' ) { +if ( PHP_SAPI !== 'cli' ) { die( "This is not a valid entry point.\n" ); } error_reporting( E_ALL ); @@ -79,9 +79,9 @@ class LockServerDaemon { foreach ( array( 'address', 'port', 'authKey' ) as $par ) { if ( !isset( $config[$par] ) ) { die( "Usage: php LockServerDaemon.php " . - "--address
--port --authkey " . + "--address
--port --authKey " . "[--lockTimeout ] " . - "[--maxLocks ] [--maxClients ] [--maxBacklog ]" + "[--maxLocks ] [--maxClients ] [--maxBacklog ]\n" ); } } @@ -242,7 +242,9 @@ class LockServerDaemon { $m = explode( ':', $data ); // if ( count( $m ) == 5 ) { list( $session, $key, $command, $type, $values ) = $m; - if ( sha1( $session . $command . $type . $values . $this->authKey ) !== $key ) { + $goodKey = hash_hmac( 'sha1', + "{$session}\n{$command}\n{$type}\n{$values}", $this->authKey ); + if ( $goodKey !== $key ) { return 'BAD_KEY'; } elseif ( strlen( $session ) !== 32 ) { return 'BAD_SESSION';