removes -t (ticket), -s, and -S (secret/prompt)

This commit is contained in:
Joe Bryan 2018-11-16 19:03:42 -05:00
parent d0de76a35a
commit 82b3a280b5
3 changed files with 9 additions and 88 deletions

View File

@ -492,16 +492,13 @@
*/
typedef struct _u3_opts {
c3_c* who_c; // -w, begin with ticket
c3_c* tic_c; // -t, ticket value
c3_c* pil_c; // -B, bootstrap from
c3_c* lit_c; // -J, ivory (fastboot) kernel
c3_c* sec_c; // -s, secret
c3_w kno_w; // -k, kernel version
c3_w fuz_w; // -f, fuzz testing
c3_s por_s; // -p, ames port
c3_o abo; // -a, abort aggressively
c3_o bat; // -b, batch create
c3_o sic; // -S, enter secret at prompt
c3_o gab; // -g, test garbage collection
c3_o dem; // -d, daemon
c3_o dry; // -D, dry compute, no checkpoint

View File

@ -325,54 +325,14 @@ _boothack_cb(uv_connect_t *conn, int status)
if ( c3y == u3_Host.ops_u.fak ) {
fprintf(stderr, "boot: F A K E ship with null security\r\n");
sec = 0;
if ( 0 != u3_Host.ops_u.tic_c ) {
fprintf(stderr, "boot: fake ship does not need a ticket (-t)\r\n");
exit(1);
}
tic = u3k(who);
tic = 0;
}
else {
if ( 0 == u3_Host.ops_u.sec_c ) {
c3_w eny_w[16];
u3_pier_rand(eny_w);
sec = u3i_words(2, eny_w);
{
u3_noun rot = u3dc("scot", 'p', u3k(sec));
c3_c* rot_c = u3r_string(rot);
fprintf(stderr, "boot: %s: R O O T P A S S W O R D %s\r\n",
u3_Host.ops_u.who_c,
rot_c);
fprintf(stderr, " (write it down and put it in your wallet)\r\n");
u3z(rot);
c3_free(rot_c);
}
} else {
u3_noun suc = u3dc("slaw", 'p', u3i_string(u3_Host.ops_u.sec_c));
if ( u3_nul == suc ) {
fprintf(stderr, "boot: malformed secret (-s)\r\n");
exit(1);
}
sec = u3k(u3t(suc));
u3z(suc);
}
{
u3_noun tuc = u3dc("slaw", 'p', u3i_string(u3_Host.ops_u.tic_c));
if ( u3_nul == tuc ) {
fprintf(stderr, "boot: malformed ticket (-t)\r\n");
exit(1);
}
tic = u3k(u3t(tuc));
u3z(tuc);
}
fprintf(stderr, "boot: real ships not yet supported\r\n");
exit(1);
}
pax = u3i_string(u3_Host.dir_c);
mat = u3ke_jam(u3nc(c3__doom,

View File

@ -71,32 +71,23 @@ _main_getopt(c3_i argc, c3_c** argv)
u3_Host.ops_u.tex = c3n;
u3_Host.ops_u.pro = c3n;
u3_Host.ops_u.dry = c3n;
u3_Host.ops_u.sic = c3n;
u3_Host.ops_u.veb = c3n;
u3_Host.ops_u.qui = c3n;
u3_Host.ops_u.nuu = c3n;
u3_Host.ops_u.rep = c3n;
u3_Host.ops_u.kno_w = DefaultKernel;
while ( (ch_i=getopt(argc, argv,"s:B:w:t:f:k:p:LSabcdgqvxFPDR")) != -1 ) {
while ( (ch_i=getopt(argc, argv,"B:w:f:k:p:LabcdgqvxFPDR")) != -1 ) {
switch ( ch_i ) {
case 'B': {
u3_Host.ops_u.pil_c = strdup(optarg);
break;
}
case 's': {
u3_Host.ops_u.sec_c = strdup(optarg);
break;
}
case 'w': {
u3_Host.ops_u.who_c = _main_presig(optarg);
u3_Host.ops_u.nuu = c3y;
break;
}
case 't': {
u3_Host.ops_u.tic_c = _main_presig(optarg);
break;
}
case 'x': {
u3_Host.ops_u.tex = c3y;
break;
@ -159,39 +150,12 @@ _main_getopt(c3_i argc, c3_c** argv)
fprintf(stderr, "comets are not yet supported; identify with -w\r\n");
return c3n;
}
else {
if ( c3n == u3_Host.ops_u.fak ) {
if ( (u3_Host.ops_u.tic_c == 0) &&
(strlen(u3_Host.ops_u.who_c) >= 4)
)
{
c3_c tic_c[29];
printf("enter your ticket: ~");
scanf("%28s", tic_c);
u3_Host.ops_u.tic_c = _main_presig(tic_c);
}
if ( c3y == u3_Host.ops_u.sic ) {
c3_c sec_c[29];
printf("enter your secret: ~");
scanf("%28s", sec_c);
u3_Host.ops_u.sec_c = _main_presig(sec_c);
}
}
}
} else {
if ( u3_Host.ops_u.sec_c != 0 ) {
fprintf(stderr, "-s only makes sense when creating a new ship\n");
else if ( c3n == u3_Host.ops_u.fak ) {
fprintf(stderr, "real ships are not yet supported; fake with -F\r\n");
return c3n;
}
if ( u3_Host.ops_u.tic_c != 0 ) {
fprintf(stderr, "-t only makes sense when creating a new ship\n");
return c3n;
}
}
else {
if ( u3_Host.ops_u.who_c != 0 ) {
fprintf(stderr, "-w only makes sense when creating a new ship\n");
return c3n;