config: make defaults work correctly 1.8
authorRobert Swiecki <robert@swiecki.net>
Wed, 27 Sep 2017 13:36:05 +0000 (15:36 +0200)
committerRobert Swiecki <robert@swiecki.net>
Wed, 27 Sep 2017 13:36:05 +0000 (15:36 +0200)
config.cc
config.proto

index 3c375211a7c46c6bb790212e4c9ed3a224fc17bf..c6c84ff5873f4c87aeb28b6c9078c155d668d031 100644 (file)
--- a/config.cc
+++ b/config.cc
@@ -68,10 +68,10 @@ static bool configParseInternal(struct nsjconf_t* nsjconf,
     }
     nsjconf->chroot = DUP_IF_SET(njc, chroot_dir);
     nsjconf->is_root_rw = njc.is_root_rw();
-    nsjconf->hostname = DUP_IF_SET(njc, hostname);
-    nsjconf->cwd = DUP_IF_SET(njc, cwd);
+    nsjconf->hostname = utilStrDup(njc.hostname().c_str());
+    nsjconf->cwd = utilStrDup(njc.cwd().c_str());
     nsjconf->port = njc.port();
-    nsjconf->bindhost = DUP_IF_SET(njc, bindhost);
+    nsjconf->bindhost = utilStrDup(njc.bindhost().c_str());
     nsjconf->max_conns_per_ip = njc.max_conns_per_ip();
     nsjconf->tlimit = njc.time_limit();
     nsjconf->max_cpus = njc.max_cpus();
@@ -240,17 +240,17 @@ static bool configParseInternal(struct nsjconf_t* nsjconf,
         : NULL;
 
     nsjconf->cgroup_mem_max = njc.cgroup_mem_max();
-    nsjconf->cgroup_mem_mount = DUP_IF_SET(njc, cgroup_mem_mount);
-    nsjconf->cgroup_mem_parent = DUP_IF_SET(njc, cgroup_mem_parent);
+    nsjconf->cgroup_mem_mount = utilStrDup(njc.cgroup_mem_mount().c_str());
+    nsjconf->cgroup_mem_parent = utilStrDup(njc.cgroup_mem_parent().c_str());
     nsjconf->cgroup_pids_max = njc.cgroup_pids_max();
-    nsjconf->cgroup_pids_mount = DUP_IF_SET(njc, cgroup_pids_mount);
-    nsjconf->cgroup_pids_parent = DUP_IF_SET(njc, cgroup_pids_parent);
+    nsjconf->cgroup_pids_mount = utilStrDup(njc.cgroup_pids_mount().c_str());
+    nsjconf->cgroup_pids_parent = utilStrDup(njc.cgroup_pids_parent().c_str());
 
     nsjconf->iface_no_lo = njc.iface_no_lo();
     nsjconf->iface_vs = DUP_IF_SET(njc, macvlan_iface);
-    nsjconf->iface_vs_ip = DUP_IF_SET(njc, macvlan_vs_ip);
-    nsjconf->iface_vs_nm = DUP_IF_SET(njc, macvlan_vs_nm);
-    nsjconf->iface_vs_gw = DUP_IF_SET(njc, macvlan_vs_gw);
+    nsjconf->iface_vs_ip = utilStrDup(njc.macvlan_vs_ip().c_str());
+    nsjconf->iface_vs_nm = utilStrDup(njc.macvlan_vs_nm().c_str());
+    nsjconf->iface_vs_gw = utilStrDup(njc.macvlan_vs_gw().c_str());
 
     if (njc.has_exec_bin()) {
         char** argv = reinterpret_cast<char**>(utilCalloc(sizeof(const char*) * (njc.exec_bin().arg().size() + 2)));
index 42a94858953ca5e300878f964adcc36b19643e10..e23c29d4470c053c4a29a9fed66e9a0c5f12a4b0 100644 (file)
@@ -51,8 +51,8 @@ message MountPt
     optional bool is_dir = 10;
     /* Should the sandboxing fail if we cannot mount this resource? */
     optional bool mandatory = 11 [ default = true ];
-       /* Is it a symlink (instead of real mount point)? */
-       optional bool is_symlink = 12 [ default = false ];
+    /* Is it a symlink (instead of real mount point)? */
+    optional bool is_symlink = 12 [ default = false ];
 }
 message Exe
 {
@@ -112,7 +112,7 @@ message NsJailConfig
     optional bool keep_caps = 21 [ default = false ];
     /* Which capabilities should be preserved if keep_caps == false.
        Format: "CAP_SYS_PTRACE" */
-       repeated string cap = 63;
+    repeated string cap = 63;
     /* Should nsjail close FD=0,1,2 before executing the process */
     optional bool silent = 22 [ default = false ];
     /* Should the child process have control over terminal?