27024 Commits

Author SHA1 Message Date
Isaac Connor
208779ed60 Merge branch 'master' of github.com:ZoneMinder/zoneminder 2026-02-06 13:23:56 -05:00
Isaac Connor
3907eb1687 fix: update last_write_time when skipping decode in KEYFRAMESONDEMAND
In KEYFRAMESONDEMAND mode without viewers, only keyframes are decoded.
Non-keyframe packets skip decoding and never reach the Phase 5 code
that updates last_write_time.  If the keyframe interval exceeds
ZM_WATCH_MAX_DELAY, zmwatch sees the stale timestamp and restarts
the capture daemon unnecessarily.

Update last_write_time for skipped video packets so zmwatch knows the
decode thread is still processing.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-06 13:23:24 -05:00
Isaac Connor
0bd4acbdf7 fix: prevent Chrome from offering to save monitor camera credentials
The monitor form has password fields for camera credentials (ONVIF,
RTSP) which triggered Chrome's "save password" prompt on every save
or navigation.

Convert "Save and Close" from native form submit to AJAX via
saveMonitorData() with redirect, matching how "Save" already works.
Clear password field values before any remaining native form
submissions (Type/Method changes) and on pagehide, since the values
are repopulated from the database on reload. Remove the ineffective
dummy hidden password field.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-06 11:40:10 -05:00
Isaac Connor
54adbb57ff Merge pull request #4599 from IgorA100/patch-134551
Added the constant "PLACEHOLDER_IMAGE" which is equal to a transparent GIF of 1 pixel (skin.js)
2026-02-06 10:35:42 -05:00
Isaac Connor
ae59caafdc Merge pull request #4600 from IgorA100/patch-164076
Fix: When downloading event files, create the "ZM_DIR_EXPORTS" directory if it does not exist
2026-02-06 08:49:57 -05:00
IgorA100
b09dc9264d When downloading event files, create the "ZM_DIR_EXPORTS" directory if it does not exist (download.php) 2026-02-06 16:43:19 +03:00
IgorA100
0b1afa928c Added the constant "PLACEHOLDER_IMAGE" which is equal to a transparent GIF of 1 pixel (skin.js) 2026-02-06 14:54:51 +03:00
Isaac Connor
7f97f2b77e fix: flush decoder when on-demand decoding is no longer needed
When using DECODING_ONDEMAND or DECODING_KEYFRAMESONDEMAND, packets
accumulate in the decoder_queue while a viewer is connected. When the
viewer disconnects, should_decode becomes false but stale packets
remain queued in the decoder indefinitely — Phase 1 tries
receive_frame (gets EAGAIN), Phase 2 skips sending new packets, and
the cycle repeats.

Flush the decoder via avcodec_flush_buffers in both Phase 1 (before
attempting receive_frame) and Phase 2 (after determining decoding is
not needed), marking queued packets as decoded and clearing the queue.
This releases held packet locks and resets the decoder so it starts
clean when a viewer reconnects.

Also rename the 'dominated' variable to 'already_decoded' for clarity.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-05 22:47:37 -05:00
Isaac Connor
8f28cc4725 Merge branch 'master' of github.com:ZoneMinder/zoneminder 2026-02-05 17:59:03 -05:00
Isaac Connor
9047fb691e Merge pull request #4595 from IgorA100/patch-326084
Fix: Optimization code for displaying monitor status in the "Show on hover" mode on the Montage page
2026-02-05 17:17:35 -05:00
Isaac Connor
5f2dc621bd fix: guard against undefined container in scaleToFit
- Check container.length instead of just container (empty jQuery objects are truthy)
- Guard against container[0] being undefined before accessing lastElementChild
- Add check for bottomEl.length before calling offset() on it

Fixes TypeError when scaleToFit is called with a selector that matches nothing.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-05 16:54:54 -05:00
Isaac Connor
3f58bc762d fix: update auth_relay along with auth_hash in event.js
When auth_hash changes, auth_relay must also be updated to stay in sync.
The event.js getCmdResponse was only updating auth_hash, which could
cause requests to use stale auth_relay values.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-05 16:50:05 -05:00
Isaac Connor
079b873380 fix: correct auth property name in getStatusCmdResponse
The PHP status.php returns 'auth' but getStatusCmdResponse was checking
for 'auth_hash'. This mismatch prevented auth hash updates from status
responses from ever being applied, causing invalid hash errors after
the auth expired.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-05 16:44:52 -05:00
Isaac Connor
60fbea3880 fix: security and code quality improvements in auth.php
- Fix SQL injection vulnerability in migrateHash() by using prepared statements
- Add null/empty check in password_type() to prevent array access error
- Remove dead code branch in generateAuthHash() (unreachable $_SESSION check)
- Fix PHP version in error message (5.3 -> 5.5 for password_hash)
- Prevent username enumeration by using consistent error messages
- Fix spacing inconsistency in substr() call
- Add TODO comment about MD5 hash weakness

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-05 15:10:55 -05:00
Isaac Connor
d64636cf7d fix: prevent stream commands from being sent after quit
Added started flag checks in streamCommand() and streamCmdQuery() to
prevent commands from being sent after the stream has been killed.
This fixes an issue where scale commands were being sent after quit
commands during page reload.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-05 14:59:16 -05:00
Isaac Connor
458be55418 style: use let/const instead of var in montage_common.js and export.js
- Change var to let/const for proper block scoping
- Use const for variables that are not reassigned

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-05 14:30:11 -05:00
Isaac Connor
81ceed9c40 fix: fix JS issues in skin.js
- Change var to let/const for proper block scoping in for loops and
  conditionals
