Bug 75187 - [patches] add support for OpenBSD
Summary: [patches] add support for OpenBSD
Status: RESOLVED FIXED
Alias: None
Product: PolicyKit
Classification: Unclassified
Component: daemon (show other bugs)
Version: unspecified
Hardware: All OpenBSD
: medium normal
Assignee: David Zeuthen (not reading bugmail)
QA Contact: David Zeuthen (not reading bugmail)
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-02-19 08:25 UTC by Antoine Jacoutot
Modified: 2015-07-20 20:17 UTC (History)
2 users (show)

See Also:
i915 platform:
i915 features:


Attachments
patch 1/3: add support for BSD authentication (6.67 KB, patch)
2014-02-19 08:26 UTC, Antoine Jacoutot
Details | Splinter Review
patch 2/3: get_kinfo_proc(): add support for OpenBSD (3.29 KB, patch)
2014-02-19 08:26 UTC, Antoine Jacoutot
Details | Splinter Review
patch 3/3: get/setnetgrent is different on OpenBSD (2.32 KB, patch)
2014-02-19 08:27 UTC, Antoine Jacoutot
Details | Splinter Review
patch 1/3: add support for BSD authentication (6.61 KB, patch)
2014-02-19 09:34 UTC, Antoine Jacoutot
Details | Splinter Review
add OpenBSD support (12.59 KB, patch)
2015-07-16 17:42 UTC, Antoine Jacoutot
Details | Splinter Review
add OpenBSD support v3 (12.21 KB, patch)
2015-07-19 00:29 UTC, Antoine Jacoutot
Details | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Antoine Jacoutot 2014-02-19 08:25:50 UTC
Hi.

This set of patches adds support for OpenBSD.
We've running with these for years but since I am a professional slacker I never
took the time to properly report them...

patch 1/3: add support for BSD authentication
(OpenBSD does not use PAM nor SHADOW)

patch 2/3: get_kinfo_proc(): add support for OpenBSD

patch 3/3: get/setnetgrent is a little bit different on OpenBSD, so adapt accordingly

Waiting on your comments.
Thank you :-)
Comment 1 Antoine Jacoutot 2014-02-19 08:26:25 UTC
Created attachment 94329 [details] [review]
patch 1/3: add support for BSD authentication
Comment 2 Antoine Jacoutot 2014-02-19 08:26:50 UTC
Created attachment 94330 [details] [review]
patch 2/3: get_kinfo_proc(): add support for OpenBSD
Comment 3 Antoine Jacoutot 2014-02-19 08:27:15 UTC
Created attachment 94331 [details] [review]
patch 3/3: get/setnetgrent is different on OpenBSD
Comment 4 Antoine Jacoutot 2014-02-19 09:34:49 UTC
Created attachment 94333 [details] [review]
patch 1/3: add support for BSD authentication
Comment 5 Antoine Jacoutot 2014-03-18 13:08:51 UTC
Any comments about these patches?
Comment 6 Antoine Jacoutot 2014-03-30 16:54:24 UTC
Any chance I could have someone interested in these?
Thanks.
Comment 7 Antoine Jacoutot 2014-11-30 21:43:38 UTC
So the reason patches are totally ignored it because of PolKit is deprecated and should not be used anymore or ...?
If it's too much of a burden, get me commit access for 10 minutes and I can take care of these ;-)
Comment 8 Colin Walters 2015-06-03 20:36:58 UTC
Yeah, there's not much reviewer bandwith on PolicyKit, sorry.  I may look at these for the next release though.
Comment 9 Antoine Jacoutot 2015-06-04 03:56:01 UTC
(In reply to Colin Walters from comment #8)
> Yeah, there's not much reviewer bandwith on PolicyKit, sorry.  I may look at
> these for the next release though.

That would be awesome, thanks Colin.
Comment 10 Antoine Jacoutot 2015-07-16 17:42:15 UTC
Created attachment 117176 [details] [review]
add OpenBSD support

Hi.

This bring the OpenBSD patch up-to-date with the most recent polkit release.
I hope we can move forward at some point...
Thank you very much in advance.
Comment 11 Miloslav Trmac 2015-07-17 20:10:45 UTC
Sorry about not responding earlier, I was not getting any bugmail for a time ☹

> +case "$host_os" in
> +  *openbsd*)
> +	AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
> +	    #include <stddef.h>
> +	    #include <netgroup.h>
> +	]], [[int r = setnetgrent (NULL);]])],
> +	[AC_DEFINE([HAVE_SETNETGRENT_RETURN], 1, [Define to 1 if setnetgrent has > return value])])
> +	;;
> +  *)
> +	AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
> +	    #include <stddef.h>
> +	    #include <netdb.h>
> +	]], [[int r = setnetgrent (NULL);]])],
> +	[AC_DEFINE([HAVE_SETNETGRENT_RETURN], 1, [Define to 1 if setnetgrent has > return value])])
> +        ;;
> +esac
Can this use AC_CHECK_HEADERS([netgroup.h]) and an #ifdef inside the test code instead? (And similarly the *authority.c files should use HAVE_NETGROUP_H.) That would prevent the two versions getting out of sync and someone accidentally breaking the OpenBSD version.

