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

[-- Attachment #1 --]
El día martes, junio 06, 2017 a las 12:00:34p. m. +0200, Matthias Apitz escribió:

> 
> Hello,
> 
> 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.
> 
> Now the new crypted and stored pw from /etc/nsmb.conf is not accepted
> anymore. In detail, when I do:
> 
> ...

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 
smb_simpledecrypt(): hash: [$$12a1a06767a6a5e4ebaa0b09b9af5e3eddfcd1312] gives 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 = "$$12a1a06767a6a5e4ebaa0b09b9af5e3eddfcd1312";
    char clear[256];

    clear[0] = '\0';

    smb_simpledecrypt(clear, hash);

    printf("smb_simpledecrypt(): hash: [%s] gives clear [%s]\n", hash, clear);

}

This seems to be an issue in the libsmb...

	matthias



-- 
Matthias Apitz, ✉ guru@unixarea.de, ⌂ http://www.unixarea.de/  ☎ +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ó la Guerra.
May 8, 1945: Who does not celebrate lost the War.

[-- Attachment #2 --]
-----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-----

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