case "$$domain" in \
sudo) tmpfiles=; cfiles="src/*c common/*c compat/*c";; \
sudoers) \
+ echo "syntax error" > confstr.sh; \
sed -n -e 's/^badpass_message="/gettext "/p' \
-e 's/^passprompt="/gettext "/p' \
-e 's/^mailsub="/gettext "/p' configure.in \
- > confstr.sh; \
+ >> confstr.sh; \
tmpfiles=confstr.sh; \
cfiles="plugins/sudoers/*.c plugins/sudoers/auth/*.c";; \
*) echo unknown domain $$domain; continue;; \
/* a->seqno = 0; */
list2tq(&a->members, members);
if (rbinsert(aliases, a)) {
- snprintf(errbuf, sizeof(errbuf), _("Alias `%s' already defined"), name);
+ snprintf(errbuf, sizeof(errbuf), N_("Alias `%s' already defined"), name);
alias_free(a);
debug_return_str(errbuf);
}
if (sudoers_warnings && s != NULL) {
LEXTRACE("<*> ");
#ifndef TRACELEXER
- /* XXX 's' will be in sudoers locale, not user's */
- if (trace_print == NULL || trace_print == sudoers_trace_print)
- warningx(N_(">>> %s: %s near line %d <<<"), sudoers, s, sudolineno);
+ if (trace_print == NULL || trace_print == sudoers_trace_print) {
+ int oldlocale;
+ const char fmt[] = ">>> %s: %s near line %d <<<\n";
+
+ /* Warnings are displayed in the user's locale. */
+ sudoers_setlocale(SUDOERS_LOCALE_USER, &oldlocale);
+ if (sudo_conv != NULL) {
+ struct sudo_conv_message msg;
+ struct sudo_conv_reply repl;
+ char *str;
+
+ easprintf(&str, _(fmt), sudoers, _(s), sudolineno);
+
+ memset(&msg, 0, sizeof(repl));
+ memset(&repl, 0, sizeof(repl));
+ msg.msg_type = SUDO_CONV_ERROR_MSG;
+ msg.msg = str;
+ sudo_conv(1, &msg, &repl);
+ efree(str);
+ } else {
+ fprintf(stderr, _(fmt), sudoers, _(s), sudolineno);
+ }
+ sudoers_setlocale(oldlocale, NULL);
+ }
#endif
}
parse_error = true;
if (sudoers_warnings && s != NULL) {
LEXTRACE("<*> ");
#ifndef TRACELEXER
- /* XXX 's' will be in sudoers locale, not user's */
- if (trace_print == NULL || trace_print == sudoers_trace_print)
- warningx(N_(">>> %s: %s near line %d <<<"), sudoers, s, sudolineno);
+ if (trace_print == NULL || trace_print == sudoers_trace_print) {
+ int oldlocale;
+ const char fmt[] = ">>> %s: %s near line %d <<<\n";
+
+ /* Warnings are displayed in the user's locale. */
+ sudoers_setlocale(SUDOERS_LOCALE_USER, &oldlocale);
+ if (sudo_conv != NULL) {
+ struct sudo_conv_message msg;
+ struct sudo_conv_reply repl;
+ char *str;
+
+ easprintf(&str, _(fmt), sudoers, _(s), sudolineno);
+
+ memset(&msg, 0, sizeof(repl));
+ memset(&repl, 0, sizeof(repl));
+ msg.msg_type = SUDO_CONV_ERROR_MSG;
+ msg.msg = str;
+ sudo_conv(1, &msg, &repl);
+ efree(str);
+ } else {
+ fprintf(stderr, _(fmt), sudoers, _(s), sudolineno);
+ }
+ sudoers_setlocale(oldlocale, NULL);
+ }
#endif
}
parse_error = true;
if (!(dir = opendir(dirpath))) {
if (errno != ENOENT) {
- char *errbuf;
- if (asprintf(&errbuf, _("%s: %s"), dirpath, strerror(errno)) != -1) {
- sudoerserror(errbuf);
- free(errbuf);
- } else {
- sudoerserror(strerror(errno));
- }
+ warning("%s", dirpath);
+ sudoerserror(NULL);
}
goto done;
}
/* push current state onto stack */
if (idepth >= istacksize) {
if (idepth > MAX_SUDOERS_DEPTH) {
- sudoerserror(_("too many levels of includes"));
+ sudoerserror(N_("too many levels of includes"));
debug_return_bool(false);
}
istacksize += SUDOERS_STACK_INCREMENT;
istack = (struct include_stack *) realloc(istack,
sizeof(*istack) * istacksize);
if (istack == NULL) {
- sudoerserror(strerror(errno));
+ warning(NULL);
+ sudoerserror(NULL);
debug_return_bool(false);
}
}
len += (int)(ep - cp);
path = pp = malloc(len + dirlen + 1);
if (path == NULL) {
- sudoerserror(strerror(errno));
+ warning(NULL);
+ sudoerserror(NULL);
debug_return_str(NULL);
}
if (dirlen) {
if (!(dir = opendir(dirpath))) {
if (errno != ENOENT) {
- char *errbuf;
- if (asprintf(&errbuf, _("%s: %s"), dirpath, strerror(errno)) != -1) {
- sudoerserror(errbuf);
- free(errbuf);
- } else {
- sudoerserror(strerror(errno));
- }
+ warning("%s", dirpath);
+ sudoerserror(NULL);
}
goto done;
}
/* push current state onto stack */
if (idepth >= istacksize) {
if (idepth > MAX_SUDOERS_DEPTH) {
- sudoerserror(_("too many levels of includes"));
+ sudoerserror(N_("too many levels of includes"));
debug_return_bool(false);
}
istacksize += SUDOERS_STACK_INCREMENT;
istack = (struct include_stack *) realloc(istack,
sizeof(*istack) * istacksize);
if (istack == NULL) {
- sudoerserror(strerror(errno));
+ warning(NULL);
+ sudoerserror(NULL);
debug_return_bool(false);
}
}
len += (int)(ep - cp);
path = pp = malloc(len + dirlen + 1);
if (path == NULL) {
- sudoerserror(strerror(errno));
+ warning(NULL);
+ sudoerserror(NULL);
debug_return_str(NULL);
}
if (dirlen) {
dst = olen ? realloc(sudoerslval.string, olen + len + 1) : malloc(len + 1);
if (dst == NULL) {
- sudoerserror(strerror(errno));
+ warning(NULL);
+ sudoerserror(NULL);
debug_return_bool(false);
}
sudoerslval.string = dst;
dst = sudoerslval.command.cmnd = (char *) malloc(len + 1);
if (sudoerslval.command.cmnd == NULL) {
- sudoerserror(strerror(errno));
+ warning(NULL);
+ sudoerserror(NULL);
debug_return_bool(false);
}
(char *) malloc(arg_size);
if (p == NULL) {
efree(sudoerslval.command.args);
- sudoerserror(strerror(errno));
+ warning(NULL);
+ sudoerserror(NULL);
debug_return_bool(false);
} else
sudoerslval.command.args = p;
if (addspace)
*p++ = ' ';
if (strlcpy(p, s, arg_size - (p - sudoerslval.command.args)) != len) {
- sudoerserror(_("fill_args: buffer overflow")); /* paranoia */
+ warningx(N_("fill_args: buffer overflow")); /* paranoia */
+ sudoerserror(NULL);
debug_return_bool(false);
}
arg_len = new_len;