Re: NetBSD build support

From: Alexandre Ratchov <alex_at_caoua.org>
Date: Fri, 4 Dec 2015 11:06:10 +0100
On Sat, Nov 28, 2015 at 11:48:34PM +0100, Kamil Rytarowski wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA256
> 
> I'm attaching a patch (against the CVS version) to make sndio
> buildable on NetBSD.

thanks you for the diff, comments inlined:

> I tested it on -current, it should work on all supported versions.
> 
> The current version ships with native strtonum(3) hidden under the
> _OPENBSD_SOURCE namespace, but since there is no function discovery,
> using just the builtin is fine too.

perfect

> +	NetBSD)
> +		sun=no
>

I guess NetBSD and OpenBSD APIs diverged too much and the audio
bits don't build any more, do they?

> +	    ||
> +#if HAVE_SETRESUID
> +	    setresuid(pw->pw_uid, pw->pw_uid, pw->pw_uid)
> +#else
> +	    seteuid(pw->pw_gid)
> +#endif

It took me some time trying to understand setxxxuid() functions,
and still don't 100% the logic...

seteuid() would set the effective userid only, allowing the process
to revert back root priviliges.  We want all user-IDs to be set.
AFAIU, this is done with setuid().  Could you confirm that this
works on NetBSD ?

I mean: if sndiod is started by root, setuid() must succeed, and
successive calls to seteuid(0) must fail.

thanks!
Received on Fri Dec 04 2015 - 11:06:10 CET

This archive was generated by hypermail 2.3.0 : Tue Aug 09 2022 - 16:23:47 CEST