Display warning/error messages in the user's locale.
This commit is contained in:
48
src/sudo.c
48
src/sudo.c
@@ -859,38 +859,38 @@ set_project(struct passwd *pw)
|
||||
case SETPROJ_ERR_TASK:
|
||||
switch (errno) {
|
||||
case EAGAIN:
|
||||
warningx(_("resource control limit has been reached"));
|
||||
warningx(N_("resource control limit has been reached"));
|
||||
break;
|
||||
case ESRCH:
|
||||
warningx(_("user \"%s\" is not a member of project \"%s\""),
|
||||
warningx(N_("user \"%s\" is not a member of project \"%s\""),
|
||||
pw->pw_name, proj.pj_name);
|
||||
break;
|
||||
case EACCES:
|
||||
warningx(_("the invoking task is final"));
|
||||
warningx(N_("the invoking task is final"));
|
||||
break;
|
||||
default:
|
||||
warningx(_("could not join project \"%s\""), proj.pj_name);
|
||||
warningx(N_("could not join project \"%s\""), proj.pj_name);
|
||||
}
|
||||
case SETPROJ_ERR_POOL:
|
||||
switch (errno) {
|
||||
case EACCES:
|
||||
warningx(_("no resource pool accepting default bindings "
|
||||
warningx(N_("no resource pool accepting default bindings "
|
||||
"exists for project \"%s\""), proj.pj_name);
|
||||
break;
|
||||
case ESRCH:
|
||||
warningx(_("specified resource pool does not exist for "
|
||||
warningx(N_("specified resource pool does not exist for "
|
||||
"project \"%s\""), proj.pj_name);
|
||||
break;
|
||||
default:
|
||||
warningx(_("could not bind to default resource pool for "
|
||||
warningx(N_("could not bind to default resource pool for "
|
||||
"project \"%s\""), proj.pj_name);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
if (errval <= 0) {
|
||||
warningx(_("setproject failed for project \"%s\""), proj.pj_name);
|
||||
warningx(N_("setproject failed for project \"%s\""), proj.pj_name);
|
||||
} else {
|
||||
warningx(_("warning, resource control assignment failed for "
|
||||
warningx(N_("warning, resource control assignment failed for "
|
||||
"project \"%s\""), proj.pj_name);
|
||||
}
|
||||
}
|
||||
@@ -958,7 +958,7 @@ exec_setup(struct command_details *details, const char *ptyname, int ptyfd)
|
||||
*/
|
||||
lc = login_getclass((char *)details->login_class);
|
||||
if (!lc) {
|
||||
warningx(_("unknown login class %s"), details->login_class);
|
||||
warningx(N_("unknown login class %s"), details->login_class);
|
||||
errno = ENOENT;
|
||||
goto done;
|
||||
}
|
||||
@@ -972,10 +972,10 @@ exec_setup(struct command_details *details, const char *ptyname, int ptyfd)
|
||||
}
|
||||
if (setusercontext(lc, details->pw, details->pw->pw_uid, flags)) {
|
||||
if (details->pw->pw_uid != ROOT_UID) {
|
||||
warning(_("unable to set user context"));
|
||||
warning(N_("unable to set user context"));
|
||||
goto done;
|
||||
} else
|
||||
warning(_("unable to set user context"));
|
||||
warning(N_("unable to set user context"));
|
||||
}
|
||||
}
|
||||
#endif /* HAVE_LOGIN_CAP_H */
|
||||
@@ -987,27 +987,27 @@ exec_setup(struct command_details *details, const char *ptyname, int ptyfd)
|
||||
if (!ISSET(details->flags, CD_PRESERVE_GROUPS)) {
|
||||
if (details->ngroups >= 0) {
|
||||
if (sudo_setgroups(details->ngroups, details->groups) < 0) {
|
||||
warning(_("unable to set supplementary group IDs"));
|
||||
warning(N_("unable to set supplementary group IDs"));
|
||||
goto done;
|
||||
}
|
||||
}
|
||||
}
|
||||
#ifdef HAVE_SETEUID
|
||||
if (ISSET(details->flags, CD_SET_EGID) && setegid(details->egid)) {
|
||||
warning(_("unable to set effective gid to runas gid %u"),
|
||||
warning(N_("unable to set effective gid to runas gid %u"),
|
||||
(unsigned int)details->egid);
|
||||
goto done;
|
||||
}
|
||||
#endif
|
||||
if (ISSET(details->flags, CD_SET_GID) && setgid(details->gid)) {
|
||||
warning(_("unable to set gid to runas gid %u"),
|
||||
warning(N_("unable to set gid to runas gid %u"),
|
||||
(unsigned int)details->gid);
|
||||
goto done;
|
||||
}
|
||||
|
||||
if (ISSET(details->flags, CD_SET_PRIORITY)) {
|
||||
if (setpriority(PRIO_PROCESS, 0, details->priority) != 0) {
|
||||
warning(_("unable to set process priority"));
|
||||
warning(N_("unable to set process priority"));
|
||||
goto done;
|
||||
}
|
||||
}
|
||||
@@ -1015,26 +1015,26 @@ exec_setup(struct command_details *details, const char *ptyname, int ptyfd)
|
||||
(void) umask(details->umask);
|
||||
if (details->chroot) {
|
||||
if (chroot(details->chroot) != 0 || chdir("/") != 0) {
|
||||
warning(_("unable to change root to %s"), details->chroot);
|
||||
warning(N_("unable to change root to %s"), details->chroot);
|
||||
goto done;
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef HAVE_SETRESUID
|
||||
if (setresuid(details->uid, details->euid, details->euid) != 0) {
|
||||
warning(_("unable to change to runas uid (%u, %u)"), details->uid,
|
||||
warning(N_("unable to change to runas uid (%u, %u)"), details->uid,
|
||||
details->euid);
|
||||
goto done;
|
||||
}
|
||||
#elif HAVE_SETREUID
|
||||
if (setreuid(details->uid, details->euid) != 0) {
|
||||
warning(_("unable to change to runas uid (%u, %u)"),
|
||||
warning(N_("unable to change to runas uid (%u, %u)"),
|
||||
(unsigned int)details->uid, (unsigned int)details->euid);
|
||||
goto done;
|
||||
}
|
||||
#else
|
||||
if (seteuid(details->euid) != 0 || setuid(details->euid) != 0) {
|
||||
warning(_("unable to change to runas uid (%u, %u)"), details->uid,
|
||||
warning(N_("unable to change to runas uid (%u, %u)"), details->uid,
|
||||
details->euid);
|
||||
goto done;
|
||||
}
|
||||
@@ -1048,7 +1048,7 @@ exec_setup(struct command_details *details, const char *ptyname, int ptyfd)
|
||||
if (details->chroot || strcmp(details->cwd, user_details.cwd) != 0) {
|
||||
/* Note: cwd is relative to the new root, if any. */
|
||||
if (chdir(details->cwd) != 0) {
|
||||
warning(_("unable to change directory to %s"), details->cwd);
|
||||
warning(N_("unable to change directory to %s"), details->cwd);
|
||||
goto done;
|
||||
}
|
||||
}
|
||||
@@ -1132,7 +1132,7 @@ run_command(struct command_details *details)
|
||||
exitcode = WTERMSIG(cstat.val) | 128;
|
||||
break;
|
||||
default:
|
||||
warningx(_("unexpected child termination condition: %d"), cstat.type);
|
||||
warningx(N_("unexpected child termination condition: %d"), cstat.type);
|
||||
break;
|
||||
}
|
||||
debug_return_int(exitcode);
|
||||
@@ -1193,7 +1193,7 @@ policy_list(struct plugin_container *plugin, int argc, char * const argv[],
|
||||
{
|
||||
debug_decl(policy_list, SUDO_DEBUG_PCOMM)
|
||||
if (plugin->u.policy->list == NULL) {
|
||||
warningx(_("policy plugin %s does not support listing privileges"),
|
||||
warningx(N_("policy plugin %s does not support listing privileges"),
|
||||
plugin->name);
|
||||
debug_return_bool(false);
|
||||
}
|
||||
@@ -1205,7 +1205,7 @@ policy_validate(struct plugin_container *plugin)
|
||||
{
|
||||
debug_decl(policy_validate, SUDO_DEBUG_PCOMM)
|
||||
if (plugin->u.policy->validate == NULL) {
|
||||
warningx(_("policy plugin %s does not support the -v option"),
|
||||
warningx(N_("policy plugin %s does not support the -v option"),
|
||||
plugin->name);
|
||||
debug_return_bool(false);
|
||||
}
|
||||
|
Reference in New Issue
Block a user