Commit Graph

18390 Commits

Author SHA1 Message Date
Peter Keresztes Schmidt 67d7872e9a Eliminate non-thread-safe calls to gmtime
gmtime uses an internal static storage to which a pointer is given as return value.
Due to this it is not safe to call gmtime from multiple threads since the same static storage is used.

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

Fixes:
https://github.com/ZoneMinder/zoneminder/security/code-scanning/32
2021-03-21 21:42:02 +01: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 7e86e1ef40 utils: Make TimevalToString thread-safe 2021-03-21 21:42:02 +01:00
Peter Keresztes Schmidt 7f9c9c6624 web: make eslint happy 2021-03-21 21:40:41 +01:00
Isaac Connor 5f5648317c
Merge pull request #3198 from SirLouen/3197-record-event-close-mode
Issue #3197 Add RECORD to Event_Close_Mode time
2021-03-21 13:04:08 -04:00
Isaac Connor 7c9eb42ebb
Merge branch 'master' into 3197-record-event-close-mode 2021-03-21 13:03:26 -04:00
Isaac Connor 8a1284e2fa Can't use a decimal step. Has to be any because browsers suck. 2021-03-21 12:30:56 -04:00
Isaac Connor 6d9a4ed661 If the analysis thread is falling behind, we can't count the packets after it in the number of packets to keep in queue. So figure out how many there are and add that to the max_video_packet count to keep so that we always have enough to satisfy pre_event_count 2021-03-21 12:28:33 -04:00
Peter Keresztes Schmidt 07cf469714 dep: Update RtspServer 2021-03-21 14:33:20 +01:00
Isaac Connor a57473a146 remove debug 2021-03-21 09:19:31 -04:00
Isaac Connor 284837d536 quotes, spaces. Also move setting redirect to to where we actually do the redirect so that actions can remove the redirect if there was an error to report. 2021-03-21 09:19:21 -04:00
Isaac Connor cc455e5d74 fix require=>require_once for User.php. Use getBodyTopHTML so that we get the error reporting 2021-03-21 09:18:47 -04:00
Isaac Connor d0adaeaabe rework user saving action to use User object. Implement a duplicate username check. Deprecate php < 5.3 due to lack of bcrypt password hashing functions. Hence deprecate the use of mysql PASSWORD() 2021-03-21 09:18:12 -04:00
Isaac Connor 8a1d13b6cd perror => Error() 2021-03-21 09:17:03 -04:00
Isaac Connor 68f9c7c9e6 introduce a _last_error member to the object for reporting errors saving. 2021-03-20 19:27:53 -04:00
Isaac Connor a042e4bf77 spacing 2021-03-20 19:27:18 -04:00
SirLouen db7e9edcab Issue #3197 Improvement 2021-03-21 00:00:36 +01:00
SirLouen 33f98a0d40 Issue #3197 Add RECORD to Event_Close_Mode time 2021-03-20 20:02:52 +01:00
Isaac Connor b71db319a0 need to rm -r RtspServer 2021-03-18 17:56:39 -04:00
Isaac Connor 65ed17ab76 fix dest of clone of RtspServer 2021-03-18 17:46:00 -04:00
Isaac Connor 53133ba051 add token as an alternative to jwt_token 2021-03-18 17:43:31 -04:00
Isaac Connor 70e61740d3 Fix eslint 2021-03-18 16:48:26 -04:00
Isaac Connor 86e7c44087 add missing [] 2021-03-18 16:48:26 -04:00
Isaac Connor dd714a018f add populating RtspServer 2021-03-18 16:48:26 -04:00
Isaac Connor e39c293a77 fix eslint 2021-03-18 16:48:26 -04:00
Isaac Connor 7889b515d3 Add groovy and hirsuit builds 2021-03-18 16:48:26 -04:00
Isaac Connor c0f53382c8
Merge pull request #3196 from Carbenium/clang-build-fix
Fix build under clang
2021-03-18 15:37:56 -04:00
Peter Keresztes Schmidt d1bbfdaf6b Build: Enable -Wconditionally-supported on GCC
We want to have warnings if we use some implementation-specific features of GCC
to be able to keep compatibility with clang.
2021-03-18 20:02:23 +01:00
Peter Keresztes Schmidt 7a4c34ec7e RemoteCameraHttp: Fix a log message 2021-03-18 20:02:20 +01:00
Isaac Connor 4cb38a119e Fix saving Filters and other objects. Apparently comparing 0 to NOW() doesn't work. 2021-03-18 14:09:15 -04:00
Isaac Connor edefbfcad6 Remove assumptions about Analysis being about motion detection. Fixes mem leaks in Monitor mode 2021-03-18 09:24:27 -04:00
Isaac Connor f4506a8f35 We always need an analysis thread. 2021-03-17 23:41:00 -04:00
Isaac Connor 1b876f24f9 Must have Id as well in order to know which monitor to control 2021-03-17 17:15:04 -04:00
Isaac Connor ccb1bc1a7d Have to wait until we are finished with the packet before unlocking. 2021-03-17 16:11:31 -04:00
Isaac Connor fb28c6b365 Fix login in Decode for non-ffmpeg monitors 2021-03-17 15:53:14 -04:00
Isaac Connor 079d3361a2 Rework to read content_length bytes at once. Micro-optimisation 2021-03-17 15:52:55 -04:00
Isaac Connor ec8e0f5997 replace while(1) with while(not zm_terminate) so that these scripts exit cleanly 2021-03-17 13:09:54 -04:00
Isaac Connor 284fe52b5f fix double stop/free of decoder and analysis threads 2021-03-17 12:57:45 -04:00
Isaac Connor c39ec5873b don't include zm_utils in decoder_thread 2021-03-17 12:50:13 -04:00
Isaac Connor 2b34d09b84 Move analysis_thread into Monitor. Don't do extra gettimeofday if no delays are set. Fix status update on terminate 2021-03-17 12:49:50 -04:00
Isaac Connor feafaa29bf improve debug logging 2021-03-17 12:49:12 -04:00
Isaac Connor 6ab8bee581 Increase debug level for fifo writing 2021-03-17 12:48:59 -04:00
Isaac Connor 0b4f04c4d5 notify in clear before taking lock to increase chance of other threads exiting. Handle terminate case in get_packet 2021-03-17 12:48:42 -04:00
Isaac Connor 9ca5f49d82 Move analysis_thread into Monitor 2021-03-17 12:48:08 -04:00
Isaac Connor dca34544ec move analysis thread into monitor. populate analysis_it and decoder_it in Prime instead of constantly checking for them. Handle cases where LockedPacket are null due to shutdown 2021-03-17 12:47:52 -04:00
Isaac Connor a8d31ca686 After moving analysis thread into monitor, I don't know how to handle the shared_ptr stuff 2021-03-17 12:46:55 -04:00
Isaac Connor 657a5edda4 If decoding disabled, set signal and last_write_time in the Capture thread. So that zm_watch knows we are alive 2021-03-17 10:11:06 -04:00
Isaac Connor 6a2e237902 Fix delete packet before deleting lock on packet 2021-03-17 10:07:03 -04:00
Isaac Connor 74616d1061 Update CaptureFPS SQL to just do an update and don't use static sql. TThis may fix a signal 6 crash that we have been seeing 2021-03-17 10:06:45 -04:00
Isaac Connor 14ef8336b9 If ffmpeg and decoding Disabled don't stream 2021-03-16 20:10:00 -04:00