diff options
author | Arthur de Jong <arthur@arthurdejong.org> | 2007-07-26 11:58:47 +0000 |
---|---|---|
committer | Arthur de Jong <arthur@arthurdejong.org> | 2007-07-26 11:58:47 +0000 |
commit | e89ff82e87617f17091212a512f11666b931623a (patch) | |
tree | 3bae7b0e1dab8e3e4abb9e2baa12f267324de502 | |
parent | 04782c6e4f74a7620363ddbc072f094f6ccda425 (diff) |
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
-rw-r--r-- | nslcd/ldap-nss.c | 35 | ||||
-rw-r--r-- | nslcd/ldap-nss.h | 3 | ||||
-rw-r--r-- | nslcd/shadow.c | 34 |
3 files changed, 34 insertions, 38 deletions
diff --git a/nslcd/ldap-nss.c b/nslcd/ldap-nss.c index 48e784e..48ebec9 100644 --- a/nslcd/ldap-nss.c +++ b/nslcd/ldap-nss.c @@ -2992,41 +2992,6 @@ int has_objectclass(LDAPMessage *entry,const char *objectclass) return 0; } -#ifdef HAVE_SHADOW_H -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 - -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; - } -} -#endif /* HAVE_SHADOW_H */ - static enum nss_status _nss_ldap_map_get (enum ldap_map_selector sel, enum ldap_map_type type, diff --git a/nslcd/ldap-nss.h b/nslcd/ldap-nss.h index 268289f..5a86eb5 100644 --- a/nslcd/ldap-nss.h +++ b/nslcd/ldap-nss.h @@ -408,9 +408,6 @@ enum nss_status _nss_ldap_assign_userpassword (LDAPMessage * e, /* IN */ return 0 for false, not-0 for true */ int has_objectclass(LDAPMessage *entry,const char *objectclass); -int _nss_ldap_shadow_date(const char *val); -void _nss_ldap_shadow_handle_flag(struct spwd *sp); - const char *_nss_ldap_map_at (enum ldap_map_selector sel, const char *attribute); const char *_nss_ldap_map_oc (enum ldap_map_selector sel, const char *objectclass); 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), |