From 90b53649ca97ac2cf402e0c3c60d3c73aa0387a4 Mon Sep 17 00:00:00 2001 From: "Michael J. Rubinsky" Date: Thu, 1 Apr 2010 16:12:51 -0400 Subject: [PATCH] Pass the rest of the policy parameters to the activesync server. Simplify this a little while I'm at it.. --- .../lib/Horde/ActiveSync/Driver/Base.php | 36 ++++++++++------------ .../lib/Horde/ActiveSync/Request/Base.php | 2 +- horde/rpc.php | 11 ++++--- 3 files changed, 24 insertions(+), 25 deletions(-) diff --git a/framework/ActiveSync/lib/Horde/ActiveSync/Driver/Base.php b/framework/ActiveSync/lib/Horde/ActiveSync/Driver/Base.php index 7dbdc4eb9..173077c35 100644 --- a/framework/ActiveSync/lib/Horde/ActiveSync/Driver/Base.php +++ b/framework/ActiveSync/lib/Horde/ActiveSync/Driver/Base.php @@ -75,9 +75,8 @@ abstract class Horde_ActiveSync_Driver_Base * *
      * Currently supported settings are:
-     *   requirePin      - Device must have a pin lock enabled.
-     *   computerUnlock  - Device can be unlocked by a computer.
-     *   AEFrequencyType - AEFrequencyValue is set (1) or not (0)
+     *   pin      - Device must have a pin lock enabled.
+     *   computerunlock  - Device can be unlocked by a computer.
      *   AEFrequencyValue - Time (in minutes) of inactivity before device locks
      *   DeviceWipeThreshold - Number of failed unlock attempts before the
      *                         device should wipe on devices that support this.
@@ -89,14 +88,13 @@ abstract class Horde_ActiveSync_Driver_Base
      * 
*/ protected $_policies = array( - 'requirePin' => true, - 'computerUnlock' => true, - 'AEFrequencyType' => 1, - 'AEFrequencyValue' => 5, - 'DeviceWipeThreshold' => 10, - 'CodewordFrequency' => 5, - 'MinimumPasswordLength' => 5, - 'PasswordComplexity' => 2, + 'pin' => true, + 'computerunlock' => true, + 'inactivity' => 5, + 'wipethreshold' => 10, + 'codewordfrequency' => 5, + 'minimumlength' => 5, + 'complexity' => 2, ); /** @@ -555,25 +553,25 @@ abstract class Horde_ActiveSync_Driver_Base public function getCurrentPolicy($policyType = 'MS-WAP-Provisioning-XML') { return '' - . '' - . '' + . '' + . '' . '' . '' . '' - . '' - . (!empty($this->_policies['AEFrequencyValue']) ? '' : '') + . '' + . (!empty($this->_policies['AEFrequencyValue']) ? '' : '') . '' . '' - . '' + . '' . '' . '' - . '' + . '' . '' . '' - . '' + . '' . '' . '' - . '' + . '' . '' . '' . ''; diff --git a/framework/ActiveSync/lib/Horde/ActiveSync/Request/Base.php b/framework/ActiveSync/lib/Horde/ActiveSync/Request/Base.php index be9c9ea40..e63715a0f 100644 --- a/framework/ActiveSync/lib/Horde/ActiveSync/Request/Base.php +++ b/framework/ActiveSync/lib/Horde/ActiveSync/Request/Base.php @@ -121,7 +121,7 @@ abstract class Horde_ActiveSync_Request_Base /* Loose provsioning should allow a blank key */ if ((empty($storedKey) || $storedKey != $sentKey) && ($this->_provisioning !== 'loose' || - ($this->_provisioning === 'loose' && !empty($this->_policyKey)))) { + ($this->_provisioning === 'loose' && !is_null($this->_policyKey)))) { Horde_ActiveSync::provisioningRequired(); return false; diff --git a/horde/rpc.php b/horde/rpc.php index 217a91be4..15cea1f1c 100644 --- a/horde/rpc.php +++ b/horde/rpc.php @@ -35,7 +35,7 @@ $params['logger'] = $GLOBALS['injector']->getInstance('Horde_Log_Logger'); /* Look at the Content-type of the request, if it is available, to try * and determine what kind of request this is. */ -if (!empty($conf['activesync']['enabled']) && +if (!empty($GLOBALS['conf']['activesync']['enabled']) && ((strpos($request->getServer('CONTENT_TYPE'), 'application/vnd.ms-sync.wbxml') !== false) || (strpos($request->getUri(), 'Microsoft-Server-ActiveSync') !== false))) { /* ActiveSync Request */ @@ -47,15 +47,16 @@ if (!empty($conf['activesync']['enabled']) && $params['registry'] = $GLOBALS['registry']; $connector = new Horde_ActiveSync_Driver_Horde_Connector_Registry($params); $stateMachine = new Horde_ActiveSync_State_File(array('stateDir' => $GLOBALS['conf']['activesync']['state']['directory'])); - $params['backend'] = new Horde_ActiveSync_Driver_Horde(array('connector' => $connector, - 'state_basic' => $stateMachine)); + $driver_params = array('connector' => $connector, 'state_basic' => $stateMachine); + if ($params['provisioning'] = $GLOBALS['conf']['activesync']['securitypolicies']['provisioning']) { + $driver_params['policies'] = $GLOBALS['conf']['activesync']['securitypolicies']; + } + $params['backend'] = new Horde_ActiveSync_Driver_Horde($driver_params); $params['server'] = new Horde_ActiveSync($params['backend'], new Horde_ActiveSync_Wbxml_Decoder(fopen('php://input', 'r')), new Horde_ActiveSync_Wbxml_Encoder(fopen('php://output', 'w+')), $request); $params['server']->setLogger($params['logger']); - $params['provisioning'] = $conf['activesync']['securitypolicies']['provisioning']; - } elseif ($request->getServer('PATH_INFO') || in_array($request->getServer('REQUEST_METHOD'), array('DELETE', 'PROPFIND', 'PUT', 'OPTIONS'))) { $serverType = 'Webdav'; -- 2.11.0