php - Block system commands in a C program -
i compiling , executing c program uses php system command on windows xp server.
if c program contains system command system("shutdown -a")
or system command, turns system down.
i want these kinds of commands denied. how show "permission denied" output when program tries run system command?
here code.
php script contains-
system(gcc code.c -o out); system(out.exe);
if c program contains-
int main() { system("shutdown -r"); }
is there way block commands being run?
windows runas command
you might able use windows runas
command run command specific user. , in user's profile, set list of white listed commands. https://superuser.com/questions/42537/is-there-any-sudo-command-for-windows
roll own command white list
create list of commands in php or c allowed run through c program, , if command isn't on approved list, denied. or of live dangerously, create black list, , define bunch of things don't want run.