Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 6 Jun 2017 14:37:38 +0200
From:      Matthias Apitz <guru@unixarea.de>
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>
In-Reply-To: <20170606100034.GA4245@c720-r314251>
References:  <20170606100034.GA4245@c720-r314251>

next in thread | previous in thread | raw e-mail | index | archive | help

--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 <stdio.h>

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--



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