From 26fb5caadf1e867534d21f3f43bef498fd7fd4ab Mon Sep 17 00:00:00 2001
From: Cecil Hugh Watson <knoppmyth@gmail.com>
Date: Sat, 8 Aug 2009 21:03:18 -0700
Subject: Policykit:Updated to latest.

---
 abs/extra-testing/policykit/PKGBUILD               | 31 ++++++++++--------
 abs/extra-testing/policykit/entry-leak.patch       | 37 ++++++++++++++++++++++
 abs/extra-testing/policykit/policykit.install      |  2 +-
 .../policykit/polkit-0.8-dbus-policy.patch         | 12 +++++++
 4 files changed, 68 insertions(+), 14 deletions(-)
 create mode 100644 abs/extra-testing/policykit/entry-leak.patch
 create mode 100644 abs/extra-testing/policykit/polkit-0.8-dbus-policy.patch

diff --git a/abs/extra-testing/policykit/PKGBUILD b/abs/extra-testing/policykit/PKGBUILD
index b7cdb74..d7dd90e 100644
--- a/abs/extra-testing/policykit/PKGBUILD
+++ b/abs/extra-testing/policykit/PKGBUILD
@@ -3,36 +3,41 @@
 
 pkgname=policykit
 pkgver=0.9
-pkgrel=7
+pkgrel=9
 pkgdesc="Application development toolkit for controlling system-wide privileges"
 arch=(i686 x86_64)
 license=('custom')
 url="http://hal.freedesktop.org/docs/PolicyKit/"
-depends=('dbus-glib>=0.76' 'expat>=2.0.1' 'pam')
-makedepends=('intltool' 'docbook-xsl')
+depends=('dbus-glib>=0.80' 'expat>=2.0.1' 'pam')
+makedepends=('intltool' 'docbook-xsl' 'gtk-doc')
 options=('!libtool')
 backup=('etc/PolicyKit/PolicyKit.conf')
 install=policykit.install
 source=(http://hal.freedesktop.org/releases/PolicyKit-${pkgver}.tar.gz
 	polkit.pam
-	pk-ck-api-change.patch)
-
+	pk-ck-api-change.patch
+	polkit-0.8-dbus-policy.patch
+	entry-leak.patch)
 md5sums=('802fd13ae41f73d79359e5ecb0a98716'
          '6564f95878297b954f0572bc1610dd15'
-         '15b42b41e98410d8d7ec4f91d0cff190')
+         '15b42b41e98410d8d7ec4f91d0cff190'
+         'da5129eee9517d00985a354055d778a9'
+         '62adbf90657b17dae429fc92937af513')
 
 build() {
-  cd ${srcdir}/PolicyKit-${pkgver}
-  patch -Np1 -i ${srcdir}/pk-ck-api-change.patch || return 1
+  cd "${srcdir}/PolicyKit-${pkgver}"
+  patch -Np1 -i "${srcdir}/pk-ck-api-change.patch" || return 1
+  patch -Np1 -i "${srcdir}/polkit-0.8-dbus-policy.patch" || return 1
+  patch -Np1 -i "${srcdir}/entry-leak.patch" || return 1
   ./configure --prefix=/usr --sysconfdir=/etc --localstatedir=/var \
               --libexecdir=/usr/lib/PolicyKit --disable-static \
 	      --with-polkit-user=policykit --with-polkit-group=policykit || return 1
   make || return 1
-  make DESTDIR=${pkgdir} install || return 1
+  make DESTDIR="${pkgdir}" install || return 1
 
-  install -m755 -d ${pkgdir}/usr/share/licenses/${pkgname}
-  install -m644 COPYING ${pkgdir}/usr/share/licenses/${pkgname}/ || return 1
+  install -m755 -d "${pkgdir}/usr/share/licenses/${pkgname}"
+  install -m644 COPYING "${pkgdir}/usr/share/licenses/${pkgname}/" || return 1
 
-  rm -rf ${pkgdir}/etc/profile.d
-  install -m644 ${srcdir}/polkit.pam ${pkgdir}/etc/pam.d/polkit || return 1
+  rm -rf "${pkgdir}/etc/profile.d"
+  install -m644 "${srcdir}/polkit.pam" "${pkgdir}/etc/pam.d/polkit" || return 1
 }
