Commit Graph

113 Commits

Author SHA1 Message Date
Anatol Belski
18750a2238 Eliminate cast 2018-03-19 11:44:27 +01:00
Anatol Belski
397d40cdd7 Mark non exported symbol as static 2018-03-17 21:17:47 +01:00
Xinchen Hui
a6519d0514 year++ 2018-01-02 12:57:58 +08:00
Anatol Belski
32db45ca54 Drop unused code 2017-12-15 14:58:43 +01:00
Anatol Belski
f3f6cd24e9 Modernize realpath and integrate quick variant into virtual_file_ex
The slower I/O as a traditional bottleneck on Windows which is
the target of this patch. The recursive path resolution, while being
an allround solution, is expensive when it comes to the common case.
Files with proper ACLs set can be resolved in one go by usage of specific
API. Those are available since Vista, so actually can be called old. Those
simpler api is used for the cases where no CWD_EXPAND is requested. For
the cases where ACLs are improper, the existing solution based on
FindFirstFile still does good job also partially providing quirks. Cases
involing reparse tags and other non local filesystems are also partially
server by new APIs.

The approach uses both APIs - the quick one for the common case still
integrating realpath cache, and the existing one as a fallback. The tests
show the I/O load drop on the realpath resolution part due to less
system calls for the sub part resolution of paths. In most case it is
justified, as the sub parts were otherwise cached or unused as well. The
realpath() implementation in ioutil is also closer to the POSIX.
2017-12-15 13:23:34 +01:00
Anatol Belski
17d621e7d3 Allow delete-sharing mode for CreateFile by default
This effectively allows a UNIX like semantics for deleting files
with an open handle. Some OS related limitations still persist,
but the Windows 95 times can be considered as definitely over.
2017-12-08 18:14:20 +01:00
Anatol Belski
80d6eb6806 Fix unsigned comparisons and remove dead code
Fix unsigned comparison

Cleanup never executed block

Fix unsigned comparison

Fix unsigned comparison, diff can't be < 0

Fix unsigned comparison

Fix unsigned comparison

Remove dead code
2017-11-17 22:38:44 +01:00
Anatol Belski
61259d692e Merge branch 'PHP-7.2'
* PHP-7.2:
  Fixed #75384 PHP seems incompatible with OneDrive files on demand
  bump versions
  Fixed ext/date tests due to changes in Olson database
2017-11-08 12:01:39 +01:00
Anatol Belski
01c70cc98b Merge branch 'PHP-7.1' into PHP-7.2
* PHP-7.1:
  Fixed #75384 PHP seems incompatible with OneDrive files on demand
  bump versions
  Fixed ext/date tests due to changes in Olson database
2017-11-08 12:00:30 +01:00
Anatol Belski
d36e793c93 Merge branch 'PHP-7.0' into PHP-7.1
* PHP-7.0:
  Fixed #75384 PHP seems incompatible with OneDrive files on demand
  Fixed ext/date tests due to changes in Olson database
2017-11-08 11:54:18 +01:00
Anatol Belski
c6720e2f45 Fixed #75384 PHP seems incompatible with OneDrive files on demand 2017-11-08 11:52:42 +01:00
Anatol Belski
be62d5fc19 Merge branch 'PHP-7.2'
* PHP-7.2:
  Fix datatype
2017-10-11 09:00:32 +02:00
Anatol Belski
53169dc480 Fix datatype 2017-10-11 08:58:59 +02:00
Anatol Belski
beb9295790 Merge branch 'PHP-7.2'
* PHP-7.2:
  Fixed bug #75063
2017-08-14 00:53:33 +02:00
Anatol Belski
0a2a136111 Merge branch 'PHP-7.1' into PHP-7.2
* PHP-7.1:
  Fixed bug #75063
2017-08-14 00:51:47 +02:00
Anatol Belski
3069ad8dd1 Fixed bug #75063 2017-08-14 00:44:19 +02:00
Anatol Belski
827284ec36 fix up porting mistakes 2017-07-27 23:38:04 +02:00
Anatol Belski
49d9b3013f Move cwd_state and path related routines to size_t
Having `int` there is no real profit in the size or speed, while unsigned
improves security and overall integration. ZPP supplied strings can
be then accepted directly and structs can be still handled with smaller
unsigned types for size reasons, which is safe. Yet some related places
are to go.

basic move tsrm_realpath_r to size_t

fix conditions and sync with affected places

touch ocurrences of php_sys_readlink usage

follow up on phar path handling

remove duplicated check

move zend_resolve_path and related pieces to size_t

touch yet resolve path related places

remove cast

missing pieces

missing piece

yet cleanups for php_sys_readlink for ssize_t

