config: OpenSSH parity for numeric parsing (port, timeout, time suffixes)

Summary

This PR tightens libssh's numeric configuration parsing to match OpenSSH behavior in four related areas:

  • Port range validation: Rejects values outside 1..65535 instead of silently masking with & 0xffffU (so Port 70000 no longer becomes 4464). "23abc" is also no longer accepted as port 23.
  • Trailing garbage in numerics: ssh_config_get_long() now requires strtol() to consume the whole token. Invalid formats like Port 2201abc, ConnectTimeout 30abc, and RequiredRSASize 2233abc are now rejected rather than silently truncated.
  • ConnectTimeout time suffixes + "none": Introduces a new ssh_config_convtime() that accepts OpenSSH's s/m/h/d/w suffixes with accumulation (e.g., 30s30s = 60, 1h30m = 5400), caps the total at INT_MAX seconds, and maps the literal none to SSH_TIMEOUT_INFINITE.
  • ssh_make_milliseconds() bounds: Caps large timeouts at INT_MAX ms (~24.8 days) to prevent integer overflows, and ensures the SSH_TIMEOUT_INFINITE flag is passed through cleanly without being altered.

Verification

All four behaviors were manually verified against OpenSSH via ssh -G.

Checklist

  • Commits have Signed-off-by: with name/author being identical to the commit author
  • Code modified for feature
  • Test suite updated with functionality tests
  • Test suite updated with negative tests
  • Documentation updated
  • The project pipelines timeout is extended at least to 2 hours.

Reviewer's checklist:

  • Any issues marked for closing are addressed
  • There is a test suite reasonably covering new functionality or modifications
  • Function naming, parameters, return values, types, etc., are consistent and according to CONTRIBUTING.md
  • This feature/change has adequate documentation added
  • No obvious mistakes in the code

Merge request reports

Loading