Commit 5f5f297
committed
fix: use timegm/_mkgmtime instead of std::mktime for permission timestamps
std::mktime interprets the broken-down time as local time, so permission
validity periods change depending on the timezone of the host parsing the
XML. This breaks deployments where permissions documents are distributed
across hosts in different timezones.
Replace std::mktime with timegm (POSIX) / _mkgmtime (Windows) so the
not_before and not_after timestamps are always interpreted as UTC.
Fixes #6403.
Test Plan:
Parsed a permissions XML with validity="2025-01-01T00:00:00" and
verified the epoch time is the same regardless of TZ environment
variable.
Signed-off-by: Yuchen Fan <functionhx@gmail.com>1 parent dd66ef2 commit 5f5f297
1 file changed
Lines changed: 11 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
20 | 20 | | |
21 | 21 | | |
22 | 22 | | |
| 23 | + | |
23 | 24 | | |
24 | 25 | | |
25 | 26 | | |
| |||
339 | 340 | | |
340 | 341 | | |
341 | 342 | | |
342 | | - | |
| 343 | + | |
| 344 | + | |
| 345 | + | |
| 346 | + | |
| 347 | + | |
343 | 348 | | |
344 | 349 | | |
345 | 350 | | |
| |||
360 | 365 | | |
361 | 366 | | |
362 | 367 | | |
363 | | - | |
| 368 | + | |
| 369 | + | |
| 370 | + | |
| 371 | + | |
| 372 | + | |
364 | 373 | | |
365 | 374 | | |
366 | 375 | | |
| |||
0 commit comments