Hi,

I'm currently porting acme-client to FreeBSD and while doing that I've
noticed a few small issues.

src/usr.sbin/acme-client/parse.y:
* The grammar allows the user to omit the newline after the first line
  in a domain or authority block.

* The grammar uses right recursion for lists, left recursion is
  probably the better option here
  (https://docs.oracle.com/cd/E19504-01/802-5880/yacc-13/index.html)

src/usr.sbin/acme-client/dbg.c doesn't build because in the included
header file extern.h the type pid_t is missing (unistd.h).

src/usr.sbin/acme-client/dnsproc.c also fails to build because
struct sockaddr_in and struct sockaddr_in6 are missing (netinet/in.h).

The missing header files only cause a build failure on FreeBSD, but I
think it would still be a good idea to fix them in OpenBSD...

Regards,
Daniel Eisele

--- parse.y.orig        2020-07-10 12:36:30 UTC
+++ parse.y
@@ -170,11 +170,11 @@ varset            : STRING '=' string             {
                }
                ;

-optnl          : '\n' optnl
+optnl          : nl
                |
                ;

-nl             : '\n' optnl            /* one newline or more */
+nl             : optnl '\n'            /* one newline or more */
                ;

 comma          : ','
@@ -190,7 +190,7 @@ authority   : AUTHORITY STRING {
                                yyerror("authority already defined");
                                YYERROR;
                        }
-               } '{' optnl authorityopts_l '}' {
+               } '{' optnl authorityopts_l optnl '}' {
                        if (auth->api == NULL) {
                                yyerror("authority %s: no api URL specified",
                                    auth->name);
@@ -205,8 +205,8 @@ authority   : AUTHORITY STRING {
                }
                ;

-authorityopts_l        : authorityopts_l authorityoptsl nl
-               | authorityoptsl optnl
+authorityopts_l        : authorityopts_l nl authorityoptsl
+               | authorityoptsl
                ;

 authorityoptsl : API URL STRING {
@@ -246,7 +246,7 @@ domain              : DOMAIN STRING {
                                yyerror("domain already defined");
                                YYERROR;
                        }
-               } '{' optnl domainopts_l '}' {
+               } '{' optnl domainopts_l optnl '}' {
                        if (domain->domain == NULL) {
                                if ((domain->domain = strdup(domain->handle))
                                    == NULL)
@@ -273,8 +273,8 @@ keytype             : RSA   { $$ = KT_RSA; }
                |       { $$ = KT_RSA; }
                ;

-domainopts_l   : domainopts_l domainoptsl nl
-               | domainoptsl optnl
+domainopts_l   : domainopts_l nl domainoptsl
+               | domainoptsl
                ;

 domainoptsl    : ALTERNATIVE NAMES '{' altname_l '}'
@@ -385,7 +385,7 @@ domainoptsl : ALTERNATIVE NAMES '{' altname_l '}'
                }
                ;

-altname_l      : altname comma altname_l
+altname_l      : altname_l comma altname
                | altname
                ;

Reply via email to