- Fix variable shadowing (renamed inner 'el' to 'element')
- Remove erroneous semicolons after function declaration and else block
- Use const for variables that are not reassigned

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-05 10:49:25 -05:00
Isaac Connor
aa415a627f The allowerasing thing doesn't work. Drop rawhide. add f43 2026-02-05 10:49:06 -05:00
Isaac Connor
a814c8ef22 fix: fix typo and undeclared variables in zone.js
- Fix typo 'btn-primaryary' -> 'btn-primary' which prevented the
  class from being removed when toggling analyse mode
- Declare CheckMethod and el variables with let to avoid creating
  implicit globals

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-05 10:25:43 -05:00
Isaac Connor
72bd85c861 Merge branch 'master' of github.com:ZoneMinder/zoneminder 2026-02-05 10:25:23 -05:00
Isaac Connor
c9c2b4f04d Fix missing - 2026-02-05 10:25:17 -05:00
Isaac Connor
4eeb0cc08a Merge pull request #4594 from IgorA100/patch-635393
Fix: Vertically center the ".btn-term-remove-all" button in the sidebar filter (sidebar.css)
2026-02-05 10:09:17 -05:00
Isaac Connor
5a706aa5de style: use let instead of var in for loops
Replace var with let in for loop declarations for proper block scoping.
Affects console.js, monitor.js, montage.js, montagereview.js, zone.js,
and zones.js.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-05 10:05:39 -05:00
Isaac Connor
ecc7eacc08 fix: use consistent parameter naming and remove debug logs in filter.js
- Change click_AutoEmail, click_automove, click_autocopy to use the
  'element' parameter instead of 'this' for consistency
- Remove debug console.log statements for availableTags, operator
  defaults, and term parsing

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-05 09:30:41 -05:00
Isaac Connor
c4a90cea93 refactor: move escapeHTML to skin.js as shared utility
Move the escapeHTML function from filter.js to skin.js so it can be
reused across views. Also switch from textarea-based encoding to
explicit string replacement which is cleaner and doesn't require
maintaining a DOM element.

This also fixes the issue where 'escape' variable shadowed the
built-in JavaScript escape function.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-05 09:27:39 -05:00
Isaac Connor
b0e4e643b0 Add -allowerasing to resolve issues with rawhide 2026-02-05 09:27:04 -05:00
Isaac Connor
1222fbca56 fix: correct malformed HTML option tags in filter.js
The bracket select options were missing the closing > in their
opening tags, causing invalid HTML to be generated.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-05 09:17:13 -05:00
Isaac Connor
24e16796b7 Add mpeg4 as some older cameras that use are still funcitoning 2026-02-05 09:08:02 -05:00
Isaac Connor
591db357a8 Fix missing consts 2026-02-05 09:07:38 -05:00
Isaac Connor
0f92ad79b0 Remove debug 2026-02-05 09:07:22 -05:00
IgorA100
4761f78242 Fix: Optimization code for displaying monitor status in the "Show on hover" mode on the Montage page (montage.js)
Also, I prevented the status display block from flickering when hovering over it.
2026-02-05 14:57:30 +03:00
IgorA100
aa2b6a197c Fix: Added padding to the right to prevent elements from overlapping the ".btn-term-remove-all" button (sidebar.css) 2026-02-05 12:59:35 +03:00
IgorA100
0c5d7e1e18 Fix: Vertically center the ".btn-term-remove-all" button in the sidebar filter (sidebar.css) 2026-02-05 12:43:31 +03:00
Isaac Connor
6b7c96aba1 Only show DHCP/dnsmasq and X10 options if they are enabled 2026-02-04 22:55:50 -05:00
Isaac Connor
34f4bec8a3 fix: increase ONVIF WS-Security timestamp validity to prevent auth errors
The WS-Security timestamp had only a 10-second validity window, which
caused intermittent "not authorized" errors when there was clock drift
between ZoneMinder and the camera.

