commit - c98f2fba02115332154fb24f9ed2b6738fbd8055
commit + 5c9f2d16b466fd52a048fbfc25e3eca9652bc5ea
blob - 35ead1157402becdb2b012e23fc6ab916df05345
blob + eb0e74c69c331997480a9c29da620b104c67414c
--- nshdoas/nshdoas.c
+++ nshdoas/nshdoas.c
return AUTH_OK;
}
-static void
+static int
authuser(char *myname, char *login_style, int persist)
{
int i, fd = -1;
if (authuser_checkpass(myname, login_style) == AUTH_OK)
goto good;
}
- exit(1);
+ return 1;
good:
if (fd != -1) {
int secs = 5 * 60;
ioctl(fd, TIOCSETVERAUTH, &secs);
close(fd);
}
+ return 0;
}
int
if (action == 0) {
printf("%% No rule for %s found in /etc/doas.conf; "
"root password required\n", mypw->pw_name);
- authuser(targpw->pw_name, login_style, 0);
+ if (authuser(targpw->pw_name, login_style, 0))
+ exit(1);
rule = NULL;
} else {
if (action != PERMIT) {
if (nflag)
errx(1, "Authentication required");
- authuser(mypw->pw_name, login_style,
- rule->options & PERSIST);
+ if (authuser(mypw->pw_name, login_style,
+ rule->options & PERSIST)) {
+ printf("%% Too many authentication failures; "
+ "root password required\n");
+ if (authuser(targpw->pw_name, login_style, 0))
+ exit(1);
+ }
}
}