Fix SMBFS when saved passwords are greater than 18 characters

PR:	132302
Submitted by:	dhorn2000@gmail.com guru@unixarea.de
MFC after:	1 week
This commit is contained in:
Josh Paetzel 2017-06-08 00:48:26 +00:00
parent 69db934679
commit f56de56355
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=319670

View file

@ -232,6 +232,8 @@ smb_simplecrypt(char *dst, const char *src)
islower(ch) ? ('a' + (ch - 'a' + 13) % 26) : ch);
ch ^= pos;
pos += 13;
if (pos > 256)
pos -= 256;
sprintf(dst, "%02x", ch);
dst += 2;
}
@ -262,6 +264,8 @@ smb_simpledecrypt(char *dst, const char *src)
return EINVAL;
ch ^= pos;
pos += 13;
if (pos > 256)
pos -= 256;
if (isascii(ch))
ch = (isupper(ch) ? ('A' + (ch - 'A' + 13) % 26) :
islower(ch) ? ('a' + (ch - 'a' + 13) % 26) : ch);