Re: NetBSD build support

From: Kamil Rytarowski <n54_at_gmx.com>
Date: Tue, 8 Dec 2015 04:08:39 +0100
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

On 04.12.2015 11:06, Alexandre Ratchov wrote:
> 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?
> 

It doesn't build as it is.

>> +	    || +#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.
> 

I'm OK with a solution you will pickup. I took an example of fallback
to seteuid(3). Existing code snippets fallback to setreuid(2) too, but
this interface is marked as obsoleted on NetBSD.

> thanks!
> 

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2

iQIcBAEBCAAGBQJWZkm1AAoJEEuzCOmwLnZsdVgP/iVLoyFNjK+kTU5jPQ5XqR3F
5M57mxGll5+DoijF4jR9Tk5FBJNPvLYyyw5nHOYDVRTTgt22QgWU/+bgPHpuLBts
0Ma0XuUcpq/FvF51jA5qME3GtE0fEMbeTxzULOR1ysUzDJ6Q7zqgs1YiVbCWvQ8q
se/xHORLnOGOoDT3+LInfosJiALma4youSuqhJOv2UFTkLO0i1w00JCMzoysP9tI
cviHXK+4xiwUfWElMTK4SLRXC/+votcAXoNhFm3fbak6x/1rst3WjKnioRhh6RYg
u+0qLSMd7wMUZLVACXNUFKJjorSN68jGptQ6d4nHZp8FlSRi1Rxqdu+foEU8fN9R
a/DI4l64sxut9/gw5Oc0XkvRZRDQAPQZVqtgw+cabT9zE3rirO09xBbwQ+E2RFe5
7X0mRZrzk0tYcjnn8yZ6x68Gl/o3GHaNkRgoY2S9Y6KZ9bRCyzMs5ymuZjw8a0gQ
0BD/3/PphMYTcqQAmEVdtPodROizMbnygSNMYRvYpwzg9CR8kbDIs+N2jKWsXyP7
1PgR0SLGrAVhwkrbixPSrbwbDdfu07XwjiyfmbbOT7l1YWbUOCCqDaKHUR/4v06C
vJXpw6y5WukwEtuRgyPD5tmpYTg2ZXT3LMkQItQ5evRFR26Cvaozm2TwLS+/5Czl
tgHfI75f03tyE2bzxtlV
=3okd
-----END PGP SIGNATURE-----
Received on Tue Dec 08 2015 - 04:08:39 CET

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