Skip to content

Commit

Permalink
ymp sandbox improvement (not completed yet)
Browse files Browse the repository at this point in the history
  • Loading branch information
sulincix committed Oct 2, 2023
1 parent f14dc16 commit 145f205
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 8 deletions.
2 changes: 1 addition & 1 deletion src/ccode/sandbox.c
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ int sandbox(char** args){
unshare(CLONE_VM);
unshare(CLONE_NEWPID| CLONE_VFORK | SIGCHLD);
char *envp[] = {"TERM=linux", "PATH=/usr/bin:/bin:/usr/sbin:/sbin", NULL};
exit(execvpe("/proc/self/exe",args,envp));
exit(operation_main_raw("exec",args));
}
}
exit(127);
Expand Down
8 changes: 1 addition & 7 deletions src/operations/utility/run-sandbox.vala
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,7 @@ public int run_sandbox_main (string[] args) {
sandbox_uid = int.parse (get_value ("uid"));
sandbox_gid = int.parse (get_value ("gid"));
info (_ ("Execute sandbox :%s").printf (join (" ", args)));
string[] argv = {};
argv += "ymp";
argv += "exec";
foreach (string i in args) {
argv += i;
}
int status = sandbox (argv);
int status = sandbox (args);
return status / 256;
}

Expand Down
15 changes: 15 additions & 0 deletions src/ymp.vala
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,21 @@ private void unlock_operation () {
unblock_sigint ();
}

public int operation_main_raw(string type, string[] args){
info (_ ("RUN (RAW):") + type + ":" + join (" ", args));
foreach (operation op in ops) {
foreach (string name in op.names) {
if (type == name) {
set_value_readonly ("OPERATION", op.help.name);
return op.callback (args);
}
}
}
warning (_ ("Invalid operation name: %s").printf (type));
return 0;

}

public int operation_main (string type, string[] args) {
info (_ ("RUN:") + type + ":" + join (" ", args));
foreach (operation op in ops) {
Expand Down

0 comments on commit 145f205

Please sign in to comment.