static const char *args_for_afb_daemon[] = {
"/usr/bin/afb-daemon",
+ "--daemon",
"--alias=/icons:%I",
"--port=%P",
"--rootdir=%D",
};
static const char *args_for_web_runtime[] = {
- "/usr/share/qt5/examples/webkitwidgets/browser/browser",
+ "/usr/bin/web-runtime",
"http://localhost:%P/%c?token=%S",
NULL
};
const char **slave_args;
};
+static gid_t groupid = 0;
+
static char **instantiate_arguments(const char **args, struct afm_launch_desc *desc, struct launchparam *params)
{
const char **iter, *p, *v;
}
/********* in the master child ************/
+
+ /* avoid set-gid effect */
+ setresgid(groupid, groupid, groupid);
+
/* enter the process group */
rc = setpgid(0, 0);
if (rc) {
close(mpipe[0]);
close(spipe[1]);
+ /* avoid set-gid effect */
+ setresgid(groupid, groupid, groupid);
+
/* enter the process group */
rc = setpgid(0, 0);
if (rc) {
_exit(1);
}
+static void afm_launch_init_group()
+{
+ if (!groupid) {
+ gid_t r, e, s;
+ getresgid(&r, &e, &s);
+ if (s && s != e)
+ groupid = s;
+ else
+ groupid = -1;
+ }
+}
+
int afm_launch(struct afm_launch_desc *desc, pid_t children[2])
{
char datadir[PATH_MAX];
char secret[9];
struct launchparam params;
+ /* static init */
+ afm_launch_init_group();
+
/* what launcher ? */
ikl = 0;
if (desc->type != NULL && *desc->type) {