> +	if (sysctl (name, namelen, p, &sz, NULL, 0) == -1) {
> +		perror("sysctl kern.proc.pid");
> +		return FALSE;
> +	}
(The perror() can corrupt errno, and the real error reporting happens in the caller so it seems redundant anyway. Generally the coding style would favor using GError directly in this function instead of passing errno to the caller, but FreeBSD has started this way. But either case, we probably try to redirect the bug reports to you so I don’t functions in #ifdefs as a review / acceptance blockers at all.)
Comment 12 Miloslav Trmac 2015-07-17 20:12:40 UTC
> But either case, we probably try to redirect the bug reports to you so I don’t
> functions in #ifdefs as a review / acceptance blockers at all.)

…we will probably try…, …I don’t see functions”
Comment 13 Antoine Jacoutot 2015-07-19 00:29:01 UTC
(In reply to Miloslav Trmac from comment #11)
> Sorry about not responding earlier, I was not getting any bugmail for a time

No problem, I am happy someone is answering now :-)

> Can this use AC_CHECK_HEADERS([netgroup.h]) and an #ifdef inside the test
> code instead? (And similarly the *authority.c files should use
> HAVE_NETGROUP_H.) That would prevent the two versions getting out of sync
> and someone accidentally breaking the OpenBSD version.

Right, hopefully this is taken care of in my new patch.

> 
> > +	if (sysctl (name, namelen, p, &sz, NULL, 0) == -1) {
> > +		perror("sysctl kern.proc.pid");
> > +		return FALSE;
> > +	}
> (The perror() can corrupt errno, and the real error reporting happens in the
> caller so it seems redundant anyway. Generally the coding style would favor
> using GError directly in this function instead of passing errno to the
> caller, but FreeBSD has started this way. But either case, we probably try
> to redirect the bug reports to you so I don’t functions in #ifdefs as a
> review / acceptance blockers at all.)

Yeah, I don't think the error was really useful there so I just dropped it.
Thanks for the review!
Comment 14 Antoine Jacoutot 2015-07-19 00:29:35 UTC
Created attachment 117239 [details] [review]
add OpenBSD support v3
Comment 15 Miloslav Trmac 2015-07-20 19:40:16 UTC
Thanks, applied.  I have also committed a minor cleanup to use HAVE_NETGROUP_H consistently everywhere.
Comment 16 Antoine Jacoutot 2015-07-20 20:17:23 UTC
(In reply to Miloslav Trmac from comment #15)
> Thanks, applied.  I have also committed a minor cleanup to use
> HAVE_NETGROUP_H consistently everywhere.

That's awesome. Thanks Miloslav :-)


Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.