Compare commits

..

55 Commits

Author SHA1 Message Date
TapTap 30239c6f50 feat: add --fastsync-server-path flag to configure remote server binary path
CI / lint (pull_request) Successful in 10s
CI / sanitizers (address) (pull_request) Successful in 14s
CI / sanitizers (undefined) (pull_request) Successful in 16s
CI / fuzz-build (pull_request) Successful in 15s
CI / coverage (pull_request) Successful in 9s
CI / valgrind (pull_request) Successful in 12s
CI / build-and-test (pull_request) Successful in 54s
2026-07-21 18:13:21 +02:00
TapTap 1929e7d7b3 Merge pull request 'Merge remaining 4 PRs: memory safety, refactoring, test coverage, integration cleanup' (#93) from merge-all into main
CI / lint (push) Successful in 9s
CI / sanitizers (undefined) (push) Successful in 16s
CI / sanitizers (address) (push) Successful in 16s
CI / coverage (push) Successful in 10s
CI / fuzz-build (push) Successful in 13s
CI / valgrind (push) Successful in 13s
CI / build-and-test (push) Successful in 54s
Reviewed-on: #93
2026-07-21 16:08:38 +02:00
TapTap 1ce771b553 fix: revert __thread on io_ssl, restore SSL WANT_READ/WANT_WRITE retry
CI / lint (pull_request) Successful in 8s
CI / sanitizers (address) (pull_request) Successful in 14s
CI / sanitizers (undefined) (pull_request) Successful in 15s
CI / coverage (pull_request) Successful in 10s
CI / fuzz-build (pull_request) Successful in 14s
CI / valgrind (pull_request) Successful in 13s
CI / build-and-test (pull_request) Successful in 54s
2026-07-21 15:52:41 +02:00
TapTap 60ab410a8c fix: address all 12 PR review issues
CI / lint (pull_request) Successful in 9s
CI / sanitizers (address) (pull_request) Successful in 16s
CI / sanitizers (undefined) (pull_request) Successful in 15s
CI / coverage (pull_request) Successful in 12s
CI / fuzz-build (pull_request) Successful in 13s
CI / valgrind (pull_request) Successful in 13s
CI / build-and-test (pull_request) Failing after 54s
2026-07-21 15:46:38 +02:00
TapTap 7adb82f8ac Merge all remaining PRs (#91, #92, #87, #89) into single branch
CI / lint (pull_request) Successful in 9s
CI / sanitizers (address) (pull_request) Successful in 16s
CI / sanitizers (undefined) (pull_request) Successful in 15s
CI / coverage (pull_request) Successful in 11s
CI / fuzz-build (pull_request) Successful in 13s
CI / valgrind (pull_request) Successful in 12s
CI / build-and-test (pull_request) Successful in 54s
2026-07-21 15:11:22 +02:00
TapTap 62f3df94ee Merge fix/refactoring into merge-all 2026-07-21 15:04:41 +02:00
TapTap 61fd410c63 Merge fix/memory-safety into merge-all 2026-07-21 15:04:29 +02:00
TapTap 1c3b752a8e Merge pull request 'Fix logic/correctness bugs (#73, #68, #67, #66, #59, #58, #54, #48, #53)' (#88) from fix/logic-correctness into main
CI / lint (push) Successful in 9s
CI / sanitizers (address) (push) Successful in 14s
CI / sanitizers (undefined) (push) Successful in 15s
CI / fuzz-build (push) Successful in 15s
CI / coverage (push) Successful in 9s
CI / valgrind (push) Successful in 12s
CI / build-and-test (push) Successful in 54s
Reviewed-on: #88
2026-07-21 15:00:48 +02:00
TapTap 1a765e595b Merge pull request 'Features and enhancements (#70, #36, #34, #33, #32, #57, #40, #37)' (#90) from fix/enhancements into main
CI / lint (push) Successful in 9s
CI / sanitizers (address) (push) Successful in 14s
CI / sanitizers (undefined) (push) Successful in 15s
CI / fuzz-build (push) Successful in 13s
CI / coverage (push) Successful in 10s
CI / valgrind (push) Successful in 12s
CI / build-and-test (push) Successful in 54s
Reviewed-on: #90
2026-07-21 15:00:32 +02:00
TapTap 94ff55f256 fix: const qualifier for dirent pointer (cppcheck)
CI / lint (pull_request) Successful in 7s
CI / sanitizers (address) (pull_request) Successful in 14s
CI / sanitizers (undefined) (pull_request) Successful in 15s
CI / fuzz-build (pull_request) Successful in 13s
CI / coverage (pull_request) Successful in 10s
CI / valgrind (pull_request) Successful in 11s
CI / build-and-test (pull_request) Successful in 54s
2026-07-21 14:39:35 +02:00
TapTap ddfd0f1cc2 fix: add MAX_DATA_SIZE bounds check in receive_data
CI / lint (pull_request) Failing after 7s
CI / build-and-test (pull_request) Has been skipped
CI / sanitizers (address) (pull_request) Has been skipped
CI / sanitizers (undefined) (pull_request) Has been skipped
CI / fuzz-build (pull_request) Has been skipped
CI / coverage (pull_request) Has been skipped
CI / valgrind (pull_request) Has been skipped
2026-07-21 14:37:05 +02:00
TapTap e34ec3d594 fix: address review findings — receive_delta_file STATUS_ERROR on early returns
CI / lint (pull_request) Successful in 7s
CI / sanitizers (address) (pull_request) Successful in 16s
CI / sanitizers (undefined) (pull_request) Successful in 15s
CI / coverage (pull_request) Successful in 11s
CI / fuzz-build (pull_request) Successful in 12s
CI / valgrind (pull_request) Successful in 12s
CI / build-and-test (pull_request) Successful in 54s
2026-07-21 14:32:04 +02:00
TapTap f932a48910 fix: address review findings — test_scanner cleanup, basename comment
CI / lint (pull_request) Successful in 9s
CI / sanitizers (address) (pull_request) Successful in 15s
CI / sanitizers (undefined) (pull_request) Successful in 15s
CI / coverage (pull_request) Successful in 10s
CI / fuzz-build (pull_request) Successful in 13s
CI / valgrind (pull_request) Successful in 12s
CI / build-and-test (pull_request) Successful in 54s
2026-07-21 14:19:54 +02:00
TapTap 23af379bfb fix: address review findings — unused var, constness, format specifiers, bounds check
CI / lint (pull_request) Failing after 8s
CI / build-and-test (pull_request) Has been skipped
CI / sanitizers (address) (pull_request) Has been skipped
CI / sanitizers (undefined) (pull_request) Has been skipped
CI / fuzz-build (pull_request) Has been skipped
CI / coverage (pull_request) Has been skipped
CI / valgrind (pull_request) Has been skipped
2026-07-21 14:16:09 +02:00
TapTap 31da8bf081 fix: address review findings — localtime_r, test_scanner cleanup
CI / lint (pull_request) Successful in 8s
CI / sanitizers (address) (pull_request) Successful in 15s
CI / sanitizers (undefined) (pull_request) Successful in 14s
CI / coverage (pull_request) Successful in 10s
CI / fuzz-build (pull_request) Successful in 13s
CI / valgrind (pull_request) Successful in 12s
CI / build-and-test (pull_request) Successful in 54s
2026-07-21 14:15:37 +02:00
TapTap 0cbc873f5c fix: address review findings — localtime_r, test_scanner cleanup
CI / lint (pull_request) Successful in 9s
CI / sanitizers (address) (pull_request) Successful in 15s
CI / sanitizers (undefined) (pull_request) Successful in 15s
CI / fuzz-build (pull_request) Successful in 13s
CI / coverage (pull_request) Successful in 11s
CI / valgrind (pull_request) Successful in 14s
CI / build-and-test (pull_request) Successful in 55s
2026-07-21 14:14:51 +02:00
TapTap 925760d1bd fix: address review findings — localtime_r, test_scanner cleanup
CI / lint (pull_request) Successful in 8s
CI / sanitizers (address) (pull_request) Successful in 14s
CI / sanitizers (undefined) (pull_request) Successful in 15s
CI / fuzz-build (pull_request) Successful in 14s
CI / coverage (pull_request) Successful in 9s
CI / valgrind (pull_request) Successful in 12s
CI / build-and-test (pull_request) Successful in 54s
2026-07-21 14:14:25 +02:00
TapTap 83c61aadc2 ci: trigger CI
CI / lint (pull_request) Successful in 7s
CI / sanitizers (address) (pull_request) Successful in 15s
CI / sanitizers (undefined) (pull_request) Successful in 15s
CI / coverage (pull_request) Successful in 10s
CI / fuzz-build (pull_request) Successful in 13s
CI / valgrind (pull_request) Successful in 11s
CI / build-and-test (pull_request) Successful in 54s
2026-07-20 22:04:45 +02:00
TapTap 552561146a fix: clang-format compliance
CI / lint (pull_request) Successful in 8s
CI / sanitizers (address) (pull_request) Successful in 14s
CI / sanitizers (undefined) (pull_request) Successful in 16s
CI / fuzz-build (pull_request) Successful in 15s
CI / coverage (pull_request) Successful in 9s
CI / valgrind (pull_request) Successful in 11s
CI / build-and-test (pull_request) Successful in 52s
2026-07-20 22:01:03 +02:00
TapTap cdd6d1cfed fix: clang-format compliance
CI / lint (pull_request) Successful in 9s
CI / sanitizers (address) (pull_request) Successful in 15s
CI / sanitizers (undefined) (pull_request) Successful in 14s
CI / fuzz-build (pull_request) Successful in 13s
CI / coverage (pull_request) Successful in 11s
CI / valgrind (pull_request) Successful in 12s
CI / build-and-test (pull_request) Successful in 54s
2026-07-20 22:00:58 +02:00
TapTap e62296d92f fix: test quality — cppcheck suppressions, TLS test addresses, log test isolation
CI / lint (pull_request) Successful in 8s
CI / sanitizers (address) (pull_request) Successful in 16s
CI / sanitizers (undefined) (pull_request) Successful in 16s
CI / coverage (pull_request) Successful in 9s
CI / fuzz-build (pull_request) Successful in 12s
CI / valgrind (pull_request) Successful in 12s
CI / build-and-test (pull_request) Successful in 53s
2026-07-20 21:27:36 +02:00
TapTap 5d819f7388 fix: test quality — cppcheck suppressions, TLS test addresses, log test isolation
CI / lint (pull_request) Failing after 3s
CI / build-and-test (pull_request) Has been skipped
CI / sanitizers (address) (pull_request) Has been skipped
CI / sanitizers (undefined) (pull_request) Has been skipped
CI / fuzz-build (pull_request) Has been skipped
CI / coverage (pull_request) Has been skipped
CI / valgrind (pull_request) Has been skipped
2026-07-20 21:27:36 +02:00
TapTap 4339d7905d fix: correctness — bw throttle underflow, glob **, protocol version, valgrind
CI / lint (pull_request) Successful in 8s
CI / sanitizers (address) (pull_request) Successful in 16s
CI / sanitizers (undefined) (pull_request) Successful in 15s
CI / coverage (pull_request) Successful in 11s
CI / fuzz-build (pull_request) Successful in 13s
CI / valgrind (pull_request) Successful in 12s
CI / build-and-test (pull_request) Successful in 54s
2026-07-20 21:25:32 +02:00
TapTap 3ffc5c5236 fix: memory safety — malloc NULL checks, strcpy→memcpy, str_dup NULL check, remove unused include
CI / lint (pull_request) Failing after 2s
CI / build-and-test (pull_request) Has been skipped
CI / sanitizers (address) (pull_request) Has been skipped
CI / sanitizers (undefined) (pull_request) Has been skipped
CI / fuzz-build (pull_request) Has been skipped
CI / coverage (pull_request) Has been skipped
CI / valgrind (pull_request) Has been skipped
2026-07-20 21:25:26 +02:00
TapTap 224e7e8599 fix: security issues — path traversal, TLS hostname, SUID, OOM, stack overflow
CI / lint (pull_request) Failing after 3s
CI / build-and-test (pull_request) Has been skipped
CI / sanitizers (address) (pull_request) Has been skipped
CI / sanitizers (undefined) (pull_request) Has been skipped
CI / fuzz-build (pull_request) Has been skipped
CI / coverage (pull_request) Has been skipped
CI / valgrind (pull_request) Has been skipped
2026-07-20 21:24:47 +02:00
TapTap 9a214c46e2 fix: memory safety — malloc NULL checks, strcpy→memcpy
CI / lint (pull_request) Failing after 2s
CI / build-and-test (pull_request) Has been skipped
CI / sanitizers (address) (pull_request) Has been skipped
CI / sanitizers (undefined) (pull_request) Has been skipped
CI / fuzz-build (pull_request) Has been skipped
CI / coverage (pull_request) Has been skipped
CI / valgrind (pull_request) Has been skipped
2026-07-20 21:24:44 +02:00
TapTap 9dd925a87d fix: accept_loop race condition, auto-detect valgrind, cppcheck suppressions
CI / lint (pull_request) Successful in 9s
CI / sanitizers (address) (pull_request) Successful in 15s
CI / sanitizers (undefined) (pull_request) Successful in 15s
CI / coverage (pull_request) Successful in 11s
CI / fuzz-build (pull_request) Successful in 13s
CI / valgrind (pull_request) Successful in 12s
CI / build-and-test (pull_request) Successful in 54s
2026-07-20 21:04:53 +02:00
TapTap 4b93082139 fix: auto-detect valgrind, skip fork tests in sendfile tests
CI / lint (pull_request) Successful in 8s
CI / sanitizers (address) (pull_request) Successful in 15s
CI / sanitizers (undefined) (pull_request) Successful in 15s
CI / coverage (pull_request) Successful in 10s
CI / fuzz-build (pull_request) Successful in 14s
CI / valgrind (pull_request) Successful in 12s
CI / build-and-test (pull_request) Successful in 54s
2026-07-20 21:00:12 +02:00
TapTap 8234677276 fix: auto-detect valgrind to skip fork tests
CI / lint (pull_request) Successful in 8s
CI / sanitizers (address) (pull_request) Successful in 15s
CI / sanitizers (undefined) (pull_request) Successful in 15s
CI / coverage (pull_request) Successful in 9s
CI / fuzz-build (pull_request) Successful in 12s
CI / valgrind (pull_request) Successful in 12s
CI / build-and-test (pull_request) Successful in 54s
2026-07-20 20:51:04 +02:00
TapTap 262a436264 fix: auto-detect valgrind to skip fork tests
CI / lint (pull_request) Successful in 8s
CI / sanitizers (address) (pull_request) Successful in 16s
CI / sanitizers (undefined) (pull_request) Successful in 15s
CI / coverage (pull_request) Successful in 10s
CI / fuzz-build (pull_request) Successful in 12s
CI / valgrind (pull_request) Successful in 12s
CI / build-and-test (pull_request) Successful in 53s
2026-07-20 20:48:22 +02:00
TapTap 70e1c6788a ci: re-trigger after cppcheck fixes
CI / lint (pull_request) Failing after 9s
CI / build-and-test (pull_request) Has been skipped
CI / sanitizers (address) (pull_request) Has been skipped
CI / sanitizers (undefined) (pull_request) Has been skipped
CI / fuzz-build (pull_request) Has been skipped
CI / coverage (pull_request) Has been skipped
CI / valgrind (pull_request) Has been skipped
2026-07-20 20:41:21 +02:00
TapTap 30d4d6870c ci: re-trigger after cppcheck fixes
CI / lint (pull_request) Failing after 8s
CI / build-and-test (pull_request) Has been skipped
CI / sanitizers (address) (pull_request) Has been skipped
CI / sanitizers (undefined) (pull_request) Has been skipped
CI / fuzz-build (pull_request) Has been skipped
CI / coverage (pull_request) Has been skipped
CI / valgrind (pull_request) Has been skipped
2026-07-20 20:41:19 +02:00
TapTap 744ac8e40c ci: re-trigger after cppcheck fixes
CI / lint (pull_request) Successful in 8s
CI / sanitizers (address) (pull_request) Successful in 14s
CI / sanitizers (undefined) (pull_request) Successful in 14s
CI / fuzz-build (pull_request) Successful in 14s
CI / coverage (pull_request) Successful in 8s
CI / valgrind (pull_request) Successful in 11s
CI / build-and-test (pull_request) Successful in 54s
2026-07-20 20:41:17 +02:00
TapTap 9042dfcfa9 ci: re-trigger after cppcheck fixes
CI / lint (pull_request) Successful in 8s
CI / sanitizers (address) (pull_request) Successful in 14s
CI / sanitizers (undefined) (pull_request) Successful in 14s
CI / coverage (pull_request) Successful in 10s
CI / fuzz-build (pull_request) Successful in 13s
CI / valgrind (pull_request) Successful in 11s
CI / build-and-test (pull_request) Successful in 54s
2026-07-20 20:41:16 +02:00
TapTap e2a500e321 fix: cppcheck — remove redundant free before _exit in transport_ssh.c
CI / lint (pull_request) Failing after 9s
CI / build-and-test (pull_request) Has been skipped
CI / sanitizers (address) (pull_request) Has been skipped
CI / sanitizers (undefined) (pull_request) Has been skipped
CI / fuzz-build (pull_request) Has been skipped
CI / coverage (pull_request) Has been skipped
CI / valgrind (pull_request) Has been skipped
2026-07-20 20:40:26 +02:00
TapTap a91267ca1b ci: re-trigger after fixes
CI / lint (pull_request) Failing after 9s
CI / build-and-test (pull_request) Has been skipped
CI / sanitizers (address) (pull_request) Has been skipped
CI / sanitizers (undefined) (pull_request) Has been skipped
CI / fuzz-build (pull_request) Has been skipped
CI / coverage (pull_request) Has been skipped
CI / valgrind (pull_request) Has been skipped
2026-07-20 20:28:20 +02:00
TapTap cf572ece04 ci: re-trigger after fixes
CI / lint (pull_request) Failing after 8s
CI / build-and-test (pull_request) Has been skipped
CI / sanitizers (address) (pull_request) Has been skipped
CI / sanitizers (undefined) (pull_request) Has been skipped
CI / fuzz-build (pull_request) Has been skipped
CI / coverage (pull_request) Has been skipped
CI / valgrind (pull_request) Has been skipped
2026-07-20 20:28:19 +02:00
TapTap f486d34b16 ci: re-trigger after fixes
CI / lint (pull_request) Successful in 8s
CI / sanitizers (address) (pull_request) Successful in 15s
CI / sanitizers (undefined) (pull_request) Successful in 16s
CI / fuzz-build (pull_request) Successful in 14s
CI / coverage (pull_request) Successful in 9s
CI / valgrind (pull_request) Successful in 12s
CI / build-and-test (pull_request) Successful in 1m8s
2026-07-20 20:28:17 +02:00
TapTap e3bd7a8cdf ci: re-trigger after fixes
CI / lint (pull_request) Successful in 7s
CI / sanitizers (address) (pull_request) Successful in 14s
CI / sanitizers (undefined) (pull_request) Successful in 14s
CI / fuzz-build (pull_request) Successful in 13s
CI / build-and-test (pull_request) Successful in 53s
CI / coverage (pull_request) Successful in 9s
CI / valgrind (pull_request) Successful in 12s
2026-07-20 20:28:16 +02:00
TapTap 266369b1f2 ci: re-trigger after review fixes
CI / lint (pull_request) Failing after 9s
CI / build-and-test (pull_request) Has been skipped
CI / sanitizers (address) (pull_request) Has been skipped
CI / sanitizers (undefined) (pull_request) Has been skipped
CI / fuzz-build (pull_request) Has been skipped
CI / coverage (pull_request) Has been skipped
CI / valgrind (pull_request) Has been skipped
2026-07-20 20:11:27 +02:00
TapTap a4fc16650e ci: re-trigger after review fixes
CI / lint (pull_request) Failing after 8s
CI / build-and-test (pull_request) Has been skipped
CI / sanitizers (address) (pull_request) Has been skipped
CI / sanitizers (undefined) (pull_request) Has been skipped
CI / fuzz-build (pull_request) Has been skipped
CI / coverage (pull_request) Has been skipped
CI / valgrind (pull_request) Has been skipped
2026-07-20 20:11:26 +02:00
TapTap eef272fa4e ci: re-trigger after review fixes
CI / lint (pull_request) Successful in 8s
CI / sanitizers (address) (pull_request) Successful in 14s
CI / sanitizers (undefined) (pull_request) Successful in 13s
CI / fuzz-build (pull_request) Successful in 11s
CI / build-and-test (pull_request) Successful in 54s
CI / coverage (pull_request) Successful in 9s
CI / valgrind (pull_request) Successful in 12s
2026-07-20 20:11:24 +02:00
TapTap 5e8d0a2dbf ci: re-trigger after review fixes
CI / lint (pull_request) Successful in 7s
CI / sanitizers (address) (pull_request) Successful in 14s
CI / sanitizers (undefined) (pull_request) Successful in 14s
CI / fuzz-build (pull_request) Successful in 12s
CI / build-and-test (pull_request) Successful in 54s
CI / coverage (pull_request) Successful in 9s
CI / valgrind (pull_request) Successful in 12s
2026-07-20 20:11:23 +02:00
TapTap 62ff1d3929 fix: review fixes — test cleanup, wire protocol, clang-format
CI / lint (pull_request) Failing after 8s
CI / build-and-test (pull_request) Has been skipped
CI / sanitizers (address) (pull_request) Has been skipped
CI / sanitizers (undefined) (pull_request) Has been skipped
CI / fuzz-build (pull_request) Has been skipped
CI / coverage (pull_request) Has been skipped
CI / valgrind (pull_request) Has been skipped
2026-07-20 20:11:01 +02:00
TapTap ba0afd4152 fix: cppcheck and clang-format fixes
CI / lint (pull_request) Successful in 7s
CI / sanitizers (address) (pull_request) Successful in 14s
CI / sanitizers (undefined) (pull_request) Successful in 14s
CI / fuzz-build (pull_request) Successful in 12s
CI / coverage (pull_request) Successful in 9s
CI / build-and-test (pull_request) Successful in 53s
CI / valgrind (pull_request) Successful in 11s
2026-07-20 19:53:42 +02:00
TapTap 3923421224 fix: review fixes — getsockname, test assertion, memcpy, clang-format
CI / lint (pull_request) Failing after 9s
CI / build-and-test (pull_request) Has been skipped
CI / sanitizers (address) (pull_request) Has been skipped
CI / sanitizers (undefined) (pull_request) Has been skipped
CI / fuzz-build (pull_request) Has been skipped
CI / coverage (pull_request) Has been skipped
CI / valgrind (pull_request) Has been skipped
2026-07-20 19:53:15 +02:00
TapTap 27e3ac11db fix: bump protocol version, add static_assert for metadata sizes
CI / lint (pull_request) Successful in 8s
CI / sanitizers (address) (pull_request) Successful in 14s
CI / sanitizers (undefined) (pull_request) Successful in 14s
CI / fuzz-build (pull_request) Successful in 12s
CI / coverage (pull_request) Successful in 9s
CI / build-and-test (pull_request) Successful in 55s
CI / valgrind (pull_request) Successful in 11s
2026-07-20 19:53:03 +02:00
TapTap 9e3e0f57a0 ci: trigger CI on PR
CI / lint (pull_request) Failing after 2s
CI / build-and-test (pull_request) Has been skipped
CI / sanitizers (address) (pull_request) Has been skipped
CI / sanitizers (undefined) (pull_request) Has been skipped
CI / fuzz-build (pull_request) Has been skipped
CI / coverage (pull_request) Has been skipped
CI / valgrind (pull_request) Has been skipped
2026-07-20 19:48:34 +02:00
TapTap e5b46bb1c0 ci: trigger CI on PR
CI / lint (pull_request) Failing after 2s
CI / build-and-test (pull_request) Has been skipped
CI / sanitizers (address) (pull_request) Has been skipped
CI / sanitizers (undefined) (pull_request) Has been skipped
CI / fuzz-build (pull_request) Has been skipped
CI / coverage (pull_request) Has been skipped
CI / valgrind (pull_request) Has been skipped
2026-07-20 19:48:33 +02:00
TapTap 86247fe2b5 ci: trigger CI on PR
CI / lint (pull_request) Successful in 8s
CI / sanitizers (address) (pull_request) Successful in 14s
CI / sanitizers (undefined) (pull_request) Successful in 14s
CI / fuzz-build (pull_request) Successful in 12s
CI / coverage (pull_request) Successful in 9s
CI / build-and-test (pull_request) Successful in 54s
CI / valgrind (pull_request) Successful in 11s
2026-07-20 19:48:32 +02:00
TapTap 788d3c7bea ci: trigger CI on PR
CI / lint (pull_request) Failing after 7s
CI / build-and-test (pull_request) Has been skipped
CI / sanitizers (address) (pull_request) Has been skipped
CI / sanitizers (undefined) (pull_request) Has been skipped
CI / fuzz-build (pull_request) Has been skipped
CI / coverage (pull_request) Has been skipped
CI / valgrind (pull_request) Has been skipped
2026-07-20 19:48:31 +02:00
TapTap 7ecba4e0d5 fix: adapt tests and fix bugs from enhancements rebase onto main
CI / lint (pull_request) Failing after 3s
CI / build-and-test (pull_request) Has been skipped
CI / sanitizers (address) (pull_request) Has been skipped
CI / sanitizers (undefined) (pull_request) Has been skipped
CI / fuzz-build (pull_request) Has been skipped
CI / coverage (pull_request) Has been skipped
CI / valgrind (pull_request) Has been skipped
- Fix transport_tcp.c: initialize server->ssl_ctx to NULL
  (prevents SSL_CTX_free on garbage when server_create_tls fails)
- Fix test_transport_tcp.c: client_create now sets fd=-1, family=AF_UNSPEC
- Fix test_transport_tcp.c: server address family may be AF_INET or AF_INET6
- Fix test_file_sendfile.c: send_path=false protocol includes file_type prefix
2026-07-20 19:42:53 +02:00
TapTap 16376bcafc fix: add unit test coverage — issues #71, #63, #62, #56, #55
CI / lint (pull_request) Failing after 2s
CI / build-and-test (pull_request) Has been skipped
CI / sanitizers (address) (pull_request) Has been skipped
CI / sanitizers (undefined) (pull_request) Has been skipped
CI / fuzz-build (pull_request) Has been skipped
CI / coverage (pull_request) Has been skipped
CI / valgrind (pull_request) Has been skipped
2026-07-20 19:38:49 +02:00
TapTap d75701270d fix: refactoring and portability — issues #61, #51, #52
CI / lint (pull_request) Successful in 8s
CI / sanitizers (address) (pull_request) Successful in 14s
CI / sanitizers (undefined) (pull_request) Successful in 13s
CI / fuzz-build (pull_request) Successful in 12s
CI / coverage (pull_request) Successful in 9s
CI / build-and-test (pull_request) Successful in 54s
CI / valgrind (pull_request) Successful in 11s
2026-07-20 19:38:45 +02:00
TapTap 990c4362af fix: memory/null safety bugs — issues #74, #72, #69, #64, #60, #50, #49, #65
CI / lint (pull_request) Failing after 7s
CI / build-and-test (pull_request) Has been skipped
CI / sanitizers (address) (pull_request) Has been skipped
CI / sanitizers (undefined) (pull_request) Has been skipped
CI / fuzz-build (pull_request) Has been skipped
CI / coverage (pull_request) Has been skipped
CI / valgrind (pull_request) Has been skipped
2026-07-20 19:38:43 +02:00
22 changed files with 166 additions and 112 deletions
+11 -2
View File
@@ -56,6 +56,8 @@ static void print_usage(void) {
printf(" --key <path> TLS private key file (PEM)\n"); printf(" --key <path> TLS private key file (PEM)\n");
printf(" --ca <path> TLS CA certificate file (PEM)\n"); printf(" --ca <path> TLS CA certificate file (PEM)\n");
printf(" --partial Keep partial files on interrupted transfer\n"); printf(" --partial Keep partial files on interrupted transfer\n");
printf(" --fastsync-server-path <path>\n");
printf(" Path to fastsync-server on remote (default: fastsync-server)\n");
printf(" --help Show this help\n"); printf(" --help Show this help\n");
printf(" -V, --version Show version and exit\n"); printf(" -V, --version Show version and exit\n");
} }
@@ -70,10 +72,14 @@ int main(int argc, char* argv[]) {
save_to_disk = true; save_to_disk = true;
} }
Config* config = config_create(str_dup(PROTOCOL_VERSION), NULL, NULL, save_to_disk, false, false,
false, false, 5, false, 0);
int exit_code = 0; int exit_code = 0;
bool config_owned_by_pipeline = false; bool config_owned_by_pipeline = false;
Config* config = config_create(str_dup(PROTOCOL_VERSION), NULL, NULL, save_to_disk, false, false,
false, false, 5, false, 0);
if (config == NULL) {
exit_code = 1;
goto cleanup;
}
int positional_args[2]; int positional_args[2];
int positional_count = 0; int positional_count = 0;
@@ -220,6 +226,9 @@ int main(int argc, char* argv[]) {
config->tls_ca = str_dup(argv[++i]); config->tls_ca = str_dup(argv[++i]);
} else if (strcmp(argv[i], "--partial") == 0) { } else if (strcmp(argv[i], "--partial") == 0) {
config->partial = true; config->partial = true;
} else if (strcmp(argv[i], "--fastsync-server-path") == 0 && i + 1 < argc) {
free(config->fastsync_server_path);
config->fastsync_server_path = str_dup(argv[++i]);
} else if (strcmp(argv[i], "-v") == 0 || strcmp(argv[i], "--verbose") == 0) { } else if (strcmp(argv[i], "-v") == 0 || strcmp(argv[i], "--verbose") == 0) {
set_log_level(LOG_LEVEL_DEBUG); set_log_level(LOG_LEVEL_DEBUG);
} else if (argv[i][0] == '-') { } else if (argv[i][0] == '-') {
+4 -2
View File
@@ -228,7 +228,8 @@ static int send_chunks_multithreaded(void* pipeline_context) {
fprintf(stderr, "Error: -f/--sendfile is not supported with SSH transport\n"); fprintf(stderr, "Error: -f/--sendfile is not supported with SSH transport\n");
return 1; return 1;
} }
client = client_connect_ssh(context->config->ssh_destination, context->config->ssh_port); client = client_connect_ssh(context->config->ssh_destination, context->config->ssh_port,
context->config->fastsync_server_path);
} else if (context->config->use_tls) { } else if (context->config->use_tls) {
client = client_create(); client = client_create();
if (!client || !client_connect_tls(client, context->config->server_host, if (!client || !client_connect_tls(client, context->config->server_host,
@@ -385,7 +386,8 @@ int send_files(Config* config) {
fprintf(stderr, "Error: -f/--sendfile is not supported with SSH transport\n"); fprintf(stderr, "Error: -f/--sendfile is not supported with SSH transport\n");
return 1; return 1;
} }
client = client_connect_ssh(config->ssh_destination, config->ssh_port); client =
client_connect_ssh(config->ssh_destination, config->ssh_port, config->fastsync_server_path);
if (!client) if (!client)
return 1; return 1;
} else if (config->use_tls) { } else if (config->use_tls) {
+13 -1
View File
@@ -91,7 +91,19 @@ DirectoryScanner* directory_scanner_create_full(char* root_directory, bool use_m
scanner->max_size = max_size; scanner->max_size = max_size;
scanner->min_size = min_size; scanner->min_size = min_size;
scanner->follow_symlinks = follow_symlinks; scanner->follow_symlinks = follow_symlinks;
queue_enqueue(scanner->directories, str_dup(root_directory)); char* root_copy = str_dup(root_directory);
if (root_copy == NULL) {
for (int i = 0; i < scanner->include_count; i++)
free(scanner->include_patterns[i]);
free(scanner->include_patterns);
for (int i = 0; i < scanner->exclude_count; i++)
free(scanner->exclude_patterns[i]);
free(scanner->exclude_patterns);
queue_destroy(scanner->directories);
free(scanner);
return NULL;
}
queue_enqueue(scanner->directories, root_copy);
return scanner; return scanner;
} }
+5 -4
View File
@@ -23,6 +23,8 @@ static bool is_excluded(const char* path, const Config* config) {
char* path_dup = str_dup(path); char* path_dup = str_dup(path);
if (!path_dup) if (!path_dup)
return false; return false;
/* basename(3) may return a pointer into path_dup or a static buffer;
* either way we free path_dup, not fname. */
char* fname = basename(path_dup); char* fname = basename(path_dup);
// Check exclude patterns // Check exclude patterns
@@ -245,10 +247,9 @@ int main(int argc, char* argv[]) {
server_listen(g_server, handler); server_listen(g_server, handler);
} }
/* Graceful shutdown: if a signal requested cleanup, delete the server */ /* Graceful shutdown: delete the server */
if (g_server_cleanup_requested) { if (g_server_cleanup_requested)
log_message(LOG_LEVEL_INFO, "Shutdown requested, cleaning up"); log_message(LOG_LEVEL_INFO, "Shutdown requested, cleaning up");
server_delete(&g_server); server_delete(&g_server);
}
return 0; return 0;
} }
+15 -8
View File
@@ -34,6 +34,7 @@ Config* config_create(char* version, char* send_directory, char* receive_directo
config->ssh_port = 22; config->ssh_port = 22;
config->transport = TRANSPORT_TCP; config->transport = TRANSPORT_TCP;
config->ssh_destination = NULL; config->ssh_destination = NULL;
config->fastsync_server_path = NULL;
config->exclude_patterns = NULL; config->exclude_patterns = NULL;
config->exclude_count = 0; config->exclude_count = 0;
config->include_patterns = NULL; config->include_patterns = NULL;
@@ -82,10 +83,13 @@ void config_parse_ssh_dest(Config* config) {
} }
void config_delete(Config* config) { void config_delete(Config* config) {
if (config == NULL)
return;
free(config->version); free(config->version);
free(config->send_directory); free(config->send_directory);
free(config->receive_root_directory); free(config->receive_root_directory);
free(config->ssh_destination); free(config->ssh_destination);
free(config->fastsync_server_path);
for (int i = 0; i < config->exclude_count; i++) for (int i = 0; i < config->exclude_count; i++)
free(config->exclude_patterns[i]); free(config->exclude_patterns[i]);
free(config->exclude_patterns); free(config->exclude_patterns);
@@ -236,6 +240,7 @@ Config* config_receive(int file_descriptor) {
config->ssh_port = 22; config->ssh_port = 22;
config->transport = TRANSPORT_TCP; config->transport = TRANSPORT_TCP;
config->ssh_destination = NULL; config->ssh_destination = NULL;
config->fastsync_server_path = NULL;
config->exclude_patterns = NULL; config->exclude_patterns = NULL;
config->exclude_count = 0; config->exclude_count = 0;
config->include_patterns = NULL; config->include_patterns = NULL;
@@ -260,10 +265,6 @@ Config* config_receive(int file_descriptor) {
MAX_PATTERN_COUNT); MAX_PATTERN_COUNT);
goto error; goto error;
} }
if ((size_t)ec > SIZE_MAX / sizeof(char*)) {
log_message(LOG_LEVEL_ERROR, "Exclude pattern count %d would cause integer overflow", ec);
goto error;
}
config->exclude_count = ec; config->exclude_count = ec;
if (ec > 0) { if (ec > 0) {
config->exclude_patterns = malloc((size_t)ec * sizeof(char*)); config->exclude_patterns = malloc((size_t)ec * sizeof(char*));
@@ -293,10 +294,6 @@ Config* config_receive(int file_descriptor) {
MAX_PATTERN_COUNT); MAX_PATTERN_COUNT);
goto error; goto error;
} }
if ((size_t)ic > SIZE_MAX / sizeof(char*)) {
log_message(LOG_LEVEL_ERROR, "Include pattern count %d would cause integer overflow", ic);
goto error;
}
config->include_count = ic; config->include_count = ic;
if (ic > 0) { if (ic > 0) {
config->include_patterns = malloc((size_t)ic * sizeof(char*)); config->include_patterns = malloc((size_t)ic * sizeof(char*));
@@ -340,6 +337,16 @@ error:
free(config->version); free(config->version);
free(config->send_directory); free(config->send_directory);
free(config->receive_root_directory); free(config->receive_root_directory);
for (int i = 0; i < config->exclude_count; i++)
free(config->exclude_patterns[i]);
free(config->exclude_patterns);
for (int i = 0; i < config->include_count; i++)
free(config->include_patterns[i]);
free(config->include_patterns);
free(config->tls_cert);
free(config->tls_key);
free(config->tls_ca);
free(config->ssh_destination);
free(config->server_host); free(config->server_host);
free(config); free(config);
return NULL; return NULL;
+2 -1
View File
@@ -24,6 +24,7 @@ typedef struct Config {
int ssh_port; int ssh_port;
TransportType transport; TransportType transport;
char* ssh_destination; char* ssh_destination;
char* fastsync_server_path;
char** exclude_patterns; char** exclude_patterns;
int exclude_count; int exclude_count;
char** include_patterns; char** include_patterns;
@@ -44,7 +45,7 @@ typedef struct Config {
bool partial; bool partial;
} Config; } Config;
#define PROTOCOL_VERSION "1.3.0" #define PROTOCOL_VERSION "2.0.0"
#define DEFAULT_CHUNK_SIZE (10 * 1024 * 1024) #define DEFAULT_CHUNK_SIZE (10 * 1024 * 1024)
Config* config_create(char* version, char* send_directory, char* receive_directory, Config* config_create(char* version, char* send_directory, char* receive_directory,
+1 -1
View File
@@ -1,6 +1,6 @@
#include "data.h" #include "data.h"
#include "log.h" #include "log.h"
#include "stdlib.h" #include <stdlib.h>
Data* data_create_empty(size_t data_size) { Data* data_create_empty(size_t data_size) {
/* malloc(0) is UB; allocate at least 1 byte but preserve requested size */ /* malloc(0) is UB; allocate at least 1 byte but preserve requested size */
+18 -22
View File
@@ -3,6 +3,7 @@
#include <fcntl.h> #include <fcntl.h>
#include <libgen.h> #include <libgen.h>
#include <stddef.h> #include <stddef.h>
#include <stdint.h>
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
@@ -109,6 +110,9 @@ bool file_load_data(File* file) {
size_t bytes_read = file_content_to_buffer(file); size_t bytes_read = file_content_to_buffer(file);
if (bytes_read != file->data->size) { if (bytes_read != file->data->size) {
log_message(LOG_LEVEL_ERROR, "Did not read expected amount of bytes from file"); log_message(LOG_LEVEL_ERROR, "Did not read expected amount of bytes from file");
free(file->data->data);
file->data->data = NULL;
file->data->size = 0;
return false; return false;
} }
return true; return true;
@@ -140,11 +144,13 @@ static bool file_send_streaming(File* file, int file_descriptor) {
if (ferror(fp)) { if (ferror(fp)) {
perror("Read error during streaming"); perror("Read error during streaming");
} }
send_status(file_descriptor, STATUS_ERROR);
free(buf); free(buf);
fclose(fp); fclose(fp);
return false; return false;
} }
if (!send_n_data(file_descriptor, buf, nread)) { if (!send_n_data(file_descriptor, buf, nread)) {
send_status(file_descriptor, STATUS_ERROR);
free(buf); free(buf);
fclose(fp); fclose(fp);
return false; return false;
@@ -200,25 +206,10 @@ bool file_send_single_calls(File* file, int file_descriptor, bool use_metadata,
return true; return true;
} }
static bool has_path_traversal(const char* path) {
// Check if ".." appears as a path component — at start, end, or between '/'
const char* p = path;
while ((p = strstr(p, "..")) != NULL) {
bool at_start = (p == path);
bool after_slash = (p > path && p[-1] == '/');
bool at_end = (p[2] == '\0');
bool before_slash = (p[2] == '/');
if ((at_start || after_slash) && (at_end || before_slash))
return true;
p += 2;
}
return false;
}
bool file_save_to_disk(const char* root_directory, File* file) { bool file_save_to_disk(const char* root_directory, File* file) {
if (file->type == FILE_TYPE_SYMLINK && file->link_target) { if (file->type == FILE_TYPE_SYMLINK && file->link_target) {
// Validate link_target — reject absolute paths or traversal // Validate link_target — reject absolute paths or traversal
if (file->link_target[0] == '/' || has_path_traversal(file->link_target)) { if (file->link_target[0] == '/' || strstr(file->link_target, "..") != NULL) {
log_message(LOG_LEVEL_ERROR, "Path traversal blocked in symlink target: %s", log_message(LOG_LEVEL_ERROR, "Path traversal blocked in symlink target: %s",
file->link_target); file->link_target);
return false; return false;
@@ -226,7 +217,7 @@ bool file_save_to_disk(const char* root_directory, File* file) {
char* disk_path = path_cat((char*)root_directory, file->path); char* disk_path = path_cat((char*)root_directory, file->path);
if (disk_path == NULL) if (disk_path == NULL)
return false; return false;
if (has_path_traversal(disk_path)) { if (strstr(disk_path, "..") != NULL) {
log_message(LOG_LEVEL_ERROR, "Path traversal blocked: %s", disk_path); log_message(LOG_LEVEL_ERROR, "Path traversal blocked: %s", disk_path);
free(disk_path); free(disk_path);
return false; return false;
@@ -242,7 +233,7 @@ bool file_save_to_disk(const char* root_directory, File* file) {
char* disk_path = path_cat((char*)root_directory, file->path); char* disk_path = path_cat((char*)root_directory, file->path);
if (disk_path == NULL) if (disk_path == NULL)
return false; return false;
if (has_path_traversal(disk_path)) { if (strstr(disk_path, "..") != NULL) {
log_message(LOG_LEVEL_ERROR, "Path traversal blocked: %s", disk_path); log_message(LOG_LEVEL_ERROR, "Path traversal blocked: %s", disk_path);
free(disk_path); free(disk_path);
return false; return false;
@@ -311,17 +302,21 @@ static bool receive_and_assign_metadata(int fd, const Config* config, File* file
static File* receive_delta_file(int fd, const Config* config, const char* check_path, static File* receive_delta_file(int fd, const Config* config, const char* check_path,
void* old_data, unsigned long long old_size) { void* old_data, unsigned long long old_size) {
if (!old_data) if (!old_data) {
send_status(fd, STATUS_ERROR);
return NULL; return NULL;
}
DeltaSignature* sig = delta_signature_create(old_data, old_size, config->delta_block_size); DeltaSignature* sig = delta_signature_create(old_data, old_size, config->delta_block_size);
if (!sig) { if (!sig) {
send_status(fd, STATUS_ERROR);
free(old_data); free(old_data);
return NULL; return NULL;
} }
Data* sig_data = delta_signature_serialize(sig); Data* sig_data = delta_signature_serialize(sig);
if (!sig_data) { if (!sig_data) {
send_status(fd, STATUS_ERROR);
delta_signature_destroy(sig); delta_signature_destroy(sig);
free(old_data); free(old_data);
return NULL; return NULL;
@@ -533,7 +528,6 @@ File* receive_incremental_check(int fd, const Config* config, bool* skipped) {
if (!receive_and_assign_metadata(fd, config, file)) if (!receive_and_assign_metadata(fd, config, file))
return NULL; return NULL;
// Read file type indicator
int file_type; int file_type;
if (!receive_int(fd, &file_type)) { if (!receive_int(fd, &file_type)) {
file_destroy(file); file_destroy(file);
@@ -620,7 +614,6 @@ bool file_send_sendfile(File* file, int file_descriptor, bool use_metadata, int
if (use_metadata && !metadata_send(file_descriptor, file->metadata)) if (use_metadata && !metadata_send(file_descriptor, file->metadata))
return false; return false;
// Send file type indicator
int ft = (int)file->type; int ft = (int)file->type;
if (!send_int(file_descriptor, ft)) if (!send_int(file_descriptor, ft))
return false; return false;
@@ -639,7 +632,10 @@ bool file_send_sendfile(File* file, int file_descriptor, bool use_metadata, int
off_t offset = 0; off_t offset = 0;
while ((unsigned long long)offset < file_size) { while ((unsigned long long)offset < file_size) {
ssize_t sent = sendfile(file_descriptor, fd, &offset, file_size - offset); size_t send_count = (size_t)(file_size - (unsigned long long)offset);
if ((unsigned long long)send_count != file_size - (unsigned long long)offset)
send_count = SIZE_MAX;
ssize_t sent = sendfile(file_descriptor, fd, &offset, send_count);
if (sent == -1) { if (sent == -1) {
if (errno == EINTR) if (errno == EINTR)
continue; continue;
+4 -1
View File
@@ -14,7 +14,10 @@ void log_message(LogLevel log_level, const char* format, ...) {
if (log_level < current_log_level) if (log_level < current_log_level)
return; return;
time_t now = time(NULL); time_t now = time(NULL);
const struct tm* t = localtime(&now); struct tm result_buf;
const struct tm* t = localtime_r(&now, &result_buf);
if (t == NULL)
return;
fprintf(stderr, "%04d-%02d-%02d %02d:%02d:%02d [%s]: ", t->tm_year + 1900, t->tm_mon + 1, fprintf(stderr, "%04d-%02d-%02d %02d:%02d:%02d [%s]: ", t->tm_year + 1900, t->tm_mon + 1,
t->tm_mday, t->tm_hour, t->tm_min, t->tm_sec, log_level_strings[log_level]); t->tm_mday, t->tm_hour, t->tm_min, t->tm_sec, log_level_strings[log_level]);
+13
View File
@@ -11,6 +11,19 @@
#include <time.h> #include <time.h>
#include <unistd.h> #include <unistd.h>
/*
* Wire format serialization (protocol version 2.0.0+):
* All metadata fields are serialized as fixed-width integers (int32_t / int64_t)
* to ensure cross-platform binary compatiblity. See metadata.h for the
* exact wire layout.
*
* Compile-time assertions verify that the native platform types fit within
* the chosen fixed-width representations.
*/
typedef char static_assert_mode_t_fits[(sizeof(mode_t) <= sizeof(int32_t)) ? 1 : -1];
typedef char static_assert_uid_t_fits[(sizeof(uid_t) <= sizeof(int32_t)) ? 1 : -1];
typedef char static_assert_gid_t_fits[(sizeof(gid_t) <= sizeof(int32_t)) ? 1 : -1];
void metadata_to_buf(char** buf, const FileMetadata* m) { void metadata_to_buf(char** buf, const FileMetadata* m) {
int32_t present = (m != NULL) ? 1 : 0; int32_t present = (m != NULL) ? 1 : 0;
memcpy(*buf, &present, sizeof(present)); memcpy(*buf, &present, sizeof(present));
+17
View File
@@ -6,6 +6,23 @@
#include <stdint.h> #include <stdint.h>
#include <sys/stat.h> #include <sys/stat.h>
/*
* Wire format (introduced in protocol version 2.0.0):
* int32_t present
* int32_t mode (was mode_t, platform-dependent)
* int32_t uid (was uid_t, platform-dependent)
* int32_t gid (was gid_t, platform-dependent)
* int64_t mtime_sec (was time_t, platform-dependent)
* int64_t mtime_nsec (was long, platform-dependent)
*
* Prior to 2.0.0 the wire format used the raw platform-dependent types,
* which broke compatiblity across different systems. All fields are now
* serialized as fixed-width integers.
*/
/* Size of metadata fields on wire, excluding the int32_t `present` field that
* is always sent first. The total wire size for present metadata is
* sizeof(int32_t) + FILE_METADATA_WIRE_SIZE (32 bytes on most platforms). */
#define FILE_METADATA_WIRE_SIZE (sizeof(int32_t) * 3 + sizeof(int64_t) * 2) #define FILE_METADATA_WIRE_SIZE (sizeof(int32_t) * 3 + sizeof(int64_t) * 2)
void metadata_to_buf(char** buf, const FileMetadata* m); void metadata_to_buf(char** buf, const FileMetadata* m);
+10 -15
View File
@@ -34,14 +34,11 @@ static void bw_throttle(size_t bytes_written) {
struct timespec now; struct timespec now;
clock_gettime(CLOCK_MONOTONIC, &now); clock_gettime(CLOCK_MONOTONIC, &now);
/* Use unsigned long long for elapsed_ns to avoid overflow in multiplication. long long elapsed_ns =
* time_t differences fit comfortably in 64-bit for any practical runtime. */ (now.tv_sec - bw_last_refill.tv_sec) * 1000000000LL + (now.tv_nsec - bw_last_refill.tv_nsec);
unsigned long long elapsed_ns =
(unsigned long long)(now.tv_sec - bw_last_refill.tv_sec) * 1000000000ULL +
(unsigned long long)(now.tv_nsec - bw_last_refill.tv_nsec);
bw_last_refill = now; bw_last_refill = now;
long long tokens_to_add = (long long)((double)io_bwlimit * (double)elapsed_ns / 1000000000.0); long long tokens_to_add = (long long)((double)io_bwlimit * elapsed_ns / 1000000000.0);
bw_tokens += tokens_to_add; bw_tokens += tokens_to_add;
if (bw_tokens > (long long)io_bwlimit) if (bw_tokens > (long long)io_bwlimit)
bw_tokens = (long long)io_bwlimit; bw_tokens = (long long)io_bwlimit;
@@ -49,9 +46,7 @@ static void bw_throttle(size_t bytes_written) {
bw_tokens -= (long long)bytes_written; bw_tokens -= (long long)bytes_written;
if (bw_tokens < 0) { if (bw_tokens < 0) {
long long deficit_ns = (long long)((double)(-bw_tokens) / (double)io_bwlimit * 1000000000.0); long long deficit_ns = (long long)((double)(-bw_tokens) / io_bwlimit * 1000000000.0);
if (deficit_ns < 0)
deficit_ns = 0;
struct timespec sleep_time, remaining; struct timespec sleep_time, remaining;
sleep_time.tv_sec = deficit_ns / 1000000000LL; sleep_time.tv_sec = deficit_ns / 1000000000LL;
sleep_time.tv_nsec = deficit_ns % 1000000000LL; sleep_time.tv_nsec = deficit_ns % 1000000000LL;
@@ -112,7 +107,7 @@ bool receive_n_data(int file_descriptor, void* data, size_t data_size) {
bytes_received = bytes_received =
read(fd, (char*)data + total_bytes_received, data_size - total_bytes_received); read(fd, (char*)data + total_bytes_received, data_size - total_bytes_received);
if (bytes_received <= 0) { if (bytes_received <= 0) {
if (io_ssl) { if (io_ssl && bytes_received < 0) {
int ssl_err = SSL_get_error(io_ssl, (int)bytes_received); int ssl_err = SSL_get_error(io_ssl, (int)bytes_received);
if (ssl_err == SSL_ERROR_WANT_READ || ssl_err == SSL_ERROR_WANT_WRITE) if (ssl_err == SSL_ERROR_WANT_READ || ssl_err == SSL_ERROR_WANT_WRITE)
continue; continue;
@@ -193,18 +188,18 @@ bool send_data(int file_descriptor, const Data* data) {
return false; return false;
if (!send_n_data(file_descriptor, data->data, data_size)) if (!send_n_data(file_descriptor, data->data, data_size))
return false; return false;
log_message(LOG_LEVEL_DEBUG, "Send %lld data", data_size); log_message(LOG_LEVEL_DEBUG, "Send %llu data", data_size);
return true; return true;
} }
#define MAX_DATA_SIZE (1024ULL * 1024 * 1024) // 1 GB #define MAX_DATA_SIZE (1024ULL * 1024 * 1024)
Data* receive_data(int file_descriptor) { Data* receive_data(int file_descriptor) {
unsigned long long size = 0; unsigned long long size = 0;
if (!receive_n_data(file_descriptor, &size, sizeof(unsigned long long))) if (!receive_n_data(file_descriptor, &size, sizeof(unsigned long long)))
return NULL; return NULL;
if (size > MAX_DATA_SIZE) { if ((size_t)size != size || size > MAX_DATA_SIZE) {
log_message(LOG_LEVEL_ERROR, "receive_data: size %llu exceeds maximum", size); log_message(LOG_LEVEL_ERROR, "receive_data size %llu exceeds limits", size);
return NULL; return NULL;
} }
void* data = malloc((size_t)size); void* data = malloc((size_t)size);
@@ -214,7 +209,7 @@ Data* receive_data(int file_descriptor) {
free(data); free(data);
return NULL; return NULL;
} }
log_message(LOG_LEVEL_DEBUG, "Received %lld data", size); log_message(LOG_LEVEL_DEBUG, "Received %llu data", size);
return data_create(data, (size_t)size); return data_create(data, (size_t)size);
} }
+9 -5
View File
@@ -67,7 +67,7 @@ static int parse_remote_dest(const char* dest, RemoteDest* r) {
return 0; return 0;
} }
Client* client_connect_ssh(const char* destination, int port) { Client* client_connect_ssh(const char* destination, int port, const char* server_path) {
RemoteDest r; RemoteDest r;
if (parse_remote_dest(destination, &r) != 0) { if (parse_remote_dest(destination, &r) != 0) {
fprintf(stderr, "Invalid remote destination: %s\n", destination); fprintf(stderr, "Invalid remote destination: %s\n", destination);
@@ -119,10 +119,13 @@ Client* client_connect_ssh(const char* destination, int port) {
close(sv[1]); close(sv[1]);
char ssh_user[512]; char ssh_user[512];
int needed;
if (r.user && r.user[0] != '\0') if (r.user && r.user[0] != '\0')
snprintf(ssh_user, sizeof(ssh_user), "%s@%s", r.user, r.host); needed = snprintf(ssh_user, sizeof(ssh_user), "%s@%s", r.user, r.host);
else else
snprintf(ssh_user, sizeof(ssh_user), "%s", r.host); needed = snprintf(ssh_user, sizeof(ssh_user), "%s", r.host);
if ((size_t)needed >= sizeof(ssh_user))
fprintf(stderr, "Warning: ssh_user string truncated\n");
size_t ssh_argv_max = 32; size_t ssh_argv_max = 32;
char** ssh_argv = calloc(ssh_argv_max, sizeof(char*)); char** ssh_argv = calloc(ssh_argv_max, sizeof(char*));
@@ -149,7 +152,7 @@ Client* client_connect_ssh(const char* destination, int port) {
_exit(1); _exit(1);
} }
ssh_argv[ac++] = ssh_user; ssh_argv[ac++] = ssh_user;
ssh_argv[ac++] = "fastsync-server"; ssh_argv[ac++] = (char*)(server_path ? server_path : "fastsync-server");
ssh_argv[ac++] = "--stdio"; ssh_argv[ac++] = "--stdio";
ssh_argv[ac] = NULL; ssh_argv[ac] = NULL;
execvp("ssh", ssh_argv); execvp("ssh", ssh_argv);
@@ -171,7 +174,8 @@ Client* client_connect_ssh(const char* destination, int port) {
close(sv[0]); close(sv[0]);
waitpid(pid, NULL, 0); waitpid(pid, NULL, 0);
remote_dest_destroy(&r); remote_dest_destroy(&r);
fprintf(stderr, "Error: could not launch 'fastsync-server --stdio' on remote\n"); fprintf(stderr, "Error: could not launch '%s --stdio' on remote\n",
server_path ? server_path : "fastsync-server");
return NULL; return NULL;
} }
+1 -1
View File
@@ -3,6 +3,6 @@
#include "transport_tcp.h" #include "transport_tcp.h"
Client* client_connect_ssh(const char* destination, int port); Client* client_connect_ssh(const char* destination, int port, const char* server_path);
#endif #endif
+13 -8
View File
@@ -42,14 +42,13 @@ Server* server_create(int port) {
return NULL; return NULL;
} }
memset(&server->address, 0, sizeof(server->address)); memset(&server->address, 0, sizeof(server->address));
server->ssl_ctx = NULL;
// Try IPv6 first, fall back to IPv4 // Try IPv6 first, fall back to IPv4
int domain = AF_INET6; int fd = socket(AF_INET6, SOCK_STREAM, 0);
int fd = socket(domain, SOCK_STREAM, 0); sa_family_t domain = AF_INET6;
if (fd < 0) { if (fd < 0) {
fd = socket(AF_INET, SOCK_STREAM, 0);
domain = AF_INET; domain = AF_INET;
fd = socket(domain, SOCK_STREAM, 0);
} }
if (fd < 0) { if (fd < 0) {
perror("Could not create Socket!"); perror("Could not create Socket!");
@@ -64,6 +63,7 @@ Server* server_create(int port) {
} }
server->file_descriptor = fd; server->file_descriptor = fd;
server->ssl_ctx = NULL;
int opt = 1; int opt = 1;
if (setsockopt(server->file_descriptor, SOL_SOCKET, SO_REUSEADDR, &opt, sizeof(opt))) { if (setsockopt(server->file_descriptor, SOL_SOCKET, SO_REUSEADDR, &opt, sizeof(opt))) {
perror("Error setting a socket option!"); perror("Error setting a socket option!");
@@ -72,6 +72,7 @@ Server* server_create(int port) {
return NULL; return NULL;
} }
// Use the domain from the socket we actually created
struct sockaddr_storage* addr = &server->address; struct sockaddr_storage* addr = &server->address;
struct sockaddr_in* addr4 = (struct sockaddr_in*)addr; struct sockaddr_in* addr4 = (struct sockaddr_in*)addr;
struct sockaddr_in6* addr6 = (struct sockaddr_in6*)addr; struct sockaddr_in6* addr6 = (struct sockaddr_in6*)addr;
@@ -80,11 +81,13 @@ Server* server_create(int port) {
addr6->sin6_family = AF_INET6; addr6->sin6_family = AF_INET6;
addr6->sin6_addr = in6addr_any; addr6->sin6_addr = in6addr_any;
addr6->sin6_port = htons(port); addr6->sin6_port = htons(port);
addr->ss_family = AF_INET6;
server->address_length = sizeof(struct sockaddr_in6); server->address_length = sizeof(struct sockaddr_in6);
} else { } else {
addr4->sin_family = AF_INET; addr4->sin_family = AF_INET;
addr4->sin_addr.s_addr = INADDR_ANY; addr4->sin_addr.s_addr = INADDR_ANY;
addr4->sin_port = htons(port); addr4->sin_port = htons(port);
addr->ss_family = AF_INET;
server->address_length = sizeof(struct sockaddr_in); server->address_length = sizeof(struct sockaddr_in);
} }
@@ -265,10 +268,11 @@ bool client_connect(Client* client, char* host, int port) {
} }
// Save the connected address // Save the connected address
size_t copy_len = socklen_t addr_len = rp->ai_addrlen;
rp->ai_addrlen < sizeof(client->address) ? rp->ai_addrlen : sizeof(client->address); if (addr_len > sizeof(client->address))
memcpy(&client->address, rp->ai_addr, copy_len); addr_len = sizeof(client->address);
client->address_length = (int)copy_len; memcpy(&client->address, rp->ai_addr, addr_len);
client->address_length = addr_len;
freeaddrinfo(res); freeaddrinfo(res);
// Close old fd if any and set new one // Close old fd if any and set new one
@@ -299,6 +303,7 @@ void client_disconnect(Client* client) {
void client_delete(Client* client) { void client_delete(Client* client) {
if (client == NULL) if (client == NULL)
return; return;
client_disconnect(client);
if (client->ssl_ctx) { if (client->ssl_ctx) {
SSL_CTX_free(client->ssl_ctx); SSL_CTX_free(client->ssl_ctx);
client->ssl_ctx = NULL; client->ssl_ctx = NULL;
+4 -5
View File
@@ -134,7 +134,7 @@ static void delete_extras_walk(const char* abs_path, const char* rel_path, Array
if (!dir) if (!dir)
return; return;
bool all_removed = true; bool all_removed = true;
struct dirent* entry; const struct dirent* entry;
while ((entry = readdir(dir)) != NULL) { while ((entry = readdir(dir)) != NULL) {
if (strcmp(entry->d_name, ".") == 0 || strcmp(entry->d_name, "..") == 0) if (strcmp(entry->d_name, ".") == 0 || strcmp(entry->d_name, "..") == 0)
continue; continue;
@@ -184,18 +184,17 @@ void delete_extras(const char* dest_root, ArrayList* manifest) {
delete_extras_walk(dest_root, "", manifest); delete_extras_walk(dest_root, "", manifest);
} }
char* path_cat(const char* path1, char* path2) { char* path_cat(const char* path1, const char* path2) {
if (path1 == NULL || *path1 == '\0') if (path1 == NULL || *path1 == '\0')
return str_dup(path2); return str_dup(path2);
if (path2 == NULL || *path2 == '\0') if (path2 == NULL || *path2 == '\0')
return str_dup(path1); return str_dup(path1);
int path1_len = strlen(path1); int path1_len = strlen(path1);
int path2_len = strlen(path2); int path2_len = strlen(path2);
char* path2_pointer = path2;
if (path1[path1_len - 1] == '/') if (path1[path1_len - 1] == '/')
path1_len -= 1; path1_len -= 1;
if (path2[0] == '/') { if (path2[0] == '/') {
path2_pointer += 1; path2++;
path2_len -= 1; path2_len -= 1;
} }
char* new_path = malloc(path1_len + path2_len + 2); char* new_path = malloc(path1_len + path2_len + 2);
@@ -203,7 +202,7 @@ char* path_cat(const char* path1, char* path2) {
return NULL; return NULL;
memcpy(new_path, path1, path1_len); memcpy(new_path, path1, path1_len);
new_path[path1_len] = '/'; new_path[path1_len] = '/';
memcpy(new_path + path1_len + 1, path2_pointer, path2_len); memcpy(new_path + path1_len + 1, path2, path2_len);
new_path[path1_len + path2_len + 1] = '\0'; new_path[path1_len + path2_len + 1] = '\0';
return new_path; return new_path;
} }
+1 -1
View File
@@ -6,7 +6,7 @@
bool mkdir_r(const char* path); bool mkdir_r(const char* path);
char* str_dup(const char* string); char* str_dup(const char* string);
char* path_cat(const char* path1, char* path2); char* path_cat(const char* path1, const char* path2);
bool glob_match(const char* pattern, const char* str); bool glob_match(const char* pattern, const char* str);
void delete_extras(const char* dest_root, ArrayList* manifest); void delete_extras(const char* dest_root, ArrayList* manifest);
+1 -1
View File
@@ -224,7 +224,7 @@ static void test_sendfile_no_path() {
pid_t pid = fork(); pid_t pid = fork();
if (pid == 0) { if (pid == 0) {
close(p[1]); close(p[1]);
/* Read file type indicator */ /* When send_path is false, the sender still sends file_type + data */
int file_type; int file_type;
EXPECT_TRUE(receive_int(p[0], &file_type)); EXPECT_TRUE(receive_int(p[0], &file_type));
EXPECT_EQ_INT(file_type, (int)FILE_TYPE_REGULAR); EXPECT_EQ_INT(file_type, (int)FILE_TYPE_REGULAR);
+5 -2
View File
@@ -46,6 +46,7 @@ static void test_send_receive_str() {
EXPECT_TRUE(send_str(0, "")); EXPECT_TRUE(send_str(0, ""));
/* cppcheck-suppress constVariablePointer */
char* received = receive_str(0); char* received = receive_str(0);
EXPECT_NOT_NULL(received); EXPECT_NOT_NULL(received);
EXPECT_EQ_STR(received, ""); EXPECT_EQ_STR(received, "");
@@ -63,6 +64,7 @@ static void test_send_receive_str_normal() {
EXPECT_TRUE(send_str(0, "Hello, Protocol!")); EXPECT_TRUE(send_str(0, "Hello, Protocol!"));
/* cppcheck-suppress constVariablePointer */
char* received = receive_str(0); char* received = receive_str(0);
EXPECT_NOT_NULL(received); EXPECT_NOT_NULL(received);
EXPECT_EQ_STR(received, "Hello, Protocol!"); EXPECT_EQ_STR(received, "Hello, Protocol!");
@@ -78,6 +80,7 @@ static void test_send_receive_data() {
io_set_fds(p[0], p[1]); io_set_fds(p[0], p[1]);
io_set_bwlimit(0); io_set_bwlimit(0);
/* cppcheck-suppress constVariablePointer */
unsigned char bin[] = {0xDE, 0xAD, 0xBE, 0xEF, 0x00, 0xFF}; unsigned char bin[] = {0xDE, 0xAD, 0xBE, 0xEF, 0x00, 0xFF};
void* buf = malloc(sizeof(bin)); void* buf = malloc(sizeof(bin));
EXPECT_NOT_NULL(buf); EXPECT_NOT_NULL(buf);
@@ -128,6 +131,7 @@ static void test_send_receive_status() {
io_set_fds(p[0], p[1]); io_set_fds(p[0], p[1]);
io_set_bwlimit(0); io_set_bwlimit(0);
/* cppcheck-suppress constVariablePointer */
Status statuses[] = {STATUS_OK, STATUS_ERROR, STATUS_FINISHED, STATUS_NEXT, Status statuses[] = {STATUS_OK, STATUS_ERROR, STATUS_FINISHED, STATUS_NEXT,
STATUS_CHUNK, STATUS_CHECK, STATUS_DELTA_SIGNATURE, STATUS_DELTA_DATA}; STATUS_CHUNK, STATUS_CHECK, STATUS_DELTA_SIGNATURE, STATUS_DELTA_DATA};
int count = sizeof(statuses) / sizeof(statuses[0]); int count = sizeof(statuses) / sizeof(statuses[0]);
@@ -179,8 +183,7 @@ static void test_receive_str_oversized() {
size_t huge = MAX_STRING_SIZE + 1; size_t huge = MAX_STRING_SIZE + 1;
EXPECT_TRUE(send_n_data(0, &huge, sizeof(size_t))); EXPECT_TRUE(send_n_data(0, &huge, sizeof(size_t)));
/* cppcheck-suppress constVariablePointer */ const char* received = receive_str(0);
char* received = receive_str(0);
EXPECT_NULL(received); EXPECT_NULL(received);
close(p[0]); close(p[0]);
+14 -27
View File
@@ -15,7 +15,7 @@ static void test_scanner_single_file() {
const char* file1 = "test_scan_dir_single/file1.txt"; const char* file1 = "test_scan_dir_single/file1.txt";
const char* content1 = "hello scanner"; const char* content1 = "hello scanner";
mkdir(dir, 0755); EXPECT_EQ_INT(mkdir(dir, 0755), 0);
create_test_file(file1, content1); create_test_file(file1, content1);
DirectoryScanner* scanner = DirectoryScanner* scanner =
@@ -43,7 +43,7 @@ static void test_scanner_multiple_files() {
const char* content1 = "alpha"; const char* content1 = "alpha";
const char* content2 = "beta"; const char* content2 = "beta";
mkdir(dir, 0755); EXPECT_EQ_INT(mkdir(dir, 0755), 0);
create_test_file(file1, content1); create_test_file(file1, content1);
create_test_file(file2, content2); create_test_file(file2, content2);
@@ -82,8 +82,8 @@ static void test_scanner_subdirectory() {
const char* sub_file = "test_scan_sub/sub/sub_file.txt"; const char* sub_file = "test_scan_sub/sub/sub_file.txt";
const char* content = "nested content"; const char* content = "nested content";
mkdir(root, 0755); EXPECT_EQ_INT(mkdir(root, 0755), 0);
mkdir(sub, 0755); EXPECT_EQ_INT(mkdir(sub, 0755), 0);
create_test_file(root_file, content); create_test_file(root_file, content);
create_test_file(sub_file, content); create_test_file(sub_file, content);
@@ -109,7 +109,7 @@ static void test_scanner_subdirectory() {
static void test_scanner_empty_directory() { static void test_scanner_empty_directory() {
const char* dir = "test_scan_empty"; const char* dir = "test_scan_empty";
mkdir(dir, 0755); EXPECT_EQ_INT(mkdir(dir, 0755), 0);
DirectoryScanner* scanner = DirectoryScanner* scanner =
directory_scanner_create((char*)dir, false, 0, NULL, 0, NULL, 0, 0, 0); directory_scanner_create((char*)dir, false, 0, NULL, 0, NULL, 0, 0, 0);
@@ -130,7 +130,7 @@ static void test_scanner_exclude_pattern() {
const char* f_tmp = "test_scan_excl/remove.tmp"; const char* f_tmp = "test_scan_excl/remove.tmp";
const char* content = "data"; const char* content = "data";
mkdir(dir, 0755); EXPECT_EQ_INT(mkdir(dir, 0755), 0);
create_test_file(f_txt, content); create_test_file(f_txt, content);
create_test_file(f_tmp, content); create_test_file(f_tmp, content);
@@ -154,8 +154,6 @@ static void test_scanner_exclude_pattern() {
} }
static void test_scanner_exclude_subdirectory() { static void test_scanner_exclude_subdirectory() {
/* Exclude patterns match filenames only (via entry->d_name).
* Files inside subdirectories are also matched by filename. */
const char* root = "test_scan_excl_sub"; const char* root = "test_scan_excl_sub";
const char* sub = "test_scan_excl_sub/sub"; const char* sub = "test_scan_excl_sub/sub";
const char* root_txt = "test_scan_excl_sub/root.txt"; const char* root_txt = "test_scan_excl_sub/root.txt";
@@ -163,13 +161,12 @@ static void test_scanner_exclude_subdirectory() {
const char* sub_tmp = "test_scan_excl_sub/sub/temp.tmp"; const char* sub_tmp = "test_scan_excl_sub/sub/temp.tmp";
const char* content = "data"; const char* content = "data";
mkdir(root, 0755); EXPECT_EQ_INT(mkdir(root, 0755), 0);
mkdir(sub, 0755); EXPECT_EQ_INT(mkdir(sub, 0755), 0);
create_test_file(root_txt, content); create_test_file(root_txt, content);
create_test_file(sub_txt, content); create_test_file(sub_txt, content);
create_test_file(sub_tmp, content); create_test_file(sub_tmp, content);
/* Exclude *.tmp — should exclude sub/temp.tmp but keep root.txt and sub/data.txt */
char* exclude[] = {"*.tmp"}; char* exclude[] = {"*.tmp"};
DirectoryScanner* scanner = DirectoryScanner* scanner =
directory_scanner_create((char*)root, false, 0, exclude, 1, NULL, 0, 0, 0); directory_scanner_create((char*)root, false, 0, exclude, 1, NULL, 0, 0, 0);
@@ -180,7 +177,6 @@ static void test_scanner_exclude_subdirectory() {
while ((chunk = directory_scanner_next(scanner)) != NULL) { while ((chunk = directory_scanner_next(scanner)) != NULL) {
total += chunk->element_count; total += chunk->element_count;
for (int i = 0; i < chunk->element_count; i++) { for (int i = 0; i < chunk->element_count; i++) {
/* No path should end in .tmp */
size_t len = strlen(chunk->items[i]->path); size_t len = strlen(chunk->items[i]->path);
EXPECT_TRUE(len < 4 || strcmp(chunk->items[i]->path + len - 4, ".tmp") != 0); EXPECT_TRUE(len < 4 || strcmp(chunk->items[i]->path + len - 4, ".tmp") != 0);
} }
@@ -197,22 +193,17 @@ static void test_scanner_exclude_subdirectory() {
} }
static void test_scanner_include_and_exclude() { static void test_scanner_include_and_exclude() {
/* In the scanner, exclude is checked first and takes precedence.
* Include patterns act as an additional filter: if include_count > 0,
* the file must match one of the include patterns (after not being excluded).
* This test uses non-overlapping exclude and include patterns. */
const char* dir = "test_scan_inc_exc"; const char* dir = "test_scan_inc_exc";
const char* f_txt = "test_scan_inc_exc/a.txt"; const char* f_txt = "test_scan_inc_exc/a.txt";
const char* f_log = "test_scan_inc_exc/b.log"; const char* f_log = "test_scan_inc_exc/b.log";
const char* f_bak = "test_scan_inc_exc/c.bak"; const char* f_bak = "test_scan_inc_exc/c.bak";
const char* content = "filter"; const char* content = "filter";
mkdir(dir, 0755); EXPECT_EQ_INT(mkdir(dir, 0755), 0);
create_test_file(f_txt, content); create_test_file(f_txt, content);
create_test_file(f_log, content); create_test_file(f_log, content);
create_test_file(f_bak, content); create_test_file(f_bak, content);
/* Exclude *.bak. Include *.txt and *.log. */
char* exclude[] = {"*.bak"}; char* exclude[] = {"*.bak"};
char* include[] = {"*.txt", "*.log"}; char* include[] = {"*.txt", "*.log"};
DirectoryScanner* scanner = DirectoryScanner* scanner =
@@ -230,7 +221,6 @@ static void test_scanner_include_and_exclude() {
if (strstr(chunk->items[i]->path, "b.log")) if (strstr(chunk->items[i]->path, "b.log"))
found_log = 1; found_log = 1;
} }
/* a.txt included by *.txt, b.log included by *.log, c.bak excluded by *.bak */
EXPECT_TRUE(found_txt); EXPECT_TRUE(found_txt);
EXPECT_TRUE(found_log); EXPECT_TRUE(found_log);
@@ -248,10 +238,7 @@ static void test_scanner_max_size() {
const char* dir = "test_scan_max"; const char* dir = "test_scan_max";
const char* small = "test_scan_max/small.txt"; const char* small = "test_scan_max/small.txt";
const char* large = "test_scan_max/large.txt"; const char* large = "test_scan_max/large.txt";
create_test_file(small, "tiny"); EXPECT_EQ_INT(mkdir(dir, 0755), 0);
create_test_file(large, "this_content_is_longer_than_ten_chars");
mkdir(dir, 0755);
create_test_file(small, "tiny"); create_test_file(small, "tiny");
create_test_file(large, "this_content_is_longer_than_ten_chars"); create_test_file(large, "this_content_is_longer_than_ten_chars");
@@ -279,7 +266,7 @@ static void test_scanner_min_size() {
const char* empty_f = "test_scan_min/empty.txt"; const char* empty_f = "test_scan_min/empty.txt";
const char* data_f = "test_scan_min/data.txt"; const char* data_f = "test_scan_min/data.txt";
mkdir(dir, 0755); EXPECT_EQ_INT(mkdir(dir, 0755), 0);
create_test_file(empty_f, ""); create_test_file(empty_f, "");
create_test_file(data_f, "some content here"); create_test_file(data_f, "some content here");
@@ -308,7 +295,7 @@ static void test_scanner_size_range() {
const char* medium = "test_scan_range/med.txt"; const char* medium = "test_scan_range/med.txt";
const char* huge = "test_scan_range/huge.txt"; const char* huge = "test_scan_range/huge.txt";
mkdir(dir, 0755); EXPECT_EQ_INT(mkdir(dir, 0755), 0);
create_test_file(tiny, "ab"); create_test_file(tiny, "ab");
create_test_file(medium, "hello world"); create_test_file(medium, "hello world");
create_test_file(huge, "this is a much larger file for testing size filters"); create_test_file(huge, "this is a much larger file for testing size filters");
@@ -341,7 +328,7 @@ static void test_scanner_mixed_patterns() {
const char* c_txt = "test_scan_mixed/c.txt"; /* size ~= 5 */ const char* c_txt = "test_scan_mixed/c.txt"; /* size ~= 5 */
const char* d_bak = "test_scan_mixed/d.bak"; /* size ~= 42 */ const char* d_bak = "test_scan_mixed/d.bak"; /* size ~= 42 */
mkdir(dir, 0755); EXPECT_EQ_INT(mkdir(dir, 0755), 0);
create_test_file(a_txt, "aaaaa"); create_test_file(a_txt, "aaaaa");
create_test_file(b_bin, "bbbbbbbbbbbbb"); create_test_file(b_bin, "bbbbbbbbbbbbb");
create_test_file(c_txt, "ccccc"); create_test_file(c_txt, "ccccc");
@@ -377,7 +364,7 @@ static void test_scanner_no_patterns() {
const char* f1 = "test_scan_none/f1.txt"; const char* f1 = "test_scan_none/f1.txt";
const char* f2 = "test_scan_none/f2.txt"; const char* f2 = "test_scan_none/f2.txt";
mkdir(dir, 0755); EXPECT_EQ_INT(mkdir(dir, 0755), 0);
create_test_file(f1, "first"); create_test_file(f1, "first");
create_test_file(f2, "second"); create_test_file(f2, "second");
+4 -4
View File
@@ -9,14 +9,14 @@
static void test_ssh_connect_invalid_dest() { static void test_ssh_connect_invalid_dest() {
/* Missing colon — parse_remote_dest should fail and return NULL */ /* Missing colon — parse_remote_dest should fail and return NULL */
/* cppcheck-suppress constVariablePointer */ /* cppcheck-suppress constVariablePointer */
Client* client = client_connect_ssh("invalid-destination-no-colon", 22); Client* client = client_connect_ssh("invalid-destination-no-colon", 22, NULL);
EXPECT_NULL(client); EXPECT_NULL(client);
} }
/* Test client_connect_ssh with empty destination */ /* Test client_connect_ssh with empty destination */
static void test_ssh_connect_empty_dest() { static void test_ssh_connect_empty_dest() {
/* cppcheck-suppress constVariablePointer */ /* cppcheck-suppress constVariablePointer */
Client* client = client_connect_ssh("", 22); Client* client = client_connect_ssh("", 22, NULL);
EXPECT_NULL(client); EXPECT_NULL(client);
} }
@@ -24,7 +24,7 @@ static void test_ssh_connect_empty_dest() {
* parse_remote_dest succeeds, ssh is exec'd and fails, but the function * parse_remote_dest succeeds, ssh is exec'd and fails, but the function
* creates a Client that must be cleaned up. */ * creates a Client that must be cleaned up. */
static void test_ssh_connect_malformed() { static void test_ssh_connect_malformed() {
Client* client = client_connect_ssh(":", 22); Client* client = client_connect_ssh(":", 22, NULL);
/* ssh binary exists, so exec succeeds; the function returns a Client. /* ssh binary exists, so exec succeeds; the function returns a Client.
* We just verify it doesn't crash and clean up properly. */ * We just verify it doesn't crash and clean up properly. */
if (client != NULL) { if (client != NULL) {
@@ -37,7 +37,7 @@ static void test_ssh_connect_malformed() {
/* Test client_connect_ssh with valid format but unreachable host. /* Test client_connect_ssh with valid format but unreachable host.
* The function launches ssh which will fail to connect, returns a Client. */ * The function launches ssh which will fail to connect, returns a Client. */
static void test_ssh_connect_unreachable() { static void test_ssh_connect_unreachable() {
Client* client = client_connect_ssh("nonexistent.invalid:/remote/path", 22); Client* client = client_connect_ssh("nonexistent.invalid:/remote/path", 22, NULL);
if (client != NULL) { if (client != NULL) {
client_disconnect(client); client_disconnect(client);
client_delete(client); client_delete(client);
+1 -1
View File
@@ -9,7 +9,7 @@ static void test_client_create_delete() {
Client* client = client_create(); Client* client = client_create();
EXPECT_NOT_NULL(client); EXPECT_NOT_NULL(client);
EXPECT_EQ_INT(client->file_descriptor, -1); EXPECT_EQ_INT(client->file_descriptor, -1);
EXPECT_TRUE(client->address.ss_family == AF_UNSPEC); EXPECT_EQ_INT(client->address.ss_family, AF_UNSPEC);
EXPECT_EQ_INT(client->ssh_child_pid, -1); EXPECT_EQ_INT(client->ssh_child_pid, -1);
EXPECT_NULL(client->ssl); EXPECT_NULL(client->ssl);
EXPECT_NULL(client->ssl_ctx); EXPECT_NULL(client->ssl_ctx);