mirror of
https://github.com/vincentmli/bpfire.git
synced 2026-04-28 11:43:25 +02:00
misc-progs: Call unpriv_system commands in a shell
Reported-by: Arne Fitzenreiter <arne_f@ipfire.org> Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
This commit is contained in:
@@ -144,7 +144,14 @@ int safe_system(char* command) {
|
|||||||
/* Much like safe_system but lets you specify a non-root uid and gid to run
|
/* Much like safe_system but lets you specify a non-root uid and gid to run
|
||||||
* the command as */
|
* the command as */
|
||||||
int unpriv_system(char* command, uid_t uid, gid_t gid) {
|
int unpriv_system(char* command, uid_t uid, gid_t gid) {
|
||||||
return system_core(command, NULL, uid, gid, "unpriv_system");
|
char* argv[4] = {
|
||||||
|
"/bin/sh",
|
||||||
|
"-c",
|
||||||
|
command,
|
||||||
|
NULL,
|
||||||
|
};
|
||||||
|
|
||||||
|
return system_core(argv[0], argv, uid, gid, "unpriv_system");
|
||||||
}
|
}
|
||||||
|
|
||||||
/* General routine to initialise a setuid root program, and put the
|
/* General routine to initialise a setuid root program, and put the
|
||||||
|
|||||||
Reference in New Issue
Block a user