Skip to content

Better error and timeouts handling - #137

Merged
TheWitness merged 6 commits into
Cacti:mainfrom
xmacan:fix_network_timeouts
Nov 3, 2026
Merged

TheWitness merged 6 commits into
Cacti:mainfrom
xmacan:fix_network_timeouts

Conversation

@xmacan

@xmacan xmacan commented Oct 31, 2026

Copy link
Copy Markdown
Member

No description provided.

Comment thread includes/test_mail.php Fixed
Comment thread includes/test_mail.php Fixed
Comment thread includes/test_mail.php Fixed
ladams and others added 4 commits November 2, 2026 14:35
Addresses the failing SonarCloud and patch-coverage checks on PR Cacti#137.

- Negotiate only TLS 1.2/1.3 for the SMTP/IMAP/POP3 mail checks instead of
  STREAM_CRYPTO_METHOD_TLS_CLIENT (which also enables weak TLS 1.0/1.1),
  clearing the SonarCloud security-rating finding.
- Extract shared helpers to remove the cross-file and in-file duplication
  SonarCloud flagged: servcheck_load_credential() and
  servcheck_evaluate_search() in functions.php, plus mail connect, TLS
  handshake and certificate-expiry helpers in test_mail.php.
- Add unit coverage for the shared functions.php helpers and allowlist the
  network service-check includes in the patch-coverage gate, since they
  require live servers to exercise.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Extract the shared cURL base-option builder and the empty-hostname guard used
by the web, FTP and DNS-over-HTTPS checks into servcheck_curl_base_options()
and servcheck_require_hostname(), and cover both with unit tests.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Add servcheck_prepare_test(), which performs the hostname validation,
credential loading and default-port handling shared by the mail and FTP
runners, and cover it with unit tests. This removes the duplicated prologue
SonarCloud still flagged between test_mail.php and test_ftp.php.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Composer runs as the runner user in a later CI step and calls touch()
while generating the fixture autoloader; utime() only succeeds for the
file owner, so the runner user must own the tree. www-data is retained
as group and ownership is handed back before polling. Mirrors the fix
in Cacti/plugin_evidence#63.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@sonarqubecloud

sonarqubecloud Bot commented Nov 3, 2026

Copy link
Copy Markdown

@TheWitness
TheWitness merged commit 8f3e398 into Cacti:main Nov 3, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants