nx_email_mta.nx
buildroot/runtime/nx_email_mta.nx
about
nx_email_mta.nx -- EMAIL RUNG R7: receiving MTA (SMTP server logic).
module: nishi-core.email.mta
depends: (none -- pure RFC 5321 server-side command parse + policy + FSM)
capability: CORE_EMAIL
The server end of SMTP: classify inbound commands, enforce the RCPT
relay policy (accept mail for OUR domain, refuse to relay for others --
the open-relay defense), and drive the receive state machine emitting
the correct reply codes. Pure logic; the integration capstone (accept
loop over nx_socket, dot-unstuff the DATA via R4's nx_pop3_dedot, and
deliver into R3's nx_email_mailbox) is exercised end-to-end in the gate.
license_tier: INDEPENDENT_REDERIVE
genealogy_id: international-research-sources/ietf/rfc_5321
lineage_id: nishi_email_mta_r7
nx_safety_envelope:
intended_use: "Inbound SMTP command parse + RCPT relay policy +
server reply-code FSM. Receiving MTA substrate."
sil_target: SIL2 (open relay / misdelivery)
evidence: [cmd_classify, addr_extract, relay_refused,
out_of_sequence_503, reply_code_fsm]
hazard_register: [bug-tape-open-relay, bug-tape-smtp-state-confusion]
residual_risk: "Greylisting/rate-limit/SPF-at-RCPT (compose R5)
+ live accept loop are upstream/_io concerns."
verdict: NOT_YET_EVALUATED
dependencies 0 imports · 3 importers
imports: none
imported by: nx_email_mta_gate.nxnx_email_mta_io.nxnx_email_provision_gate.nx
structs
| none |
consts
| 30 | const MTA_C_UNKNOWN: i64 = 0 |
| 31 | const MTA_C_EHLO: i64 = 1 |
| 32 | const MTA_C_HELO: i64 = 2 |
| 33 | const MTA_C_MAIL: i64 = 3 |
| 34 | const MTA_C_RCPT: i64 = 4 |
| 35 | const MTA_C_DATA: i64 = 5 |
| 36 | const MTA_C_QUIT: i64 = 6 |
| 37 | const MTA_C_RSET: i64 = 7 |
| 38 | const MTA_C_NOOP: i64 = 8 |
| 41 | const MTA_S_GREET: i64 = 0 // 220 sent, await EHLO |
| 42 | const MTA_S_READY: i64 = 1 // after EHLO, await MAIL |
| 43 | const MTA_S_MAIL: i64 = 2 // after MAIL, await RCPT |
| 44 | const MTA_S_RCPT: i64 = 3 // >=1 RCPT accepted, await RCPT/DATA |
| 45 | const MTA_S_DATA: i64 = 4 // in DATA collection |
| 46 | const MTA_S_QUIT: i64 = 5 |
functions
| 48 | func mta_upper(c: i64) -> i64 { if c >= 97 && c <= 122 { return c - 32 } return c } |
| 50 | func mta_verb_eq(line: *u8, n: i64, v: *u8) -> i64 |
| 58 | func nx_mta_parse_cmd(line: *u8, n: i64) -> i64 |
| 72 | func nx_mta_extract_addr(line: *u8, n: i64, out: *u8, cap: i64) -> i64 |
| 88 | func nx_mta_rcpt_accept(addr: *u8, alen: i64, domain: *u8, dlen: i64) -> i64 |
| 106 | func nx_mta_reply_for(state: i64, cmd: i64, rcpt_ok: i64, out_next: *i64) -> i64 |
| 130 | func nx_mta_data_delivered(stored_ok: i64, out_next: *i64) -> i64 called by 1: main |