C2: --force is deletion authority (an incoming regular file may remove a non-empty destination directory tree, and --delete-missing-args may remove a non-empty directory mirror), but it was not masked by the operator --allow-delete policy. The handler now clears config->force_delete unless --allow-delete was given, exactly like --delete and --delete-missing-args. C3: a standalone TCP / --stdio server running as root defaulted to SUPER_MODE_AUTO, so an untrusted client --devices/--write-devices/ --super could make it create device nodes, write raw devices, or apply client-chosen ownership. A privileged standalone receiver now forces SUPER_MODE_OFF unless the operator opts in with the new server-only --allow-super flag. Non-root receivers are unchanged, and the daemon path keeps its per-module `client owner = yes` gate. --allow-super is rejected with --no-super or --daemon. C6: tls_client_identity_allowed now rejects a CN whose reported length reached the buffer bound, so a truncated over-long CN cannot be matched by a required --client-cn prefix. Tests: an integration regression proving --force cannot replace a destination directory without --allow-delete; standalone-default tests for --copy-as refusal and (root-only) skipped device creation; a CLI unit test for the new flag. The integration shared_server fixture opts in with --allow-super so the existing root-only ownership/device/copy-as tests continue to exercise the opted-in configuration. README and RSYNC_COMPAT document the flag and the force/delete gating.
38 lines
1.4 KiB
Python
38 lines
1.4 KiB
Python
"""Shared pytest configuration for integration tests."""
|
|
import os
|
|
import shutil
|
|
import sys
|
|
import pytest
|
|
|
|
sys.path.insert(0, os.path.join(os.path.dirname(__file__), "integration"))
|
|
|
|
from common import ServerManager, TEST_DATA_DIR
|
|
|
|
|
|
@pytest.fixture(scope="session")
|
|
def shared_server():
|
|
"""One server for the entire test session. Avoids 27+ server start/stop cycles.
|
|
|
|
Under pytest-xdist this session fixture is instantiated once per worker
|
|
process, so each worker gets its own server on an ephemeral port."""
|
|
server = ServerManager()
|
|
# --allow-super keeps the historical permissive super mode for a root
|
|
# receiver: the integration suite's root-only ownership/device/copy-as tests
|
|
# exercise that opted-in configuration. The secure default (a root
|
|
# standalone server without --allow-super forces SUPER_MODE_OFF) is covered
|
|
# explicitly by TestStandaloneSuperDefault in test_features.py. Non-root
|
|
# runs are unaffected by the flag.
|
|
server.start(extra_args=["--allow-super"])
|
|
yield server
|
|
server.stop()
|
|
|
|
|
|
@pytest.fixture(scope="session", autouse=True)
|
|
def _cleanup_worker_test_data():
|
|
"""Remove this (worker-keyed) TEST_DATA_DIR at the end of the session.
|
|
|
|
Modules clean only their own rows; this final pass ensures the per-worker
|
|
directory never lingers in the working tree."""
|
|
yield
|
|
shutil.rmtree(TEST_DATA_DIR, ignore_errors=True)
|