if (seteuid(ROOT_UID) != 0)
error(1, "seteuid(ROOT_UID)");
}
+ if (setegid(egid) != 0)
+ error(1, "setegid(%d)", (int)egid);
if (ngroups != -1) {
- if (setgroups(ngroups, groups) != 0)
+ if (sudo_setgroups(ngroups, groups) != 0)
error(1, "setgroups");
}
- if (setegid(egid) != 0)
- error(1, "setegid(%d)", (int)egid);
if (euid != ROOT_UID) {
if (seteuid(euid) != 0)
error(1, "seteuid(%d)", (int)euid);
* We will change the euid as needed below.
*/
if (setuid(ROOT_UID) != 0) {
- warning("unable to change to uid to root (%u)", ROOT_UID);
+ warning(_("unable to change uid to root (%u)"), ROOT_UID);
return 1;
}
editor_argc++;
}
if (nfiles == 0) {
- warningx("plugin error: missing file list for sudoedit");
+ warningx(_("plugin error: missing file list for sudoedit"));
return 1;
}
if (rc)
warning("%s", files[i]);
else
- warningx("%s: not a regular file", files[i]);
+ warningx(_("%s: not a regular file"), files[i]);
if (ofd != -1)
close(ofd);
continue;
if (nwritten == -1)
warning("%s", tf[j].tfile);
else
- warningx("%s: short write", tf[j].tfile);
+ warningx(_("%s: short write"), tf[j].tfile);
goto cleanup;
}
}
if (rc)
warning("%s", tf[i].tfile);
else
- warningx("%s: not a regular file", tf[i].tfile);
- warningx("%s left unmodified", tf[i].ofile);
+ warningx(_("%s: not a regular file"), tf[i].tfile);
+ warningx(_("%s left unmodified"), tf[i].ofile);
if (tfd != -1)
close(tfd);
continue;
*/
timevalsub(&tv1, &tv2);
if (timevalisset(&tv2)) {
- warningx("%s unchanged", tf[i].ofile);
+ warningx(_("%s unchanged"), tf[i].ofile);
unlink(tf[i].tfile);
close(tfd);
continue;
switch_user(ROOT_UID, user_details.egid,
user_details.ngroups, user_details.groups);
if (ofd == -1) {
- warning("unable to write to %s", tf[i].ofile);
- warningx("contents of edit session left in %s", tf[i].tfile);
+ warning(_("unable to write to %s"), tf[i].ofile);
+ warningx(_("contents of edit session left in %s"), tf[i].tfile);
close(tfd);
continue;
}
if (nwritten == -1)
warning("%s", tf[i].ofile);
else
- warningx("%s: short write", tf[i].ofile);
+ warningx(_("%s: short write"), tf[i].ofile);
break;
}
}
/* success, got EOF */
unlink(tf[i].tfile);
} else if (nread < 0) {
- warning("unable to read temporary file");
- warningx("contents of edit session left in %s", tf[i].tfile);
+ warning(_("unable to read temporary file"));
+ warningx(_("contents of edit session left in %s"), tf[i].tfile);
} else {
- warning("unable to write to %s", tf[i].ofile);
- warningx("contents of edit session left in %s", tf[i].tfile);
+ warning(_("unable to write to %s"), tf[i].ofile);
+ warningx(_("contents of edit session left in %s"), tf[i].tfile);
}
close(ofd);
}