[OpenWrt-Devel] usign race?

Daniel Golle daniel at makrotopia.org
Sat Sep 15 07:15:05 EDT 2018


On Fri, Sep 14, 2018 at 07:22:06PM +1000, Mike McCormack wrote:
> On 13/09/18 17:47, Koen Vandeputte wrote:
> > 
> > As it mostly works, but only sometimes fail, it looks like a race
> > condition.
> > 
> > Does anyone have any clue?
> 
> Hi Koen,
> 
> I think I hit something similar... sometimes usign only spits out 16
> characters rather than 17, so ucert fails.
> The attached patch worked around the problem for me, but may not be the best
> fix.

For now, this is acceptable. In the long run we should store keys in
their native fixed-length binary representation rather than using
usign's base64 encoded text strings -- however, that requires changes
to usign as well, so for now fixing ucert to work with usign ascii i/o
is the way to go.

Please resend you patch including a patch description and SoB line, so
it can be merged.

Cheers


Daniel

> 
> Mike
> 

> From fafbf7b74da96ae0cfe20ed4fb8a5294b644444a Mon Sep 17 00:00:00 2001
> From: Mike McCormack <mike at atratus.org>
> Date: Sat, 18 Aug 2018 16:04:57 +1000
> Subject: [PATCH] Add patch to fix ucert
> 
> ---
>  package/system/ucert/patches/0001-Fix-cert-length.patch | 15 +++++++++++++++
>  1 file changed, 15 insertions(+)
>  create mode 100644 package/system/ucert/patches/0001-Fix-cert-length.patch
> 
> diff --git a/package/system/ucert/patches/0001-Fix-cert-length.patch b/package/system/ucert/patches/0001-Fix-cert-length.patch
> new file mode 100644
> index 0000000000..8ccf4561fb
> --- /dev/null
> +++ b/package/system/ucert/patches/0001-Fix-cert-length.patch
> @@ -0,0 +1,15 @@
> +--- a/usign-exec.c	2018-08-09 03:48:11.000000000 +1000
> ++++ b/usign-exec.c	2018-08-18 16:03:41.393546235 +1000
> +@@ -156,9 +156,10 @@
> + 		waitpid(pid, &status, 0);
> + 		status = WEXITSTATUS(status);
> + 		if (fingerprint && !WEXITSTATUS(status)) {
> ++			ssize_t r;
> + 			memset(fingerprint, 0, 17);
> +-			read(fds[0], fingerprint, 17);
> +-			if (fingerprint[16] != '\n')
> ++			r = read(fds[0], fingerprint, 17);
> ++			if (r < 16)
> + 				status = -1;
> + 
> + 			fingerprint[16] = '\0';
> -- 
> 2.11.0
> 

> _______________________________________________
> openwrt-devel mailing list
> openwrt-devel at lists.openwrt.org
> https://lists.openwrt.org/mailman/listinfo/openwrt-devel


_______________________________________________
openwrt-devel mailing list
openwrt-devel at lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel



More information about the openwrt-devel mailing list