mirror of
https://github.com/urbit/shrub.git
synced 2024-12-26 05:23:35 +03:00
single-home's arvo, refines fake keys
This commit is contained in:
parent
bcc1261009
commit
0b13837bfa
@ -26,6 +26,7 @@
|
||||
u3_noun sev_l; // instance number
|
||||
u3_noun sen; // instance string
|
||||
u3_noun own; // owner list
|
||||
u3_noun fak; // &=fake XX use c3_o?
|
||||
|
||||
u3_noun sac; // space profiling
|
||||
|
||||
|
@ -591,7 +591,7 @@
|
||||
c3_o bat; // -b, batch create
|
||||
c3_o dem; // -d, daemon
|
||||
c3_o dry; // -D, dry compute
|
||||
c3_o fak; // -F, fake carrier
|
||||
c3_c* fak_c; // -F, fake ship
|
||||
c3_o fog; // -X, skip last event
|
||||
c3_o gab; // -g, run with garbage collector
|
||||
c3_o has; // -S, Skip battery hashes
|
||||
|
22
vere/http.c
22
vere/http.c
@ -1401,7 +1401,7 @@ _http_serv_start_all(void)
|
||||
htp_u = _http_serv_new(por_s, c3y, c3n);
|
||||
htp_u->h2o_u = _http_serv_init_h2o(u3_Host.tls_u, for_u->log, for_u->red);
|
||||
|
||||
if ( (c3y == for_u->pro) || (c3y == u3_Host.ops_u.fak) ) {
|
||||
if ( c3y == for_u->pro ) {
|
||||
htp_u->rox_u = _proxy_serv_new(htp_u, 443, c3y);
|
||||
}
|
||||
|
||||
@ -1416,7 +1416,7 @@ _http_serv_start_all(void)
|
||||
htp_u = _http_serv_new(por_s, c3n, c3n);
|
||||
htp_u->h2o_u = _http_serv_init_h2o(0, for_u->log, for_u->red);
|
||||
|
||||
if ( (c3y == for_u->pro) || (c3y == u3_Host.ops_u.fak) ) {
|
||||
if ( c3y == for_u->pro ) {
|
||||
htp_u->rox_u = _proxy_serv_new(htp_u, 80, c3n);
|
||||
}
|
||||
|
||||
@ -2571,25 +2571,16 @@ _proxy_dest(u3_pcon* con_u, u3_noun sip)
|
||||
_proxy_loop_connect(con_u);
|
||||
}
|
||||
else {
|
||||
u3_noun hip = u3k(u3t(sip));
|
||||
u3_noun own = u3A->own;
|
||||
c3_o our = c3n;
|
||||
u3_noun hip = u3t(sip);
|
||||
|
||||
while ( u3_nul != own ) {
|
||||
if ( c3y == u3r_sing(hip, u3h(own)) ) {
|
||||
our = c3y;
|
||||
break;
|
||||
}
|
||||
own = u3t(own);
|
||||
}
|
||||
|
||||
if ( c3y == our ) {
|
||||
if ( c3y == u3r_sing(u3A->own, hip) ) {
|
||||
_proxy_loop_connect(con_u);
|
||||
}
|
||||
else {
|
||||
// XX check if (sein:title sip) == our
|
||||
// XX check will
|
||||
_proxy_ward_start(con_u, hip);
|
||||
// XX extract bytes from hip, this could leak
|
||||
_proxy_ward_start(con_u, u3k(hip));
|
||||
}
|
||||
}
|
||||
|
||||
@ -2852,6 +2843,7 @@ u3_http_ef_that(u3_noun tat)
|
||||
return;
|
||||
}
|
||||
|
||||
// XX extract bytes from sip, this could leak
|
||||
cli_u = _proxy_warc_new(htp_u, (u3_atom)sip, (c3_s)por, (c3_o)sec);
|
||||
|
||||
// XX add to constructor
|
||||
|
34
vere/main.c
34
vere/main.c
@ -77,7 +77,6 @@ _main_getopt(c3_i argc, c3_c** argv)
|
||||
u3_Host.ops_u.bat = c3n;
|
||||
u3_Host.ops_u.dem = c3n;
|
||||
u3_Host.ops_u.dry = c3n;
|
||||
u3_Host.ops_u.fak = c3n;
|
||||
u3_Host.ops_u.fog = c3n;
|
||||
u3_Host.ops_u.gab = c3n;
|
||||
u3_Host.ops_u.git = c3n;
|
||||
@ -92,7 +91,7 @@ _main_getopt(c3_i argc, c3_c** argv)
|
||||
u3_Host.ops_u.veb = c3n;
|
||||
u3_Host.ops_u.kno_w = DefaultKernel;
|
||||
|
||||
while ( (ch_i=getopt(argc, argv,"G:B:K:A:H:I:w:u:f:k:l:n:p:r:NabcdgqsvxFMPDXRS")) != -1 ) {
|
||||
while ( (ch_i=getopt(argc, argv,"G:B:K:A:H:I:w:u:f:F:k:l:n:p:r:NabcdgqsvxMPDXRS")) != -1 ) {
|
||||
switch ( ch_i ) {
|
||||
case 'M': {
|
||||
u3_Host.ops_u.mem = c3y;
|
||||
@ -114,10 +113,15 @@ _main_getopt(c3_i argc, c3_c** argv)
|
||||
u3_Host.ops_u.dns_c = strdup(optarg);
|
||||
break;
|
||||
}
|
||||
// XX remove in deference to -K
|
||||
case 'I': {
|
||||
u3_Host.ops_u.imp_c = _main_presig(optarg);
|
||||
break;
|
||||
}
|
||||
case 'F': {
|
||||
u3_Host.ops_u.fak_c = _main_presig(optarg);
|
||||
break;
|
||||
}
|
||||
case 'w': {
|
||||
u3_Host.ops_u.who_c = _main_presig(optarg);
|
||||
u3_Host.ops_u.nuu = c3y;
|
||||
@ -177,7 +181,6 @@ _main_getopt(c3_i argc, c3_c** argv)
|
||||
return c3y;
|
||||
}
|
||||
case 'N': { u3_Host.ops_u.net = c3y; break; }
|
||||
case 'F': { u3_Host.ops_u.fak = c3y; break; }
|
||||
case 'a': { u3_Host.ops_u.abo = c3y; break; }
|
||||
case 'b': { u3_Host.ops_u.bat = c3y; break; }
|
||||
case 'c': { u3_Host.ops_u.nuu = c3y; break; }
|
||||
@ -195,10 +198,29 @@ _main_getopt(c3_i argc, c3_c** argv)
|
||||
}
|
||||
}
|
||||
|
||||
if ( u3_Host.ops_u.fak == c3n && u3_Host.ops_u.net == c3y ) {
|
||||
// XX remove -I
|
||||
if ( (0 != u3_Host.ops_u.fak_c) && (0 != u3_Host.ops_u.imp_c) ) {
|
||||
fprintf(stderr, "-I is redundant with -F\n");
|
||||
return c3n;
|
||||
}
|
||||
|
||||
// set galaxy name
|
||||
// XX need to do this with -K too
|
||||
// -A is required when booting a galaxy
|
||||
if ( (0 != u3_Host.ops_u.fak_c) && (4 == strlen(u3_Host.ops_u.fak_c)) ) {
|
||||
u3_Host.ops_u.imp_c = strdup(u3_Host.ops_u.fak_c);
|
||||
}
|
||||
|
||||
if ( (0 != u3_Host.ops_u.fak_c) && (c3n == u3_Host.ops_u.nuu) ) {
|
||||
fprintf(stderr, "-F only makes sense on initial boot\n");
|
||||
return c3n;
|
||||
}
|
||||
|
||||
// XX revisit
|
||||
if ( (0 == u3_Host.ops_u.fak_c) && (c3y == u3_Host.ops_u.net) ) {
|
||||
fprintf(stderr, "-N only makes sense with -F\n");
|
||||
return c3n;
|
||||
} else if ( u3_Host.ops_u.fak == c3n && u3_Host.ops_u.net == c3n ) {
|
||||
} else if ( (0 == u3_Host.ops_u.fak_c) && (c3n == u3_Host.ops_u.net) ) {
|
||||
u3_Host.ops_u.net = c3y; /* remote networking is always on in real mode. */
|
||||
}
|
||||
|
||||
@ -333,7 +355,7 @@ u3_ve_usage(c3_i argc, c3_c** argv)
|
||||
"-c pier Create a new urbit in pier/\n",
|
||||
"-d Daemon mode\n",
|
||||
"-D Recompute from events\n",
|
||||
"-F Fake keys; also disables networking\n",
|
||||
"-F ship Fake keys; also disables networking\n",
|
||||
"-f Fuzz testing\n",
|
||||
"-g Set GC flag\n",
|
||||
"-H domain Set ames bootstrap domain (default urbit.org)\n",
|
||||
|
19
vere/reck.c
19
vere/reck.c
@ -100,13 +100,10 @@ _reck_kick_term(u3_noun pox, c3_l tid_l, u3_noun fav)
|
||||
|
||||
case c3__init: p_fav = u3t(fav);
|
||||
{
|
||||
u3A->own = u3nc(u3k(p_fav), u3A->own);
|
||||
c3_assert( u3_none == u3A->own );
|
||||
u3A->own = u3k(p_fav);
|
||||
|
||||
u3_noun hox = u3dc("scot", 'p', u3k(p_fav));
|
||||
c3_c* nam_c = u3r_string(hox);
|
||||
|
||||
// uL(fprintf(uH, "kick: init: %s\n", nam_c));
|
||||
free(nam_c); u3z(pox); u3z(hox); u3z(fav); return c3y;
|
||||
u3z(pox); u3z(fav); return c3y;
|
||||
} break;
|
||||
|
||||
case c3__mass: p_fav = u3t(fav);
|
||||
@ -224,11 +221,12 @@ _reck_kick_ames(u3_noun pox, u3_noun fav)
|
||||
|
||||
switch ( u3h(fav) ) {
|
||||
default: break;
|
||||
// XX remove
|
||||
case c3__init: p_fav = u3t(fav);
|
||||
{
|
||||
u3A->own = u3nc(u3k(p_fav), u3A->own);
|
||||
uL(fprintf(uH, "kick: init: ames\n"));
|
||||
c3_assert(0);
|
||||
|
||||
// uL(fprintf(uH, "kick: init: %d\n", p_fav));
|
||||
u3z(pox); u3z(fav); return c3y;
|
||||
} break;
|
||||
}
|
||||
@ -313,11 +311,12 @@ _reck_kick_spec(u3_noun pox, u3_noun fav)
|
||||
}
|
||||
} break;
|
||||
|
||||
// XX remove
|
||||
case c3__init: p_fav = u3t(fav);
|
||||
{
|
||||
u3A->own = u3nc(u3k(p_fav), u3A->own);
|
||||
uL(fprintf(uH, "kick: init: spec\n"));
|
||||
c3_assert(0);
|
||||
|
||||
// uL(fprintf(uH, "kick: init: %d\n", p_fav));
|
||||
u3z(pox); u3z(fav); return c3y;
|
||||
} break;
|
||||
|
||||
|
39
vere/sist.c
39
vere/sist.c
@ -261,9 +261,11 @@ _sist_sing(u3_noun ovo)
|
||||
u3_noun fex = u3h(vir);
|
||||
u3_noun fav = u3t(fex);
|
||||
|
||||
if ( (c3__init == u3h(fav)) || (c3__inuk == u3h(fav)) ) {
|
||||
u3A->own = u3nc(u3k(u3t(fav)), u3A->own);
|
||||
// XX is this now just to support ctrl-z during first boot?
|
||||
if ( c3__init == u3h(fav) ) {
|
||||
u3A->own = u3k(u3t(fav));
|
||||
}
|
||||
|
||||
vir = u3t(vir);
|
||||
}
|
||||
u3z(nug);
|
||||
@ -1342,30 +1344,47 @@ _sist_dawn(void)
|
||||
void
|
||||
u3_sist_boot(void)
|
||||
{
|
||||
// uL(fprintf(uH, "sist: booting\n"));
|
||||
|
||||
if ( c3y == u3_Host.ops_u.nuu ) {
|
||||
u3_noun pig;
|
||||
|
||||
if ( c3y == u3_Host.ops_u.fak ) {
|
||||
// XX or who_c
|
||||
u3_noun imp = u3i_string(u3_Host.ops_u.imp_c);
|
||||
u3_noun whu = u3dc("slaw", 'p', u3k(imp));
|
||||
if ( 0 != u3_Host.ops_u.fak_c ) {
|
||||
u3_noun whu = u3dc("slaw", 'p', u3i_string(u3_Host.ops_u.fak_c));
|
||||
|
||||
if ( (u3_nul == whu) ) {
|
||||
fprintf(stderr, "czar: incorrect format\r\n");
|
||||
fprintf(stderr, "fake: invalid ship: %s\r\n", u3_Host.ops_u.fak_c);
|
||||
u3_lo_bail();
|
||||
}
|
||||
|
||||
pig = u3nc(c3__fake, u3t(whu));
|
||||
fprintf(stderr, "fake: %s\r\n", u3_Host.ops_u.fak_c);
|
||||
|
||||
u3A->fak = c3y;
|
||||
pig = u3nc(c3__fake, u3k(u3t(whu)));
|
||||
u3z(whu);
|
||||
}
|
||||
else {
|
||||
u3A->fak = c3n;
|
||||
pig = _sist_dawn();
|
||||
}
|
||||
|
||||
// will be set by %init card in reck.c
|
||||
u3A->own = u3_none;
|
||||
_sist_make(pig);
|
||||
}
|
||||
else {
|
||||
if ( c3y == u3A->fak ) {
|
||||
c3_c* who_c = u3r_string(u3dc("scot", 'p', u3k(u3A->own)));
|
||||
fprintf(stderr, "fake: %s\r\n", who_c);
|
||||
|
||||
// XX use clan:title
|
||||
if ( 4 == strlen(who_c) ) {
|
||||
u3_Host.ops_u.imp_c = who_c;
|
||||
} else {
|
||||
free(who_c);
|
||||
}
|
||||
|
||||
// XX make conditional
|
||||
u3_Host.ops_u.net = c3n;
|
||||
}
|
||||
_sist_rest();
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user