mirror of
https://github.com/ZoneMinder/zoneminder.git
synced 2026-06-21 12:09:31 -04:00
open() is contracted to return true or false so callers (zmcontrol.pl, zmwatch.pl) can tell whether the camera is reachable, but it always ended with an assignment that evaluated truthy and reported success regardless. When the initial login probe failed it also rebuilt BASE_URL in the old basic-auth style and returned without ever testing that connection. Return 0 on a failed probe and 1 only after a successful exchange. Check is_success() on the authcode response in the modern path, and actually issue and check a request on the old-style URL in the fallback path so success means we can talk to the camera. Log the previously unused ResCode. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>