From e89ff82e87617f17091212a512f11666b931623a Mon Sep 17 00:00:00 2001 From: Arthur de Jong Date: Thu, 26 Jul 2007 11:58:47 +0000 Subject: move some shadow specific functions to shadow.c git-svn-id: http://arthurdejong.org/svn/nss-pam-ldapd/nss-ldapd@329 ef36b2f9-881f-0410-afb5-c4e39611909c --- nslcd/shadow.c | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) (limited to 'nslcd/shadow.c') diff --git a/nslcd/shadow.c b/nslcd/shadow.c index e453ba0..53e9baa 100644 --- a/nslcd/shadow.c +++ b/nslcd/shadow.c @@ -49,6 +49,40 @@ #include "common.h" #include "log.h" #include "attmap.h" +#include "cfg.h" + +static int +_nss_ldap_shadow_date (const char *val) +{ + int date; + + if (nslcd_cfg->ldc_shadow_type == LS_AD_SHADOW) + { + date = atoll (val) / 864000000000LL - 134774LL; + date = (date > 99999) ? 99999 : date; + } + else + { + date = atol (val); + } + + return date; +} + +#ifndef UF_DONT_EXPIRE_PASSWD +#define UF_DONT_EXPIRE_PASSWD 0x10000 +#endif + +static void +_nss_ldap_shadow_handle_flag (struct spwd *sp) +{ + if (nslcd_cfg->ldc_shadow_type == LS_AD_SHADOW) + { + if (sp->sp_flag & UF_DONT_EXPIRE_PASSWD) + sp->sp_max = 99999; + sp->sp_flag = 0; + } +} static enum nss_status _nss_ldap_parse_sp(LDAPMessage *e, struct ldap_state UNUSED(*pvt), -- cgit v1.2.3