Commit Graph

111 Commits

Author SHA1 Message Date
Peter Keresztes Schmidt
65656de6ce db: Adjust the query methods to accept std::strings 2021-07-06 10:20:46 +02:00
Peter Keresztes Schmidt
cf9c47149f db: Add helper for escaping strings and use it 2021-07-06 10:20:45 +02:00
Peter Keresztes Schmidt
d69afc9672 misc: Convert time(nullptr) calls to std::chrono 2021-06-13 23:22:51 +02:00
Peter Keresztes Schmidt
8b87830e3e Use the new ByteArrayToHexString helper 2021-05-30 22:53:05 +02:00
Peter Keresztes Schmidt
837b32ccff User: Convert to new hashing API 2021-05-30 22:53:05 +02:00
Peter Keresztes Schmidt
b81689aa3f Remove libgcrypt as dependency
GnuTLS used gcrypt as backend but switched in ~2011 to nettle.
Thus we don't need to/shouldn't depend on it.
2021-05-29 21:37:30 +02:00
Peter Keresztes Schmidt
deb12f5613 Restore GnuTLS support after VLA removal
298415fff3 made variables constexpr which led to build failures with GnuTLS.
2021-05-18 00:18:26 +02:00
Peter Keresztes Schmidt
298415fff3 Remove remaining usages of VLAs 2021-05-17 22:12:04 +02:00
Peter Keresztes Schmidt
68bedfe48f Fix logging format string mismatches
* Remove SZFMTD format macro and use %zu instead for size_t. %zu is understood by every compiler nowadays.
2021-04-30 00:26:24 +02:00
Isaac Connor
ccf1599b3a use better variable names and avoid reusing user 2021-04-20 17:06:29 -04:00
Isaac Connor
de661752ce pass jwt_token_str by reference 2021-04-20 17:04:45 -04:00
Peter Keresztes Schmidt
e330f8553d utils: cleanup Split and Join 2021-04-04 00:30:18 +02:00
Peter Keresztes Schmidt
4e8c7d1f7c Eliminate non-thread-safe calls to localtime
localtime uses an internal static storage to which a pointer is given as return value.
Due to this it is not safe to call localtime from multiple threads since the same static storage is used.

Use localtime_r instead which allows to pass in a tm struct.

Fixes:
https://github.com/ZoneMinder/zoneminder/security/code-scanning/24
https://github.com/ZoneMinder/zoneminder/security/code-scanning/25
https://github.com/ZoneMinder/zoneminder/security/code-scanning/26
https://github.com/ZoneMinder/zoneminder/security/code-scanning/27
https://github.com/ZoneMinder/zoneminder/security/code-scanning/28
https://github.com/ZoneMinder/zoneminder/security/code-scanning/30
https://github.com/ZoneMinder/zoneminder/security/code-scanning/31
https://github.com/ZoneMinder/zoneminder/security/code-scanning/33
https://github.com/ZoneMinder/zoneminder/security/code-scanning/58
https://github.com/ZoneMinder/zoneminder/security/code-scanning/59
https://github.com/ZoneMinder/zoneminder/security/code-scanning/63
https://github.com/ZoneMinder/zoneminder/security/code-scanning/64
https://github.com/ZoneMinder/zoneminder/security/code-scanning/65
2021-03-21 21:42:02 +01:00
Peter Keresztes Schmidt
9e77324de4 Replace raw mysql_query calls with the zmDb* functions
With this we can make sure we have proper locking of our DB connection at all times.
2021-03-06 00:12:18 +01:00
Peter Keresztes Schmidt
0dbc39ee25 Cleanup and reorganize includes
With this commit a unified structure for includes is introduced.
The general rules:
 * Only include what you need
 * Include wherever possible in the cpp and forward-declare in the header

 The includes are sorted in a local to global fashion. This means for the include order:
  0. If cpp file: The corresponding h file and an empty line
  1. Includes from the project sorted alphabetically
  2. System/library includes sorted alphabetically
  3. Conditional includes
