|
@@ -8,7 +8,7 @@ discard block |
|
|
block discarded – undo |
|
8
|
8
|
*/ |
|
9
|
9
|
|
|
10
|
10
|
class Request { |
|
11
|
|
- public const MAXMEMORYUSAGE = 0.9; // use max. 90% of allowed memory when syncing |
|
|
11
|
+ public const MAXMEMORYUSAGE = 0.9; // use max. 90% of allowed memory when syncing |
|
12
|
12
|
public const UNKNOWN = 'unknown'; |
|
13
|
13
|
public const IMPERSONATE_DELIM = '#'; |
|
14
|
14
|
|
|
@@ -140,7 +140,7 @@ discard block |
|
|
block discarded – undo |
|
140
|
140
|
} |
|
141
|
141
|
|
|
142
|
142
|
if (isset(self::$base64QueryDecoded['PolKey'])) { |
|
143
|
|
- self::$policykey = (int) self::filterEvilInput(self::$base64QueryDecoded['PolKey'], self::NUMBERS_ONLY); |
|
|
143
|
+ self::$policykey = (int)self::filterEvilInput(self::$base64QueryDecoded['PolKey'], self::NUMBERS_ONLY); |
|
144
|
144
|
} |
|
145
|
145
|
|
|
146
|
146
|
if (isset(self::$base64QueryDecoded['ProtVer'])) { |
|
@@ -197,7 +197,7 @@ discard block |
|
|
block discarded – undo |
|
197
|
197
|
} else { |
|
198
|
198
|
preg_replace_callback( |
|
199
|
199
|
'/(\-?\d+)(.?)/', |
|
200
|
|
- function ($m) { |
|
|
200
|
+ function($m) { |
|
201
|
201
|
self::$memoryLimit = $m[1] * pow(1024, strpos('BKMG', $m[2])) * self::MAXMEMORYUSAGE; |
|
202
|
202
|
}, |
|
203
|
203
|
strtoupper($memoryLimit) |
|
@@ -221,7 +221,7 @@ discard block |
|
|
block discarded – undo |
|
221
|
221
|
// the policy key might be set in Request::Initialize from the base64 encoded query |
|
222
|
222
|
if (!isset(self::$policykey)) { |
|
223
|
223
|
if (isset(self::$headers['x-ms-policykey'])) { |
|
224
|
|
- self::$policykey = (int) self::filterEvilInput(self::$headers['x-ms-policykey'], self::NUMBERS_ONLY); |
|
|
224
|
+ self::$policykey = (int)self::filterEvilInput(self::$headers['x-ms-policykey'], self::NUMBERS_ONLY); |
|
225
|
225
|
} else { |
|
226
|
226
|
self::$policykey = 0; |
|
227
|
227
|
} |
|
@@ -635,7 +635,7 @@ discard block |
|
|
block discarded – undo |
|
635
|
635
|
* @return int |
|
636
|
636
|
*/ |
|
637
|
637
|
public static function GetContentLength() { |
|
638
|
|
- return (isset(self::$headers['content-length'])) ? (int) self::$headers['content-length'] : 0; |
|
|
638
|
+ return (isset(self::$headers['content-length'])) ? (int)self::$headers['content-length'] : 0; |
|
639
|
639
|
} |
|
640
|
640
|
|
|
641
|
641
|
/** |
|
@@ -758,7 +758,7 @@ discard block |
|
|
block discarded – undo |
|
758
|
758
|
private static function filterIP($input) { |
|
759
|
759
|
$in_addr = @inet_pton($input); |
|
760
|
760
|
if (false === $in_addr) { |
|
761
|
|
- return 'badip-' . self::filterEvilInput($input, self::HEX_EXTENDED); |
|
|
761
|
+ return 'badip-'.self::filterEvilInput($input, self::HEX_EXTENDED); |
|
762
|
762
|
} |
|
763
|
763
|
|
|
764
|
764
|
return inet_ntop($in_addr); |
|
@@ -790,14 +790,14 @@ discard block |
|
|
block discarded – undo |
|
790
|
790
|
$polKeyLength = ord($decoded[5 + $devIdLength]); // policy key length |
|
791
|
791
|
$devTypeLength = ord($decoded[6 + $devIdLength + $polKeyLength]); // device type length |
|
792
|
792
|
// unpack the decoded query string values |
|
793
|
|
- self::$base64QueryDecoded = unpack('CProtVer/CCommand/vLocale/CDevIDLen/H' . ($devIdLength * 2) . 'DevID/CPolKeyLen' . (4 == $polKeyLength ? '/VPolKey' : '') . '/CDevTypeLen/A' . ($devTypeLength) . 'DevType', $decoded); |
|
|
793
|
+ self::$base64QueryDecoded = unpack('CProtVer/CCommand/vLocale/CDevIDLen/H'.($devIdLength * 2).'DevID/CPolKeyLen'.(4 == $polKeyLength ? '/VPolKey' : '').'/CDevTypeLen/A'.($devTypeLength).'DevType', $decoded); |
|
794
|
794
|
|
|
795
|
795
|
// get the command parameters |
|
796
|
796
|
$pos = 7 + $devIdLength + $polKeyLength + $devTypeLength; |
|
797
|
797
|
$decoded = substr($decoded, $pos); |
|
798
|
798
|
while (strlen($decoded) > 0) { |
|
799
|
799
|
$paramLength = ord($decoded[1]); |
|
800
|
|
- $unpackedParam = unpack('CParamTag/CParamLength/A' . $paramLength . 'ParamValue', $decoded); |
|
|
800
|
+ $unpackedParam = unpack('CParamTag/CParamLength/A'.$paramLength.'ParamValue', $decoded); |
|
801
|
801
|
self::$base64QueryDecoded[ord($decoded[0])] = $unpackedParam['ParamValue']; |
|
802
|
802
|
// remove parameter from decoded query string |
|
803
|
803
|
$decoded = substr($decoded, 2 + $paramLength); |