Changes:
- Increase default timestamp validity from 10 to 60 seconds
- Add configurable timestamp_validity option (range 10-600 seconds)
- Add better error diagnostics for auth failures showing timestamp_validity
  and camera_clock_offset values
- Update parse_onvif_options documentation

Users experiencing auth errors due to clock drift can now set
onvif_options=timestamp_validity=120 (or higher) as a workaround.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-04 22:55:50 -05:00
Isaac Connor
45fe630677 Spacing and improve debug 2026-02-04 22:55:50 -05:00
Isaac Connor
e64eb7b8f8 Add hevc as a decoder 2026-02-04 22:55:50 -05:00
Isaac Connor
94f3a5771b fix: release GPU surfaces immediately after hw transfer
The nvidia-vaapi-driver would fail with "list argument exceeds maximum
number" when decoding HEVC because GPU surfaces were being held in the
packet queue after transfer, exhausting the VAAPI surface pool.

Changes:
- Transfer hw frames to software immediately in receive_frame() while
  the VA context is still valid, then release the GPU surface
- Check hw_frames_ctx in needs_hw_transfer() to detect already-transferred
  frames
- Remove extra_hw_frames and thread_count settings (not needed with
  immediate surface release)
- Fix EAGAIN handling in send_packet to wait instead of busy-loop

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-04 22:51:21 -05:00
Isaac Connor
c012f55962 Set reference frames and turn off multi-threading when doing hwaccel 2026-02-04 21:35:06 -05:00
Isaac Connor
2892db312f Check return from transfer_hwframe so as not to crash 2026-02-04 21:34:42 -05:00
Isaac Connor
334994bd3f Fix appending %% instead of % when uri decoding. Add test for URIEncode 2026-02-04 20:45:46 -05:00
Isaac Connor
ae42c3c94d Wait on the packetqueue condition instead of sleeping. Should help analysis keep up with decoding better and offer faster shutdown. 2026-02-04 20:44:17 -05:00
Isaac Connor
11a09d5ef9 fix: correct inet_ntop buffer size in RemoteCameraHttp
Buffer was sized for binary in6_addr (16 bytes) but inet_ntop needs
space for string representation (INET6_ADDRSTRLEN = 46 bytes).

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-04 17:41:37 -05:00
Isaac Connor
a96b776949 fix: apply credentials to secondary URL and fix buffer overflow in DumpSettings
- Apply credentials to secondary stream URL in FFmpegCamera (was causing 401 Unauthorized)
- Add empty check for rtsp_second_path in RTSP2WebManager before applying credentials
- Replace unsafe sprintf pattern in Monitor::DumpSettings with std::string + stringtf
- Refactor Zone::DumpSettings to return std::string instead of writing to char buffer
- Add decimal precision to event duration debug output

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-04 17:40:26 -05:00
Isaac Connor
df907aeb83 fix: correct copy-paste error in pixel format warning
The second byte extraction was duplicating the first byte instead
of extracting the second byte with (in_pf>>8)&0xff.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-03 16:47:43 -05:00
Isaac Connor
2d01a38bdc fix: correct file descriptor error checks in StreamBase
- Change lock_fd error check from <= 0 to < 0 since open() returns -1
  on error and 0 is a valid file descriptor
- Use -1 consistently as invalid fd marker
- Fix close check from > 0 to >= 0 to handle fd 0 correctly

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-03 16:44:50 -05:00
Isaac Connor
ab1c333739 Merge branch 'master' of github.com:ZoneMinder/zoneminder 2026-02-03 16:41:38 -05:00
Isaac Connor
7592fd933c Fix command injection vulnerability in image.php (CVE-2025-65791)
Add input validation and shell argument escaping to prevent OS command
injection via the 'show' parameter in web/views/image.php. The parameter
is now validated against an allowlist and all values passed to exec()
are wrapped with escapeshellarg().

Also fix PHP operator precedence bug in shutdown.php where 'and' was
used instead of '&&', causing the 'when' parameter validation to not
work as intended.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-03 16:39:38 -05:00
Isaac Connor
e1fced5a02 Add UTC vs local timezone offset detection and accomodation 2026-02-03 15:22:49 -05:00
Isaac Connor
bb7195204c fix: address multiple issues in SessionDescriptor::generateFormatContext
- Add null check for avformat_alloc_context() return value
- Add null checks for avformat_new_stream() and avcodec_alloc_context3()
- Fix copy-paste bug using smStaticPayloads instead of smDynamicPayloads
  when setting codec_name for dynamic payloads
- Fix memory leak by freeing codec_context after copying parameters

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-03 13:34:17 -05:00