OpenCoverage

auth-shadow.c

Absolute File Name:/home/opencoverage/opencoverage/guest-scripts/openssh/src/auth-shadow.c
Switch to Source codePreprocessed file
LineSourceCount
1-
2-
3-
4-
5-
6-
7-
8-
9-
10extern struct sshbuf *loginmsg;-
11int-
12auth_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 == -1
spw->sp_expire == -1Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
26 debug3("account expiration disabled");-
27 }
never executed: end of block
else if (daysleft < 0
daysleft < 0Description
TRUEnever evaluated
FALSEnever 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_warn
daysleft <= spw->sp_warnDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
31 debug3("account will expire in %d days", daysleft);-
32 if ((
(r = sshbuf_pu..." : "s")) != 0Description
TRUEnever evaluated
FALSEnever evaluated
r = sshbuf_putf(loginmsg,
(r = sshbuf_pu..." : "s")) != 0Description
TRUEnever evaluated
FALSEnever evaluated
0
33 "Your account will expire in %d day%s.\n", daysleft,
(r = sshbuf_pu..." : "s")) != 0Description
TRUEnever evaluated
FALSEnever evaluated
0
34 daysleft == 1 ? "" : "s")) != 0
(r = sshbuf_pu..." : "s")) != 0Description
TRUEnever evaluated
FALSEnever 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-
45int-
46auth_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 ((
(spw = getspna...== ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
spw = getspnam((char *)user)) ==
(spw = getspna...== ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0
56 ((void *)0)
(spw = getspna...== ((void *)0)Description
TRUEnever evaluated
FALSEnever 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 (disabled
disabledDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
69 debug3("password expiration disabled");-
70 }
never executed: end of block
else if (spw->sp_lstchg == 0
spw->sp_lstchg == 0Description
TRUEnever evaluated
FALSEnever 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 == -1
spw->sp_max == -1Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
74 debug3("password expiration disabled");-
75 }
never executed: end of block
else if (daysleft < 0
daysleft < 0Description
TRUEnever evaluated
FALSEnever 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_warn
daysleft <= spw->sp_warnDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
79 debug3("password will expire in %d days", daysleft);-
80 if ((
(r = sshbuf_pu..." : "s")) != 0Description
TRUEnever evaluated
FALSEnever evaluated
r = sshbuf_putf(loginmsg,
(r = sshbuf_pu..." : "s")) != 0Description
TRUEnever evaluated
FALSEnever evaluated
0
81 "Your password will expire in %d day%s.\n", daysleft,
(r = sshbuf_pu..." : "s")) != 0Description
TRUEnever evaluated
FALSEnever evaluated
0
82 daysleft == 1 ? "" : "s")) != 0
(r = sshbuf_pu..." : "s")) != 0Description
TRUEnever evaluated
FALSEnever 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}-
Switch to Source codePreprocessed file

Generated by Squish Coco 4.2.2