standardize on envar vs envvar

This commit is contained in:
Robert Swiecki 2019-08-28 22:18:58 +02:00
parent c1e40e809c
commit e2c5c59bd3
4 changed files with 11 additions and 11 deletions

View File

@ -92,8 +92,8 @@ struct custom_option custom_opts[] = {
{ { "verbose", no_argument, NULL, 'v' }, "Verbose output" }, { { "verbose", no_argument, NULL, 'v' }, "Verbose output" },
{ { "quiet", no_argument, NULL, 'q' }, "Log warning and more important messages only" }, { { "quiet", no_argument, NULL, 'q' }, "Log warning and more important messages only" },
{ { "really_quiet", no_argument, NULL, 'Q' }, "Log fatal messages only" }, { { "really_quiet", no_argument, NULL, 'Q' }, "Log fatal messages only" },
{ { "keep_env", no_argument, NULL, 'e' }, "Pass all environment variables to the child process (default: all envvars are cleared)" }, { { "keep_env", no_argument, NULL, 'e' }, "Pass all environment variables to the child process (default: all envars are cleared)" },
{ { "env", required_argument, NULL, 'E' }, "Additional environment variable (can be used multiple times). If the envvar doesn't contain '=' (e.g. just the 'DISPLAY' string), the current envvar value will be used" }, { { "env", required_argument, NULL, 'E' }, "Additional environment variable (can be used multiple times). If the envar doesn't contain '=' (e.g. just the 'DISPLAY' string), the current envar value will be used" },
{ { "keep_caps", no_argument, NULL, 0x0501 }, "Don't drop any capabilities" }, { { "keep_caps", no_argument, NULL, 0x0501 }, "Don't drop any capabilities" },
{ { "cap", required_argument, NULL, 0x0509 }, "Retain this capability, e.g. CAP_PTRACE (can be specified multiple times)" }, { { "cap", required_argument, NULL, 0x0509 }, "Retain this capability, e.g. CAP_PTRACE (can be specified multiple times)" },
{ { "silent", no_argument, NULL, 0x0502 }, "Redirect child process' fd:0/1/2 to /dev/null" }, { { "silent", no_argument, NULL, 0x0502 }, "Redirect child process' fd:0/1/2 to /dev/null" },
@ -198,7 +198,7 @@ void addEnv(nsjconf_t* nsjconf, const std::string& env) {
} }
char* e = getenv(env.c_str()); char* e = getenv(env.c_str());
if (!e) { if (!e) {
LOG_W("Requested to use the '%s' envvar, but it's not set. It'll be ignored", LOG_W("Requested to use the '%s' envar, but it's not set. It'll be ignored",
env.c_str()); env.c_str());
return; return;
} }

View File

@ -28,13 +28,13 @@ message IdMap {
message MountPt { message MountPt {
/* Can be skipped for filesystems like 'proc' */ /* Can be skipped for filesystems like 'proc' */
optional string src = 1 [default = ""]; optional string src = 1 [default = ""];
/* Should 'src' path be prefixed with this envvar? */ /* Should 'src' path be prefixed with this envar? */
optional string prefix_src_env = 2 [default = ""]; optional string prefix_src_env = 2 [default = ""];
/* If specified, contains buffer that will be written to the dst file */ /* If specified, contains buffer that will be written to the dst file */
optional bytes src_content = 3 [default = ""]; optional bytes src_content = 3 [default = ""];
/* Mount point inside jail */ /* Mount point inside jail */
required string dst = 4 [default = ""]; required string dst = 4 [default = ""];
/* Should 'dst' path be prefixed with this envvar? */ /* Should 'dst' path be prefixed with this envar? */
optional string prefix_dst_env = 5 [default = ""]; optional string prefix_dst_env = 5 [default = ""];
/* Can be empty for mount --bind mounts */ /* Can be empty for mount --bind mounts */
optional string fstype = 6 [default = ""]; optional string fstype = 6 [default = ""];
@ -115,8 +115,8 @@ message NsJailConfig {
/* Should the current environment variables be kept /* Should the current environment variables be kept
when executing the binary */ when executing the binary */
optional bool keep_env = 19 [default = false]; optional bool keep_env = 19 [default = false];
/* EnvVars to be set before executing binaries. If the envvar doesn't contain '=' /* EnvVars to be set before executing binaries. If the envar doesn't contain '='
(e.g. just the 'DISPLAY' string), the current envvar value will be used */ (e.g. just the 'DISPLAY' string), the current envar value will be used */
repeated string envar = 20; repeated string envar = 20;
/* Should capabilities be preserved or dropped */ /* Should capabilities be preserved or dropped */

4
mnt.cc
View File

@ -478,7 +478,7 @@ static bool addMountPt(mount_t* mnt, const std::string& src, const std::string&
if (!src_env.empty()) { if (!src_env.empty()) {
const char* e = getenv(src_env.c_str()); const char* e = getenv(src_env.c_str());
if (e == NULL) { if (e == NULL) {
LOG_W("No such envvar:'%s'", src_env.c_str()); LOG_W("No such envar:'%s'", src_env.c_str());
return false; return false;
} }
mnt->src = e; mnt->src = e;
@ -488,7 +488,7 @@ static bool addMountPt(mount_t* mnt, const std::string& src, const std::string&
if (!dst_env.empty()) { if (!dst_env.empty()) {
const char* e = getenv(dst_env.c_str()); const char* e = getenv(dst_env.c_str());
if (e == NULL) { if (e == NULL) {
LOG_W("No such envvar:'%s'", dst_env.c_str()); LOG_W("No such envar:'%s'", dst_env.c_str());
return false; return false;
} }
mnt->dst = e; mnt->dst = e;

View File

@ -89,10 +89,10 @@ Log warning and more important messages only
Log fatal messages only Log fatal messages only
.TP .TP
\fB\-\-keep_env\fR|\fB\-e\fR \fB\-\-keep_env\fR|\fB\-e\fR
Pass all environment variables be passed process (default: all envvars are cleared) Pass all environment variables be passed process (default: all envars are cleared)
.TP .TP
\fB\-\-env\fR|\fB\-E\fR VALUE \fB\-\-env\fR|\fB\-E\fR VALUE
Additional environment variable (can be used multiple times). If the envvar doesn't contain '=' (e.g. just the 'DISPLAY' string), the current envvar value will be used Additional environment variable (can be used multiple times). If the envar doesn't contain '=' (e.g. just the 'DISPLAY' string), the current envar value will be used
.TP .TP
\fB\-\-keep_caps\fR \fB\-\-keep_caps\fR
Don't drop any capabilities Don't drop any capabilities