X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=blobdiff_plain;f=pubkeys.fl.pl;h=da1e4d40ce396e255ff685c181710b531c23f8b8;hb=147b444d6faa9a621e33d653b7a72c29724203c3;hp=69cc3c925aee2ab249529d32d631c5cfb4f8f399;hpb=4217929f5828f3d542d89fc8c598756d0ad5c5c3;p=secnet.git diff --git a/pubkeys.fl.pl b/pubkeys.fl.pl index 69cc3c9..da1e4d4 100755 --- a/pubkeys.fl.pl +++ b/pubkeys.fl.pl @@ -134,6 +134,7 @@ L [ \t]* S [ \t]+ BASE91S []-~!#-&(-[]+ %x SKIPNL +%x SYNTAXERR %option yylineno %option noyywrap @@ -226,16 +227,16 @@ static struct pubkeyset_context c[1]; !FINAL { if (c->building->nkeys >= MAX_SIG_KEYS) DOSKIP("too many public keys"); struct sigpubkey_if *pubkey; + closure_t *cl; bool_t ok=c->scheme->loadpub(c->scheme,c->data_buf, - &pubkey,c->log,c->loc); + &pubkey,&cl,c->log,c->loc); if (!ok) break; - memcpy(c->building->keys[c->building->nkeys].id.b, - c->grpid, - GRPIDSZ); + struct peer_pubkey *fill=&c->building->keys[c->building->nkeys]; + memcpy(fill->id.b,c->grpid,GRPIDSZ); assert(ALGIDSZ==1); /* otherwise need htons or htonl or something */ - c->building->keys[c->building->nkeys].id.b[GRPIDSZ]= - c->scheme->algid; - c->building->keys[c->building->nkeys++].pubkey=pubkey; + fill->id.b[GRPIDSZ]=c->scheme->algid; + fill->pubkey=pubkey; + c->building->nkeys++; !} !KEYWORD serial @@ -267,7 +268,14 @@ static struct pubkeyset_context c[1]; <> { return 0; } -<*>. { FAIL("syntax error"); } +<*>. { + yymore(); + BEGIN(SYNTAXERR); +} +.* { + slilog(LI,M_DEBUG,"pubkeys syntax error at `%s'", yytext); + FAIL("syntax error"); +} <*>\n { FAIL("syntax error - unexpected newline"); } <> { FAIL("syntax error - unexpected eof"); } @@ -303,10 +311,6 @@ keyset_load(const char *path, struct buffer_if *data_buf, int r=pkyylex(); if (r) goto err_bad; - if (!c->had_serial) { - slilog(LI,M_ERR,"missing serial number in %s",path); - goto err_bad; - } if (!c->building->nkeys) { slilog(LI,M_ERR,"no useable keys in %s",path); goto err_bad;