Commit Graph
107 Commits
Author SHA1 Message Date
Alhuda Khan 16908dc4aa utils: fix size_t underflow in FormatTime %f padding 2026-10-14 11:32:00 +05:30
Alexey Sokolov 5bd5ecc5b8 Remove old ssl compatibility code 2026-06-29 19:19:40 +01:00
Ravi Kant Sharma 94bcf919e1 Fix build error with OpenSSL 4 (#2024)
More details here https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1138356
2026-06-29 19:03:27 +01:00
Alexey Sokolov 6186f611b9 Merge pull request #2017 from MarkLee131/fix/checkpass-constant-time
User: use constant-time compare for MD5/SHA256/plain password paths
2026-04-30 08:23:07 +01:00
MarkLee131 c9d0677e4f Utils: prefer CRYPTO_memcmp in ConstantTimeEquals when OpenSSL is available
Per review feedback on #2017: a hand-rolled byte loop can in principle
be folded back into a short-circuiting compare by an aggressive optimizer.
Use CRYPTO_memcmp under HAVE_LIBSSL since OpenSSL is already a build
dependency for the SHA256 path. For non-OpenSSL builds, mark the
accumulator and pointers volatile and note in a comment that this is
best-effort.
2026-04-29 17:06:49 +08:00
MarkLee131 f0c3341e35 User,Utils: move ConstantTimeEquals to CUtils and add tests (#2011) 2026-04-25 17:37:33 +08:00
MarkLee131 b944299167 Utils: reject out-of-range years in ParseServerTime
cctz::parse into a microseconds time_point internally multiplies the
parsed seconds-since-epoch by 1,000,000 in signed int64. Years past ~292k
overflow, which is UB under UBSan or -ftrapv builds. In plain production
builds the overflow silently wraps and buffer playback shows a garbage
timestamp.

Reject anything with a year longer than 5 digits before calling into
cctz. 5 digits covers every realistic IRCv3 @time tag.
2026-04-25 10:36:53 +08:00
Falk Rund ad6a397ca4 Welcome to 2026
[skip ci]
2026-01-01 13:44:32 +01:00
Giovanni 30fbf1172c Fix host name retrieval during TLS certificate generation (#1935)
Use HOSTNAME if defined, otherwise invoke gethostname(3) if possible,
fallback to uname(2)
2025-03-16 15:43:39 +00:00
Peter 44e4b95a20 Welcome to 2025 (#1929) 2025-02-07 23:23:45 +00:00
Falk Rund 17a004aa0b Welcome to 2024
[skip ci]
2023-12-31 21:09:25 +01:00
Alexey Sokolov a1a254bef1 Update password hashes from SHA-256 to Argon2id
These days salted SHA-256 is considered quite weak for passwords.

Transparently upgrade existing hashes upon login.

Bump cmake requirement to able to use IMPORTED_TARGET, this will allow
further cleanup in next commits.
2023-09-27 01:11:07 +01:00
Alexey Sokolov 64359328cf Use std::chrono and cctz instead of messing with TZ 2023-01-07 21:18:20 +00:00
Alexey Sokolov 963a00a371 Merge commit 'refs/pull/1853/head' of github.com:znc/znc 2023-01-07 20:41:48 +00:00
Alexey Sokolov c5befe3dc4 Use steady clock for cache map 2023-01-07 18:10:50 +00:00
Falk Rund f9fd05c307 Welcome to 2023 2023-01-01 06:49:00 +01:00
John Marrett 2a6a1d70ff Add ParseServerTime TZ fix and tests 2022-12-29 07:53:39 -05:00
Falk Rund 6402d241ac Welcome to 2022
The same procedure as last year, Miss Sophie?
Same procedure as every year, James.
2022-01-01 14:05:32 +01:00
MAGIC 99687b0f24 Welcome to 2021 2021-01-01 19:37:07 +01:00
MAGIC 9081aa971d Welcome to 2020 2020-01-02 00:36:05 +01:00
Alexey Sokolov fa9fff618e Merge branch '1.7.x' 2019-11-01 08:24:36 +00:00
Rosen Penev f839d258d0 Fix redefinition error under OpenSSL
LIBRESSL_VERSION_NUMBER is 0 when not defined, making the condition always true.

Close #1688
2019-11-01 08:23:46 +00:00
girst 3988cfef98 ListStyle (compact) replacement for two-column tables
by calling CTable::SetStyle(CTable::ListStyle) one can switch from the
bulky and unreadable-on-narrow-devices-or-nonmonospaced-fonts tables to
a more compact list style of output. The first "column" will be bolded
for better visibility and seperated with a colon from the second.

This is currently designed to replace two column tables only.
2019-05-19 14:03:41 +02:00
dgw 8d5427cf9b Welcome to 2019
What are we going to do today, Brain?

The same thing we do every year, Pinky: Update all the copyright
headers!

[Skip CI]
2019-01-01 17:05:05 -06:00
Rosen Penev a28c5f8056 Fix compilation with LibreSSL < 2.7.0
LibreSSL was stubborn and did not implement all of OpenSSL 1.1 despite
advertising support for it. Fixed in 2.7.0.

Close #1623
2018-12-09 22:50:50 +00:00
Rosen Penev f6eb43673c Fix compilation without deprecated APIs in OpenSSL 1.1
Prior commit was tested with 1.0.2. This one with 1.1.
2018-11-26 14:35:24 -08:00
Rosen Penev dddcef52b9 Fix compilation without deprecated APIs in OpenSSL
Added a few implicit headers that don't get included anymore and switched
to OpenSSL 1.0.0's THREAD API when supported.

Close #1615
2018-11-10 18:04:03 +00:00
Baruch Siach e567f4cb73 Fix build without SSL support
The <memory> headers is needed for unique_ptr even when SSL is not
enabled. This fixes the following build failure:

src/Utils.cpp: In static member function 'static bool CUtils::CheckCIDR(const CString&, const CString&)':
src/Utils.cpp:674:5: error: 'unique_ptr' is not a member of 'std'
     std::unique_ptr<addrinfo, decltype(deleter)> aiHost(aiHostC, deleter);
     ^

Close #1554
2018-06-10 21:09:07 +01:00
Falk Seidel d647eaabc0 Welcome to 2018
The same procedure as last year, Miss Sophie?
The same procedure as every year, James.

[skip ci]
2018-01-19 19:38:58 +00:00
Alexey Sokolov bd51ebcdca Merge pull request #1455 from CyberShadow/timeval
Add sub-second precision for timestamp formatting
2017-12-10 11:46:22 +00:00
Vladimir Panteleev 15b1f8d8fa Change format syntax to a simple custom %f/%#f scheme 2017-12-10 09:45:58 +00:00
Alexey Sokolov 744bd7d55c Fix use-after-free in znc --makepem
X509_get_subject_name() returns an internal pointer, which was destroyed
by X509_set_subject_name(), and then accessed again in
X509_set_issuer_name().
But X509_set_subject_name() isn't needed at all, because subject name
was modified in place.
2017-11-12 16:45:23 +00:00
Vladimir Panteleev 901a21e91b Utils: Add FormatTime overload taking timeval
This overload also supports additional format sequences for formatting
the sub-second part of timeval.
2017-10-26 00:00:50 +00:00
Phansa 3189ce7f8a Welcome to 2017
Welcome to 2017

temp

temp2
2017-03-12 20:34:26 -04:00
Alexey Sokolov a44aa0c699 Revert tables to how they were in 1.4
See #914
2017-02-24 23:49:18 +00:00
Alexey Sokolov c7c878adc8 Fix build on macOS Sierra (10.12)
Rename OS X to macOS
Add Sierra to Travis
2017-01-15 23:04:55 +00:00
Alexey Sokolov 30cd0584a1 Fix build on FreeBSD for the latest CIDR commits 2016-12-25 13:53:17 +00:00
Alexey Sokolov b445ad30e3 Modernize CIDR code. 2016-12-25 13:52:54 +00:00
Alexey Sokolov 6fbab7b44c Add CIDR support to TrustedProxy setting
Fix #1219
2016-12-25 13:00:02 +00:00
Alexey Sokolov 3846813512 Merge branch '1.6.x'
Conflicts:
	modules/schat.cpp
	src/SSLVerifyHost.cpp
	src/Utils.cpp
2016-09-13 22:45:10 +01:00
William Elwood 6a5c2c649d Fix use of a feature deprecated in OpenSSL 0.9.8
If OpenSSL 1.1 is configured in such a way that features deprecated in 0.9.8 are not built, then compile errors would result here.
I also noticed a potential memory leak where pRSA was not always freed before early return from this function - fixed by using C++11 unique_ptr.
2016-09-13 11:50:40 +01:00
Alexey Sokolov 3f1c27250c Fix warning in Utils.cpp 2016-09-12 00:07:29 +01:00
Alexey Sokolov 187f617bbc Merge branch '1.6.x'
Close #1313
2016-09-09 21:14:00 +01:00
Alexey Sokolov debfdf6c02 Fix build on OS X after fixing build on Cygwin 2016-09-09 00:17:20 +01:00
Alexey Sokolov 1480177458 Merge branch '1.6.x' 2016-09-08 22:26:51 +01:00
Alexey Sokolov aff7e25043 Fix cygwin build
(cherry picked from commit f1ef8c79db)
2016-08-13 09:55:00 +01:00
Alexey Sokolov f1ef8c79db Fix cygwin build 2016-07-20 00:19:19 +01:00
Tor Arne Vestbø 02bfb9eaf5 Centralize logic to get current server time
A few different implementations of computing the current time were
spread out through the code base, most of them using gettimeofday().

This centralizes the logic in CUtil::GetTime() for easier maintenance,
and also allows all call sites to get the benefit of the clock_gettime()
code path on systems that support it.
2016-07-06 01:16:15 +02:00
Falk Seidel 8f73840e74 Welcome to 2016
🎆  Happy 2016 🎆
2016-01-01 20:11:21 +01:00
Alexey Sokolov 16a8c77737 Replace virtual with override where possible.
Using clang-tidy
2015-12-08 20:51:50 +00:00