Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 09 Oct 2018 01:28:15 +0200
From:      =?utf-8?Q?Dag-Erling_Sm=C3=B8rgrav?= <des@des.no>
To:        Marek Zarychta <zarychtam@plan-b.pwste.edu.pl>
Cc:        Michael Butler <imb@protected-networks.net>, emaste@freebsd.org, FreeBSD Current <freebsd-current@FreeBSD.org>
Subject:   Re: SVN r339216 breaks ssh to i386 devices
Message-ID:  <86lg78c92o.fsf@next.des.no>
In-Reply-To: <86tvlwcee0.fsf@next.des.no> ("Dag-Erling =?utf-8?Q?Sm=C3=B8r?= =?utf-8?Q?grav=22's?= message of "Mon, 08 Oct 2018 23:33:27 %2B0200")
References:  <6bd10ee9-eb03-1f9f-c533-fdb5d02eb829@protected-networks.net> <20181008190846.GA84941@plan-b.pwste.edu.pl> <86tvlwcee0.fsf@next.des.no>

next in thread | previous in thread | raw e-mail | index | archive | help
--=-=-=
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable

Please try the attached patch.  I expect it to fix i386.  If it also
fixes arm32, all the better, although I don't quite see why it would.

DES
--=20
Dag-Erling Sm=C3=B8rgrav - des@des.no


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment; filename=sshbuf_getput_time.diff

Index: crypto/openssh/sshbuf-getput-basic.c
===================================================================
--- crypto/openssh/sshbuf-getput-basic.c	(revision 339244)
+++ crypto/openssh/sshbuf-getput-basic.c	(working copy)
@@ -482,7 +482,9 @@
 	    (r = sshbuf_put_cstring(buf, "*")) != 0 ||
 	    (r = sshbuf_put_u32(buf, pwent->pw_uid)) != 0 ||
 	    (r = sshbuf_put_u32(buf, pwent->pw_gid)) != 0 ||
-	    (r = sshbuf_put_u64(buf, pwent->pw_change)) != 0 ||
+#ifdef HAVE_STRUCT_PASSWD_PW_CHANGE
+	    (r = sshbuf_put_time(buf, pwent->pw_change)) != 0 ||
+#endif
 #ifdef HAVE_STRUCT_PASSWD_PW_GECOS
 	    (r = sshbuf_put_cstring(buf, pwent->pw_gecos)) != 0 ||
 #endif
@@ -491,7 +493,9 @@
 #endif
 	    (r = sshbuf_put_cstring(buf, pwent->pw_dir)) != 0 ||
 	    (r = sshbuf_put_cstring(buf, pwent->pw_shell)) != 0 ||
-	    (r = sshbuf_put_u64(buf, pwent->pw_expire)) != 0 ||
+#ifdef HAVE_STRUCT_PASSWD_PW_EXPIRE
+	    (r = sshbuf_put_time(buf, pwent->pw_expire)) != 0 ||
+#endif
 	    (r = sshbuf_put_u32(buf, pwent->pw_fields)) != 0) {
 		return r;
 	}
@@ -518,7 +522,9 @@
 	    sshbuf_get_cstring(buf, &pw->pw_passwd, NULL) != 0 ||
 	    sshbuf_get_u32(buf, &pw->pw_uid) != 0 ||
 	    sshbuf_get_u32(buf, &pw->pw_gid) != 0 ||
-	    sshbuf_get_u64(buf, &pw->pw_change) != 0 ||
+#ifdef HAVE_STRUCT_PASSWD_PW_CHANGE
+	    sshbuf_get_time(buf, &pw->pw_change) != 0 ||
+#endif
 #ifdef HAVE_STRUCT_PASSWD_PW_GECOS
 	    sshbuf_get_cstring(buf, &pw->pw_gecos, NULL) != 0 ||
 #endif
@@ -527,7 +533,9 @@
 #endif
 	    sshbuf_get_cstring(buf, &pw->pw_dir, NULL) != 0 ||
 	    sshbuf_get_cstring(buf, &pw->pw_shell, NULL) != 0 ||
-	    sshbuf_get_u64(buf, &pw->pw_expire) != 0 ||
+#ifdef HAVE_STRUCT_PASSWD_PW_EXPIRE
+	    sshbuf_get_time(buf, &pw->pw_expire) != 0 ||
+#endif
 	    sshbuf_get_u32(buf, &pw->pw_fields) != 0) {
 		sshbuf_free_passwd(pw);
 		return NULL;
Index: crypto/openssh/sshbuf.h
===================================================================
--- crypto/openssh/sshbuf.h	(revision 339244)
+++ crypto/openssh/sshbuf.h	(working copy)
@@ -177,6 +177,14 @@
 int	sshbuf_put_u16(struct sshbuf *buf, u_int16_t val);
 int	sshbuf_put_u8(struct sshbuf *buf, u_char val);
 
+#if defined(__FreeBSD__) && defined(__i386__)
+#define sshbuf_get_time(b, vp) sshbuf_get_u32((b), (u_int32_t *)(vp))
+#define sshbuf_put_time(b, v) sshbuf_put_u32((b), (u_int32_t)(v))
+#else
+#define sshbuf_get_time(b, vp) sshbuf_get_u64((b), (u_int64_t *)(vp))
+#define sshbuf_put_time(b, v) sshbuf_put_u64((b), (u_int64_t)(v))
+#endif
+
 /*
  * Functions to extract or store SSH wire encoded strings (u32 len || data)
  * The "cstring" variants admit no \0 characters in the string contents.

--=-=-=--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?86lg78c92o.fsf>