]> source.dussan.org Git - nextcloud-server.git/commitdiff
catch broken server config and disable encryption app.
authorBjoern Schiessle <schiessle@owncloud.com>
Thu, 1 Aug 2013 09:50:56 +0000 (11:50 +0200)
committerBjoern Schiessle <schiessle@owncloud.com>
Thu, 1 Aug 2013 09:50:56 +0000 (11:50 +0200)
apps/files_encryption/hooks/hooks.php
apps/files_encryption/lib/helper.php

index b2a17f6bca5e344646a76a8e42354d765f439ed4..264dc2fd71933e7eb2b4f34fabe13b2d2a43ef1a 100644 (file)
@@ -40,7 +40,7 @@ class Hooks {
        public static function login($params) {\r
                $l = new \OC_L10N('files_encryption');\r
                //check if all requirements are met\r
-               if(!Helper::checkRequirements() ) {\r
+               if(!Helper::checkRequirements() || !Helper::checkConfiguration() ) {\r
                        $error_msg = $l->t("Missing requirements.");\r
                        $hint = $l->t('Please make sure that PHP 5.3.3 or newer is installed and that the OpenSSL PHP extension is enabled and configured properly. For now, the encryption app has been disabled.');\r
                        \OC_App::disable('files_encryption');\r
index 6eee8fed6a63932b01071dc0b173ee8041dc6f1a..d3d4afff912c1f31ca0714d4753267f81c1363dc 100755 (executable)
@@ -232,6 +232,18 @@ class Helper {
 
                return (bool) $result;
        }
+       
+       /**
+        * check some common errors if the server isn't configured properly for encryption
+        * @return bool true if configuration seems to be OK
+        */
+       public static function checkConfiguration() {
+               if(openssl_pkey_new(array('private_key_bits' => 4096))) {
+                       return true;
+               } else {
+                       return false;
+               }
+       }
 
        /**
         * @brief glob uses different pattern than regular expressions, escape glob pattern only