From owner-freebsd-current@freebsd.org Mon Oct 8 23:28:22 2018 Return-Path: Delivered-To: freebsd-current@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 68E4A10A4023 for ; Mon, 8 Oct 2018 23:28:22 +0000 (UTC) (envelope-from des@des.no) Received: from smtp.des.no (smtp.des.no [194.63.250.102]) by mx1.freebsd.org (Postfix) with ESMTP id D504984E09; Mon, 8 Oct 2018 23:28:21 +0000 (UTC) (envelope-from des@des.no) Received: from next.des.no (smtp.des.no [194.63.250.102]) by smtp.des.no (Postfix) with ESMTP id 6938F82E9; Mon, 8 Oct 2018 23:28:15 +0000 (UTC) Received: by next.des.no (Postfix, from userid 1001) id 7C167B6C2; Tue, 9 Oct 2018 01:28:15 +0200 (CEST) From: =?utf-8?Q?Dag-Erling_Sm=C3=B8rgrav?= To: Marek Zarychta Cc: Michael Butler , emaste@freebsd.org, FreeBSD Current Subject: Re: SVN r339216 breaks ssh to i386 devices 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 +0200") References: <6bd10ee9-eb03-1f9f-c533-fdb5d02eb829@protected-networks.net> <20181008190846.GA84941@plan-b.pwste.edu.pl> <86tvlwcee0.fsf@next.des.no> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.1 (berkeley-unix) Date: Tue, 09 Oct 2018 01:28:15 +0200 Message-ID: <86lg78c92o.fsf@next.des.no> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 08 Oct 2018 23:28:22 -0000 --=-=-= 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. --=-=-=--