2021-02-04 18:02:01 +01:00
Peter Keresztes Schmidt
5a57efdfe2 Replace deprecated C header includes with the C++ ones. 2021-02-04 05:39:03 +01:00
Isaac Connor
4dcce4ac95 Merge branch 'rtsp_server' 2021-01-26 14:22:10 -05:00
Terry Sanders
ef006ca407 Fixed issue where mysql_free_result can get called twice when a vaild username with an incorrect password is used. 2021-01-19 14:47:11 +00:00
Isaac Connor
0a0c99ce7a fix double free of mysql result 2021-01-15 14:43:31 -05:00
Isaac Connor
a39a656373 Merge branch 'master' into zma_to_thread 2020-09-29 11:02:40 -04:00
Peter Keresztes Schmidt
8f980a1168 Convert NULL/0 to nullptr
The 0 -> nullptr changes should definitely improve readability.
2020-08-26 22:03:40 +02:00
Isaac Connor
7575afc8d5 Merge branch 'master' into zma_to_thread 2020-07-21 17:38:32 -04:00
Isaac Connor
4ff341a0f5 Merge branch 'master' into zma_to_thread 2020-05-02 18:03:42 -04:00
Isaac Connor
434f34f027 use delete[] instead of delete. 2020-04-30 11:04:55 -04:00
Isaac Connor
a6ee817bc4 Fix auth by hash 2020-04-28 19:00:42 -04:00
Isaac Connor
e21ffbea7d Merge branch 'fix_zms' 2020-04-26 18:43:39 -04:00
Isaac Connor
ae9a5766f5 Merge branch 'release-1.34' into fix_zms 2020-04-26 18:19:30 -04:00
Isaac Connor
b0c5abc2c2 Quiet compiler warnings. 2020-04-24 17:51:00 -04:00
Pliable Pixels
9b77f77ac3 better logs 2020-04-23 11:09:39 -04:00
Isaac Connor
8193e4ea4e replace snprintf with hex table lookup for speed 2020-04-06 11:46:14 -04:00
Isaac Connor
1e38ba871d Merge branch 'master' into fix_use_of_sprintf 2020-04-06 11:23:12 -04:00
Isaac Connor
c6e0b9be39 Merge branch 'master' into fix_use_of_sprintf 2020-04-06 11:21:43 -04:00
Isaac Connor
98e9355723 snprintf will put the terminator in. We don't have to. 2020-04-06 11:21:02 -04:00
hax0kartik
face73ad7e Fix compilation 2020-04-05 22:45:47 -04:00
Isaac Connor
2827ba38cd use snprintf instead of sprintf. Fix putting a \0 terminator 2020-04-05 13:41:03 -04:00
Isaac Connor
9441fe833f satisfy cpplint 2020-04-05 13:23:12 -04:00
Isaac Connor
3a129a8818 Merge pull request #2874 from hax0kartik/2810-libjwt
Add libjwt and remove gnutls-openssl wrapper
2020-03-06 14:48:45 -05:00
Isaac Connor
835966eb24 Merge pull request #2874 from hax0kartik/2810-libjwt
Add libjwt and remove gnutls-openssl wrapper
2020-03-05 15:30:27 -05:00
hax0kartik
2091ad8c92 Add libjwt and remove gnutls-openssl wrapper 2020-03-05 09:29:27 -08:00
Pliable Pixels
54c14db863 better logs 2020-03-01 14:02:44 -05:00
Isaac Connor
09fcbad666 Merge branch 'master' into zma_to_thread 2019-11-30 14:59:39 -05:00
Isaac Connor
5f0080ef92 Fix crash when using auth_relay=none 2019-08-28 10:34:30 -04:00
Isaac Connor
396be10d6f Merge branch 'master' into zma_to_thread 2019-08-22 12:57:00 -04:00
Isaac Connor
c7b6db9be7 Put backticks around all columns and tables in sql to deal with mysql 8 2019-08-14 16:18:21 -04:00
Pliable Pixels
a9d01ba3d2 Alarm api (#2665)
* fixed alarm api to use tokens if present

* clearer debug logs for tokens

* space
2019-07-17 20:38:58 -04:00
Pliable Pixels
67168a2387 demote token log (#2663) 2019-07-12 14:31:39 -04:00
Pliable Pixels
21710b6e49 demote logs 2019-05-12 15:45:39 -04:00
Pliable Pixels
cc0d23ce4e move token index after adding password 2019-05-12 15:01:49 -04:00
Pliable Pixels
9a8aa5453b add Password back so User object indexes don't change 2019-05-12 14:48:23 -04:00
Pliable Pixels
8499958767 typo 2019-05-12 05:57:17 -04:00