mirror of
https://github.com/ericonr/sndio.git
synced 2024-02-18 04:45:21 -06:00
allow sndiod user to be changed, dont check its home directory
This commit is contained in:
parent
bca3235a53
commit
983c8433a2
@ -51,12 +51,16 @@
|
|||||||
/*
|
/*
|
||||||
* unprivileged user name
|
* unprivileged user name
|
||||||
*/
|
*/
|
||||||
|
#ifndef SNDIO_USER
|
||||||
#define SNDIO_USER "_sndio"
|
#define SNDIO_USER "_sndio"
|
||||||
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* priority when run as root
|
* priority when run as root
|
||||||
*/
|
*/
|
||||||
|
#ifndef SNDIO_PRIO
|
||||||
#define SNDIO_PRIO (-20)
|
#define SNDIO_PRIO (-20)
|
||||||
|
#endif
|
||||||
|
|
||||||
#define PROG_AUCAT "aucat"
|
#define PROG_AUCAT "aucat"
|
||||||
#define PROG_SNDIOD "sndiod"
|
#define PROG_SNDIOD "sndiod"
|
||||||
@ -321,14 +325,9 @@ void
|
|||||||
privdrop(void)
|
privdrop(void)
|
||||||
{
|
{
|
||||||
struct passwd *pw;
|
struct passwd *pw;
|
||||||
struct stat sb;
|
|
||||||
|
|
||||||
if ((pw = getpwnam(SNDIO_USER)) == NULL)
|
if ((pw = getpwnam(SNDIO_USER)) == NULL)
|
||||||
errx(1, "unknown user %s", SNDIO_USER);
|
errx(1, "unknown user %s", SNDIO_USER);
|
||||||
if (stat(pw->pw_dir, &sb) < 0)
|
|
||||||
err(1, "stat(\"%s\")", pw->pw_dir);
|
|
||||||
if (sb.st_uid != 0 || (sb.st_mode & 022) != 0)
|
|
||||||
errx(1, "%s has wrong permissions", pw->pw_dir);
|
|
||||||
if (setpriority(PRIO_PROCESS, 0, SNDIO_PRIO) < 0)
|
if (setpriority(PRIO_PROCESS, 0, SNDIO_PRIO) < 0)
|
||||||
err(1, "setpriority");
|
err(1, "setpriority");
|
||||||
if (setgroups(1, &pw->pw_gid) ||
|
if (setgroups(1, &pw->pw_gid) ||
|
||||||
|
Loading…
Reference in New Issue
Block a user