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
0db8a314
Commit
0db8a314
authored
Aug 28, 2015
by
Sebastian Kummer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ZP-672 Always require Authentication header. Released under the Affero
GNU General Public License (AGPL) version 3.
parent
9139eb89
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
17 deletions
+9
-17
index.php
src/index.php
+9
-17
No files found.
src/index.php
View file @
0db8a314
...
@@ -8,7 +8,7 @@
...
@@ -8,7 +8,7 @@
*
*
* Created : 01.10.2007
* Created : 01.10.2007
*
*
* Copyright 2007 - 201
3
Zarafa Deutschland GmbH
* Copyright 2007 - 201
5
Zarafa Deutschland GmbH
*
*
* This program is free software: you can redistribute it and/or modify
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License, version 3,
* it under the terms of the GNU Affero General Public License, version 3,
...
@@ -141,23 +141,19 @@ include_once('version.php');
...
@@ -141,23 +141,19 @@ include_once('version.php');
Request
::
Initialize
();
Request
::
Initialize
();
ZLog
::
Initialize
();
ZLog
::
Initialize
();
$autenticationInfo
=
Request
::
AuthenticationInfo
();
$GETUser
=
Request
::
GetGETUser
();
ZLog
::
Write
(
LOGLEVEL_DEBUG
,
"-------- Start"
);
ZLog
::
Write
(
LOGLEVEL_DEBUG
,
"-------- Start"
);
ZLog
::
Write
(
LOGLEVEL_INFO
,
ZLog
::
Write
(
LOGLEVEL_INFO
,
sprintf
(
"Version='%s' method='%s' from='%s' cmd='%s' getUser='%s' devId='%s' devType='%s'"
,
sprintf
(
"Version='%s' method='%s' from='%s' cmd='%s' getUser='%s' devId='%s' devType='%s'"
,
@
constant
(
'ZPUSH_VERSION'
),
Request
::
GetMethod
(),
Request
::
GetRemoteAddr
(),
@
constant
(
'ZPUSH_VERSION'
),
Request
::
GetMethod
(),
Request
::
GetRemoteAddr
(),
Request
::
GetCommand
(),
$GETUser
,
Request
::
GetDeviceID
(),
Request
::
GetDeviceType
()));
Request
::
GetCommand
(),
Request
::
GetGETUser
(),
Request
::
GetDeviceID
(),
Request
::
GetDeviceType
()));
// always request the authorization header
if
(
!
Request
::
AuthenticationInfo
())
throw
new
AuthenticationRequiredException
(
"Access denied. Please send authorization header."
);
// Stop here if this is an OPTIONS request
// Stop here if this is an OPTIONS request
- Auth information is available but not verified
if
(
Request
::
IsMethodOPTIONS
())
{
if
(
Request
::
IsMethodOPTIONS
())
{
if
(
!
$autenticationInfo
||
!
$GETUser
)
{
throw
new
NoPostRequestException
(
"Options request"
,
NoPostRequestException
::
OPTIONS_REQUEST
);
throw
new
AuthenticationRequiredException
(
"Access denied. Please send authentication information"
);
}
else
{
throw
new
NoPostRequestException
(
"Options request"
,
NoPostRequestException
::
OPTIONS_REQUEST
);
}
}
}
ZPush
::
CheckAdvancedConfig
();
ZPush
::
CheckAdvancedConfig
();
...
@@ -166,16 +162,12 @@ include_once('version.php');
...
@@ -166,16 +162,12 @@ include_once('version.php');
Request
::
ProcessHeaders
();
Request
::
ProcessHeaders
();
// Check required GET parameters
// Check required GET parameters
if
(
Request
::
IsMethodPOST
()
&&
(
Request
::
GetCommandCode
()
===
false
||
!
Request
::
GetDeviceID
()
||
!
Request
::
GetDeviceType
()))
if
(
Request
::
IsMethodPOST
()
&&
(
Request
::
GetCommandCode
()
===
false
||
!
Request
::
GetDeviceID
()
||
!
Request
::
GetDeviceType
()
||
!
Request
::
GetGETUser
()
))
throw
new
FatalException
(
"Requested the Z-Push URL without the required GET parameters"
);
throw
new
FatalException
(
"Requested the Z-Push URL without the required GET parameters"
);
// Load the backend
// Load the backend
$backend
=
ZPush
::
GetBackend
();
$backend
=
ZPush
::
GetBackend
();
// always request the authorization header
if
(
!
$autenticationInfo
||
!
$GETUser
)
throw
new
AuthenticationRequiredException
(
"Access denied. Please send authorisation information"
);
// check the provisioning information
// check the provisioning information
if
(
PROVISIONING
===
true
&&
Request
::
IsMethodPOST
()
&&
ZPush
::
CommandNeedsProvisioning
(
Request
::
GetCommandCode
())
&&
if
(
PROVISIONING
===
true
&&
Request
::
IsMethodPOST
()
&&
ZPush
::
CommandNeedsProvisioning
(
Request
::
GetCommandCode
())
&&
((
Request
::
WasPolicyKeySent
()
&&
Request
::
GetPolicyKey
()
==
0
)
||
ZPush
::
GetDeviceManager
()
->
ProvisioningRequired
(
Request
::
GetPolicyKey
()))
&&
((
Request
::
WasPolicyKeySent
()
&&
Request
::
GetPolicyKey
()
==
0
)
||
ZPush
::
GetDeviceManager
()
->
ProvisioningRequired
(
Request
::
GetPolicyKey
()))
&&
...
...
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