summaryrefslogtreecommitdiff
path: root/source3/passdb
diff options
context:
space:
mode:
authorAndrew Bartlett <abartlet@samba.org>2004-02-08 08:38:42 +0000
committerAndrew Bartlett <abartlet@samba.org>2004-02-08 08:38:42 +0000
commitd198c5587774808823aa09e997ff492826738c51 (patch)
treec23c8a18241756b7924ed1b45241d136fcae4962 /source3/passdb
parentae2c8656b22ca855aaf1ab7382a92996b362a900 (diff)
downloadsamba-d198c5587774808823aa09e997ff492826738c51.tar.gz
samba-d198c5587774808823aa09e997ff492826738c51.tar.bz2
samba-d198c5587774808823aa09e997ff492826738c51.zip
Make more functions static, and remove duplication in the use of functions
in lib/smbpasswd.c that were exact duplicates of functions in passdb/passdb.c (These should perhaps be pulled back out to smbpasswd.c, but that can occour later). Andrew Bartlett (This used to be commit fcdc5efb1e245c8fa95cd031f67ec56093b9056e)
Diffstat (limited to 'source3/passdb')
-rw-r--r--source3/passdb/pdb_get_set.c17
1 files changed, 14 insertions, 3 deletions
diff --git a/source3/passdb/pdb_get_set.c b/source3/passdb/pdb_get_set.c
index 9248fc1f8f..935b75cf75 100644
--- a/source3/passdb/pdb_get_set.c
+++ b/source3/passdb/pdb_get_set.c
@@ -1120,13 +1120,24 @@ BOOL pdb_set_plaintext_passwd (SAM_ACCOUNT *sampass, const char *plaintext)
if (!sampass || !plaintext)
return False;
- nt_lm_owf_gen (plaintext, new_nt_p16, new_lanman_p16);
+ /* Calculate the MD4 hash (NT compatible) of the password */
+ E_md4hash(plaintext, new_nt_p16);
if (!pdb_set_nt_passwd (sampass, new_nt_p16, PDB_CHANGED))
return False;
- if (!pdb_set_lanman_passwd (sampass, new_lanman_p16, PDB_CHANGED))
- return False;
+ if (!E_deshash(plaintext, new_lanman_p16)) {
+ /* E_deshash returns false for 'long' passwords (> 14
+ DOS chars). This allows us to match Win2k, which
+ does not store a LM hash for these passwords (which
+ would reduce the effective password length to 14 */
+
+ if (!pdb_set_lanman_passwd (sampass, NULL, PDB_CHANGED))
+ return False;
+ } else {
+ if (!pdb_set_lanman_passwd (sampass, new_lanman_p16, PDB_CHANGED))
+ return False;
+ }
if (!pdb_set_plaintext_pw_only (sampass, plaintext, PDB_CHANGED))
return False;