code wiki / _hdl_build / nx_publish_opaque_login.nx
nx_publish_opaque_login.nx source
↩ module page · 33 lines · 1952 B
1// nx_publish_opaque_login.nx -- one-shot: hand the registration-CLOSED OPAQUE login daemons to THE NISHI
2// PUBLISHER (nx_publisher.pub_submit) as durable PENDING requests. Workstreams REQUEST; the publisher SHIPS
3// to the NAS + restarts -- decoupled from this workstream (the sites.elf-outage collision-class fix). The two
4// rebuilt binaries are pre-staged under knowledge/publish/staging/ so pub_submit can sha256 them now and the
5// publisher can ship them later. Idempotent at the publisher (R2 sha-skip); re-submitting is safe.
6import "nx_syscalls.nx"
7import "nx_publisher.nx"
8
9func pl_puts(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } sys_write(1, s, n); return n }
10func pl_puti(v: i64) -> i64 {
11 let t: *u8 = sys_mmap(28); var m: i64 = v; var neg: i64 = 0
12 if m < 0 { neg = 1; m = 0 - m }
13 var k: i64 = 0; if m == 0 { t[0] = 48 as u8; k = 1 }
14 while m > 0 { t[k] = (48 + (m % 10)) as u8; m = m / 10; k = k + 1 }
15 let o: *u8 = sys_mmap(30); var w: i64 = 0; if neg == 1 { o[0] = 45 as u8; w = 1 }
16 var q: i64 = k - 1; while q >= 0 { o[w] = t[q]; w = w + 1; q = q - 1 }
17 sys_write(1, o, w); return 0
18}
19
20func main(argc: i64, argv: *i64) -> i64 {
21 pub_init()
22 let r1: i64 = pub_submit(
23 "knowledge/publish/staging/nx_opaque_login.elf" as *u8,
24 "/volume1/homes/elderwesto/nishihost/nx_opaque_login.elf" as *u8,
25 "nishifamily" as *u8, "acct-cleanup-32992a14" as *u8, "replace-binary-restart" as *u8)
26 pl_puts("submit plain -> " as *u8); pl_puti(r1); pl_puts(" (1=enqueued)\n" as *u8)
27 let r2: i64 = pub_submit(
28 "knowledge/publish/staging/nx_opaque_login_tls.elf" as *u8,
29 "/volume1/homes/elderwesto/nishihost/nx_opaque_login_tls.elf" as *u8,
30 "nishifamily" as *u8, "acct-cleanup-32992a14" as *u8, "replace-binary-restart" as *u8)
31 pl_puts("submit tls -> " as *u8); pl_puti(r2); pl_puts(" (1=enqueued)\n" as *u8)
32 sys_exit(0); return 0
33}