From c0ae078afd7201b503dfd1fc04bdb4dc85288137 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ond=C5=99ej=20Kuzn=C3=ADk?= Date: Thu, 24 Oct 2019 14:04:35 +0100 Subject: [PATCH] ITS#9156 Implement pwdStartTime and pwdEndTime --- servers/slapd/overlays/ppolicy.c | 34 ++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/servers/slapd/overlays/ppolicy.c b/servers/slapd/overlays/ppolicy.c index f379c0c4f6..5dc7088824 100644 --- a/servers/slapd/overlays/ppolicy.c +++ b/servers/slapd/overlays/ppolicy.c @@ -507,6 +507,40 @@ account_locked( Operation *op, Entry *e, assert(mod != NULL); + if ( (la = attr_find( e->e_attrs, ad_pwdStartTime )) != NULL ) { + BerVarray vals = la->a_nvals; + time_t then, now = op->o_time; + + /* + * Password has a defined start of validity + */ + if ( vals[0].bv_val != NULL ) { + if ( (then = parse_time( vals[0].bv_val )) == (time_t)-1 ) { + return 1; + } + if ( now < then ) { + return 1; + } + } + } + + if ( (la = attr_find( e->e_attrs, ad_pwdEndTime )) != NULL ) { + BerVarray vals = la->a_nvals; + time_t then, now = op->o_time; + + /* + * Password has a defined end of validity + */ + if ( vals[0].bv_val != NULL ) { + if ( (then = parse_time( vals[0].bv_val )) == (time_t)-1 ) { + return 1; + } + if ( then <= now ) { + return 1; + } + } + } + if ( !pp->pwdLockout ) return 0;