summaryrefslogtreecommitdiff
path: root/source4/auth/credentials/credentials_files.c
diff options
context:
space:
mode:
authorAndrew Bartlett <abartlet@samba.org>2010-05-17 13:41:01 +1000
committerAndrew Bartlett <abartlet@samba.org>2010-05-18 13:20:22 +1000
commitb183a30b2b3983a7f827dc6fd44eb16ac64904ce (patch)
treee48bb1f357b795a0f318d562e86a459e02af4823 /source4/auth/credentials/credentials_files.c
parent6324a0f59f78dff6501627518824e708aa3dc257 (diff)
downloadsamba-b183a30b2b3983a7f827dc6fd44eb16ac64904ce.tar.gz
samba-b183a30b2b3983a7f827dc6fd44eb16ac64904ce.tar.bz2
samba-b183a30b2b3983a7f827dc6fd44eb16ac64904ce.zip
s4:credentials Add in tracking of the password last set time
We perhaps need a more general API here, but for now extend the credentials API to return the password last changed time that the s3compat layer will need. Andrew Bartlett
Diffstat (limited to 'source4/auth/credentials/credentials_files.c')
-rw-r--r--source4/auth/credentials/credentials_files.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/source4/auth/credentials/credentials_files.c b/source4/auth/credentials/credentials_files.c
index 6ddee9e3ef..2e88cf4c4e 100644
--- a/source4/auth/credentials/credentials_files.c
+++ b/source4/auth/credentials/credentials_files.c
@@ -210,7 +210,8 @@ _PUBLIC_ NTSTATUS cli_credentials_set_secrets(struct cli_credentials *cred,
enum netr_SchannelType sct;
const char *salt_principal;
const char *keytab;
-
+ const struct ldb_val *whenChanged;
+
/* ok, we are going to get it now, don't recurse back here */
cred->machine_account_pending = false;
@@ -314,6 +315,14 @@ _PUBLIC_ NTSTATUS cli_credentials_set_secrets(struct cli_credentials *cred,
cli_credentials_set_kvno(cred, ldb_msg_find_attr_as_int(msg, "msDS-KeyVersionNumber", 0));
+ whenChanged = ldb_msg_find_ldb_val(msg, "whenChanged");
+ if (whenChanged) {
+ time_t lct;
+ if (ldb_val_to_time(whenChanged, &lct) == LDB_SUCCESS) {
+ cli_credentials_set_password_last_changed_time(cred, lct);
+ }
+ }
+
/* If there was an external keytab specified by reference in
* the LDB, then use this. Otherwise we will make one up
* (chewing CPU time) from the password */