Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Z
z-push
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Björn Fischer
z-push
Commits
7e45e9ed
Commit
7e45e9ed
authored
Mar 30, 2016
by
Manfred Kutas
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ZP-77 Remove unnecessary brackets.
Released under the Affero GNU General Public License (AGPL) version 3.
parent
32438bde
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
37 additions
and
20 deletions
+37
-20
devicemanager.php
src/lib/core/devicemanager.php
+24
-16
zpushdefs.php
src/lib/core/zpushdefs.php
+2
-1
provisioning.php
src/lib/request/provisioning.php
+4
-3
syncprovisioning.php
src/lib/syncobjects/syncprovisioning.php
+7
-0
No files found.
src/lib/core/devicemanager.php
View file @
7e45e9ed
...
...
@@ -231,14 +231,14 @@ class DeviceManager {
}
$p
=
(
(
$this
->
device
->
GetWipeStatus
()
!=
SYNC_PROVISION_RWSTATUS_NA
&&
$policykey
!=
$this
->
device
->
GetPolicyKey
())
||
(
Request
::
WasPolicyKeySent
()
&&
$this
->
device
->
GetPolicyKey
()
==
ASDevice
::
UNDEFINED
)
);
Request
::
WasPolicyKeySent
()
&&
$this
->
device
->
GetPolicyKey
()
==
ASDevice
::
UNDEFINED
);
if
(
!
$noDebug
||
$p
)
ZLog
::
Write
(
LOGLEVEL_DEBUG
,
sprintf
(
"DeviceManager->ProvisioningRequired('%s') saved device key '%s': %s"
,
$policykey
,
$this
->
device
->
GetPolicyKey
(),
Utils
::
PrintAsString
(
$p
)));
if
(
$checkPolicies
)
{
$policyHash
=
SyncProvisioning
::
GetObjectWithPolicies
(
$this
->
getProvisioningPolicies
()
)
->
GetPolicyHash
();
if
(
$this
->
device
->
getPolicyhash
()
!=
$policyHash
)
{
$policyHash
=
$this
->
GetProvisioningObject
(
)
->
GetPolicyHash
();
if
(
$this
->
device
->
hasPolicyhash
()
&&
$this
->
device
->
getPolicyhash
()
!=
$policyHash
)
{
$p
=
true
;
ZLog
::
Write
(
LOGLEVEL_INFO
,
sprintf
(
"DeviceManager->ProvisioningRequired(): saved policy hash '%s' changed '%s'. Provisioning required."
,
$this
->
device
->
getPolicyhash
(),
$policyHash
));
}
...
...
@@ -277,13 +277,9 @@ class DeviceManager {
* @return SyncProvisioning
*/
public
function
GetProvisioningObject
()
{
$p
=
SyncProvisioning
::
GetObjectWithPolicies
(
$this
->
getProvisioningPolicies
());
// save policies' hash and name
$this
->
device
->
SetPolicyname
(
$this
->
getPolicyName
());
$this
->
device
->
SetPolicyhash
(
$p
->
GetPolicyHash
());
ZLog
::
Write
(
LOGLEVEL_DEBUG
,
sprintf
(
"Set policy: %s with hash: %s"
,
$this
->
device
->
GetPolicyname
(),
$this
->
device
->
GetPolicyhash
()));
$policyName
=
$this
->
getPolicyName
();
$p
=
SyncProvisioning
::
GetObjectWithPolicies
(
$this
->
getProvisioningPolicies
(
$policyName
));
$p
->
PolicyName
=
$policyName
;
return
$p
;
}
...
...
@@ -316,6 +312,21 @@ class DeviceManager {
return
true
;
}
/**
* Saves the policy hash and name in device's state.
*
* @param SyncProvisioning $provisioning
*
* @access public
* @return void
*/
public
function
SavePolicyHashAndName
(
$provisioning
)
{
// save policies' hash and name
$this
->
device
->
SetPolicyname
(
$provisioning
->
PolicyName
);
$this
->
device
->
SetPolicyhash
(
$provisioning
->
GetPolicyHash
());
ZLog
::
Write
(
LOGLEVEL_DEBUG
,
sprintf
(
"DeviceManager->SavePolicyHashAndName(): Set policy: %s with hash: %s"
,
$this
->
device
->
GetPolicyname
(),
$this
->
device
->
GetPolicyhash
()));
}
/**----------------------------------------------------------------------------------------------------------
* LEGACY AS 1.0 and WRAPPER operations
...
...
@@ -944,11 +955,12 @@ class DeviceManager {
/**
* Loads Provisioning policies from the policies file.
*
* @param string $policyName The name of the policy
*
* @access private
* @return array
*/
private
function
getProvisioningPolicies
()
{
$policyName
=
$this
->
getPolicyName
();
private
function
getProvisioningPolicies
(
$policyName
)
{
$policies
=
ZPush
::
GetPolicies
();
if
(
!
isset
(
$policies
[
$policyName
])
&&
$policyName
!=
ASDevice
::
DEFAULTPOLICYNAME
)
{
...
...
@@ -968,10 +980,6 @@ class DeviceManager {
private
function
getPolicyName
()
{
$policyName
=
ZPush
::
GetBackend
()
->
GetUserPolicyName
();
if
(
$policyName
===
false
&&
$this
->
device
->
HasPolicyname
())
{
// get the policy name from device data
$policyName
=
$this
->
device
->
GetPolicyname
();
}
$policyName
=
((
!
empty
(
$policyName
)
&&
$policyName
!==
false
)
?
$policyName
:
ASDevice
::
DEFAULTPOLICYNAME
);
ZLog
::
Write
(
LOGLEVEL_DEBUG
,
sprintf
(
"DeviceManager->getPolicyName(): determined policy name: '%s'"
,
$policyName
));
return
$policyName
;
...
...
src/lib/core/zpushdefs.php
View file @
7e45e9ed
...
...
@@ -488,7 +488,8 @@ define("SYNC_PROVISION_UNAPPROVEDINROMAPPLIST", "Provision:UnapprovedInROMApplic
define
(
"SYNC_PROVISION_APPNAME"
,
"Provision:ApplicationName"
);
define
(
"SYNC_PROVISION_APPROVEDAPPLIST"
,
"Provision:ApprovedApplicationList"
);
define
(
"SYNC_PROVISION_HASH"
,
"Provision:Hash"
);
// only for internal use - never to be streamed to the mobile
define
(
"SYNC_PROVISION_POLICYNAME"
,
"Provision:PolicyName"
);
//Search
define
(
"SYNC_SEARCH_SEARCH"
,
"Search:Search"
);
...
...
src/lib/request/provisioning.php
View file @
7e45e9ed
...
...
@@ -74,7 +74,7 @@ class Provisioning extends RequestProcessor {
// - Remote Wipe
// - DeviceInformation
// - Policies
// Each of them should only be once per request.
// Each of them should only be once per request.
WBXMLDecoder
::
ResetInWhile
(
"provisioningMain"
);
while
(
WBXMLDecoder
::
InWhile
(
"provisioningMain"
))
{
$requestName
=
""
;
...
...
@@ -88,7 +88,7 @@ class Provisioning extends RequestProcessor {
$requestName
=
SYNC_SETTINGS_DEVICEINFORMATION
;
}
if
(
!
$requestName
)
if
(
!
$requestName
)
break
;
//set is available for OOF, device password and device information
...
...
@@ -150,7 +150,7 @@ class Provisioning extends RequestProcessor {
case
SYNC_SETTINGS_DEVICEINFORMATION
:
// AS14.1 and later clients pass Device Information on the initial Provision request
if
(
!
self
::
$decoder
->
getElementStartTag
(
SYNC_SETTINGS_SET
))
if
(
!
self
::
$decoder
->
getElementStartTag
(
SYNC_SETTINGS_SET
))
return
false
;
$deviceInfoSet
=
true
;
$deviceinformation
=
new
SyncDeviceInformation
();
...
...
@@ -236,6 +236,7 @@ class Provisioning extends RequestProcessor {
if
(
!
$prov
->
Check
())
throw
new
FatalException
(
"Invalid policies!"
);
self
::
$deviceManager
->
SavePolicyHashAndName
(
$prov
);
$prov
->
Encode
(
self
::
$encoder
);
self
::
$encoder
->
endTag
();
}
...
...
src/lib/syncobjects/syncprovisioning.php
View file @
7e45e9ed
...
...
@@ -94,6 +94,9 @@ class SyncProvisioning extends SyncObject {
public
$unapprovedinromapplist
;
public
$approvedapplist
;
// policy name used with the policies; not part of ActiveSync
public
$PolicyName
;
function
SyncProvisioning
()
{
$mapping
=
array
(
SYNC_PROVISION_DEVPWENABLED
=>
array
(
self
::
STREAMER_VAR
=>
"devpwenabled"
,
...
...
@@ -133,6 +136,10 @@ class SyncProvisioning extends SyncObject {
SYNC_PROVISION_DEVPWHISTORY
=>
array
(
self
::
STREAMER_VAR
=>
"devpwhistory"
,
self
::
STREAMER_CHECKS
=>
array
(
self
::
STREAMER_CHECK_CMPHIGHER
=>
-
1
)),
SYNC_PROVISION_POLICYNAME
=>
array
(
self
::
STREAMER_VAR
=>
"PolicyName"
,
self
::
STREAMER_TYPE
=>
self
::
STREAMER_TYPE_IGNORE
),
);
if
(
Request
::
GetProtocolVersion
()
>=
12.1
)
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment