8e1ca3
From 45e6d49b94da78cd82eb016b3266a17a1359a087 Mon Sep 17 00:00:00 2001
8e1ca3
From: Rob Crittenden <rcritten@redhat.com>
8e1ca3
Date: Thu, 4 Aug 2022 12:04:22 -0400
8e1ca3
Subject: [PATCH] Set default gracelimit on group password policies to -1
8e1ca3
8e1ca3
This will retain previous behavior of unlimited LDAP BIND
8e1ca3
post-expiration.
8e1ca3
8e1ca3
Fixes: https://pagure.io/freeipa/issue/9212
8e1ca3
8e1ca3
Signed-off-by: Rob Crittenden <rcritten@redhat.com>
8e1ca3
Reviewed-By: Florence Blanc-Renaud <frenaud@redhat.com>
8e1ca3
---
8e1ca3
 API.txt                                      | 2 +-
8e1ca3
 ipaserver/plugins/pwpolicy.py                | 2 ++
8e1ca3
 ipatests/test_xmlrpc/test_pwpolicy_plugin.py | 2 ++
8e1ca3
 3 files changed, 5 insertions(+), 1 deletion(-)
8e1ca3
8e1ca3
diff --git a/API.txt b/API.txt
8e1ca3
index 66929b921b197e27ede847fb6b10bf1e44c3464a..210bfc4950e6a7346dbdd6e29d1096b2f8750b1e 100644
8e1ca3
--- a/API.txt
8e1ca3
+++ b/API.txt
8e1ca3
@@ -4076,7 +4076,7 @@ option: Int('krbpwdlockoutduration?', cli_name='lockouttime')
8e1ca3
 option: Int('krbpwdmaxfailure?', cli_name='maxfail')
8e1ca3
 option: Int('krbpwdmindiffchars?', cli_name='minclasses')
8e1ca3
 option: Int('krbpwdminlength?', cli_name='minlength')
8e1ca3
-option: Int('passwordgracelimit?', cli_name='gracelimit', default=-1)
8e1ca3
+option: Int('passwordgracelimit?', autofill=True, cli_name='gracelimit', default=-1)
8e1ca3
 option: Flag('raw', autofill=True, cli_name='raw', default=False)
8e1ca3
 option: Str('setattr*', cli_name='setattr')
8e1ca3
 option: Str('version?')
8e1ca3
diff --git a/ipaserver/plugins/pwpolicy.py b/ipaserver/plugins/pwpolicy.py
8e1ca3
index 4428aede2dcc7a2a0b6128bf7f58eb47e4a8e07d..f4ebffd5c8f06a53b6c4d5e48ff6eeafa240e3a4 100644
8e1ca3
--- a/ipaserver/plugins/pwpolicy.py
8e1ca3
+++ b/ipaserver/plugins/pwpolicy.py
8e1ca3
@@ -408,6 +408,7 @@ class pwpolicy(LDAPObject):
8e1ca3
             minvalue=-1,
8e1ca3
             maxvalue=Int.MAX_UINT32,
8e1ca3
             default=-1,
8e1ca3
+            autofill=True,
8e1ca3
         ),
8e1ca3
     )
8e1ca3
 
8e1ca3
@@ -539,6 +540,7 @@ class pwpolicy_add(LDAPCreate):
8e1ca3
             keys[-1], krbpwdpolicyreference=dn,
8e1ca3
             cospriority=options.get('cospriority')
8e1ca3
         )
8e1ca3
+
8e1ca3
         return dn
8e1ca3
 
8e1ca3
     def post_callback(self, ldap, dn, entry_attrs, *keys, **options):
8e1ca3
diff --git a/ipatests/test_xmlrpc/test_pwpolicy_plugin.py b/ipatests/test_xmlrpc/test_pwpolicy_plugin.py
8e1ca3
index 8eee69c185b15be72870050ed247f252c72d1c66..fc785223bfe56269ad8b211e8f1c3ac9f4064c3c 100644
8e1ca3
--- a/ipatests/test_xmlrpc/test_pwpolicy_plugin.py
8e1ca3
+++ b/ipatests/test_xmlrpc/test_pwpolicy_plugin.py
8e1ca3
@@ -387,6 +387,7 @@ class test_pwpolicy_mod_cospriority(Declarative):
8e1ca3
                     krbpwdhistorylength=[u'10'],
8e1ca3
                     krbpwdmindiffchars=[u'3'],
8e1ca3
                     krbpwdminlength=[u'8'],
8e1ca3
+                    passwordgracelimit=[u'-1'],
8e1ca3
                     objectclass=objectclasses.pwpolicy,
8e1ca3
                 ),
8e1ca3
                 summary=None,
8e1ca3
@@ -417,6 +418,7 @@ class test_pwpolicy_mod_cospriority(Declarative):
8e1ca3
                     krbpwdhistorylength=[u'10'],
8e1ca3
                     krbpwdmindiffchars=[u'3'],
8e1ca3
                     krbpwdminlength=[u'8'],
8e1ca3
+                    passwordgracelimit=[u'-1'],
8e1ca3
                 ),
8e1ca3
                 summary=None,
8e1ca3
                 value=u'ipausers',
8e1ca3
-- 
8e1ca3
2.37.2
8e1ca3