]> git.ipfire.org Git - people/ms/ipfire-3.x.git/blame - pam_ldap/patches/pam_ldap-185-expiration4.patch
Move all packages to root.
[people/ms/ipfire-3.x.git] / pam_ldap / patches / pam_ldap-185-expiration4.patch
CommitLineData
09a030e4
SS
1Heavily based on a patch from Masahiro Matsuya.
2
3diff -up pam_ldap-185/pam_ldap.c pam_ldap-185/pam_ldap.c
4--- pam_ldap-185/pam_ldap.c 2010-09-22 18:35:55.377828002 -0400
5+++ pam_ldap-185/pam_ldap.c 2010-09-22 19:08:34.938828001 -0400
6@@ -4014,6 +4014,8 @@ pam_sm_acct_mgmt (pam_handle_t * pamh, i
7 time_t currenttime;
8 long int currentday;
9 long int expirein = 0; /* seconds until password expires */
10+ long int expireh = 0;
11+ long int expires = 0;
12 const char *configFile = NULL;
13
14 for (i = 0; i < argc; i++)
15@@ -4190,14 +4191,29 @@ pam_sm_acct_mgmt (pam_handle_t * pamh, i
16 }
17 else
18 {
19- expirein = session->info->password_expiration_time / SECSPERDAY;
20+ if ( session->info->password_expiration_time != 0 )
21+ {
22+ expires = session->info->password_expiration_time;
23+ expirein = session->info->password_expiration_time / SECSPERDAY;
24+ if ( expirein == 0 )
25+ {
26+ expireh = session->info->password_expiration_time / SECSPERHOUR;
27+ }
28+ }
29+ else
30+ {
31+ expirein = 0;
32+ }
33 }
34
35- if (expirein > 0)
36+ if ((expirein > 0) || (expireh > 0) || (expires > 0))
37 {
38 snprintf (buf, sizeof buf,
39- "Your LDAP password will expire in %ld day%s.",
40- expirein, (expirein == 1) ? "" : "s");
41+ "Your LDAP password will expire in %ld %s.",
42+ (expirein == 0) ? expireh : expirein,
43+ (expirein == 0) ?
44+ ((expireh == 1) ? "hour" : "hours") :
45+ ((expirein == 1) ? "day" : "days"));
46 _conv_sendmsg (appconv, buf, PAM_ERROR_MSG, no_warn);
47
48 /* we set this to make sure that user can't abort a password change */
49diff -up pam_ldap-185/pam_ldap.h pam_ldap-185/pam_ldap.h
50--- pam_ldap-185/pam_ldap.h 2010-09-22 18:35:55.359828002 -0400
51+++ pam_ldap-185/pam_ldap.h 2010-09-22 19:00:56.787828000 -0400
52@@ -226,6 +226,9 @@ pam_ldap_shadow_t;
53 /* Seconds in a day */
54 #define SECSPERDAY 86400
55
56+/* Seconds in an hour */
57+#define SECSPERHOUR 3600
58+
59 /* Netscape per-use password attributes. Unused except for DN. */
60 typedef struct pam_ldap_user_info
61 {