aboutsummaryrefslogtreecommitdiff
path: root/sysutils/policykit
diff options
context:
space:
mode:
authorJoe Marcus Clarke <marcus@FreeBSD.org>2006-10-14 08:35:50 +0000
committerJoe Marcus Clarke <marcus@FreeBSD.org>2006-10-14 08:35:50 +0000
commitf1bb12de8e50bf76ae21f37debda60994ec7fd99 (patch)
tree1671d4beef381f12d939e34b344eb385a3af4f19 /sysutils/policykit
parent29adee7bb42244f34736c5c24ed18a9b269d0925 (diff)
downloadports-f1bb12de8e50bf76ae21f37debda60994ec7fd99.tar.gz
ports-f1bb12de8e50bf76ae21f37debda60994ec7fd99.zip
Notes
Diffstat (limited to 'sysutils/policykit')
-rw-r--r--sysutils/policykit/Makefile40
-rw-r--r--sysutils/policykit/distinfo3
-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
-rw-r--r--sysutils/policykit/pkg-descr4
-rw-r--r--sysutils/policykit/pkg-install38
-rw-r--r--sysutils/policykit/pkg-plist19
9 files changed, 303 insertions, 0 deletions
diff --git a/sysutils/policykit/Makefile b/sysutils/policykit/Makefile
new file mode 100644
index 000000000000..68a6b9c12107
--- /dev/null
+++ b/sysutils/policykit/Makefile
@@ -0,0 +1,40 @@
+# New ports collection makefile for: PolicyKit
+# Date Created: 01 May 2006
+# Whom: Joe Marcus Clarke <marcus@FreeBSD.org>
+#
+# $FreeBSD$
+# $MCom: ports/sysutils/policykit/Makefile,v 1.12 2006/10/07 19:45:38 marcus Exp $
+#
+
+PORTNAME= policykit
+PORTVERSION= 0.1.20060514
+PORTREVISION= 2
+CATEGORIES= sysutils gnome
+MASTER_SITES= http://www.marcuscom.com/downloads/
+DISTNAME= PolicyKit-${PORTVERSION}
+
+MAINTAINER= gnome@FreeBSD.org
+COMMENT= Framework for controlling access to system-wide components
+
+LIB_DEPENDS= dbus-glib-1.2:${PORTSDIR}/devel/dbus-glib
+
+USE_BZIP2= yes
+USE_GNOME= gnomehack gnometarget
+USE_GMAKE= yes
+GNU_CONFIGURE= yes
+USE_LDCONFIG= yes
+CONFIGURE_ARGS= --disable-gtk-doc \
+ --with-pid-file=/var/run/polkitd/polkitd.pid \
+ --with-pam-include=system
+CONFIGURE_ENV= CPPFLAGS="-I${LOCALBASE}/include" \
+ LDFLAGS="-L${LOCALBASE}/lib" \
+ GTKDOC="false"
+
+USE_RC_SUBR= polkitd
+
+post-install:
+.if !defined(PACKAGE_BUILDING)
+ @${SETENV} PKG_PREFIX=${PREFIX} ${SH} ${PKGINSTALL} ${PKGNAME} POST-INSTALL
+.endif
+
+.include <bsd.port.mk>
diff --git a/sysutils/policykit/distinfo b/sysutils/policykit/distinfo
new file mode 100644
index 000000000000..2bf4052122f3
--- /dev/null
+++ b/sysutils/policykit/distinfo
@@ -0,0 +1,3 @@
+MD5 (PolicyKit-0.1.20060514.tar.bz2) = f81ac5fb28603a4b419fca6c4efc027a
+SHA256 (PolicyKit-0.1.20060514.tar.bz2) = d9015a69d63902b091475ad2cad1b6fe012cf0e8fead6603cf822c2033c9d552
+SIZE (PolicyKit-0.1.20060514.tar.bz2) = 333800
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"
diff --git a/sysutils/policykit/pkg-descr b/sysutils/policykit/pkg-descr
new file mode 100644
index 000000000000..5c002310127b
--- /dev/null
+++ b/sysutils/policykit/pkg-descr
@@ -0,0 +1,4 @@
+PolicyKit is a framework for defining policy for system-wide components and
+for desktop pieces to configure it. It is used by HAL.
+
+WWW: http://www.freedesktop.org/Software/hal
diff --git a/sysutils/policykit/pkg-install b/sysutils/policykit/pkg-install
new file mode 100644
index 000000000000..7c7d4baca2c9
--- /dev/null
+++ b/sysutils/policykit/pkg-install
@@ -0,0 +1,38 @@
+#!/bin/sh
+
+case $2 in
+POST-INSTALL)
+ USER=polkit
+ GROUP=${USER}
+ UID=559
+ GID=${UID}
+ PW=/usr/sbin/pw
+
+ if ${PW} group show "${GROUP}" 2>/dev/null; then
+ echo "You already have a group \"${GROUP}\", so I will use it."
+ else
+ if ${PW} groupadd ${GROUP} -g ${GID}; then
+ echo "Added group \"${GROUP}\"."
+ else
+ echo "Adding group \"${GROUP}\" failed..."
+ exit 1
+ fi
+ fi
+
+ if ${PW} user show "${USER}" 2>/dev/null; then
+ echo "You already have a user \"${USER}\", so I will use it."
+ else
+ if ${PW} useradd ${USER} -u ${UID} -g ${GROUP} -h - \
+ -d "/nonexistent" -s /sbin/nologin -c "PolicyKit Daemon User"
+ then
+ echo "Added user \"${USER}\"."
+ else
+ echo "Adding user \"${USER}\" failed..."
+ exit 1
+ fi
+ fi
+
+ /usr/bin/install -d -o ${USER} -g ${GROUP} /var/run/polkitd
+ exit 0
+ ;;
+esac
diff --git a/sysutils/policykit/pkg-plist b/sysutils/policykit/pkg-plist
new file mode 100644
index 000000000000..66c27dc14847
--- /dev/null
+++ b/sysutils/policykit/pkg-plist
@@ -0,0 +1,19 @@
+bin/polkit-grant-privilege
+bin/polkit-is-privileged
+bin/polkit-list-privileges
+bin/polkit-revoke-privilege
+etc/PolicyKit/privilege.d/desktop-console.privilege
+etc/dbus-1/system.d/PolicyKit.conf
+etc/pam.d/policy-kit
+include/libpolkit/libpolkit.h
+lib/libpolkit.a
+lib/libpolkit.la
+lib/libpolkit.so
+lib/libpolkit.so.0
+libdata/pkgconfig/polkit.pc
+sbin/polkitd
+@dirrm include/libpolkit
+@dirrm etc/PolicyKit/privilege.d
+@dirrm etc/PolicyKit
+@unexec rm -f /var/run/polkitd/polkitd.pid 2>/dev/null || true
+@unexec rmdir /var/run/polkitd 2>/dev/null || true