- /* Become root if we are not already to avoid user interference */
- set_perms(PERM_ROOT|PERM_NOEXIT);
+ /* Log messages should be in the sudoers locale. */
+ sudoers_setlocale(SUDOERS_LOCALE_SUDOERS, &oldlocale);
+
+ /* Expand printf-style format + args (with a special case). */
+ if (fmt == INCORRECT_PASSWORD_ATTEMPT) {
+ int tries = va_arg(ap, int);
+ easprintf(&message, ngettext("%d incorrect password attempt",
+ "%d incorrect password attempts", tries), tries);
+ } else {
+ evasprintf(&message, _(fmt), ap);
+ }