Commit Graph
2 Commits
Author SHA1 Message Date
Steve GilvarryandClaude Opus 5 74453bf783 test: guard the WS-Security test on WITH_GSOAP refs #4998
src/CMakeLists.txt wraps the gsoap sources in if(GSOAP_FOUND), so the
daemons build fine without gsoap. tests/ had no such guard, and
zm_onvif_wsse.cpp includes soapH.h and plugin/wsseapi.h unconditionally,
so BUILD_TEST_SUITE=ON plus no gsoap failed to compile:

  tests/zm_onvif_wsse.cpp:23:10: fatal error: 'soapH.h' file not found

gsoap was therefore optional for the binaries and mandatory for the test
suite. Nothing noticed because ci-cpp-tests.yml installs libgsoap-dev, so
the no-gsoap path is never exercised.

Guarded in the file rather than in CMake, matching what
zm_onvif_auth_error.cpp already does. zm_onvif_renewal.cpp deliberately
stays unguarded - it pulls in no gsoap headers and its four cases are
plain timing and formatting logic that run either way.

Verified on macOS: 144 cases with gsoap, 142 without, both clean builds.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01B5KL9Xbi7K5aGsauLtd8tG
2026-09-12 15:52:55 +10:00
Isaac ConnorandClaude Opus 4.8 312ce1d676 fix: pin ONVIF WS-Security Timestamp and UsernameToken Created together
ONVIF PullMessages intermittently failed with ter:NotAuthorized (logged as
the misleading clock-drift error) every few thousand requests, then ZM tore
down a healthy subscription and re-subscribed. SOAP logs showed the trigger:
the failing request always had wsu:Timestamp/Created one second behind
UsernameToken/Created, while every successful request had them identical.

The cause is in set_credentials(): soap_wsse_add_Timestamp() and
soap_wsse_add_UsernameTokenDigest() each call time(NULL) on their own, so when
the two calls straddle a one-second boundary the two Created values diverge by
a second and Hikvision rejects the request. This is probabilistic, which is
why it hit roughly hourly per camera and constantly across a fleet.

Capture time(NULL) once, re-stamp the Timestamp Created/Expires from it, and
use soap_wsse_add_UsernameTokenDigest_at() so the token Created and its
password digest are pinned to the same instant. Both Created values are then
always identical.

Add tests/zm_onvif_wsse.cpp asserting the two Created values match.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-13 21:12:49 -05:00