[BUGFIX] Check if OpenSSL works on every platform
authorHelmut Hummel <helmut.hummel@typo3.org>
Sat, 22 Oct 2011 13:26:07 +0000 (15:26 +0200)
committerOliver Hader <oliver@typo3.org>
Mon, 24 Oct 2011 22:52:10 +0000 (00:52 +0200)
The php backend in rsaauth checks if key generation works on Windows platforms.
Since there also could be *nix platforms with a wrong OpenSSL configuration,
we should remove this limitation and check if key generation works in any case.

Change-Id: Id075445f1fbf9bd37ca44525257892052a94c6e5
Resolves: #31188
Releases: 4.6, 4.5, 4.4, 4.3
Reviewed-on: http://review.typo3.org/6192
Reviewed-by: Oliver Klee
Reviewed-by: Xavier Perseguers
Reviewed-by: Steffen Gebert
Tested-by: Steffen Gebert
Reviewed-by: Steffen Ritter
Tested-by: Steffen Ritter
Reviewed-by: Oliver Hader
typo3/sysext/rsaauth/sv1/backends/class.tx_rsaauth_php_backend.php

index e4963f0..1cb63bf 100644 (file)
@@ -97,20 +97,13 @@ class tx_rsaauth_php_backend extends tx_rsaauth_abstract_backend {
        public function isAvailable() {
                $result = FALSE;
                if (is_callable('openssl_pkey_new')) {
-                       if (TYPO3_OS !== 'WIN') {
-                               // If the server does not run Windows, we can be sure than
-                               // OpenSSL will work
-                               $result = TRUE;
-                       }
-                       else {
-                               // On Windows PHP extension has to be configured properly. It
+                               // PHP extension has to be configured properly. It
                                // can be installed and available but will not work unless
-                               // configured. So we check if it works.
-                               $testKey = @openssl_pkey_new();
-                               if ($testKey) {
-                                       openssl_free_key($testKey);
-                                       $result = TRUE;
-                               }
+                               // properly configured. So we check if it works.
+                       $testKey = @openssl_pkey_new();
+                       if (is_resource($testKey)) {
+                               openssl_free_key($testKey);
+                               $result = TRUE;
                        }
                }
                return $result;