makedepend -Y. -- $(CFLAGS) -- $(SRCS)
indent:
- indent -linux -l120 -lc120 -sob -c33 -cp33 *.c *.h seccomp/*.c seccomp/*.h; rm -f *~ seccomp/*~
+ indent -linux -l100 -lc100 *.c *.h seccomp/*.c seccomp/*.h; rm -f *~ seccomp/*~
# DO NOT DELETE THIS LINE -- make depend depends on it.
LOG_HELP_BOLD("Options:");
for (int i = 0; opts[i].opt.name; i++) {
if (isprint(opts[i].opt.val)) {
- LOG_HELP_BOLD(" --%s%s%c %s", opts[i].opt.name,
- "|-", opts[i].opt.val, opts[i].opt.has_arg == required_argument ? "[val]" : "");
+ LOG_HELP_BOLD(" --%s%s%c %s", opts[i].opt.name, "|-", opts[i].opt.val,
+ opts[i].opt.has_arg == required_argument ? "[val]" : "");
} else {
LOG_HELP_BOLD(" --%s %s", opts[i].opt.name,
opts[i].opt.has_arg == required_argument ? "[val]" : "");
return cur.rlim_cur;
}
if (cmdlineIsANumber(optarg) == false) {
- LOG_F("RLIMIT %d needs a numeric or 'max'/'def' value ('%s' provided)", res, optarg);
+ LOG_F("RLIMIT %d needs a numeric or 'max'/'def' value ('%s' provided)", res,
+ optarg);
}
rlim_t val = strtoul(optarg, NULL, 0) * mul;
if (val == ULONG_MAX && errno != 0) {
int opt_index = 0;
for (;;) {
- int c = getopt_long(argc, argv, "H:c:p:i:u:g:l:t:M:Ndveh?R:B:T:I:", opts, &opt_index);
+ int c =
+ getopt_long(argc, argv, "H:c:p:i:u:g:l:t:M:Ndveh?R:B:T:I:", opts, &opt_index);
if (c == -1) {
break;
}
PLOG_E("open('/proc/self/uid_map', O_WRONLY | O_CLOEXEC)");
return false;
}
- snprintf(map, sizeof(map), "%lu %lu 1", (unsigned long)uid, (unsigned long)nsjconf->initial_uid);
+ snprintf(map, sizeof(map), "%lu %lu 1", (unsigned long)uid,
+ (unsigned long)nsjconf->initial_uid);
LOG_D("Writing '%s' to /proc/self/uid_map", map);
if (write(fd, map, strlen(map)) == -1) {
PLOG_E("write('/proc/self/uid_map', %d, '%s')", fd, map);
PLOG_E("open('/proc/self/gid_map', O_WRONLY | O_CLOEXEC)");
return false;
}
- snprintf(map, sizeof(map), "%lu %lu 1", (unsigned long)gid, (unsigned long)nsjconf->initial_gid);
+ snprintf(map, sizeof(map), "%lu %lu 1", (unsigned long)gid,
+ (unsigned long)nsjconf->initial_gid);
LOG_D("Writing '%s' to /proc/self/gid_map", map);
if (write(fd, map, strlen(map)) == -1) {
PLOG_E("write('/proc/self/gid_map', %d, '%s')", fd, map);
if (S_ISDIR(st.st_mode)) {
// Create mount_pt dir, only if the source bind mount point is also a directory
if (mkdir(mount_pt, 0700) == -1 && errno != EEXIST) {
- PLOG_E("mkdir('%s') failed. Try creating the '%s/%s' directory manually", mount_pt,
- nsjconf->chroot, dest);
+ PLOG_E("mkdir('%s') failed. Try creating the '%s/%s' directory manually",
+ mount_pt, nsjconf->chroot, dest);
goto cleanup;
}
} else {
// For everything else (files, sockets, pipes, devices), create a regular file
int fd = open(mount_pt, O_CREAT | O_RDONLY, 0700);
if (fd == -1) {
- PLOG_E("creat('%s') failed. Try creating the '%s/%s' file manually", mount_pt, nsjconf->chroot,
- dest);
+ PLOG_E("creat('%s') failed. Try creating the '%s/%s' file manually",
+ mount_pt, nsjconf->chroot, dest);
goto cleanup;
}
close(fd);
char *dest = findSpecDestination(source);
LOG_D("Remounting (bind(0x%lx)) '%s' on '%s'", flags, dest, dest);
- if (mount(dest, dest, NULL, MS_BIND | MS_NOSUID | MS_REMOUNT | MS_PRIVATE | flags, NULL) == -1) {
- PLOG_E("mount('%s', '%s', MS_BIND|MS_NOSUID|MS_REMOUNT|MS_PRIVATE|%lu)", dest, dest, flags);
+ if (mount(dest, dest, NULL, MS_BIND | MS_NOSUID | MS_REMOUNT | MS_PRIVATE | flags, NULL) ==
+ -1) {
+ PLOG_E("mount('%s', '%s', MS_BIND|MS_NOSUID|MS_REMOUNT|MS_PRIVATE|%lu)", dest, dest,
+ flags);
goto cleanup;
}
success = true;
char tmpfsdir[PATH_MAX];
snprintf(tmpfsdir, sizeof(tmpfsdir), "%s/%s", newrootdir, p->value);
if (mkdir(tmpfsdir, 0700) == -1 && errno != EEXIST) {
- PLOG_E("mkdir('%s') (for tmpfs:'%s'); You probably need to create it inside your "
- "--chroot ('%s') directory", tmpfsdir, p->value, nsjconf->chroot);
+ PLOG_E
+ ("mkdir('%s') (for tmpfs:'%s'); You probably need to create it inside your "
+ "--chroot ('%s') directory", tmpfsdir, p->value, nsjconf->chroot);
return false;
}
LOG_D("Mounting (tmpfs) '%s' at '%s'", p->value, tmpfsdir);
dprintf(log_fd, "%s", logLevels[ll].prefix);
}
if (logLevels[ll].print_funcline) {
- dprintf(log_fd, "[%s][%s][%ld] %s():%d ", timestr, logLevels[ll].descr, syscall(__NR_getpid), fn, ln);
+ dprintf(log_fd, "[%s][%s][%ld] %s():%d ", timestr, logLevels[ll].descr,
+ syscall(__NR_getpid), fn, ln);
}
va_list args;
char pid_str[512];
snprintf(pid_str, sizeof(pid_str), "%d", pid);
- char *const argv_netns[] = { SBIN_IP_PATH, "link", "set", "dev", iface, "netns", pid_str, NULL };
+ char *const argv_netns[] =
+ { SBIN_IP_PATH, "link", "set", "dev", iface, "netns", pid_str, NULL };
if (netSystem(SBIN_IP_PATH, argv_netns) == false) {
LOG_E("Couldn't put interface '%s' into NS of PID '%d'", iface, pid);
return false;
return false;
}
#else /* defined(__x86_64__) || defined(__i386__) */
- LOG_W("There's no seccomp-bpf implementation ready for the current CPU architecture. Sandbox not enabled");
+ LOG_W
+ ("There's no seccomp-bpf implementation ready for the current CPU architecture. Sandbox not enabled");
#endif /* defined(__x86_64__) || defined(__i386__) */
return true;
}
switch ((filter->jt << 8) | filter->jf) {
case (JUMP_JT << 8) | JUMP_JF:
if (labels->labels[filter->k].location == 0xffffffff) {
- fprintf(stderr, "Unresolved label: '%s'\n", labels->labels[filter->k].label);
+ fprintf(stderr, "Unresolved label: '%s'\n",
+ labels->labels[filter->k].label);
return 1;
}
filter->k = labels->labels[filter->k].location - (insn + 1);
continue;
case (LABEL_JT << 8) | LABEL_JF:
if (labels->labels[filter->k].location != 0xffffffff) {
- fprintf(stderr, "Duplicate label use: '%s'\n", labels->labels[filter->k].label);
+ fprintf(stderr, "Duplicate label use: '%s'\n",
+ labels->labels[filter->k].label);
return 1;
}
labels->labels[filter->k].location = insn;
{
struct sock_filter *end = filter + count;
for (; filter < end; ++filter)
- printf("{ code=%u,jt=%u,jf=%u,k=%u },\n", filter->code, filter->jt, filter->jf, filter->k);
+ printf("{ code=%u,jt=%u,jf=%u,k=%u },\n", filter->code, filter->jt, filter->jf,
+ filter->k);
}
LIST_FOREACH(p, &nsjconf->pids, pointers) {
time_t diff = now - p->start;
time_t left = nsjconf->tlimit ? nsjconf->tlimit - diff : 0;
- LOG_I("PID: %d, Remote host: %s, Run time: %ld sec. (time left: %ld sec.)", p->pid, p->remote_txt,
- (long)diff, (long)left);
+ LOG_I("PID: %d, Remote host: %s, Run time: %ld sec. (time left: %ld sec.)", p->pid,
+ p->remote_txt, (long)diff, (long)left);
}
}