summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/database.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/database.c b/src/database.c
index 9939573..dc43d92 100644
--- a/src/database.c
+++ b/src/database.c
@@ -1949,6 +1949,16 @@ int apk_db_run_script(struct apk_database *db, char *fn, char **argv)
exit(127);
}
+ status = setgid(getegid());
+ if (status != 0) {
+ apk_warning("%s: setgid: %s", basename(fn), strerror(errno));
+ }
+
+ status = setuid(geteuid());
+ if (status != 0) {
+ apk_warning("%s: setuid: %s", basename(fn), strerror(errno));
+ }
+
execve(fn, argv, environment);
exit(127); /* should not get here */
}