fix wrong return
2017-07-27 20:11:21 +02:00
Anatol Belski
6a010ad492 Avoid unnecessary string copy
which is the case when there's no impersonation.
2017-04-27 16:03:12 +02:00
Anatol Belski
24ae881080 get rid of two strlen calls 2017-04-27 15:41:09 +02:00
Anatol Belski
ad4ef13c5d Switch to FindFirstFileEx with basic info level
That omits querying of short names, thus improving perf.
2017-04-07 21:15:37 +02:00
Anatol Belski
936e341b5e missing bits for php_sys_stat_ex so everything is handled with wide chars
rename to pathw_len
2017-04-03 17:39:15 +02:00
Anatol Belski
f02b4d575f Merge branch 'PHP-7.1'
* PHP-7.1:
  fix possible out of bounds buffer access
2017-04-03 15:22:59 +02:00
Anatol Belski
3438e62b30 Merge branch 'PHP-7.0' into PHP-7.1
* PHP-7.0:
  fix possible out of bounds buffer access
2017-04-03 15:22:04 +02:00
Anatol Belski
feeb35e438 fix possible out of bounds buffer access 2017-04-03 15:20:32 +02:00
Nikita Popov
edcabf6d07 Drop unnecessary allocator return value checks 2017-03-13 22:07:15 +01:00
Anatol Belski
5b5130c4ff Revert "backport 51e1da6ea1 into 7.0"
This reverts commit 8da8756312.
2017-01-31 14:21:20 +01:00
Anatol Belski
352456031e Merge branch 'PHP-7.1'
* PHP-7.1:
  make length check more robust
2017-01-24 13:25:57 +01:00
Anatol Belski
403f352482 make length check more robust 2017-01-24 13:24:11 +01:00
Anatol Belski
8da8756312 backport 51e1da6ea1 into 7.0 2017-01-21 02:56:15 +01:00
Anatol Belski
d263f29b71 Merge branch 'PHP-7.1'
* PHP-7.1:
  exclude debug code
  ensure the string for conversion is \0 terminated and integrade additional path length check
2017-01-21 02:20:52 +01:00
Anatol Belski
51e1da6ea1 exclude debug code 2017-01-21 02:17:06 +01:00
Anatol Belski
6b6122a957 ensure the string for conversion is \0 terminated and integrade
additional path length check
2017-01-21 02:11:24 +01:00
Anatol Belski
73bfa264cc Merge branch 'PHP-7.1'
* PHP-7.1:
  Fixed bug #73962 bug with symlink related to cyrillic directory
2017-01-20 23:47:12 +01:00
Anatol Belski
95406c878a Fixed bug #73962 bug with symlink related to cyrillic directory 2017-01-20 23:45:08 +01:00
Anatol Belski
25797535d4 Merge branch 'PHP-7.1'
* PHP-7.1:
  fix edge case leak
2017-01-07 01:17:18 +01:00
Anatol Belski
b716a1fbef fix edge case leak 2017-01-07 01:15:49 +01:00
Anatol Belski
628c5a31da Merge branch 'PHP-7.1'
* PHP-7.1:
  Fixed bug #73877 readlink() returns garbage for UTF-8 paths
2017-01-07 01:10:56 +01:00
Anatol Belski
0f410f8087 Fixed bug #73877 readlink() returns garbage for UTF-8 paths 2017-01-07 01:09:17 +01:00
Sammy Kaye Powers
dac6c639bb Update copyright headers to 2017 2017-01-04 11:23:42 -06:00
Sammy Kaye Powers
478f119ab9 Update copyright headers to 2017 2017-01-04 11:14:55 -06:00
Sammy Kaye Powers
9e29f841ce Update copyright headers to 2017 2017-01-02 09:30:12 -06:00
Anatol Belski
758af77e9d Path handling related refactorings
Primarily related to the path handling datatypes, to avoid unnecessary
casts, where possible. Also some rework to avoid code dup. Probably
more places are to go, even not path related, primarily to have less
casts and unsigned integers where possible. That way, we've not only
less warnings and casts, but are also safer with regard to the
integer overflows. OFC it's not a panacea, but still significantly
reduces the vulnerability potential.
2016-12-22 14:56:47 +01:00
Anatol Belski
4d790486b8 reduce realpath_cache_bucket size by 8 bytes on 64-bit
This limits the path length to 64kb which is already far above the
use case. In return, the whole path cache storage size is reduced
by 8kb.
2016-11-13 20:21:44 +01:00
Kalle Sommer Nielsen
2104bea5d7 Remove Netware support
If this does not break the Unix system somehow, I'll be amazed. This should get most of it out, apologies for any errors this may cause on non-Windows ends which I cannot test atm.
2016-11-12 11:20:01 +01:00
Anatol Belski
71f73d7f58 remove dead code 2016-10-26 18:06:16 +02:00
Anatol Belski
6679df147a reset also the cwd_length, when cwd is free'd 2016-10-26 18:06:16 +02:00
Christoph M. Becker
dec8c7e9d8 Merge branch 'PHP-7.1' 2016-09-06 12:20:20 +02:00
Christoph M. Becker
5d394b3bb4 Merge branch 'PHP-7.0' into PHP-7.1 2016-09-06 12:16:42 +02:00
Christoph M. Becker
af3031d755 Merge branch 'PHP-5.6' into PHP-7.0 2016-09-06 12:11:24 +02:00