summaryrefslogtreecommitdiff
path: root/source3/passdb
diff options
context:
space:
mode:
authorAndrew Bartlett <abartlet@samba.org>2001-10-29 07:15:51 +0000
committerAndrew Bartlett <abartlet@samba.org>2001-10-29 07:15:51 +0000
commitab5d5cfbe0aee4387ec7ae8805c69b31a1696435 (patch)
tree2d1033bf6bcb51f685f68b441b746d495fc5abcd /source3/passdb
parent879ecfae58ea47c7130aab53a44ab158d4667b5b (diff)
downloadsamba-ab5d5cfbe0aee4387ec7ae8805c69b31a1696435.tar.gz
samba-ab5d5cfbe0aee4387ec7ae8805c69b31a1696435.tar.bz2
samba-ab5d5cfbe0aee4387ec7ae8805c69b31a1696435.zip
This commit is number 1 of 4.
In particular this commit focusses on: Adding the new 'pass changed now' helper function. While these changes have been mildly tested, and are pretty small, any assistance in this is appreciated. (This used to be commit a8971a5448cf6d203b379c3ed01e331d5263c9ee)
Diffstat (limited to 'source3/passdb')
-rw-r--r--source3/passdb/passdb.c77
1 files changed, 54 insertions, 23 deletions
diff --git a/source3/passdb/passdb.c b/source3/passdb/passdb.c
index fa0dd244d2..634ea8fdac 100644
--- a/source3/passdb/passdb.c
+++ b/source3/passdb/passdb.c
@@ -1624,29 +1624,6 @@ BOOL pdb_set_lanman_passwd (SAM_ACCOUNT *sampass, uint8 *pwd)
return True;
}
-/*********************************************************************
- Set the user's PLAINTEXT password. Used as an interface to the above.
- ********************************************************************/
-
-BOOL pdb_set_plaintext_passwd (SAM_ACCOUNT *sampass, char *plaintext)
-{
- uchar new_lanman_p16[16];
- uchar new_nt_p16[16];
-
- if (!sampass || !plaintext)
- return False;
-
- nt_lm_owf_gen (plaintext, new_nt_p16, new_lanman_p16);
-
- if (!pdb_set_nt_passwd (sampass, new_nt_p16))
- return False;
-
- if (!pdb_set_lanman_passwd (sampass, new_lanman_p16))
- return False;
-
- return True;
-}
-
BOOL pdb_set_unknown_3 (SAM_ACCOUNT *sampass, uint32 unkn)
{
if (!sampass)
@@ -1688,3 +1665,57 @@ BOOL pdb_set_hours (SAM_ACCOUNT *sampass, uint8 *hours)
return True;
}
+
+
+/* Helpful interfaces to the above */
+
+/*********************************************************************
+ Sets the last changed times and must change times for a normal
+ password change.
+ ********************************************************************/
+
+BOOL pdb_set_pass_changed_now (SAM_ACCOUNT *sampass)
+{
+
+ if (!sampass)
+ return False;
+
+ if (!pdb_set_pass_last_set_time (sampass, time(NULL)))
+ return False;
+
+ if (!pdb_set_pass_must_change_time (sampass,
+ pdb_get_pass_last_set_time(sampass)
+ + MAX_PASSWORD_AGE))
+ return False;
+
+ return True;
+}
+
+/*********************************************************************
+ Set the user's PLAINTEXT password. Used as an interface to the above.
+ Also sets the last change time to NOW.
+ ********************************************************************/
+
+BOOL pdb_set_plaintext_passwd (SAM_ACCOUNT *sampass, const char *plaintext)
+{
+ uchar new_lanman_p16[16];
+ uchar new_nt_p16[16];
+
+ if (!sampass || !plaintext)
+ return False;
+
+ nt_lm_owf_gen (plaintext, new_nt_p16, new_lanman_p16);
+
+ if (!pdb_set_nt_passwd (sampass, new_nt_p16))
+ return False;
+
+ if (!pdb_set_lanman_passwd (sampass, new_lanman_p16))
+ return False;
+
+ if (!pdb_set_pass_changed_now (sampass))
+ return False;
+
+ return True;
+}
+
+