From owner-freebsd-current@freebsd.org Tue Jun 6 12:37:52 2017 Return-Path: Delivered-To: freebsd-current@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 08376B94777; Tue, 6 Jun 2017 12:37:52 +0000 (UTC) (envelope-from guru@unixarea.de) Received: from ms-10.1blu.de (ms-10.1blu.de [178.254.4.101]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id C070A66247; Tue, 6 Jun 2017 12:37:51 +0000 (UTC) (envelope-from guru@unixarea.de) Received: from [2.247.252.203] (helo=localhost.unixarea.de) by ms-10.1blu.de with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.86_2) (envelope-from ) id 1dIDk4-0004Vx-Eb; Tue, 06 Jun 2017 14:37:49 +0200 Received: from localhost.my.domain (localhost [127.0.0.1]) by localhost.unixarea.de (8.15.2/8.14.9) with ESMTPS id v56CbjnX005319 (version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Tue, 6 Jun 2017 14:37:45 +0200 (CEST) (envelope-from guru@unixarea.de) Received: (from guru@localhost) by localhost.my.domain (8.15.2/8.14.9/Submit) id v56CbiWe005318; Tue, 6 Jun 2017 14:37:44 +0200 (CEST) (envelope-from guru@unixarea.de) X-Authentication-Warning: localhost.my.domain: guru set sender to guru@unixarea.de using -f Date: Tue, 6 Jun 2017 14:37:38 +0200 From: Matthias Apitz To: freebsd-questions@freebsd.org Cc: freebsd-current@freebsd.org Subject: Re: mount_smbfs gives error when stored crypted pw is used Message-ID: <20170606123738.GA5213@c720-r314251> Reply-To: Matthias Apitz Mail-Followup-To: Matthias Apitz , freebsd-questions@freebsd.org, freebsd-current@freebsd.org References: <20170606100034.GA4245@c720-r314251> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="2oS5YaxWCcQjTEyO" Content-Disposition: inline In-Reply-To: <20170606100034.GA4245@c720-r314251> X-Operating-System: FreeBSD 12.0-CURRENT r314251 (amd64) User-Agent: Mutt/1.8.0 (2017-02-23) X-Con-Id: 51246 X-Con-U: 0-guru X-Originating-IP: 2.247.252.203 X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.23 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: Tue, 06 Jun 2017 12:37:52 -0000 --2oS5YaxWCcQjTEyO Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable El d=C3=ADa martes, junio 06, 2017 a las 12:00:34p. m. +0200, Matthias Apit= z escribi=C3=B3: >=20 > Hello, >=20 > At work I have to run FreeBSD (12-CURRENT, amd64) in vbox on Win7 host > and used successful mount_smbfs to mount the hosts disk to FreeBSD. This > worked fine until the last password change of the domain pw we have todo > every 12 weeks or so. >=20 > Now the new crypted and stored pw from /etc/nsmb.conf is not accepted > anymore. In detail, when I do: >=20 > ... I looked into the sources in src/contrib/smbfs/lib/smb to understand how the hashed pw is translated to clear text and wrote a small test pgm which uses the same function of the /usr/lib/libsmb.so $ cc -o smbpw smbpw.c -l smb I now crypt a dummy pw with the following chars '1234567890-1-1234567': $ smbutil crypt 1234567890-1-1234567 $$12a1a06767a6a5e4ebaa0b09b9af5e3eddfcd1312 the resulting hash gives retranslated by smb_simpledecrypt(): $ ./smbpw=20 smb_simpledecrypt(): hash: [$$12a1a06767a6a5e4ebaa0b09b9af5e3eddfcd1312] gi= ves clear [1234567890-1-12345] i.e. the last two chars are missing. $ cat smbpw.c #include int smb_simpledecrypt(char *dst, const char *src); int main() { char *hash =3D "$$12a1a06767a6a5e4ebaa0b09b9af5e3eddfcd1312"; char clear[256]; clear[0] =3D '\0'; smb_simpledecrypt(clear, hash); printf("smb_simpledecrypt(): hash: [%s] gives clear [%s]\n", hash, clea= r); } This seems to be an issue in the libsmb... matthias --=20 Matthias Apitz, =E2=9C=89 guru@unixarea.de, =E2=8C=82 http://www.unixarea.d= e/ =E2=98=8E +49-176-38902045 Public GnuPG key: http://www.unixarea.de/key.pub 8. Mai 1945: Wer nicht feiert hat den Krieg verloren. 8 de mayo de 1945: Quien no festeja perdi=C3=B3 la Guerra. May 8, 1945: Who does not celebrate lost the War. --2oS5YaxWCcQjTEyO Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCAAdFiEEXmn7rBYYViyzy/vBR8z35Hb+nREFAlk2ogoACgkQR8z35Hb+ nRHWFhAAoqC614OwHMRp3vZCwWqlGaT+Rf3u5AJYgFevgBdiwHbywaodrV4U/SfZ db6U9+5KsMHfqc1sfR83AqyIt7VAUBG/TROyrGaKHlPgJKALI67bvTg7LNfv96iL 8woXL+obewGSiqPCYyvVlwDauMovi0LFI5MmF3SQ42XllzDDZ7PzAJ6JnotTzLta RxyPxs8yfASChx+72ZGWdQdj2W4bBjAVZRoLSDR/JzvnQSPNJO28tBv2YJlmo57O JnzAGcyGu1Tx7VrM9Pzqu2+/p+HZehK+kvoT1jm0JtLib6DNKkgmI0r1uvN/M1u9 253RF6dpqTGoDHMQUpzhZCIvNsXTofAgAmDANAoOJ6bp+qXtx0PVSZG91Vwr7cEp caGD/UEQXUr7skhob618W8H/wpJY42HKBRkkw8Jr13t2C4fZl7sL6DCbxE9wPB2Z iMRVGmEXp3+ejnhzDfbheyxIvWvPmJAKHXx8Q+cbjyYdnj4IRqOVuliabL1k0N+Q RyLl6w7NAp3LqAAoM1QnXh6pU6TdkvyM2MMl00gazfl1A/qCZAuMUQ8m0CLEdEWA sHX+bVORUkUGb3kkhdx/2OtxDQ6UbyGVPygIjU0yws1egyzcLwvfNZ6rL5av6xrj rllm9UH3ASz3YHzb3JbyJWSNG+e2aU4po9HxsMVQYfQvXpBllFs= =rVwD -----END PGP SIGNATURE----- --2oS5YaxWCcQjTEyO--