mirror of
https://github.com/aziascreations/BakaShrot.git
synced 2026-11-23 20:58:46 +01:00
Added bench.ps1, Made a CRL file not there yet revoke nothing for clients too
- bench.ps1 runs the benchmarks (push_rate, replication_rate, compare_with_old) in release mode: -Only, -Sync full|normal. Plan step 13 done, every step of the plan is. - A CRL file named in client.toml that isn't there yet: nothing revoked (the tool, Python's from_file), as on the server, which now warns in its log. A path given to the DLL's SetCrl or Client(crl=...) stays a FileError. Decided in revamp.md, dropped from known-issues.md. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -70,8 +70,8 @@ ptrdiff_t BakaShrot_SetPrivateKeyW(const uint16_t *key);
|
||||
|
||||
/**
|
||||
* Sets the CA's CRL, optional: servers it revokes are refused. PEM text,
|
||||
* or the path of a file holding it; null or empty for none. Before
|
||||
* connecting.
|
||||
* or the path of a file holding it (one that isn't there is a
|
||||
* `FileError`); null or empty for none. Before connecting.
|
||||
*/
|
||||
ptrdiff_t BakaShrot_SetCrlA(const char *crl);
|
||||
|
||||
|
||||
@@ -326,8 +326,8 @@ class Client:
|
||||
@classmethod
|
||||
def from_file(cls, path: Union[str, os.PathLike], dll_path: Optional[str] = None) -> "Client":
|
||||
"""From a client.toml (server, ca, certificate, key, crl), the tools'
|
||||
too; paths in it are relative to its folder. Needs Python 3.11+
|
||||
(tomllib)."""
|
||||
too; paths in it are relative to its folder, a crl whose file isn't
|
||||
there yet is none. Needs Python 3.11+ (tomllib)."""
|
||||
import tomllib
|
||||
|
||||
try:
|
||||
@@ -351,7 +351,10 @@ class Client:
|
||||
value = get(key, required)
|
||||
return os.path.join(folder, value) if value else None
|
||||
|
||||
return cls(get("server"), file("ca"), file("certificate"), file("key"), file("crl", False), dll_path)
|
||||
# No CRL file yet: nothing revoked, as with the tools and the server.
|
||||
crl = file("crl", False)
|
||||
crl = crl if crl and os.path.exists(crl) else None
|
||||
return cls(get("server"), file("ca"), file("certificate"), file("key"), crl, dll_path)
|
||||
|
||||
# --- Connection --------------------------------------------------------
|
||||
|
||||
|
||||
@@ -227,6 +227,15 @@ check("None of its roles allowed: AuthError, NOT_ALLOWED", ok, detail)
|
||||
missing = Client(f"{kitchen.host}:{kitchen.port}", os.path.join(folder, "missing.crt"), *pem[1:], dll_path=dll_path)
|
||||
ok, detail = raises(missing.connect, BakaShrotError, "missing.crt", ErrorCode.FILE_ERROR)
|
||||
check("A certificate file that isn't there: FILE_ERROR", ok, detail)
|
||||
missing = Client(f"{kitchen.host}:{kitchen.port}", *pem, crl=os.path.join(folder, "missing.crl"), dll_path=dll_path)
|
||||
ok, detail = raises(missing.connect, BakaShrotError, "missing.crl", ErrorCode.FILE_ERROR)
|
||||
check("A CRL file given that isn't there: FILE_ERROR", ok, detail)
|
||||
with open(os.path.join(folder, "kitchen.toml")) as settings:
|
||||
no_crl_yet = settings.read() + '\ncrl = "missing.crl"\n'
|
||||
with open(os.path.join(folder, "no-crl-yet.toml"), "w") as settings:
|
||||
settings.write(no_crl_yet)
|
||||
with Client.from_file(os.path.join(folder, "no-crl-yet.toml"), dll_path) as again:
|
||||
check("A client.toml's CRL file not there yet: none, connected", again.connected, again.crl)
|
||||
with Client(f"{kitchen.host}:{kitchen.port}", *pem, dll_path=dll_path) as again:
|
||||
check("The same identity from PEM text: connected", again.connected and again.node == "kitchen", again.node)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user