summaryrefslogtreecommitdiff
path: root/source3/libsmb/smbencrypt.c
diff options
context:
space:
mode:
authorAndrew Bartlett <abartlet@samba.org>2004-04-12 11:18:32 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 10:51:12 -0500
commit85a307bb3ea102be24fb1f0ecdc27c9eb08c9ce9 (patch)
treef282e785ff7199fce3c7ba44d477024fd33bf3d3 /source3/libsmb/smbencrypt.c
parent156075555647a15f0f57b1372deb1f442d7c169a (diff)
downloadsamba-85a307bb3ea102be24fb1f0ecdc27c9eb08c9ce9.tar.gz
samba-85a307bb3ea102be24fb1f0ecdc27c9eb08c9ce9.tar.bz2
samba-85a307bb3ea102be24fb1f0ecdc27c9eb08c9ce9.zip
r176: Improve our fallback code for password changes - this would be better
with more correct NTLMSSP support in client and server, but it will do for now. Also implement LANMAN password only in the classical session setup code, but #ifdef'ed out. In Samba4, I'll make this run-time so we can torture it. Lanman passwords over 14 dos characters long could be considered 'invalid' (they are truncated) - so SMBencrypt now returns 'False' if it generates such a password. Andrew Bartlett (This used to be commit 565305f7bb30c08120c3def5367adfd6f5dd84df)
Diffstat (limited to 'source3/libsmb/smbencrypt.c')
-rw-r--r--source3/libsmb/smbencrypt.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/source3/libsmb/smbencrypt.c b/source3/libsmb/smbencrypt.c
index 3b8a375bea..44f7428086 100644
--- a/source3/libsmb/smbencrypt.c
+++ b/source3/libsmb/smbencrypt.c
@@ -28,13 +28,17 @@
/*
This implements the X/Open SMB password encryption
It takes a password ('unix' string), a 8 byte "crypt key"
- and puts 24 bytes of encrypted password into p24 */
-void SMBencrypt(const char *passwd, const uchar *c8, uchar p24[24])
+ and puts 24 bytes of encrypted password into p24
+
+ Returns False if password must have been truncated to create LM hash
+*/
+BOOL SMBencrypt(const char *passwd, const uchar *c8, uchar p24[24])
{
+ BOOL ret;
uchar p21[21];
memset(p21,'\0',21);
- E_deshash(passwd, p21);
+ ret = E_deshash(passwd, p21);
SMBOWFencrypt(p21, c8, p24);
@@ -44,6 +48,8 @@ void SMBencrypt(const char *passwd, const uchar *c8, uchar p24[24])
dump_data(100, (const char *)c8, 8);
dump_data(100, (char *)p24, 24);
#endif
+
+ return ret;
}
/**