Move policykey generation to the state object
authorMichael J. Rubinsky <mrubinsk@horde.org>
Wed, 31 Mar 2010 18:12:07 +0000 (14:12 -0400)
committerMichael J. Rubinsky <mrubinsk@horde.org>
Wed, 31 Mar 2010 18:12:07 +0000 (14:12 -0400)
framework/ActiveSync/lib/Horde/ActiveSync/Driver/Base.php
framework/ActiveSync/lib/Horde/ActiveSync/Request/Provision.php
framework/ActiveSync/lib/Horde/ActiveSync/State/Base.php

index b365313..c085030 100644 (file)
@@ -82,10 +82,11 @@ abstract class Horde_ActiveSync_Driver_Base
     protected $_policies = array(
         'requirePin' => true,
         'computerUnlock' => true,
-        'AEFrequencyType' => 0,
+        'AEFrequencyType' => 1,
+        'AEFrequencyValue' => 5,
         'DeviceWipeThreshold' => 10,
         'CodewordFrequency' => 5,
-        'MinimumPasswordLength' => 4,
+        'MinimumPasswordLength' => 5,
         'PasswordComplexity' => 2,
         );
 
@@ -513,16 +514,6 @@ abstract class Horde_ActiveSync_Driver_Base
     }
 
     /**
-     * Generate a random 10 digit policy key
-     *
-     * @return unknown
-     */
-    public function generatePolicyKey()
-    {
-        return mt_rand(1000000000, 9999999999);
-    }
-
-    /**
      * Return a device wipe status
      *
      * @param string $user
index 3ed3c28..5324de3 100644 (file)
@@ -156,12 +156,12 @@ class Horde_ActiveSync_Request_Provision extends Horde_ActiveSync_Request_Base
                 $policyStatus = self::STATUS_POLKEYMISM;
             } else {
                 /* Set the final key */
-                $policykey = $this->_driver->generatePolicyKey();
+                $policykey = $state->generatePolicyKey();
                 $state->setPolicyKey($this->_devId, $policykey);
             }
         } elseif (empty($policykey)) {
             // This is phase2 - we need to set the intermediate key
-            $policykey = $this->_driver->generatePolicyKey();
+            $policykey = $state->generatePolicyKey();
             $state->setPolicyKey($this->_devId, $policykey);
         }
 
index 1be7157..7b27362 100644 (file)
@@ -110,6 +110,16 @@ abstract class Horde_ActiveSync_State_Base
     }
 
     /**
+     * Generate a random 10 digit policy key
+     *
+     * @return unknown
+     */
+    public function generatePolicyKey()
+    {
+        return mt_rand(1000000000, 9999999999);
+    }
+
+    /**
      * Loads the initial state from storage for the specified syncKey and
      * intializes the stateMachine for use.
      *