Index | Thread | Search

From:
chaz@pyr3x.com
Subject:
Re: acme-client: print account uri with -v
To:
tech <tech@openbsd.org>
Date:
Mon, 7 Oct 2024 10:51:29 -0400

Download raw body.

Thread
On Mon, Oct 07, 2024 at 03:38:22PM +0100, Stuart Henderson wrote:
> On 2024/10/07 14:41, Stuart Henderson wrote:
> > +	if (c->kid != NULL) {
> > +		if (stravis(&accturi, c->kid, VIS_SAFE) != -1)
> > +			warn("%s", accturi);
> > +		else
> > +			dodbg("account key: %s", accturi);
> > +		free(accturi);
> > +	}
> 
> duh, my brain was obviously not working.
> 
> Index: netproc.c
> ===================================================================
> RCS file: /cvs/src/usr.sbin/acme-client/netproc.c,v
> diff -u -p -r1.35 netproc.c
> --- netproc.c	28 Apr 2024 10:09:25 -0000	1.35
> +++ netproc.c	7 Oct 2024 14:37:27 -0000
> @@ -359,7 +359,7 @@ donewacc(struct conn *c, const struct ca
>  {
>  	struct jsmnn	*j = NULL;
>  	int		 rc = 0;
> -	char		*req, *detail, *error = NULL;
> +	char		*req, *detail, *error = NULL, *accturi = NULL;
>  	long		 lc;
>  
>  	if ((req = json_fmt_newacc(contact)) == NULL)
> @@ -384,6 +384,12 @@ donewacc(struct conn *c, const struct ca
>  	else
>  		rc = 1;
>  
> +	if (c->kid != NULL) {
> +		if (stravis(&accturi, c->kid, VIS_SAFE) != -1)
> +			dodbg("account key: %s", accturi);
> +		free(accturi);
> +	}
> +
>  	if (rc == 0 || verbose > 1)
>  		buf_dump(&c->buf);
>  	free(req);
> @@ -399,7 +405,7 @@ static int
>  dochkacc(struct conn *c, const struct capaths *p, const char *contact)
>  {
>  	int		 rc = 0;
> -	char		*req;
> +	char		*req, *accturi = NULL;
>  	long		 lc;
>  
>  	if ((req = json_fmt_chkacc()) == NULL)
> @@ -417,6 +423,11 @@ dochkacc(struct conn *c, const struct ca
>  
>  	if (c->kid == NULL)
>  		rc = 0;
> +	else {
> +		if (stravis(&accturi, c->kid, VIS_SAFE) != -1)
> +			dodbg("account key: %s", accturi);
> +		free(accturi);
> +	}
>  
>  	if (rc == 0 || verbose > 1)
>  		buf_dump(&c->buf);
> 

I gave a (poor) attempt at this a while back. Looking forward to using
your version. Thanks!

https://marc.info/?l=openbsd-tech&m=167147785011922&w=2

-- 
Chaz