diff --git a/abs/extra-testing/policykit/entry-leak.patch b/abs/extra-testing/policykit/entry-leak.patch
new file mode 100644
index 0000000..f6b3295
--- /dev/null
+++ b/abs/extra-testing/policykit/entry-leak.patch
@@ -0,0 +1,37 @@
+diff -up PolicyKit-0.9/src/polkit/polkit-policy-file-entry.c.entry-leak PolicyKit-0.9/src/polkit/polkit-policy-file-entry.c
+--- PolicyKit-0.9/src/polkit/polkit-policy-file-entry.c.entry-leak	2008-08-29 21:47:22.000000000 -0400
++++ PolicyKit-0.9/src/polkit/polkit-policy-file-entry.c	2008-08-29 21:50:13.000000000 -0400
+@@ -95,9 +95,11 @@ _polkit_policy_file_entry_new   (const c
+         char *contents;
+         size_t contents_size;
+         PolKitPolicyFileEntry *pfe;
++        char **tokens;
+ 
+         path = NULL;
+         contents = NULL;
++        tokens = NULL;
+ 
+         kit_return_val_if_fail (action_id != NULL && polkit_action_validate_id (action_id), NULL);
+ 
+@@ -153,7 +155,6 @@ _polkit_policy_file_entry_new   (const c
+         }
+ 
+         if (contents != NULL) {
+-                char **tokens;
+                 size_t num_tokens;
+                 PolKitResult any;
+                 PolKitResult inactive;
+@@ -183,11 +184,13 @@ _polkit_policy_file_entry_new   (const c
+ 
+         kit_free (path);
+         kit_free (contents);
++        kit_strfreev (tokens);
+ 
+         return pfe;
+ error:
+         kit_free (path);
+         kit_free (contents);
++        kit_strfreev (tokens);
+         if (pfe != NULL)
+                 polkit_policy_file_entry_unref (pfe);
+         return NULL;
diff --git a/abs/extra-testing/policykit/policykit.install b/abs/extra-testing/policykit/policykit.install
index 76a771e..7bc653e 100644
--- a/abs/extra-testing/policykit/policykit.install
+++ b/abs/extra-testing/policykit/policykit.install
@@ -1,5 +1,5 @@
 post_install() {
-  getent group policykit >/dev/null || usr/sbin/groupadd policykit
+  getent group policykit >/dev/null || usr/sbin/groupadd -g 102 policykit
   getent passwd policykit >/dev/null || usr/sbin/useradd -c 'PolicyKit' -u 102 -g policykit -d '/' -s /sbin/nologin policykit
   usr/bin/passwd -l policykit &>/dev/null
 
diff --git a/abs/extra-testing/policykit/polkit-0.8-dbus-policy.patch b/abs/extra-testing/policykit/polkit-0.8-dbus-policy.patch
new file mode 100644
index 0000000..fa84936
--- /dev/null
+++ b/abs/extra-testing/policykit/polkit-0.8-dbus-policy.patch
@@ -0,0 +1,12 @@
+--- PolicyKit-0.8.orig/polkitd/org.freedesktop.PolicyKit.conf.in	2008-12-08 10:55:12.000000000 -0500
++++ PolicyKit-0.8/polkitd/org.freedesktop.PolicyKit.conf.in	2008-12-08 12:05:33.000000000 -0500
+@@ -8,4 +8,9 @@
+   <policy user="@polkituser@">
+     <allow own="org.freedesktop.PolicyKit"/>
+   </policy>
++
++  <!-- any user can talk to the service (fd.o #18948) -->
++  <policy context="default">
++    <allow send_destination="org.freedesktop.PolicyKit"/>
++  </policy>
+ </busconfig>
-- 
cgit v0.12

