cifs: use server timestamp for ntlmv2 authentication
authorPeter Seiderer <ps.report@gmx.net>
Thu, 17 Sep 2015 19:40:12 +0000 (21:40 +0200)
committerJiri Slaby <jslaby@suse.cz>
Wed, 28 Oct 2015 15:38:00 +0000 (16:38 +0100)
commit981cbe0c10dc1d7726e635fb2ae165787dff13c9
tree202ace88913f3a068edf5e9e170a75454554d65a
parent29bfe66a2dd06e00d758054de519f67ff82b77dd
cifs: use server timestamp for ntlmv2 authentication

commit 98ce94c8df762d413b3ecb849e2b966b21606d04 upstream.

Linux cifs mount with ntlmssp against an Mac OS X (Yosemite
10.10.5) share fails in case the clocks differ more than +/-2h:

digest-service: digest-request: od failed with 2 proto=ntlmv2
digest-service: digest-request: kdc failed with -1561745592 proto=ntlmv2

Fix this by (re-)using the given server timestamp for the
ntlmv2 authentication (as Windows 7 does).

A related problem was also reported earlier by Namjae Jaen (see below):

Windows machine has extended security feature which refuse to allow
authentication when there is time difference between server time and
client time when ntlmv2 negotiation is used. This problem is prevalent
in embedded enviornment where system time is set to default 1970.

Modern servers send the server timestamp in the TargetInfo Av_Pair
structure in the challenge message [see MS-NLMP 2.2.2.1]
In [MS-NLMP 3.1.5.1.2] it is explicitly mentioned that the client must
use the server provided timestamp if present OR current time if it is
not

Reported-by: Namjae Jeon <namjae.jeon@samsung.com>
Signed-off-by: Peter Seiderer <ps.report@gmx.net>
Signed-off-by: Steve French <smfrench@gmail.com>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
fs/cifs/cifsencrypt.c