mount: Use /tmp/nsjail.[tmp|root].<orig_euid>
This commit is contained in:
parent
8c97db00c4
commit
7917222486
@ -353,6 +353,7 @@ bool cmdlineParse(int argc, char *argv[], struct nsjconf_t * nsjconf)
|
||||
.iface_vs_gw = "0.0.0.0",
|
||||
.kafel_file = NULL,
|
||||
.kafel_string = NULL,
|
||||
.orig_euid = geteuid(),
|
||||
};
|
||||
/* *INDENT-ON* */
|
||||
|
||||
|
1
common.h
1
common.h
@ -164,6 +164,7 @@ struct nsjconf_t {
|
||||
size_t cgroup_pids_max;
|
||||
FILE *kafel_file;
|
||||
char *kafel_string;
|
||||
uid_t orig_euid;
|
||||
TAILQ_HEAD(udmaplist, idmap_t) uids;
|
||||
TAILQ_HEAD(gdmaplist, idmap_t) gids;
|
||||
TAILQ_HEAD(envlist, charptr_t) envs;
|
||||
|
7
mount.c
7
mount.c
@ -254,7 +254,8 @@ static bool mountInitNsInternal(struct nsjconf_t *nsjconf)
|
||||
return false;
|
||||
}
|
||||
|
||||
const char *const destdir = "/tmp/nsjail.root";
|
||||
char destdir[PATH_MAX];
|
||||
snprintf(destdir, sizeof(destdir), "/tmp/nsjail.root.%d", (int)nsjconf->orig_euid);
|
||||
if (mkdir(destdir, 0755) == -1 && errno != EEXIST) {
|
||||
PLOG_E("Couldn't create '%s' directory. Maybe remove it?", destdir);
|
||||
return false;
|
||||
@ -263,7 +264,9 @@ static bool mountInitNsInternal(struct nsjconf_t *nsjconf)
|
||||
PLOG_E("mount('%s', 'tmpfs')", destdir);
|
||||
return false;
|
||||
}
|
||||
const char *const tmpdir = "/tmp/nsjail.tmp";
|
||||
|
||||
char tmpdir[PATH_MAX];
|
||||
snprintf(tmpdir, sizeof(tmpdir), "/tmp/nsjail.tmp.%d", (int)nsjconf->orig_euid);
|
||||
if (mkdir(tmpdir, 0755) == -1 && errno != EEXIST) {
|
||||
PLOG_E("Couldn't create '%s' directory. Maybe remove it?", tmpdir);
|
||||
return false;
|
||||
|
Loading…
Reference in New Issue
Block a user