|
|
e8c7a2 |
From 3675bd1d7aca443832bb9bb2f521cc4d3a088aec Mon Sep 17 00:00:00 2001
|
|
|
e8c7a2 |
From: Rob Crittenden <rcritten@redhat.com>
|
|
|
e8c7a2 |
Date: Wed, 29 Jun 2022 13:25:55 +0000
|
|
|
e8c7a2 |
Subject: [PATCH] Only calculate LDAP password grace when the password is
|
|
|
e8c7a2 |
expired
|
|
|
e8c7a2 |
|
|
|
e8c7a2 |
The user's pwd expiration was retrieved but inadvertently was never
|
|
|
e8c7a2 |
compared to current time. So any LDAP bind, including from the
|
|
|
e8c7a2 |
IPA API, counted against the grace period. There is no need to go
|
|
|
e8c7a2 |
through the graceperiod code for non-expired passwords.
|
|
|
e8c7a2 |
|
|
|
e8c7a2 |
https://pagure.io/freeipa/issue/1539
|
|
|
e8c7a2 |
|
|
|
e8c7a2 |
Signed-off-by: Rob Crittenden <rcritten@redhat.com>
|
|
|
e8c7a2 |
Reviewed-By: Florence Blanc-Renaud <frenaud@redhat.com>
|
|
|
e8c7a2 |
---
|
|
|
e8c7a2 |
.../ipa-graceperiod/ipa_graceperiod.c | 12 +++++++++---
|
|
|
e8c7a2 |
1 file changed, 9 insertions(+), 3 deletions(-)
|
|
|
e8c7a2 |
|
|
|
e8c7a2 |
diff --git a/daemons/ipa-slapi-plugins/ipa-graceperiod/ipa_graceperiod.c b/daemons/ipa-slapi-plugins/ipa-graceperiod/ipa_graceperiod.c
|
|
|
e8c7a2 |
index 0860b5c20..a3f57cb4b 100644
|
|
|
e8c7a2 |
--- a/daemons/ipa-slapi-plugins/ipa-graceperiod/ipa_graceperiod.c
|
|
|
e8c7a2 |
+++ b/daemons/ipa-slapi-plugins/ipa-graceperiod/ipa_graceperiod.c
|
|
|
e8c7a2 |
@@ -359,7 +359,8 @@ static int ipagraceperiod_preop(Slapi_PBlock *pb)
|
|
|
e8c7a2 |
Slapi_ValueSet *values = NULL;
|
|
|
e8c7a2 |
long grace_limit = 0;
|
|
|
e8c7a2 |
int grace_user_time;
|
|
|
e8c7a2 |
- char *pwd_expiration = NULL;
|
|
|
e8c7a2 |
+ char *tmpstr = NULL;
|
|
|
e8c7a2 |
+ time_t pwd_expiration;
|
|
|
e8c7a2 |
int pwresponse_requested = 0;
|
|
|
e8c7a2 |
Slapi_PBlock *pbtm = NULL;
|
|
|
e8c7a2 |
Slapi_Mods *smods = NULL;
|
|
|
e8c7a2 |
@@ -414,12 +415,17 @@ static int ipagraceperiod_preop(Slapi_PBlock *pb)
|
|
|
e8c7a2 |
}
|
|
|
e8c7a2 |
slapi_value_free(&objectclass);
|
|
|
e8c7a2 |
|
|
|
e8c7a2 |
- pwd_expiration = slapi_entry_attr_get_charptr(target_entry, "krbPasswordExpiration");
|
|
|
e8c7a2 |
- if (pwd_expiration == NULL) {
|
|
|
e8c7a2 |
+ tmpstr = slapi_entry_attr_get_charptr(target_entry, "krbPasswordExpiration");
|
|
|
e8c7a2 |
+ if (tmpstr == NULL) {
|
|
|
e8c7a2 |
/* No expiration means nothing to do */
|
|
|
e8c7a2 |
LOG_TRACE("No krbPasswordExpiration for %s, nothing to do\n", dn);
|
|
|
e8c7a2 |
goto done;
|
|
|
e8c7a2 |
}
|
|
|
e8c7a2 |
+ pwd_expiration = ipapwd_gentime_to_time_t(tmpstr);
|
|
|
e8c7a2 |
+ if (pwd_expiration > time(NULL)) {
|
|
|
e8c7a2 |
+ /* Not expired, nothing to see here */
|
|
|
e8c7a2 |
+ goto done;
|
|
|
e8c7a2 |
+ }
|
|
|
e8c7a2 |
|
|
|
e8c7a2 |
ldrc = ipagraceperiod_getpolicy(target_entry, &policy_entry,
|
|
|
e8c7a2 |
&values, &actual_type_name,
|
|
|
e8c7a2 |
--
|
|
|
e8c7a2 |
2.36.1
|
|
|
e8c7a2 |
|