code wiki / (root) / nx_email_mta.nx

nx_email_mta.nx

buildroot/runtime/nx_email_mta.nx

5556 B134 linesdepth 0pulls 0 transitivereach 5 importersview sourcekind librarytopic email
docsdependenciesstructsconstsfunctions

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

nx_email_mta.nx nx_email_mta_gate.nx nx_email_mta_io.nx nx_email_provision_gate.nx

imports: none

imported by: nx_email_mta_gate.nxnx_email_mta_io.nxnx_email_provision_gate.nx

structs

none

consts

30const MTA_C_UNKNOWN: i64 = 0
31const MTA_C_EHLO: i64 = 1
32const MTA_C_HELO: i64 = 2
33const MTA_C_MAIL: i64 = 3
34const MTA_C_RCPT: i64 = 4
35const MTA_C_DATA: i64 = 5
36const MTA_C_QUIT: i64 = 6
37const MTA_C_RSET: i64 = 7
38const MTA_C_NOOP: i64 = 8
41const MTA_S_GREET: i64 = 0 // 220 sent, await EHLO
42const MTA_S_READY: i64 = 1 // after EHLO, await MAIL
43const MTA_S_MAIL: i64 = 2 // after MAIL, await RCPT
44const MTA_S_RCPT: i64 = 3 // >=1 RCPT accepted, await RCPT/DATA
45const MTA_S_DATA: i64 = 4 // in DATA collection
46const MTA_S_QUIT: i64 = 5

functions

48func mta_upper(c: i64) -> i64 { if c >= 97 && c <= 122 { return c - 32 } return c }
50func mta_verb_eq(line: *u8, n: i64, v: *u8) -> i64
called by 1: nx_mta_parse_cmd calls 1: mta_upper
58func nx_mta_parse_cmd(line: *u8, n: i64) -> i64
called by 2: mainnx_mta_serve_conn calls 1: mta_verb_eq
72func nx_mta_extract_addr(line: *u8, n: i64, out: *u8, cap: i64) -> i64
88func nx_mta_rcpt_accept(addr: *u8, alen: i64, domain: *u8, dlen: i64) -> i64
called by 3: mainnx_mta_serve_connmain calls 1: mta_upper
106func nx_mta_reply_for(state: i64, cmd: i64, rcpt_ok: i64, out_next: *i64) -> i64
130func nx_mta_data_delivered(stored_ok: i64, out_next: *i64) -> i64
called by 1: main