Line | Source | Count |
1 | | - |
2 | | - |
3 | | - |
4 | | - |
5 | | - |
6 | | - |
7 | | - |
8 | | - |
9 | | - |
10 | extern struct sshbuf *loginmsg; | - |
11 | int | - |
12 | auth_shadow_acctexpired(struct spwd *spw) | - |
13 | { | - |
14 | time_t today; | - |
15 | int daysleft; | - |
16 | int r; | - |
17 | | - |
18 | today = time( | - |
19 | ((void *)0) | - |
20 | ) / (24L * 60 * 60); | - |
21 | daysleft = spw->sp_expire - today; | - |
22 | debug3("%s: today %d sp_expire %d days left %d", __func__, (int)today, | - |
23 | (int)spw->sp_expire, daysleft); | - |
24 | | - |
25 | if (spw->sp_expire == -1TRUE | never evaluated | FALSE | never evaluated |
) { | 0 |
26 | debug3("account expiration disabled"); | - |
27 | } never executed: end of block else if (daysleft < 0TRUE | never evaluated | FALSE | never evaluated |
) { | 0 |
28 | logit("Account %.100s has expired", spw->sp_namp); | - |
29 | return never executed: return 1; 1;never executed: return 1; | 0 |
30 | } else if (daysleft <= spw->sp_warnTRUE | never evaluated | FALSE | never evaluated |
) { | 0 |
31 | debug3("account will expire in %d days", daysleft); | - |
32 | if ((TRUE | never evaluated | FALSE | never evaluated |
r = sshbuf_putf(loginmsg,TRUE | never evaluated | FALSE | never evaluated |
| 0 |
33 | "Your account will expire in %d day%s.\n", daysleft,TRUE | never evaluated | FALSE | never evaluated |
| 0 |
34 | daysleft == 1 ? "" : "s")) != 0TRUE | never evaluated | FALSE | never evaluated |
) | 0 |
35 | fatal("%s: buffer error: %s", __func__, ssh_err(r)); never executed: fatal("%s: buffer error: %s", __func__, ssh_err(r)); | 0 |
36 | } never executed: end of block | 0 |
37 | | - |
38 | return never executed: return 0; 0;never executed: return 0; | 0 |
39 | } | - |
40 | | - |
41 | | - |
42 | | - |
43 | | - |
44 | | - |
45 | int | - |
46 | auth_shadow_pwexpired(Authctxt *ctxt) | - |
47 | { | - |
48 | struct spwd *spw = | - |
49 | ((void *)0) | - |
50 | ; | - |
51 | const char *user = ctxt->pw->pw_name; | - |
52 | time_t today; | - |
53 | int r, daysleft, disabled = 0; | - |
54 | | - |
55 | if ((TRUE | never evaluated | FALSE | never evaluated |
spw = getspnam((char *)user)) == TRUE | never evaluated | FALSE | never evaluated |
| 0 |
56 | ((void *)0)TRUE | never evaluated | FALSE | never evaluated |
| 0 |
57 | ) { | - |
58 | error("Could not get shadow information for %.100s", user); | - |
59 | return never executed: return 0; 0;never executed: return 0; | 0 |
60 | } | - |
61 | | - |
62 | today = time( | - |
63 | ((void *)0) | - |
64 | ) / (24L * 60 * 60); | - |
65 | debug3("%s: today %d sp_lstchg %d sp_max %d", __func__, (int)today, | - |
66 | (int)spw->sp_lstchg, (int)spw->sp_max); | - |
67 | daysleft = spw->sp_lstchg + spw->sp_max - today; | - |
68 | if (disabledTRUE | never evaluated | FALSE | never evaluated |
) { | 0 |
69 | debug3("password expiration disabled"); | - |
70 | } never executed: end of block else if (spw->sp_lstchg == 0TRUE | never evaluated | FALSE | never evaluated |
) { | 0 |
71 | logit("User %.100s password has expired (root forced)", user); | - |
72 | return never executed: return 1; 1;never executed: return 1; | 0 |
73 | } else if (spw->sp_max == -1TRUE | never evaluated | FALSE | never evaluated |
) { | 0 |
74 | debug3("password expiration disabled"); | - |
75 | } never executed: end of block else if (daysleft < 0TRUE | never evaluated | FALSE | never evaluated |
) { | 0 |
76 | logit("User %.100s password has expired (password aged)", user); | - |
77 | return never executed: return 1; 1;never executed: return 1; | 0 |
78 | } else if (daysleft <= spw->sp_warnTRUE | never evaluated | FALSE | never evaluated |
) { | 0 |
79 | debug3("password will expire in %d days", daysleft); | - |
80 | if ((TRUE | never evaluated | FALSE | never evaluated |
r = sshbuf_putf(loginmsg,TRUE | never evaluated | FALSE | never evaluated |
| 0 |
81 | "Your password will expire in %d day%s.\n", daysleft,TRUE | never evaluated | FALSE | never evaluated |
| 0 |
82 | daysleft == 1 ? "" : "s")) != 0TRUE | never evaluated | FALSE | never evaluated |
) | 0 |
83 | fatal("%s: buffer error: %s", __func__, ssh_err(r)); never executed: fatal("%s: buffer error: %s", __func__, ssh_err(r)); | 0 |
84 | } never executed: end of block | 0 |
85 | | - |
86 | return never executed: return 0; 0;never executed: return 0; | 0 |
87 | } | - |
| | |