Commit Graph

140 Commits

Author SHA1 Message Date
Isaac Connor
dc30629247 Stop the dbQueue before closing logs. Since dbQueue.stop() join's the dbQueue thread, it should not log after we return. 2022-05-18 19:00:21 -04:00
Isaac Connor
ad32466aa4 Remove function, replacing with capturing, analysing, recording. Adjust formatting of list function 2022-01-31 18:17:31 -05:00
Isaac Connor
04bdf0ac6b change Enable/Disable to act on capture. suspend/resume is for motion 2022-01-11 13:44:11 -05:00
Isaac Connor
61fe35a32a Don't log errors when querying a monitor in NONE Function. Just report a 0 status.Fixes #3397 2021-12-15 09:11:55 -05:00
Isaac Connor
cca7953856 include user and function error message about insufficient permissions. Will make it easier to figure out who tried what. 2021-12-14 12:26:26 -05:00
Isaac Connor
52129c94ec spacing. Use a separate boolean to tell if we have specified a new value for controls. This allows negative settings. Fix zmy outputting brightness when contrast is specified. 2021-10-05 19:49:42 -04:00
Peter Keresztes Schmidt
6e96cbe14a Misc: Merge ZM_HAS_V4L with ZM_HAS_V4L2 2021-09-08 00:19:08 +02:00
Isaac Connor
a3a592d5e1 Fix errors due to not stopping the dbQueue. Fix crash when querying v4l devices 2021-08-05 14:48:14 -04:00
Peter Keresztes Schmidt
65656de6ce db: Adjust the query methods to accept std::strings 2021-07-06 10:20:46 +02:00
Peter Keresztes Schmidt
ea10939970 zmu: Fix missing include 2021-06-15 00:16:08 +02:00
Peter Keresztes Schmidt
6114d40593 misc: Replace usleep with std::this_thread::sleep_for 2021-06-13 23:22:51 +02:00
Peter Keresztes Schmidt
707975e567 Monitor: Convert API to std::chrono 2021-06-13 23:22:49 +02:00
Peter Keresztes Schmidt
f2bee0704a LocalCamera: Remove support for V4L1
Kernel support for Video4Linux 1 was removed in 2.6.38 (March 2011). It's time to drop support on our side.
2021-05-31 23:29:29 +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
fd72fbd2ac Remove unused state var and unneeded if have_output 2021-04-20 17:22:35 -04:00
Isaac Connor
ef10ecc06a Allow users to start/stop alarms without monitor view permission. When forcing an alarm, disable recording first so that the alarm is distinct. This is necessary due to permissions. 2021-04-12 15:59:31 -04: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
Isaac Connor
c9170a87b2 Allow users with Monitors::View to generate and cancel events 2021-03-12 09:26:56 -05: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
d9568a98c0 Drop zm_thread which has been replaced by STL implementations 2021-03-04 10:55:46 +01:00
Isaac Connor
57f599237c Merge pull request #3136 from Carbenium/db-connect
DB: Make connection initialization more predictable and finalize mysql library correctly
2021-02-08 08:43:33 -05:00
Peter Keresztes Schmidt
f43507dce0 Use the power of smart pointers to manage Monitor instances 2021-02-07 21:20:45 +01:00
Peter Keresztes Schmidt
aec4dbc6ff DB: Make connection initialization more predictable and avoid double-initialization
Remove calls to zmDBConnect from various places to avoid possible side-effects/double initialization.
The function should be called once from the main thread of the daemon.

Also split config loading into 2 steps: static and DB config loading. Load the static config before zmDBConnect is called so it has a chance to succeed.
2021-02-07 13:44:41 +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
e09fa1bebf Remove includes of <cinttypes>
Instead of including <cinttypes> directly, zm_define.h should be used
to get the typedef'ed types as well.
2021-02-02 21:37:26 +01:00
Isaac Connor
4bcefe0562 Add a 10 second wait to force alarm on. If the monitor doesn't notice it is likely not running, leaving an mmap behind 2021-01-31 11:44:58 -05:00
Isaac Connor
b306f1b2e8 Add R and W short form options 2020-12-15 16:55:28 -05:00
Isaac Connor
c9bd09ae7b report both capture_fps and analysis_fps 2020-12-09 15:03:18 -05:00
Isaac Connor
1257a7ea37 improvements reported by cppcheck 2020-11-01 16:11:19 -05: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
ce9e2c8b27 Merge branch 'release-1.34' 2020-05-15 11:53:09 -04:00
Isaac Connor
9ea1c637f9 Remove debug Exiting message 2020-05-15 11:48:41 -04:00
Isaac Connor
6bb2c09a72 Merge branch 'release-1.34' 2020-05-15 11:41:34 -04:00
Isaac Connor
7a85be59be Remove errant closing db debug output 2020-05-15 10:22:58 -04:00
Isaac Connor
d92772343a Merge branch 'release-1.34' 2020-05-14 12:02:50 -04:00
Isaac Connor
25a772c5eb reorder logic a bit to make it easier to read. Make exit_zmu not return a value. 2020-05-14 12:02:02 -04:00
Isaac Connor
e274aa471a Use fputc instead of printf for separator to be a tiny bit more efficient. Report current state when forcing alarm on 2020-04-23 18:13:34 -04:00
Isaac Connor
7fcd71e684 Use fputc instead of printf for separator to be a tiny bit more efficient. Report current state when forcing alarm on 2020-03-24 15:19:16 -04:00
Isaac Connor
ad61a0e385 Escape Function to fix mysql8. Fixes #2885 2020-03-16 21:06:31 -04:00
Isaac Connor
f05dbd3b89 Fix zmu not respecting jwt token auth when AUTH_RELAY set to none 2020-02-25 14:40:47 -05:00
Isaac Connor
33951ae584 Print out an error when a monitor is in MONITOR mode because we can't handle alarms. Allow signals to terminate zmu by checking zm_terminate. 2019-06-19 08:36:37 -04:00
Pliable Pixels
bb18c305ab add token to command line for zmu 2019-05-08 11:08:27 -04:00
Pliable Pixels
b293592e4c added token validation to zms/zmu/zmuser 2019-05-08 10:55:32 -04:00
Isaac Connor
f3d0c4e643 Merge branch 'master' of github.com:zoneminder/ZoneMinder 2019-04-04 09:37:13 -04:00
Isaac Connor
8de7d576a5 spacing and use Error instead of fprintf(stderr) so that things get logged. 2019-04-04 09:35:37 -04:00
Isaac Connor
b794c2ca20 fix crash by checking username without checking if it is NULL 2019-03-18 12:01:51 -04:00
Steve Gilvarry
924d5235d0 Validate zmu Username and Password lengths (#2484)
* Validate zmu Username and Password lengths
Ensure user provided values are not larger than allowed and error if
they are, therefore further preventing overflow.

* Check username and password functions for zmu and zms

* Check username and password functions for zmu and zms
2019-02-13 10:40:43 -05:00
Isaac Connor
8404f0ef64 When forcing an alarm, print out the event id 2018-11-26 16:21:32 -05:00
Isaac Connor
8a80cf686b Merge branch 'master' into storageareas 2018-04-26 21:58:34 -04:00
Isaac Connor
356badf21d Merge branch 'master' of github.com:ZoneMinder/ZoneMinder 2018-04-26 11:57:46 -04:00