summaryrefslogtreecommitdiff
path: root/sysutils/policykit/files
diff options
context:
space:
mode:
Diffstat (limited to 'sysutils/policykit/files')
-rw-r--r--sysutils/policykit/files/patch-Makefile.in11
-rw-r--r--sysutils/policykit/files/patch-polkitd_policy.c118
-rw-r--r--sysutils/policykit/files/patch-tools_Makefile.in14
-rw-r--r--sysutils/policykit/files/polkitd.in56
4 files changed, 199 insertions, 0 deletions
diff --git a/sysutils/policykit/files/patch-Makefile.in b/sysutils/policykit/files/patch-Makefile.in
new file mode 100644
index 000000000000..0c9552c020d6
--- /dev/null
+++ b/sysutils/policykit/files/patch-Makefile.in
@@ -0,0 +1,11 @@
+--- Makefile.in.orig Mon May 1 01:11:30 2006
++++ Makefile.in Mon May 1 01:11:43 2006
+@@ -231,7 +231,7 @@ sbindir = @sbindir@
+ sharedstatedir = @sharedstatedir@
+ sysconfdir = @sysconfdir@
+ target_alias = @target_alias@
+-SUBDIRS = libpolkit polkitd doc tools privileges
++SUBDIRS = libpolkit polkitd tools privileges
+ pamdir = $(sysconfdir)/pam.d
+ pam_DATA = policy-kit
+ pkgconfigdir = $(prefix)/libdata/pkgconfig
diff --git a/sysutils/policykit/files/patch-polkitd_policy.c b/sysutils/policykit/files/patch-polkitd_policy.c
new file mode 100644
index 000000000000..c633366a2b60
--- /dev/null
+++ b/sysutils/policykit/files/patch-polkitd_policy.c
@@ -0,0 +1,118 @@
+--- polkitd/policy.c.orig Tue Mar 14 07:14:33 2006
++++ polkitd/policy.c Tue May 2 01:53:06 2006
+@@ -537,13 +537,15 @@
+ int rc;
+ char *res;
+ char *buf = NULL;
+- unsigned int bufsize;
++ long bufsize;
+ struct passwd pwd;
+ struct passwd *pwdp;
+
+ res = NULL;
+
+ bufsize = sysconf (_SC_GETPW_R_SIZE_MAX);
++ if (bufsize < 0)
++ bufsize = 1024;
+ buf = g_new0 (char, bufsize);
+
+ rc = getpwuid_r (uid, &pwd, buf, bufsize, &pwdp);
+@@ -567,13 +569,15 @@
+ int rc;
+ char *res;
+ char *buf = NULL;
+- unsigned int bufsize;
++ long bufsize;
+ struct group gbuf;
+ struct group *gbufp;
+
+ res = NULL;
+
+ bufsize = sysconf (_SC_GETGR_R_SIZE_MAX);
++ if (bufsize < 0)
++ bufsize = 1024;
+ buf = g_new0 (char, bufsize);
+
+ rc = getgrgid_r (gid, &gbuf, buf, bufsize, &gbufp);
+@@ -597,13 +601,15 @@
+ int rc;
+ uid_t res;
+ char *buf = NULL;
+- unsigned int bufsize;
++ long bufsize;
+ struct passwd pwd;
+ struct passwd *pwdp;
+
+ res = (uid_t) -1;
+
+ bufsize = sysconf (_SC_GETPW_R_SIZE_MAX);
++ if (bufsize < 0)
++ bufsize = 1024;
+ buf = g_new0 (char, bufsize);
+
+ rc = getpwnam_r (username, &pwd, buf, bufsize, &pwdp);
+@@ -627,13 +633,15 @@
+ int rc;
+ gid_t res;
+ char *buf = NULL;
+- unsigned int bufsize;
++ long bufsize;
+ struct group gbuf;
+ struct group *gbufp;
+
+ res = (gid_t) -1;
+
+ bufsize = sysconf (_SC_GETGR_R_SIZE_MAX);
++ if (bufsize < 0)
++ bufsize = 1024;
+ buf = g_new0 (char, bufsize);
+
+ rc = getgrnam_r (groupname, &gbuf, buf, bufsize, &gbufp);
+@@ -649,6 +657,23 @@
+ return res;
+ }
+
++static int
++getgrouplist_ala_linux (const char *name,
++ gid_t basegid,
++ gid_t *groups,
++ int *ngroups)
++{
++ if (groups)
++ return getgrouplist (name, basegid, groups, ngroups);
++ else {
++ for (*ngroups = 1;; (*ngroups)++) {
++ gid_t _groups[*ngroups];
++ if (getgrouplist (name, basegid, _groups, ngroups) != -1)
++ return 0;
++ }
++ }
++}
++
+ PolicyResult
+ policy_get_allowed_resources_for_policy_for_uid (uid_t uid,
+ const char *policy,
+@@ -665,9 +690,9 @@
+ if ((username = policy_util_uid_to_name (uid, &default_gid)) == NULL)
+ goto out;
+
+- if (getgrouplist(username, default_gid, NULL, &num_groups) < 0) {
++ if (getgrouplist_ala_linux(username, default_gid, NULL, &num_groups) < 0) {
+ groups = (gid_t *) g_new0 (gid_t, num_groups);
+- if (getgrouplist(username, default_gid, groups, &num_groups) < 0) {
++ if (getgrouplist_ala_linux(username, default_gid, groups, &num_groups) < 0) {
+ g_warning ("getgrouplist() failed");
+ goto out;
+ }
+@@ -702,9 +727,9 @@
+ if ((username = policy_util_uid_to_name (uid, &default_gid)) == NULL)
+ goto out;
+
+- if (getgrouplist(username, default_gid, NULL, &num_groups) < 0) {
++ if (getgrouplist_ala_linux(username, default_gid, NULL, &num_groups) < 0) {
+ groups = (gid_t *) g_new0 (gid_t, num_groups);
+- if (getgrouplist(username, default_gid, groups, &num_groups) < 0) {
++ if (getgrouplist_ala_linux(username, default_gid, groups, &num_groups) < 0) {
+ g_warning ("getgrouplist() failed");
+ goto out;
+ }
diff --git a/sysutils/policykit/files/patch-tools_Makefile.in b/sysutils/policykit/files/patch-tools_Makefile.in
new file mode 100644
index 000000000000..9308ff774f36
--- /dev/null
+++ b/sysutils/policykit/files/patch-tools_Makefile.in
@@ -0,0 +1,14 @@
+--- tools/Makefile.in.orig Sun Oct 8 03:37:21 2006
++++ tools/Makefile.in Sun Oct 8 03:37:37 2006
+@@ -252,9 +252,9 @@ INCLUDES = \
+ @DBUS_CFLAGS@
+
+ polkit_is_privileged_SOURCES = polkit-is-privileged.c
+-polkit_is_privileged_LDADD = @DBUS_CFLAGS@ @GLIB_LIBS@ $(top_builddir)/libpolkit/libpolkit.la
++polkit_is_privileged_LDADD = @DBUS_LIBS@ @GLIB_LIBS@ $(top_builddir)/libpolkit/libpolkit.la
+ polkit_list_privileges_SOURCES = polkit-list-privileges.c
+-polkit_list_privileges_LDADD = @DBUS_CFLAGS@ @GLIB_LIBS@ $(top_builddir)/libpolkit/libpolkit.la
++polkit_list_privileges_LDADD = @DBUS_LIBS@ @GLIB_LIBS@ $(top_builddir)/libpolkit/libpolkit.la
+ polkit_grant_privilege_SOURCES = \
+ polkit-grant-privilege.c \
+ polkit-interface-manager-glue.h \
diff --git a/sysutils/policykit/files/polkitd.in b/sysutils/policykit/files/polkitd.in
new file mode 100644
index 000000000000..3ded54522dff
--- /dev/null
+++ b/sysutils/policykit/files/polkitd.in
@@ -0,0 +1,56 @@
+#!/bin/sh
+#
+# $FreeBSD$
+#
+# PROVIDE: polkitd
+# REQUIRE: DAEMON dbus
+#
+# Add the following line to /etc/rc.conf to enable the PolicyKit daemon:
+#
+# polkitd_enable="YES"
+#
+
+polkitd_enable=${polkitd_enable-"NO"}
+
+. %%RC_SUBR%%
+
+name=polkitd
+rcvar=`set_rcvar`
+
+command="%%PREFIX%%/sbin/polkitd"
+pidfile="/var/run/${name}/${name}.pid"
+
+start_precmd="polkitd_precmd"
+stop_postcmd="polkitd_postcmd"
+
+local_force_depend()
+{
+ _depend="$1"
+ if [ -f %%LOCALBASE%%/etc/rc.d/${_depend}.sh ]; then
+ _depend="${_depend}.sh"
+ fi
+
+ if ! %%LOCALBASE%%/etc/rc.d/${_depend} forcestatus 1>/dev/null 2>&1 &&
+ ! %%LOCALBASE%%/etc/rc.d/${_depend} forcestart; then
+ return 1
+ fi
+ return 0
+}
+
+polkitd_precmd()
+{
+ if ! checkyesno dbus_enable
+ then
+ local_force_depend dbus || return 1
+ fi
+
+ mkdir -p $(dirname $pidfile)
+}
+
+polkitd_postcmd()
+{
+ rm -f $pidfile
+}
+
+load_rc_config ${name}
+run_rc_command "$1"