seatd-launch: Use absolute path for seatd
We previously used execlp to execute seatd, which had the effect of searching PATH for the executable. This allowed the caller to control what executable was run, which is bad if SUID has been set. Instead, expose the absolute install path for seatd from meason as a define, and use that in a call to execv.
This commit is contained in:
parent
4091ba2c07
commit
907b75de1a
2 changed files with 8 additions and 4 deletions
|
@ -22,6 +22,8 @@ if defaultpath == ''
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
seatdpath = '@0@/@1@/seatd'.format(get_option('prefix'), get_option('bindir'))
|
||||||
|
|
||||||
cc = meson.get_compiler('c')
|
cc = meson.get_compiler('c')
|
||||||
add_project_arguments(cc.get_supported_arguments(
|
add_project_arguments(cc.get_supported_arguments(
|
||||||
[
|
[
|
||||||
|
@ -41,7 +43,8 @@ add_project_arguments(cc.get_supported_arguments(
|
||||||
'-D_XOPEN_SOURCE=700',
|
'-D_XOPEN_SOURCE=700',
|
||||||
'-D__BSD_VISIBLE',
|
'-D__BSD_VISIBLE',
|
||||||
'-DSEATD_VERSION="@0@"'.format(meson.project_version()),
|
'-DSEATD_VERSION="@0@"'.format(meson.project_version()),
|
||||||
'-DSEATD_DEFAULTPATH="@0@"'.format(defaultpath)
|
'-DSEATD_DEFAULTPATH="@0@"'.format(defaultpath),
|
||||||
|
'-DSEATD_INSTALLPATH="@0@"'.format(seatdpath),
|
||||||
]),
|
]),
|
||||||
language: 'c',
|
language: 'c',
|
||||||
)
|
)
|
||||||
|
|
|
@ -68,10 +68,11 @@ int main(int argc, char *argv[]) {
|
||||||
} else if (seatd_child == 0) {
|
} else if (seatd_child == 0) {
|
||||||
close(fds[0]);
|
close(fds[0]);
|
||||||
|
|
||||||
char pipebuf[8];
|
char pipebuf[16] = {0};
|
||||||
sprintf(pipebuf, "%d", fds[1]);
|
snprintf(pipebuf, sizeof pipebuf, "%d", fds[1]);
|
||||||
|
|
||||||
execlp("seatd", "seatd", "-n", pipebuf, "-s", sockpath, NULL);
|
char *command[] = {"seatd", "-n", pipebuf, "-s", sockpath, NULL};
|
||||||
|
execv(SEATD_INSTALLPATH, command);
|
||||||
perror("Could not start seatd");
|
perror("Could not start seatd");
|
||||||
_exit(1);
|
_exit(1);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue