Commit 361b4fe7 by Serge Hallyn Committed by Stéphane Graber

lxc-user-nic: be more paranoid

Just setting path isn't enough. Clear the whole environment, and only set $PATH. It's all we need - ovs-vsctl is running fine this way. Signed-off-by: 's avatarSerge Hallyn <serge.hallyn@ubuntu.com> Acked-by: 's avatarStéphane Graber <stgraber@ubuntu.com>
parent 8fefbee4
...@@ -590,7 +590,11 @@ int main(int argc, char *argv[]) ...@@ -590,7 +590,11 @@ int main(int argc, char *argv[])
char *vethname = NULL; char *vethname = NULL;
int pid; int pid;
/* set a sane path, because we are setuid-root */ /* set a sane env, because we are setuid-root */
if (clearenv() < 0) {
fprintf(stderr, "Failed to clear environment");
exit(1);
}
if (setenv("PATH", "/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin", 1) < 0) { if (setenv("PATH", "/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin", 1) < 0) {
fprintf(stderr, "Failed to set PATH, exiting\n"); fprintf(stderr, "Failed to set PATH, exiting\n");
exit(1); exit(1);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment