diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/database.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/src/database.c b/src/database.c index 9864543..b916d59 100644 --- a/src/database.c +++ b/src/database.c @@ -1949,6 +1949,19 @@ int apk_db_run_script(struct apk_database *db, char *fn, char **argv) exit(127); } + if (getuid() != geteuid()) + { + if (setgid(getegid()) != 0) { + apk_error("%s: setgid: %s", basename(fn), strerror(errno)); + exit(127); + } + + if (setuid(geteuid()) != 0) { + apk_error("%s: setuid: %s", basename(fn), strerror(errno)); + exit(127); + } + } + execve(fn, argv, environment); exit(127); /* should not get here */ } |