Fix 13 .ss with conflicting make-NAME redefinitions
ober
e5acea36291bde1802ff6f4792376b9a7f6b5157
--- a/lib/std/actor/bounded.ss +++ b/lib/std/actor/bounded.ss @@ -42,8 +42,11 @@ ;; ========== Mailbox Configuration ========== - (defstruct mailbox-config (capacity strategy)) - (def %make-mailbox-config make-mailbox-config) ;; 'block, 'drop, 'error + (defstruct %mailbox-config-rec (capacity strategy)) + (def mailbox-config? %mailbox-config-rec?) + (def %make-mailbox-config make-%mailbox-config-rec) + (def mailbox-config-capacity %mailbox-config-rec-capacity) + (def mailbox-config-strategy %mailbox-config-rec-strategy) (def (make-mailbox-config capacity . opts) (let ([strategy (if (and (pair? opts) (pair? (cdr opts)) --- a/lib/std/actor/cluster-security.ss +++ b/lib/std/actor/cluster-security.ss @@ -55,8 +55,13 @@ ;; ========== D1: Transport Encryption Config ========== - (defstruct node-tls-config (certificate private-key ca-certificate verify-peer?)) - (def %make-node-tls-config make-node-tls-config) + (defstruct %node-tls-config-rec (certificate private-key ca-certificate verify-peer?)) + (def node-tls-config? %node-tls-config-rec?) + (def %make-node-tls-config make-%node-tls-config-rec) + (def node-tls-config-certificate %node-tls-config-rec-certificate) + (def node-tls-config-private-key %node-tls-config-rec-private-key) + (def node-tls-config-ca-certificate %node-tls-config-rec-ca-certificate) + (def node-tls-config-verify-peer? %node-tls-config-rec-verify-peer?) (def (make-node-tls-config . opts) (let loop ([o opts] [cert #f] [key #f] [ca #f] [verify #t]) @@ -71,8 +76,14 @@ ;; ========== D2: Message Authentication ========== - (defstruct authenticated-message (sender sequence timestamp payload hmac)) - (def %make-auth-msg make-authenticated-message) + (defstruct %authenticated-message-rec (sender sequence timestamp payload hmac)) + (def authenticated-message? %authenticated-message-rec?) + (def %make-auth-msg make-%authenticated-message-rec) + (def authenticated-message-sender %authenticated-message-rec-sender) + (def authenticated-message-sequence %authenticated-message-rec-sequence) + (def authenticated-message-timestamp %authenticated-message-rec-timestamp) + (def authenticated-message-payload %authenticated-message-rec-payload) + (def authenticated-message-hmac %authenticated-message-rec-hmac) (def (make-authenticated-message sender sequence payload hmac-key) ;; Create an authenticated message with HMAC. @@ -118,13 +129,17 @@ ;; ========== Replay Window ========== - (defstruct replay-window (size seen mutex)) - (def %make-replay-window make-replay-window) - (def %replay-window-size replay-window-size) - (def %replay-window-seen replay-window-seen) - (def %replay-window-set-seen! replay-window-seen-set!) - (def %replay-window-mutex replay-window-mutex) - (def %replay-window-set-mutex! replay-window-mutex-set!) + (defstruct %replay-window-rec (size seen mutex)) + (def replay-window? %replay-window-rec?) + (def %make-replay-window make-%replay-window-rec) + (def %replay-window-size %replay-window-rec-size) + (def %replay-window-seen %replay-window-rec-seen) + (def %replay-window-set-seen! %replay-window-rec-seen-set!) + (def %replay-window-mutex %replay-window-rec-mutex) + (def %replay-window-set-mutex! %replay-window-rec-mutex-set!) + (def replay-window-size %replay-window-rec-size) + (def replay-window-seen %replay-window-rec-seen) + (def replay-window-mutex %replay-window-rec-mutex) (def (make-replay-window . opts) (let ([size (if (pair? opts) (car opts) 1024)]) @@ -144,8 +159,14 @@ ;; ========== D3: Capability Delegation ========== - (defstruct delegation-token (capability-type permissions target-node expiry signature)) - (def %make-delegation-token make-delegation-token) ;; string + (defstruct %delegation-token-rec (capability-type permissions target-node expiry signature)) + (def delegation-token? %delegation-token-rec?) + (def %make-delegation-token make-%delegation-token-rec) + (def delegation-token-capability-type %delegation-token-rec-capability-type) + (def delegation-token-permissions %delegation-token-rec-permissions) + (def delegation-token-target-node %delegation-token-rec-target-node) + (def delegation-token-expiry %delegation-token-rec-expiry) + (def delegation-token-signature %delegation-token-rec-signature) (def (make-delegation-token cap-type permissions target-node signing-key . opts) (let ([expiry (if (pair? opts) (car opts) #f)]) @@ -169,15 +190,15 @@ ;; ========== D4: Cluster Policies ========== - (define-record-type (cluster-policy %make-cluster-policy cluster-policy?) - (sealed #t) - (fields - (immutable auth-method cluster-policy-auth-method) - (immutable node-roles cluster-policy-node-roles) ;; alist: (node . role) - (immutable role-permissions cluster-policy-role-permissions) ;; alist: (role . (perm ...)) - (immutable allowed-connections cluster-policy-allowed-connections) ;; alist: (role . (role ...)) - (immutable max-message-rate cluster-policy-max-message-rate) - (immutable max-message-size cluster-policy-max-message-size))) + (defstruct %cluster-policy-rec (auth-method node-roles role-permissions allowed-connections max-message-rate max-message-size)) + (def cluster-policy? %cluster-policy-rec?) + (def %make-cluster-policy make-%cluster-policy-rec) + (def cluster-policy-auth-method %cluster-policy-rec-auth-method) + (def cluster-policy-node-roles %cluster-policy-rec-node-roles) + (def cluster-policy-role-permissions %cluster-policy-rec-role-permissions) + (def cluster-policy-allowed-connections %cluster-policy-rec-allowed-connections) + (def cluster-policy-max-message-rate %cluster-policy-rec-max-message-rate) + (def cluster-policy-max-message-size %cluster-policy-rec-max-message-size) (def (make-cluster-policy . opts) (let loop ([o opts] [auth 'mutual-tls] [roles '()] [perms '()] [conns '()] --- a/lib/std/build/sbom.ss +++ b/lib/std/build/sbom.ss @@ -46,8 +46,14 @@ ;; ========== Component Record ========== - (defstruct component (name version type hash license)) - (def %make-component make-component) ;; string or #f + (defstruct %component-rec (name version type hash license)) + (def component? %component-rec?) + (def %make-component make-%component-rec) + (def component-name %component-rec-name) + (def component-version %component-rec-version) + (def component-type %component-rec-type) + (def component-hash %component-rec-hash) + (def component-license %component-rec-license) (def (make-component name version type . opts) (let loop ([o opts] [hash #f] [license #f]) @@ -60,12 +66,16 @@ ;; ========== SBOM Record ========== - (defstruct sbom (project version timestamp components build-info)) - (def %make-sbom make-sbom) - (def %sbom-components sbom-components) - (def %sbom-set-components! sbom-components-set!) - (def %sbom-build-info sbom-build-info) - (def %sbom-set-build-info! sbom-build-info-set!) ;; alist + (defstruct %sbom-rec (project version timestamp components build-info)) + (def sbom? %sbom-rec?) + (def %make-sbom make-%sbom-rec) + (def %sbom-components %sbom-rec-components) + (def %sbom-set-components! %sbom-rec-components-set!) + (def %sbom-build-info %sbom-rec-build-info) + (def sbom-project %sbom-rec-project) + (def sbom-version %sbom-rec-version) + (def sbom-timestamp %sbom-rec-timestamp) + (def %sbom-set-build-info! %sbom-rec-build-info-set!) ;; alist (def (make-sbom project version) (%make-sbom project version --- a/lib/std/net/timeout.ss +++ b/lib/std/net/timeout.ss @@ -48,8 +48,13 @@ ;; ========== Timeout Configuration ========== - (defstruct timeout-config (connect read write idle)) - (def %make-timeout-config make-timeout-config) ;; milliseconds + (defstruct %timeout-config-rec (connect read write idle)) + (def timeout-config? %timeout-config-rec?) + (def %make-timeout-config make-%timeout-config-rec) + (def timeout-config-connect %timeout-config-rec-connect) + (def timeout-config-read %timeout-config-rec-read) + (def timeout-config-write %timeout-config-rec-write) + (def timeout-config-idle %timeout-config-rec-idle) (def (make-timeout-config . opts) (let loop ([o opts] @@ -71,8 +76,14 @@ ;; ========== HTTP Limits ========== - (defstruct http-limits (max-header-size max-header-count max-uri-length max-body-size request-timeout)) - (def %make-http-limits make-http-limits) ;; milliseconds + (defstruct %http-limits-rec (max-header-size max-header-count max-uri-length max-body-size request-timeout)) + (def http-limits? %http-limits-rec?) + (def %make-http-limits make-%http-limits-rec) + (def http-limits-max-header-size %http-limits-rec-max-header-size) + (def http-limits-max-header-count %http-limits-rec-max-header-count) + (def http-limits-max-uri-length %http-limits-rec-max-uri-length) + (def http-limits-max-body-size %http-limits-rec-max-body-size) + (def http-limits-request-timeout %http-limits-rec-request-timeout) (def (make-http-limits . opts) (let loop ([o opts] --- a/lib/std/net/tls.ss +++ b/lib/std/net/tls.ss @@ -45,8 +45,16 @@ ;; ========== TLS Configuration ========== - (defstruct tls-config (min-version cipher-suites verify-peer? verify-hostname? ca-file cert-file key-file)) - (def %make-tls-config make-tls-config) ;; string or #f + (defstruct %tls-config-rec (min-version cipher-suites verify-peer? verify-hostname? ca-file cert-file key-file)) + (def tls-config? %tls-config-rec?) + (def %make-tls-config make-%tls-config-rec) + (def tls-config-min-version %tls-config-rec-min-version) + (def tls-config-cipher-suites %tls-config-rec-cipher-suites) + (def tls-config-verify-peer? %tls-config-rec-verify-peer?) + (def tls-config-verify-hostname? %tls-config-rec-verify-hostname?) + (def tls-config-ca-file %tls-config-rec-ca-file) + (def tls-config-cert-file %tls-config-rec-cert-file) + (def tls-config-key-file %tls-config-rec-key-file) ;; Strong default cipher suites (TLS 1.3 + TLS 1.2 AEAD-only) (def *default-cipher-suites* @@ -385,10 +393,13 @@ ;; ========== Certificate Pinning ========== - (defstruct pin-set (pins mutex)) - (def %make-pin-set make-pin-set) - (def %pin-set-pins pin-set-pins) - (def %pin-set-mutex pin-set-mutex) + (defstruct %pin-set-rec (pins mutex)) + (def pin-set? %pin-set-rec?) + (def %make-pin-set make-%pin-set-rec) + (def %pin-set-pins %pin-set-rec-pins) + (def %pin-set-mutex %pin-set-rec-mutex) + (def pin-set-pins %pin-set-rec-pins) + (def pin-set-mutex %pin-set-rec-mutex) (def (make-pin-set) (%make-pin-set --- a/lib/std/os/iouring.ss +++ b/lib/std/os/iouring.ss @@ -68,8 +68,13 @@ ;; ========== iouring record ========== - (defstruct iouring (ring-addr depth pending mutex)) - (def %make-iouring make-iouring) + (defstruct %iouring-rec (ring-addr depth pending mutex)) + (def iouring? %iouring-rec?) + (def %make-iouring make-%iouring-rec) + (def iouring-ring-addr %iouring-rec-ring-addr) + (def iouring-depth %iouring-rec-depth) + (def iouring-pending %iouring-rec-pending) + (def iouring-mutex %iouring-rec-mutex) ;; ========== Operation ID counter ========== --- a/lib/std/security/auth.ss +++ b/lib/std/security/auth.ss @@ -43,10 +43,13 @@ ;; ========== API Key Store ========== - (defstruct api-key-store (keys mutex)) - (def %make-api-key-store make-api-key-store) - (def %api-key-store-keys api-key-store-keys) - (def %api-key-store-mutex api-key-store-mutex) + (defstruct %api-key-store-rec (keys mutex)) + (def api-key-store? %api-key-store-rec?) + (def %make-api-key-store make-%api-key-store-rec) + (def %api-key-store-keys %api-key-store-rec-keys) + (def %api-key-store-mutex %api-key-store-rec-mutex) + (def api-key-store-keys %api-key-store-rec-keys) + (def api-key-store-mutex %api-key-store-rec-mutex) (def (make-api-key-store) (%make-api-key-store @@ -83,11 +86,15 @@ ;; ========== Session Store ========== - (defstruct session-store (sessions mutex default-ttl)) - (def make-session-store* make-session-store) - (def %session-store-sessions session-store-sessions) - (def %session-store-mutex session-store-mutex) - (def %session-store-ttl session-store-default-ttl) ;; seconds + (defstruct %session-store-rec (sessions mutex default-ttl)) + (def session-store? %session-store-rec?) + (def make-session-store* make-%session-store-rec) + (def %session-store-sessions %session-store-rec-sessions) + (def %session-store-mutex %session-store-rec-mutex) + (def %session-store-ttl %session-store-rec-default-ttl) + (def session-store-sessions %session-store-rec-sessions) + (def session-store-mutex %session-store-rec-mutex) + (def session-store-default-ttl %session-store-rec-default-ttl) (def (make-session-store . opts) (let ([ttl (if (and (pair? opts) (pair? (cdr opts)) (eq? (car opts) 'ttl:)) @@ -178,12 +185,17 @@ ;; ========== Rate Limiter ========== - (defstruct rate-limiter (attempts mutex max-attempts window-seconds)) - (def make-rate-limiter* make-rate-limiter) - (def %rl-attempts rate-limiter-attempts) - (def %rl-mutex rate-limiter-mutex) - (def %rl-max rate-limiter-max-attempts) - (def %rl-window rate-limiter-window-seconds) + (defstruct %rate-limiter-rec (attempts mutex max-attempts window-seconds)) + (def rate-limiter? %rate-limiter-rec?) + (def make-rate-limiter* make-%rate-limiter-rec) + (def %rl-attempts %rate-limiter-rec-attempts) + (def %rl-mutex %rate-limiter-rec-mutex) + (def %rl-max %rate-limiter-rec-max-attempts) + (def %rl-window %rate-limiter-rec-window-seconds) + (def rate-limiter-attempts %rate-limiter-rec-attempts) + (def rate-limiter-mutex %rate-limiter-rec-mutex) + (def rate-limiter-max-attempts %rate-limiter-rec-max-attempts) + (def rate-limiter-window-seconds %rate-limiter-rec-window-seconds) (def (make-rate-limiter max-attempts window-seconds) (make-rate-limiter* --- a/lib/std/security/flow.ss +++ b/lib/std/security/flow.ss @@ -45,8 +45,11 @@ ;; ========== Security Levels ========== - (defstruct security-level (name rank)) - (def %make-security-level make-security-level) + (defstruct %security-level-rec (name rank)) + (def security-level? %security-level-rec?) + (def %make-security-level make-%security-level-rec) + (def security-level-name %security-level-rec-name) + (def security-level-rank %security-level-rec-rank) (def %security-level-rank security-level-rank) ;; integer (higher = more secret) (def (make-security-level name rank) --- a/lib/std/security/landlock.ss +++ b/lib/std/security/landlock.ss @@ -154,12 +154,15 @@ ;; ========== Ruleset Record ========== - (defstruct landlock-ruleset (rules installed?)) - (def %make-landlock-ruleset make-landlock-ruleset) - (def %landlock-rules landlock-ruleset-rules) - (def %landlock-set-rules! landlock-ruleset-rules-set!) - (def %landlock-installed? landlock-ruleset-installed?) - (def %landlock-set-installed! landlock-ruleset-installed?-set!) + (defstruct %landlock-ruleset-rec (rules installed?)) + (def landlock-ruleset? %landlock-ruleset-rec?) + (def %make-landlock-ruleset make-%landlock-ruleset-rec) + (def %landlock-rules %landlock-ruleset-rec-rules) + (def %landlock-set-rules! %landlock-ruleset-rec-rules-set!) + (def %landlock-installed? %landlock-ruleset-rec-installed?) + (def %landlock-set-installed! %landlock-ruleset-rec-installed?-set!) + (def landlock-ruleset-rules %landlock-ruleset-rec-rules) + (def landlock-ruleset-installed? %landlock-ruleset-rec-installed?) (def (make-landlock-ruleset) (%make-landlock-ruleset '() #f)) --- a/lib/std/security/metrics.ss +++ b/lib/std/security/metrics.ss @@ -32,13 +32,19 @@ ;; ========== Metrics Store ========== - (defstruct security-metrics (counters gauges histograms alerts mutex)) - (def %make-security-metrics make-security-metrics) - (def %metrics-counters security-metrics-counters) - (def %metrics-gauges security-metrics-gauges) - (def %metrics-histograms security-metrics-histograms) - (def %metrics-alerts security-metrics-alerts) - (def %metrics-mutex security-metrics-mutex) + (defstruct %security-metrics-rec (counters gauges histograms alerts mutex)) + (def security-metrics? %security-metrics-rec?) + (def %make-security-metrics make-%security-metrics-rec) + (def %metrics-counters %security-metrics-rec-counters) + (def %metrics-gauges %security-metrics-rec-gauges) + (def %metrics-histograms %security-metrics-rec-histograms) + (def %metrics-alerts %security-metrics-rec-alerts) + (def %metrics-mutex %security-metrics-rec-mutex) + (def security-metrics-counters %security-metrics-rec-counters) + (def security-metrics-gauges %security-metrics-rec-gauges) + (def security-metrics-histograms %security-metrics-rec-histograms) + (def security-metrics-alerts %security-metrics-rec-alerts) + (def security-metrics-mutex %security-metrics-rec-mutex) (def (make-security-metrics) (%make-security-metrics --- a/lib/std/security/privsep.ss +++ b/lib/std/security/privsep.ss @@ -75,12 +75,16 @@ (def %active-children (make-hashtable equal-hash equal?)) (def %children-mutex (make-mutex)) - (defstruct privsep-channel (read-fd write-fd closed?)) - (def %make-channel make-privsep-channel) - (def %channel-read-fd privsep-channel-read-fd) - (def %channel-write-fd privsep-channel-write-fd) - (def %channel-closed? privsep-channel-closed?) - (def %channel-set-closed! privsep-channel-closed?-set!) + (defstruct %privsep-channel-rec (read-fd write-fd closed?)) + (def privsep-channel? %privsep-channel-rec?) + (def %make-channel make-%privsep-channel-rec) + (def %channel-read-fd %privsep-channel-rec-read-fd) + (def %channel-write-fd %privsep-channel-rec-write-fd) + (def %channel-closed? %privsep-channel-rec-closed?) + (def %channel-set-closed! %privsep-channel-rec-closed?-set!) + (def privsep-channel-read-fd %privsep-channel-rec-read-fd) + (def privsep-channel-write-fd %privsep-channel-rec-write-fd) + (def privsep-channel-closed? %privsep-channel-rec-closed?) (def (make-privsep-channel) ;; Create a bidirectional channel using two pipes. @@ -143,12 +147,16 @@ ;; ========== Privilege Separation ========== - (defstruct privsep (channel pid running?)) - (def %make-privsep make-privsep) - (def %privsep-channel privsep-channel) - (def %privsep-pid privsep-pid) - (def %privsep-running? privsep-running?) - (def %privsep-set-running! privsep-running?-set!) + (defstruct %privsep-rec (channel pid running?)) + (def privsep? %privsep-rec?) + (def %make-privsep make-%privsep-rec) + (def %privsep-channel %privsep-rec-channel) + (def %privsep-pid %privsep-rec-pid) + (def %privsep-running? %privsep-rec-running?) + (def %privsep-set-running! %privsep-rec-running?-set!) + (def privsep-channel %privsep-rec-channel) + (def privsep-pid %privsep-rec-pid) + (def privsep-running? %privsep-rec-running?) (def (make-privsep handler) ;; Fork a child process. Parent becomes supervisor with the handler. --- a/lib/std/security/seccomp.ss +++ b/lib/std/security/seccomp.ss @@ -299,8 +299,11 @@ ;; ========== Filter Record ========== - (defstruct seccomp-filter (default-action allowed-syscalls)) - (def %make-seccomp-filter make-seccomp-filter) + (defstruct %seccomp-filter-rec (default-action allowed-syscalls)) + (def seccomp-filter? %seccomp-filter-rec?) + (def %make-seccomp-filter make-%seccomp-filter-rec) + (def seccomp-filter-default-action %seccomp-filter-rec-default-action) + (def seccomp-filter-allowed-syscalls %seccomp-filter-rec-allowed-syscalls) (def (make-seccomp-filter default-action . allowed) ;; allowed: list of syscall name symbols --- a/lib/std/security/secret.ss +++ b/lib/std/security/secret.ss @@ -33,10 +33,13 @@ ;; ========== Secret Record ========== - (defstruct secret (value consumed?)) - (def %make-secret make-secret) - (def %secret-value secret-value) - (def %secret-set-consumed! secret-consumed?-set!) + (defstruct %secret-rec (value consumed?)) + (def secret? %secret-rec?) + (def %make-secret make-%secret-rec) + (def %secret-value %secret-rec-value) + (def %secret-set-consumed! %secret-rec-consumed?-set!) + (def secret-value %secret-rec-value) + (def secret-consumed? %secret-rec-consumed?) (def (make-secret bv) ;; Wrap a bytevector as a secret. The bytevector will be zeroed on consume.