dynamic parameter filter bug fixes

This commit is contained in:
Cristian Toader 2013-07-24 17:15:57 +03:00
parent 962d814e52
commit abe082e7d0
2 changed files with 17 additions and 0 deletions

View File

@ -192,6 +192,7 @@ char*
get_prot_param(char *param)
{
int i, filter_size;
ParFilterDynamic *elem;
if (param == NULL)
return NULL;
@ -209,6 +210,13 @@ get_prot_param(char *param)
}
}
for (elem = filter_dynamic; elem != NULL; elem = elem->next) {
if (elem->prot && elem->ptype == PARAM_PTR
&& !strncmp(param, (char*)(elem->param), MAX_PARAM_LEN)) {
return (char*)(elem->param);
}
}
log_warn(LD_BUG, "(Sandbox) Parameter %s not found", param);
return param;
}
@ -272,6 +280,13 @@ add_dynamic_param_filter(char *syscall, char ptype, char pindex, intptr_t val)
break;
}
// TODO: and so on ..?
if (!strcmp(syscall, "open")) {
(*elem)->syscall = SCMP_SYS(open);
} else if (!strcmp(syscall, "rt_sigaction")) {
(*elem)->syscall = SCMP_SYS(rt_sigaction);
}
return 0;
}

View File

@ -81,6 +81,8 @@ typedef struct pfd_elem ParFilterDynamic;
void sandbox_set_debugging_fd(int fd);
int tor_global_sandbox(void);
char* get_prot_param(char *param);
int add_dynamic_param_filter(char *syscall, char ptype, char pindex,
intptr_t val);
#endif /* SANDBOX_H_ */