Skip to content

Commit 140331b

Browse files
manner82millert
authored andcommitted
plugins/sudoers/lookup.c: fix NOTBEFORE to be able to deny
If someone specifies both a NOTBEFORE and a NOTAFTER rule, the NOTAFTER rule always overrided the result of the NOTBEFORE. Let each of them be able to deny.
1 parent 2495425 commit 140331b

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

plugins/sudoers/lookup.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ sudoers_lookup_pseudo(struct sudo_nss_list *snl, struct sudoers_context *ctx,
126126
if (cs->notbefore != UNSPEC) {
127127
date_match = now < cs->notbefore ? DENY : ALLOW;
128128
}
129-
if (cs->notafter != UNSPEC) {
129+
if (date_match != DENY && cs->notafter != UNSPEC) {
130130
date_match = now > cs->notafter ? DENY : ALLOW;
131131
}
132132
/*
@@ -269,7 +269,7 @@ sudoers_lookup_check(struct sudo_nss *nss, struct sudoers_context *ctx,
269269
if (cs->notbefore != UNSPEC) {
270270
date_match = now < cs->notbefore ? DENY : ALLOW;
271271
}
272-
if (cs->notafter != UNSPEC) {
272+
if (date_match != DENY && cs->notafter != UNSPEC) {
273273
date_match = now > cs->notafter ? DENY : ALLOW;
274274
}
275275
if (date_match != DENY) {

0 commit comments

Comments
 (0)