From e2917226cb69c26201432beeab67ed1082b22540 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miloslav=20Trma=C4=8D?= Date: Tue, 4 Apr 2017 21:57:35 +0200 Subject: [PATCH] Revert "Move to an upstream snapshot, rebase patches" This reverts commit 85e785c92297a718f68d0da301d2cf55bd3f027e. That commit breaks the build with > configure: error: libsystemd autoconfigured, but system does not appear to use systemd when running ./autogen.sh, which implicitly runs ./configure. --- .gitignore | 1 - polkit-0.113-agent-leaks.patch | 85 +++ ...ull-in-GCC-warning-infra-from-ostree.patch | 489 ++++++++++++ polkit-mozjs24.patch | 704 +++++++++++++++++ ...remove-polkitbackendconfigsource.-ch.patch | 720 ++++++++++++++++++ polkit.spec | 29 +- sources | 3 +- 7 files changed, 2015 insertions(+), 16 deletions(-) create mode 100644 polkit-build-Pull-in-GCC-warning-infra-from-ostree.patch create mode 100644 polkit-mozjs24.patch create mode 100644 polkit-remove-polkitbackendconfigsource.-ch.patch diff --git a/.gitignore b/.gitignore index 1278c71..aa05492 100644 --- a/.gitignore +++ b/.gitignore @@ -24,4 +24,3 @@ polkit-0.98.tar.gz /polkit-0.112.tar.gz.sign /polkit-0.113.tar.gz /polkit-0.113.tar.gz.sign -/polkit-0.113-2919920.tar.gz diff --git a/polkit-0.113-agent-leaks.patch b/polkit-0.113-agent-leaks.patch index 7754262..be079e1 100644 --- a/polkit-0.113-agent-leaks.patch +++ b/polkit-0.113-agent-leaks.patch @@ -87,3 +87,88 @@ index bf0ee48..b8096b3 100644 gained_authorization = session->is_authenticated; g_debug ("Authentication complete, is_authenticated = %d", session->is_authenticated); } +From 673ef80ed0079d8a4343fb2567b483be17c58969 Mon Sep 17 00:00:00 2001 +From: Stef Walter +Date: Fri, 11 Mar 2016 10:00:43 +0100 +Subject: [PATCH 15/29] polkitagent: Fix access after dereference on hashtable + +If an authentication is going on while the agent listener is +going away, then we access memory that has been freed. + +g_hash_table_lookup_node: assertion failed: (hash_table->ref_count > 0)' + +https://bugs.freedesktop.org/show_bug.cgi?id=94486 +--- + src/polkitagent/polkitagentlistener.c | 7 ++++--- + 1 file changed, 4 insertions(+), 3 deletions(-) + +diff --git a/src/polkitagent/polkitagentlistener.c b/src/polkitagent/polkitagentlistener.c +index 80d1dc1..491e4b9 100644 +--- a/src/polkitagent/polkitagentlistener.c ++++ b/src/polkitagent/polkitagentlistener.c +@@ -569,8 +569,8 @@ polkit_agent_register_listener (PolkitAgentListener *listener, + + typedef struct + { +- Server *server; + gchar *cookie; ++ GHashTable *cookie_to_pending_auth; + GDBusMethodInvocation *invocation; + GCancellable *cancellable; + } AuthData; +@@ -581,6 +581,7 @@ auth_data_free (AuthData *data) + g_free (data->cookie); + g_object_unref (data->invocation); + g_object_unref (data->cancellable); ++ g_hash_table_unref (data->cookie_to_pending_auth); + g_free (data); + } + +@@ -607,7 +608,7 @@ auth_cb (GObject *source_object, + g_dbus_method_invocation_return_value (data->invocation, NULL); + } + +- g_hash_table_remove (data->server->cookie_to_pending_auth, data->cookie); ++ g_hash_table_remove (data->cookie_to_pending_auth, data->cookie); + + auth_data_free (data); + } +@@ -668,7 +669,7 @@ auth_agent_handle_begin_authentication (Server *server, + identities = g_list_reverse (identities); + + data = g_new0 (AuthData, 1); +- data->server = server; ++ data->cookie_to_pending_auth = g_hash_table_ref (server->cookie_to_pending_auth); + data->cookie = g_strdup (cookie); + data->invocation = g_object_ref (invocation); + data->cancellable = g_cancellable_new (); +-- +2.12.1 + +From f529fa4ac03f491678c7520d7a2d1c05491feab1 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Miloslav=20Trma=C4=8D?= +Date: Sat, 12 Mar 2016 03:40:20 +0100 +Subject: [PATCH 16/29] Fix a memory leak of PolkitAgentListener's Server + object + +https://bugs.freedesktop.org/show_bug.cgi?id=94506 +--- + src/polkitagent/polkitagentlistener.c | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/src/polkitagent/polkitagentlistener.c b/src/polkitagent/polkitagentlistener.c +index 491e4b9..4704b03 100644 +--- a/src/polkitagent/polkitagentlistener.c ++++ b/src/polkitagent/polkitagentlistener.c +@@ -129,6 +129,8 @@ server_free (Server *server) + g_object_unref (server->subject); + + g_free (server->object_path); ++ ++ g_free (server); + } + + static gboolean +-- +2.12.1 + diff --git a/polkit-build-Pull-in-GCC-warning-infra-from-ostree.patch b/polkit-build-Pull-in-GCC-warning-infra-from-ostree.patch new file mode 100644 index 0000000..4385d32 --- /dev/null +++ b/polkit-build-Pull-in-GCC-warning-infra-from-ostree.patch @@ -0,0 +1,489 @@ +From 3272a988655c3236b55bad70e9a3af20857f384b Mon Sep 17 00:00:00 2001 +From: Colin Walters +Date: Mon, 12 Dec 2016 12:39:43 -0500 +Subject: [PATCH 28/29] build: Pull in GCC warning infra from ostree + +I'm trying to keep a relatively standard set around, and the code +there is cleaner than what we had before. + +Also, injecting as WARN_CFLAGS rather than changing CFLAGS during +autoconf avoids any surprises from new warnings breaking autoconf +checks. +--- + buildutil/attributes.m4 | 292 ++++++++++++++++++++++++++++++++++++++++++ + configure.ac | 91 +++---------- + src/examples/Makefile.am | 1 + + src/polkit/Makefile.am | 1 + + src/polkitagent/Makefile.am | 1 + + src/polkitbackend/Makefile.am | 1 + + src/programs/Makefile.am | 1 + + 7 files changed, 318 insertions(+), 70 deletions(-) + create mode 100644 buildutil/attributes.m4 + +diff --git a/buildutil/attributes.m4 b/buildutil/attributes.m4 +new file mode 100644 +index 0000000..51ac88b +--- /dev/null ++++ b/buildutil/attributes.m4 +@@ -0,0 +1,292 @@ ++dnl Macros to check the presence of generic (non-typed) symbols. ++dnl Copyright (c) 2006-2008 Diego Pettenò ++dnl Copyright (c) 2006-2008 xine project ++dnl Copyright (c) 2012 Lucas De Marchi ++dnl ++dnl This program is free software; you can redistribute it and/or modify ++dnl it under the terms of the GNU General Public License as published by ++dnl the Free Software Foundation; either version 2, or (at your option) ++dnl any later version. ++dnl ++dnl This program is distributed in the hope that it will be useful, ++dnl but WITHOUT ANY WARRANTY; without even the implied warranty of ++dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++dnl GNU General Public License for more details. ++dnl ++dnl You should have received a copy of the GNU General Public License ++dnl along with this program; if not, write to the Free Software ++dnl Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA ++dnl 02110-1301, USA. ++dnl ++dnl As a special exception, the copyright owners of the ++dnl macro gives unlimited permission to copy, distribute and modify the ++dnl configure scripts that are the output of Autoconf when processing the ++dnl Macro. You need not follow the terms of the GNU General Public ++dnl License when using or distributing such scripts, even though portions ++dnl of the text of the Macro appear in them. The GNU General Public ++dnl License (GPL) does govern all other use of the material that ++dnl constitutes the Autoconf Macro. ++dnl ++dnl This special exception to the GPL applies to versions of the ++dnl Autoconf Macro released by this project. When you make and ++dnl distribute a modified version of the Autoconf Macro, you may extend ++dnl this special exception to the GPL to apply to your modified version as ++dnl well. ++ ++dnl Check if FLAG in ENV-VAR is supported by compiler and append it ++dnl to WHERE-TO-APPEND variable. Note that we invert -Wno-* checks to ++dnl -W* as gcc cannot test for negated warnings. If a C snippet is passed, ++dnl use it, otherwise use a simple main() definition that just returns 0. ++dnl CC_CHECK_FLAG_APPEND([WHERE-TO-APPEND], [ENV-VAR], [FLAG], [C-SNIPPET]) ++ ++AC_DEFUN([CC_CHECK_FLAG_APPEND], [ ++ AC_CACHE_CHECK([if $CC supports flag $3 in envvar $2], ++ AS_TR_SH([cc_cv_$2_$3]), ++ [eval "AS_TR_SH([cc_save_$2])='${$2}'" ++ eval "AS_TR_SH([$2])='${cc_save_$2} -Werror `echo "$3" | sed 's/^-Wno-/-W/'`'" ++ AC_LINK_IFELSE([AC_LANG_SOURCE(ifelse([$4], [], ++ [int main(void) { return 0; } ], ++ [$4]))], ++ [eval "AS_TR_SH([cc_cv_$2_$3])='yes'"], ++ [eval "AS_TR_SH([cc_cv_$2_$3])='no'"]) ++ eval "AS_TR_SH([$2])='$cc_save_$2'"]) ++ ++ AS_IF([eval test x$]AS_TR_SH([cc_cv_$2_$3])[ = xyes], ++ [eval "$1='${$1} $3'"]) ++]) ++ ++dnl CC_CHECK_FLAGS_APPEND([WHERE-TO-APPEND], [ENV-VAR], [FLAG1 FLAG2], [C-SNIPPET]) ++AC_DEFUN([CC_CHECK_FLAGS_APPEND], [ ++ for flag in [$3]; do ++ CC_CHECK_FLAG_APPEND([$1], [$2], $flag, [$4]) ++ done ++]) ++ ++dnl Check if the flag is supported by linker (cacheable) ++dnl CC_CHECK_LDFLAGS([FLAG], [ACTION-IF-FOUND],[ACTION-IF-NOT-FOUND]) ++ ++AC_DEFUN([CC_CHECK_LDFLAGS], [ ++ AC_CACHE_CHECK([if $CC supports $1 flag], ++ AS_TR_SH([cc_cv_ldflags_$1]), ++ [ac_save_LDFLAGS="$LDFLAGS" ++ LDFLAGS="$LDFLAGS $1" ++ AC_LINK_IFELSE([int main() { return 1; }], ++ [eval "AS_TR_SH([cc_cv_ldflags_$1])='yes'"], ++ [eval "AS_TR_SH([cc_cv_ldflags_$1])="]) ++ LDFLAGS="$ac_save_LDFLAGS" ++ ]) ++ ++ AS_IF([eval test x$]AS_TR_SH([cc_cv_ldflags_$1])[ = xyes], ++ [$2], [$3]) ++]) ++ ++dnl define the LDFLAGS_NOUNDEFINED variable with the correct value for ++dnl the current linker to avoid undefined references in a shared object. ++AC_DEFUN([CC_NOUNDEFINED], [ ++ dnl We check $host for which systems to enable this for. ++ AC_REQUIRE([AC_CANONICAL_HOST]) ++ ++ case $host in ++ dnl FreeBSD (et al.) does not complete linking for shared objects when pthreads ++ dnl are requested, as different implementations are present; to avoid problems ++ dnl use -Wl,-z,defs only for those platform not behaving this way. ++ *-freebsd* | *-openbsd*) ;; ++ *) ++ dnl First of all check for the --no-undefined variant of GNU ld. This allows ++ dnl for a much more readable command line, so that people can understand what ++ dnl it does without going to look for what the heck -z defs does. ++ for possible_flags in "-Wl,--no-undefined" "-Wl,-z,defs"; do ++ CC_CHECK_LDFLAGS([$possible_flags], [LDFLAGS_NOUNDEFINED="$possible_flags"]) ++ break ++ done ++ ;; ++ esac ++ ++ AC_SUBST([LDFLAGS_NOUNDEFINED]) ++]) ++ ++dnl Check for a -Werror flag or equivalent. -Werror is the GCC ++dnl and ICC flag that tells the compiler to treat all the warnings ++dnl as fatal. We usually need this option to make sure that some ++dnl constructs (like attributes) are not simply ignored. ++dnl ++dnl Other compilers don't support -Werror per se, but they support ++dnl an equivalent flag: ++dnl - Sun Studio compiler supports -errwarn=%all ++AC_DEFUN([CC_CHECK_WERROR], [ ++ AC_CACHE_CHECK( ++ [for $CC way to treat warnings as errors], ++ [cc_cv_werror], ++ [CC_CHECK_CFLAGS_SILENT([-Werror], [cc_cv_werror=-Werror], ++ [CC_CHECK_CFLAGS_SILENT([-errwarn=%all], [cc_cv_werror=-errwarn=%all])]) ++ ]) ++]) ++ ++AC_DEFUN([CC_CHECK_ATTRIBUTE], [ ++ AC_REQUIRE([CC_CHECK_WERROR]) ++ AC_CACHE_CHECK([if $CC supports __attribute__(( ifelse([$2], , [$1], [$2]) ))], ++ AS_TR_SH([cc_cv_attribute_$1]), ++ [ac_save_CFLAGS="$CFLAGS" ++ CFLAGS="$CFLAGS $cc_cv_werror" ++ AC_COMPILE_IFELSE([AC_LANG_SOURCE([$3])], ++ [eval "AS_TR_SH([cc_cv_attribute_$1])='yes'"], ++ [eval "AS_TR_SH([cc_cv_attribute_$1])='no'"]) ++ CFLAGS="$ac_save_CFLAGS" ++ ]) ++ ++ AS_IF([eval test x$]AS_TR_SH([cc_cv_attribute_$1])[ = xyes], ++ [AC_DEFINE( ++ AS_TR_CPP([SUPPORT_ATTRIBUTE_$1]), 1, ++ [Define this if the compiler supports __attribute__(( ifelse([$2], , [$1], [$2]) ))] ++ ) ++ $4], ++ [$5]) ++]) ++ ++AC_DEFUN([CC_ATTRIBUTE_CONSTRUCTOR], [ ++ CC_CHECK_ATTRIBUTE( ++ [constructor],, ++ [void __attribute__((constructor)) ctor() { int a; }], ++ [$1], [$2]) ++]) ++ ++AC_DEFUN([CC_ATTRIBUTE_FORMAT], [ ++ CC_CHECK_ATTRIBUTE( ++ [format], [format(printf, n, n)], ++ [void __attribute__((format(printf, 1, 2))) printflike(const char *fmt, ...) { fmt = (void *)0; }], ++ [$1], [$2]) ++]) ++ ++AC_DEFUN([CC_ATTRIBUTE_FORMAT_ARG], [ ++ CC_CHECK_ATTRIBUTE( ++ [format_arg], [format_arg(printf)], ++ [char *__attribute__((format_arg(1))) gettextlike(const char *fmt) { fmt = (void *)0; }], ++ [$1], [$2]) ++]) ++ ++AC_DEFUN([CC_ATTRIBUTE_VISIBILITY], [ ++ CC_CHECK_ATTRIBUTE( ++ [visibility_$1], [visibility("$1")], ++ [void __attribute__((visibility("$1"))) $1_function() { }], ++ [$2], [$3]) ++]) ++ ++AC_DEFUN([CC_ATTRIBUTE_NONNULL], [ ++ CC_CHECK_ATTRIBUTE( ++ [nonnull], [nonnull()], ++ [void __attribute__((nonnull())) some_function(void *foo, void *bar) { foo = (void*)0; bar = (void*)0; }], ++ [$1], [$2]) ++]) ++ ++AC_DEFUN([CC_ATTRIBUTE_UNUSED], [ ++ CC_CHECK_ATTRIBUTE( ++ [unused], , ++ [void some_function(void *foo, __attribute__((unused)) void *bar);], ++ [$1], [$2]) ++]) ++ ++AC_DEFUN([CC_ATTRIBUTE_SENTINEL], [ ++ CC_CHECK_ATTRIBUTE( ++ [sentinel], , ++ [void some_function(void *foo, ...) __attribute__((sentinel));], ++ [$1], [$2]) ++]) ++ ++AC_DEFUN([CC_ATTRIBUTE_DEPRECATED], [ ++ CC_CHECK_ATTRIBUTE( ++ [deprecated], , ++ [void some_function(void *foo, ...) __attribute__((deprecated));], ++ [$1], [$2]) ++]) ++ ++AC_DEFUN([CC_ATTRIBUTE_ALIAS], [ ++ CC_CHECK_ATTRIBUTE( ++ [alias], [weak, alias], ++ [void other_function(void *foo) { } ++ void some_function(void *foo) __attribute__((weak, alias("other_function")));], ++ [$1], [$2]) ++]) ++ ++AC_DEFUN([CC_ATTRIBUTE_MALLOC], [ ++ CC_CHECK_ATTRIBUTE( ++ [malloc], , ++ [void * __attribute__((malloc)) my_alloc(int n);], ++ [$1], [$2]) ++]) ++ ++AC_DEFUN([CC_ATTRIBUTE_PACKED], [ ++ CC_CHECK_ATTRIBUTE( ++ [packed], , ++ [struct astructure { char a; int b; long c; void *d; } __attribute__((packed));], ++ [$1], [$2]) ++]) ++ ++AC_DEFUN([CC_ATTRIBUTE_CONST], [ ++ CC_CHECK_ATTRIBUTE( ++ [const], , ++ [int __attribute__((const)) twopow(int n) { return 1 << n; } ], ++ [$1], [$2]) ++]) ++ ++AC_DEFUN([CC_FLAG_VISIBILITY], [ ++ AC_REQUIRE([CC_CHECK_WERROR]) ++ AC_CACHE_CHECK([if $CC supports -fvisibility=hidden], ++ [cc_cv_flag_visibility], ++ [cc_flag_visibility_save_CFLAGS="$CFLAGS" ++ CFLAGS="$CFLAGS $cc_cv_werror" ++ CC_CHECK_CFLAGS_SILENT([-fvisibility=hidden], ++ cc_cv_flag_visibility='yes', ++ cc_cv_flag_visibility='no') ++ CFLAGS="$cc_flag_visibility_save_CFLAGS"]) ++ ++ AS_IF([test "x$cc_cv_flag_visibility" = "xyes"], ++ [AC_DEFINE([SUPPORT_FLAG_VISIBILITY], 1, ++ [Define this if the compiler supports the -fvisibility flag]) ++ $1], ++ [$2]) ++]) ++ ++AC_DEFUN([CC_FUNC_EXPECT], [ ++ AC_REQUIRE([CC_CHECK_WERROR]) ++ AC_CACHE_CHECK([if compiler has __builtin_expect function], ++ [cc_cv_func_expect], ++ [ac_save_CFLAGS="$CFLAGS" ++ CFLAGS="$CFLAGS $cc_cv_werror" ++ AC_COMPILE_IFELSE([AC_LANG_SOURCE( ++ [int some_function() { ++ int a = 3; ++ return (int)__builtin_expect(a, 3); ++ }])], ++ [cc_cv_func_expect=yes], ++ [cc_cv_func_expect=no]) ++ CFLAGS="$ac_save_CFLAGS" ++ ]) ++ ++ AS_IF([test "x$cc_cv_func_expect" = "xyes"], ++ [AC_DEFINE([SUPPORT__BUILTIN_EXPECT], 1, ++ [Define this if the compiler supports __builtin_expect() function]) ++ $1], ++ [$2]) ++]) ++ ++AC_DEFUN([CC_ATTRIBUTE_ALIGNED], [ ++ AC_REQUIRE([CC_CHECK_WERROR]) ++ AC_CACHE_CHECK([highest __attribute__ ((aligned ())) supported], ++ [cc_cv_attribute_aligned], ++ [ac_save_CFLAGS="$CFLAGS" ++ CFLAGS="$CFLAGS $cc_cv_werror" ++ for cc_attribute_align_try in 64 32 16 8 4 2; do ++ AC_COMPILE_IFELSE([AC_LANG_SOURCE([ ++ int main() { ++ static char c __attribute__ ((aligned($cc_attribute_align_try))) = 0; ++ return c; ++ }])], [cc_cv_attribute_aligned=$cc_attribute_align_try; break]) ++ done ++ CFLAGS="$ac_save_CFLAGS" ++ ]) ++ ++ if test "x$cc_cv_attribute_aligned" != "x"; then ++ AC_DEFINE_UNQUOTED([ATTRIBUTE_ALIGNED_MAX], [$cc_cv_attribute_aligned], ++ [Define the highest alignment supported]) ++ fi ++]) +diff --git a/configure.ac b/configure.ac +index f457a84..af2c8dd 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -4,6 +4,7 @@ AC_PREREQ(2.59c) + AC_INIT([polkit], [0.114], [http://lists.freedesktop.org/mailman/listinfo/polkit-devel], , [http://www.freedesktop.org/wiki/Software/polkit]) + AM_INIT_AUTOMAKE([]) + AC_CONFIG_HEADERS(config.h) ++AC_CONFIG_MACRO_DIR([buildutil]) + AM_MAINTAINER_MODE + + m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])]) +@@ -52,76 +53,26 @@ GTK_DOC_CHECK([1.3]) + + #### gcc warning flags + +-if test "x$GCC" = "xyes"; then +- changequote(,)dnl +- case " $CFLAGS " in +- *[\ \ ]-Wall[\ \ ]*) ;; +- *) CFLAGS="$CFLAGS -Wall" ;; +- esac +- +- case " $CFLAGS " in +- *[\ \ ]-Wchar-subscripts[\ \ ]*) ;; +- *) CFLAGS="$CFLAGS -Wchar-subscripts" ;; +- esac +- +- case " $CFLAGS " in +- *[\ \ ]-Wmissing-declarations[\ \ ]*) ;; +- *) CFLAGS="$CFLAGS -Wmissing-declarations" ;; +- esac +- +- case " $CFLAGS " in +- *[\ \ ]-Wnested-externs[\ \ ]*) ;; +- *) CFLAGS="$CFLAGS -Wnested-externs" ;; +- esac +- +- case " $CFLAGS " in +- *[\ \ ]-Wpointer-arith[\ \ ]*) ;; +- *) CFLAGS="$CFLAGS -Wpointer-arith" ;; +- esac +- +- case " $CFLAGS " in +- *[\ \ ]-Wcast-align[\ \ ]*) ;; +- *) CFLAGS="$CFLAGS -Wcast-align" ;; +- esac +- +- case " $CFLAGS " in +- *[\ \ ]-Wsign-compare[\ \ ]*) ;; +- *) CFLAGS="$CFLAGS -Wsign-compare" ;; +- esac +- +- case " $CFLAGS " in +- *[\ \ ]-Wformat[\ \ ]*) ;; +- *) CFLAGS="$CFLAGS -Wformat" ;; +- esac +- +- case " $CFLAGS " in +- *[\ \ ]-Wformat-security[\ \ ]*) ;; +- *) CFLAGS="$CFLAGS -Wformat-security" ;; +- esac +- +- if test "x$enable_ansi" = "xyes"; then +- case " $CFLAGS " in +- *[\ \ ]-ansi[\ \ ]*) ;; +- *) CFLAGS="$CFLAGS -ansi" ;; +- esac +- +- case " $CFLAGS " in +- *[\ \ ]-D_POSIX_C_SOURCE*) ;; +- *) CFLAGS="$CFLAGS -D_POSIX_C_SOURCE=199309L" ;; +- esac +- +- case " $CFLAGS " in +- *[\ \ ]-D_BSD_SOURCE[\ \ ]*) ;; +- *) CFLAGS="$CFLAGS -D_BSD_SOURCE" ;; +- esac +- +- case " $CFLAGS " in +- *[\ \ ]-pedantic[\ \ ]*) ;; +- *) CFLAGS="$CFLAGS -pedantic" ;; +- esac +- fi +- changequote([,])dnl +-fi ++CC_CHECK_FLAGS_APPEND([WARN_CFLAGS], [CFLAGS], [\ ++ -pipe \ ++ -Wall \ ++ -Werror=empty-body \ ++ -Werror=strict-prototypes \ ++ -Werror=missing-prototypes \ ++ -Werror=implicit-function-declaration \ ++ "-Werror=format=2 -Werror=format-security -Werror=format-nonliteral" \ ++ -Werror=pointer-arith -Werror=init-self \ ++ -Werror=missing-declarations \ ++ -Werror=return-type \ ++ -Werror=overflow \ ++ -Werror=int-conversion \ ++ -Werror=parenthesis \ ++ -Werror=incompatible-pointer-types \ ++ -Werror=misleading-indentation \ ++ -Werror=missing-include-dirs -Werror=aggregate-return \ ++ -Werror=declaration-after-statement \ ++]) ++AC_SUBST(WARN_CFLAGS) + + PKG_CHECK_MODULES(GLIB, [gmodule-2.0 gio-unix-2.0 >= 2.30.0]) + AC_SUBST(GLIB_CFLAGS) +diff --git a/src/examples/Makefile.am b/src/examples/Makefile.am +index 71c4991..9b885f3 100644 +--- a/src/examples/Makefile.am ++++ b/src/examples/Makefile.am +@@ -1,5 +1,6 @@ + + NULL = ++AM_CFLAGS = -std=gnu99 $(WARN_CFLAGS) + + AM_CPPFLAGS = \ + -I$(top_builddir)/src \ +diff --git a/src/polkit/Makefile.am b/src/polkit/Makefile.am +index 51befaf..ca36355 100644 +--- a/src/polkit/Makefile.am ++++ b/src/polkit/Makefile.am +@@ -1,5 +1,6 @@ + NULL = + ++AM_CFLAGS = -std=gnu99 $(WARN_CFLAGS) + AM_CPPFLAGS = \ + -I$(top_builddir)/src \ + -I$(top_srcdir)/src \ +diff --git a/src/polkitagent/Makefile.am b/src/polkitagent/Makefile.am +index 4b64165..49720db 100644 +--- a/src/polkitagent/Makefile.am ++++ b/src/polkitagent/Makefile.am +@@ -1,5 +1,6 @@ + NULL = + ++AM_CFLAGS = -std=gnu99 $(WARN_CFLAGS) + AM_CPPFLAGS = \ + -I$(top_builddir)/src \ + -I$(top_srcdir)/src \ +diff --git a/src/polkitbackend/Makefile.am b/src/polkitbackend/Makefile.am +index ca62474..e48b739 100644 +--- a/src/polkitbackend/Makefile.am ++++ b/src/polkitbackend/Makefile.am +@@ -2,6 +2,7 @@ NULL = + + BUILT_SOURCES = + ++AM_CFLAGS = -std=gnu99 $(WARN_CFLAGS) + AM_CPPFLAGS = \ + -I$(top_builddir)/src \ + -I$(top_srcdir)/src \ +diff --git a/src/programs/Makefile.am b/src/programs/Makefile.am +index 880b90b..d69853c 100644 +--- a/src/programs/Makefile.am ++++ b/src/programs/Makefile.am +@@ -1,6 +1,7 @@ + + NULL = + ++AM_CFLAGS = -std=gnu99 $(WARN_CFLAGS) + AM_CPPFLAGS = \ + -I$(top_builddir)/src \ + -I$(top_srcdir)/src \ +-- +2.12.1 + diff --git a/polkit-mozjs24.patch b/polkit-mozjs24.patch new file mode 100644 index 0000000..71d1fea --- /dev/null +++ b/polkit-mozjs24.patch @@ -0,0 +1,704 @@ +From 0676f33aa741a87634ffc3b9ef82c7d092c997ec Mon Sep 17 00:00:00 2001 +From: Jeremy Linton +Date: Fri, 26 Aug 2016 14:01:46 -0500 +Subject: [PATCH 24/29] change mozjs interface module to c++ + +The JSAPI is now a full C++ interface. Convert the polkit +to JavaScript interface module to C++ compilation in order to +support newer versions of spidermonkey. + +Signed-off-by: Jeremy Linton +--- + configure.ac | 3 +++ + src/polkitbackend/Makefile.am | 7 ++++++- + .../{polkitbackendjsauthority.c => polkitbackendjsauthority.cpp} | 0 + test/polkitbackend/Makefile.am | 3 +++ + 4 files changed, 12 insertions(+), 1 deletion(-) + rename src/polkitbackend/{polkitbackendjsauthority.c => polkitbackendjsauthority.cpp} (100%) + +diff --git a/configure.ac b/configure.ac +index 97d4222..18c1f4e 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -30,6 +30,8 @@ AC_PROG_MAKE_SET + AC_PROG_LN_S + AC_SYS_LARGEFILE + AM_PROG_CC_C_O ++AC_PROG_CXX ++AX_CXX_COMPILE_STDCXX_11() + + # Taken from dbus + AC_ARG_ENABLE(ansi, [ --enable-ansi enable -ansi -pedantic gcc flags],enable_ansi=$enableval,enable_ansi=no) +@@ -142,6 +144,7 @@ AS_IF([test x${with_mozjs} != xauto], [ + ]) + ]) + AC_SUBST(LIBJS_CFLAGS) ++AC_SUBST(LIBJS_CXXFLAGS) + AC_SUBST(LIBJS_LIBS) + + EXPAT_LIB="" +diff --git a/src/polkitbackend/Makefile.am b/src/polkitbackend/Makefile.am +index a80ca36..5655d17 100644 +--- a/src/polkitbackend/Makefile.am ++++ b/src/polkitbackend/Makefile.am +@@ -32,7 +32,7 @@ libpolkit_backend_1_la_SOURCES = \ + polkitbackendprivate.h \ + polkitbackendauthority.h polkitbackendauthority.c \ + polkitbackendinteractiveauthority.h polkitbackendinteractiveauthority.c \ +- polkitbackendjsauthority.h polkitbackendjsauthority.c \ ++ polkitbackendjsauthority.h polkitbackendjsauthority.cpp \ + polkitbackendactionpool.h polkitbackendactionpool.c \ + polkitbackendactionlookup.h polkitbackendactionlookup.c \ + $(NULL) +@@ -53,6 +53,8 @@ libpolkit_backend_1_la_CFLAGS = \ + $(LIBJS_CFLAGS) \ + $(NULL) + ++libpolkit_backend_1_la_CXXFLAGS = $(libpolkit_backend_1_la_CFLAGS) -fpermissive ++ + libpolkit_backend_1_la_LIBADD = \ + $(GLIB_LIBS) \ + $(LIBSYSTEMD_LIBS) \ +@@ -73,6 +75,9 @@ polkitd_SOURCES = \ + polkitd.c \ + $(NULL) + ++# force C++ link via dummy C++ file, (see GNU automake manual section 8.3.5) ++nodist_EXTRA_polkitd_SOURCES = dummy-force-cpp-link.cxx ++ + polkitd_CFLAGS = \ + -DPOLKIT_BACKEND_I_KNOW_API_IS_SUBJECT_TO_CHANGE \ + -DG_LOG_DOMAIN=\"polkitd-1\" \ +diff --git a/src/polkitbackend/polkitbackendjsauthority.c b/src/polkitbackend/polkitbackendjsauthority.cpp +similarity index 100% +rename from src/polkitbackend/polkitbackendjsauthority.c +rename to src/polkitbackend/polkitbackendjsauthority.cpp +diff --git a/test/polkitbackend/Makefile.am b/test/polkitbackend/Makefile.am +index 8859c1f..53bfb2a 100644 +--- a/test/polkitbackend/Makefile.am ++++ b/test/polkitbackend/Makefile.am +@@ -35,6 +35,9 @@ TEST_PROGS = + + TEST_PROGS += polkitbackendjsauthoritytest + polkitbackendjsauthoritytest_SOURCES = test-polkitbackendjsauthority.c ++# force C++ link via dummy C++ file, (see GNU automake manual section 8.3.5) ++nodist_EXTRA_polkitbackendjsauthoritytest_SOURCES = dummy-force-cpp-link.cxx ++ + + # ---------------------------------------------------------------------------------------------------- + +-- +2.12.1 + +From 03dafd1fac8154c0a581395f1b7bf29e56a83491 Mon Sep 17 00:00:00 2001 +From: Jeremy Linton +Date: Fri, 26 Aug 2016 14:01:47 -0500 +Subject: [PATCH 25/29] Switch to hard requiring mozjs24 + +Remove mozjs185 and mozjs17 from autoconf and replace them +with mozjs24. + +Now that polkitbackendjsauthority is compiling in C++ mode +and the autoconf supports mozjs24, update the module so +that it builds with mozjs24. + +Signed-off-by: Jeremy Linton +--- + configure.ac | 14 +---- + src/polkitbackend/polkitbackendjsauthority.cpp | 74 ++++++++------------------ + 2 files changed, 25 insertions(+), 63 deletions(-) + +diff --git a/configure.ac b/configure.ac +index 18c1f4e..f457a84 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -131,18 +131,8 @@ AC_DEFINE([GLIB_VERSION_MIN_REQUIRED], [GLIB_VERSION_2_30], + AC_DEFINE([GLIB_VERSION_MAX_ALLOWED], [G_ENCODE_VERSION(2,34)], + [Notify us when we'll need to transition away from g_type_init()]) + +-AC_ARG_WITH(mozjs, AS_HELP_STRING([--with-mozjs=@<:@mozjs185/mozjs-17.0|auto@:>@], +- [Specify version of Spidermonkey to use]),, +- with_mozjs=auto) +-AS_IF([test x${with_mozjs} != xauto], [ +- PKG_CHECK_MODULES(LIBJS, ${with_mozjs}) +-], [ +- PKG_CHECK_MODULES(LIBJS, [mozjs185], have_mozjs185=yes, have_mozjs185=no) +- AS_IF([test x${have_mozjs185} = xno], [ +- PKG_CHECK_MODULES(LIBJS, [mozjs-17.0], have_mozjs17=yes, +- [AC_MSG_ERROR([Could not find mozjs185 or mozjs-17.0; see http://ftp.mozilla.org/pub/mozilla.org/js/])]) +- ]) +-]) ++PKG_CHECK_MODULES(LIBJS, [mozjs-24]) ++ + AC_SUBST(LIBJS_CFLAGS) + AC_SUBST(LIBJS_CXXFLAGS) + AC_SUBST(LIBJS_LIBS) +diff --git a/src/polkitbackend/polkitbackendjsauthority.cpp b/src/polkitbackend/polkitbackendjsauthority.cpp +index 2112868..1541856 100644 +--- a/src/polkitbackend/polkitbackendjsauthority.cpp ++++ b/src/polkitbackend/polkitbackendjsauthority.cpp +@@ -92,11 +92,7 @@ struct _PolkitBackendJsAuthorityPrivate + }; + + static JSBool execute_script_with_runaway_killer (PolkitBackendJsAuthority *authority, +-#if JS_VERSION == 186 + JSScript *script, +-#else +- JSObject *script, +-#endif + jsval *rval); + + static void utils_spawn (const gchar *const *argv, +@@ -157,17 +153,13 @@ static JSClass js_global_class = { + "global", + JSCLASS_GLOBAL_FLAGS, + JS_PropertyStub, +- JS_PropertyStub, ++ JS_DeletePropertyStub, + JS_PropertyStub, + JS_StrictPropertyStub, + JS_EnumerateStub, + JS_ResolveStub, + JS_ConvertStub, +-#if JS_VERSION == 186 + NULL, +-#else +- JS_FinalizeStub, +-#endif + JSCLASS_NO_OPTIONAL_MEMBERS + }; + +@@ -177,17 +169,13 @@ static JSClass js_polkit_class = { + "Polkit", + 0, + JS_PropertyStub, +- JS_PropertyStub, ++ JS_DeletePropertyStub, + JS_PropertyStub, + JS_StrictPropertyStub, + JS_EnumerateStub, + JS_ResolveStub, + JS_ConvertStub, +-#if JS_VERSION == 186 + NULL, +-#else +- JS_FinalizeStub, +-#endif + JSCLASS_NO_OPTIONAL_MEMBERS + }; + +@@ -300,22 +288,14 @@ load_scripts (PolkitBackendJsAuthority *authority) + for (l = files; l != NULL; l = l->next) + { + const gchar *filename = l->data; +-#if JS_VERSION == 186 +- JSScript *script; +-#else +- JSObject *script; +-#endif ++ JS::RootedScript script(authority->priv->cx); ++ JS::CompileOptions options(authority->priv->cx); ++ JS::RootedObject obj(authority->priv->cx,authority->priv->js_global); ++ options.setUTF8(true); ++ script = JS::Compile (authority->priv->cx, ++ obj, options, ++ filename); + +-#if JS_VERSION == 186 +- script = JS_CompileUTF8File (authority->priv->cx, +- authority->priv->js_global, +- filename); +- +-#else +- script = JS_CompileFile (authority->priv->cx, +- authority->priv->js_global, +- filename); +-#endif + if (script == NULL) + { + polkit_backend_authority_log (POLKIT_BACKEND_AUTHORITY (authority), +@@ -355,6 +335,8 @@ reload_scripts (PolkitBackendJsAuthority *authority) + + JS_BeginRequest (authority->priv->cx); + ++ JSAutoCompartment ac(authority->priv->cx, authority->priv->js_global); ++ + if (!JS_CallFunctionName(authority->priv->cx, + authority->priv->js_polkit, + "_deleteRules", +@@ -369,11 +351,7 @@ reload_scripts (PolkitBackendJsAuthority *authority) + + polkit_backend_authority_log (POLKIT_BACKEND_AUTHORITY (authority), + "Collecting garbage unconditionally..."); +-#if JS_VERSION == 186 + JS_GC (authority->priv->rt); +-#else +- JS_GC (authority->priv->cx); +-#endif + + load_scripts (authority); + +@@ -465,7 +443,7 @@ polkit_backend_js_authority_constructed (GObject *object) + PolkitBackendJsAuthority *authority = POLKIT_BACKEND_JS_AUTHORITY (object); + gboolean entered_request = FALSE; + +- authority->priv->rt = JS_NewRuntime (8L * 1024L * 1024L); ++ authority->priv->rt = JS_NewRuntime (8L * 1024L * 1024L, JS_USE_HELPER_THREADS); + if (authority->priv->rt == NULL) + goto fail; + +@@ -479,19 +457,17 @@ polkit_backend_js_authority_constructed (GObject *object) + JS_SetOptions (authority->priv->cx, + JSOPTION_VAROBJFIX + /* | JSOPTION_JIT | JSOPTION_METHODJIT*/); +- JS_SetVersion(authority->priv->cx, JSVERSION_LATEST); + JS_SetErrorReporter(authority->priv->cx, report_error); + JS_SetContextPrivate (authority->priv->cx, authority); + + JS_BeginRequest(authority->priv->cx); + entered_request = TRUE; + +- authority->priv->js_global = +-#if JS_VERSION == 186 +- JS_NewGlobalObject (authority->priv->cx, &js_global_class, NULL); +-#else +- JS_NewCompartmentAndGlobalObject (authority->priv->cx, &js_global_class, NULL); +-#endif ++ { ++ JS::CompartmentOptions compart_opts; ++ compart_opts.setVersion(JSVERSION_LATEST); ++ authority->priv->js_global = JS_NewGlobalObject (authority->priv->cx, &js_global_class, NULL, compart_opts); ++ JSAutoCompartment ac(authority->priv->cx, authority->priv->js_global); + + if (authority->priv->js_global == NULL) + goto fail; +@@ -548,11 +524,12 @@ polkit_backend_js_authority_constructed (GObject *object) + + setup_file_monitors (authority); + load_scripts (authority); +- ++ } + JS_EndRequest (authority->priv->cx); + entered_request = FALSE; + + G_OBJECT_CLASS (polkit_backend_js_authority_parent_class)->constructed (object); ++ + return; + + fail: +@@ -766,7 +743,6 @@ subject_to_jsval (PolkitBackendJsAuthority *authority, + char *session_str = NULL; + + src = "new Subject();"; +- + if (!JS_EvaluateScript (authority->priv->cx, + authority->priv->js_global, + src, strlen (src), +@@ -999,11 +975,7 @@ rkt_on_timeout (gpointer user_data) + g_mutex_unlock (&authority->priv->rkt_timeout_pending_mutex); + + /* Supposedly this is thread-safe... */ +-#if JS_VERSION == 186 + JS_TriggerOperationCallback (authority->priv->rt); +-#else +- JS_TriggerOperationCallback (authority->priv->cx); +-#endif + + /* keep source around so we keep trying to kill even if the JS bit catches the exception + * thrown in js_operation_callback() +@@ -1041,11 +1013,7 @@ runaway_killer_teardown (PolkitBackendJsAuthority *authority) + + static JSBool + execute_script_with_runaway_killer (PolkitBackendJsAuthority *authority, +-#if JS_VERSION == 186 + JSScript *script, +-#else +- JSObject *script, +-#endif + jsval *rval) + { + JSBool ret; +@@ -1103,6 +1071,8 @@ polkit_backend_js_authority_get_admin_auth_identities (PolkitBackendInteractiveA + + JS_BeginRequest (authority->priv->cx); + ++ JSAutoCompartment ac(authority->priv->cx, authority->priv->js_global); ++ + if (!action_and_details_to_jsval (authority, action_id, details, &argv[0], &error)) + { + polkit_backend_authority_log (POLKIT_BACKEND_AUTHORITY (authority), +@@ -1212,6 +1182,8 @@ polkit_backend_js_authority_check_authorization_sync (PolkitBackendInteractiveAu + + JS_BeginRequest (authority->priv->cx); + ++ JSAutoCompartment ac(authority->priv->cx, authority->priv->js_global); ++ + if (!action_and_details_to_jsval (authority, action_id, details, &argv[0], &error)) + { + polkit_backend_authority_log (POLKIT_BACKEND_AUTHORITY (authority), +-- +2.12.1 + +From e845ef53aec8ec502c8edac957929e2d337b2302 Mon Sep 17 00:00:00 2001 +From: Jeremy Linton +Date: Fri, 26 Aug 2016 14:01:48 -0500 +Subject: [PATCH 26/29] Fix warnings caused by building with C++ + +C++ needs explicit casts for many pointer type conversions +For example char * to void * should have a cast. Fix a +number of these cases. Also, correct a white space indentation +error left in the last patch for review clarity. + +Signed-off-by: Jeremy Linton +--- + src/polkitbackend/Makefile.am | 2 +- + src/polkitbackend/polkitbackendjsauthority.cpp | 138 ++++++++++++------------- + 2 files changed, 70 insertions(+), 70 deletions(-) + +diff --git a/src/polkitbackend/Makefile.am b/src/polkitbackend/Makefile.am +index 5655d17..ca62474 100644 +--- a/src/polkitbackend/Makefile.am ++++ b/src/polkitbackend/Makefile.am +@@ -53,7 +53,7 @@ libpolkit_backend_1_la_CFLAGS = \ + $(LIBJS_CFLAGS) \ + $(NULL) + +-libpolkit_backend_1_la_CXXFLAGS = $(libpolkit_backend_1_la_CFLAGS) -fpermissive ++libpolkit_backend_1_la_CXXFLAGS = $(libpolkit_backend_1_la_CFLAGS) + + libpolkit_backend_1_la_LIBADD = \ + $(GLIB_LIBS) \ +diff --git a/src/polkitbackend/polkitbackendjsauthority.cpp b/src/polkitbackend/polkitbackendjsauthority.cpp +index 1541856..ce3a980 100644 +--- a/src/polkitbackend/polkitbackendjsauthority.cpp ++++ b/src/polkitbackend/polkitbackendjsauthority.cpp +@@ -287,7 +287,7 @@ load_scripts (PolkitBackendJsAuthority *authority) + + for (l = files; l != NULL; l = l->next) + { +- const gchar *filename = l->data; ++ const gchar *filename = (gchar *)l->data; + JS::RootedScript script(authority->priv->cx); + JS::CompileOptions options(authority->priv->cx); + JS::RootedObject obj(authority->priv->cx,authority->priv->js_global); +@@ -464,66 +464,66 @@ polkit_backend_js_authority_constructed (GObject *object) + entered_request = TRUE; + + { +- JS::CompartmentOptions compart_opts; +- compart_opts.setVersion(JSVERSION_LATEST); +- authority->priv->js_global = JS_NewGlobalObject (authority->priv->cx, &js_global_class, NULL, compart_opts); +- JSAutoCompartment ac(authority->priv->cx, authority->priv->js_global); +- +- if (authority->priv->js_global == NULL) +- goto fail; +- JS_AddObjectRoot (authority->priv->cx, &authority->priv->js_global); +- +- if (!JS_InitStandardClasses (authority->priv->cx, authority->priv->js_global)) +- goto fail; +- +- authority->priv->js_polkit = JS_DefineObject (authority->priv->cx, +- authority->priv->js_global, +- "polkit", +- &js_polkit_class, +- NULL, +- JSPROP_ENUMERATE); +- if (authority->priv->js_polkit == NULL) +- goto fail; +- JS_AddObjectRoot (authority->priv->cx, &authority->priv->js_polkit); +- +- if (!JS_DefineFunctions (authority->priv->cx, +- authority->priv->js_polkit, +- js_polkit_functions)) +- goto fail; ++ JS::CompartmentOptions compart_opts; ++ compart_opts.setVersion(JSVERSION_LATEST); ++ authority->priv->js_global = JS_NewGlobalObject (authority->priv->cx, &js_global_class, NULL, compart_opts); ++ JSAutoCompartment ac(authority->priv->cx, authority->priv->js_global); + +- if (!JS_EvaluateScript (authority->priv->cx, +- authority->priv->js_global, +- init_js, strlen (init_js), /* init.js */ +- "init.js", /* filename */ +- 0, /* lineno */ +- NULL)) /* rval */ +- { ++ if (authority->priv->js_global == NULL) + goto fail; +- } +- +- if (authority->priv->rules_dirs == NULL) +- { +- authority->priv->rules_dirs = g_new0 (gchar *, 3); +- authority->priv->rules_dirs[0] = g_strdup (PACKAGE_SYSCONF_DIR "/polkit-1/rules.d"); +- authority->priv->rules_dirs[1] = g_strdup (PACKAGE_DATA_DIR "/polkit-1/rules.d"); +- } ++ JS_AddObjectRoot (authority->priv->cx, &authority->priv->js_global); + +- g_mutex_init (&authority->priv->rkt_init_mutex); +- g_cond_init (&authority->priv->rkt_init_cond); +- g_mutex_init (&authority->priv->rkt_timeout_pending_mutex); ++ if (!JS_InitStandardClasses (authority->priv->cx, authority->priv->js_global)) ++ goto fail; + +- authority->priv->runaway_killer_thread = g_thread_new ("runaway-killer-thread", +- runaway_killer_thread_func, +- authority); ++ authority->priv->js_polkit = JS_DefineObject (authority->priv->cx, ++ authority->priv->js_global, ++ "polkit", ++ &js_polkit_class, ++ NULL, ++ JSPROP_ENUMERATE); ++ if (authority->priv->js_polkit == NULL) ++ goto fail; ++ JS_AddObjectRoot (authority->priv->cx, &authority->priv->js_polkit); + +- /* wait for runaway_killer_thread to set up its GMainContext */ +- g_mutex_lock (&authority->priv->rkt_init_mutex); +- while (authority->priv->rkt_context == NULL) +- g_cond_wait (&authority->priv->rkt_init_cond, &authority->priv->rkt_init_mutex); +- g_mutex_unlock (&authority->priv->rkt_init_mutex); ++ if (!JS_DefineFunctions (authority->priv->cx, ++ authority->priv->js_polkit, ++ js_polkit_functions)) ++ goto fail; + +- setup_file_monitors (authority); +- load_scripts (authority); ++ if (!JS_EvaluateScript (authority->priv->cx, ++ authority->priv->js_global, ++ init_js, strlen (init_js), /* init.js */ ++ "init.js", /* filename */ ++ 0, /* lineno */ ++ NULL)) /* rval */ ++ { ++ goto fail; ++ } ++ ++ if (authority->priv->rules_dirs == NULL) ++ { ++ authority->priv->rules_dirs = g_new0 (gchar *, 3); ++ authority->priv->rules_dirs[0] = g_strdup (PACKAGE_SYSCONF_DIR "/polkit-1/rules.d"); ++ authority->priv->rules_dirs[1] = g_strdup (PACKAGE_DATA_DIR "/polkit-1/rules.d"); ++ } ++ ++ g_mutex_init (&authority->priv->rkt_init_mutex); ++ g_cond_init (&authority->priv->rkt_init_cond); ++ g_mutex_init (&authority->priv->rkt_timeout_pending_mutex); ++ ++ authority->priv->runaway_killer_thread = g_thread_new ("runaway-killer-thread", ++ runaway_killer_thread_func, ++ authority); ++ ++ /* wait for runaway_killer_thread to set up its GMainContext */ ++ g_mutex_lock (&authority->priv->rkt_init_mutex); ++ while (authority->priv->rkt_context == NULL) ++ g_cond_wait (&authority->priv->rkt_init_cond, &authority->priv->rkt_init_mutex); ++ g_mutex_unlock (&authority->priv->rkt_init_mutex); ++ ++ setup_file_monitors (authority); ++ load_scripts (authority); + } + JS_EndRequest (authority->priv->cx); + entered_request = FALSE; +@@ -559,7 +559,7 @@ polkit_backend_js_authority_finalize (GObject *object) + { + GFileMonitor *monitor = authority->priv->dir_monitors[n]; + g_signal_handlers_disconnect_by_func (monitor, +- G_CALLBACK (on_dir_monitor_changed), ++ (gpointer*)G_CALLBACK (on_dir_monitor_changed), + authority); + g_object_unref (monitor); + } +@@ -645,7 +645,7 @@ polkit_backend_js_authority_class_init (PolkitBackendJsAuthorityClass *klass) + NULL, + NULL, + G_TYPE_STRV, +- G_PARAM_CONSTRUCT_ONLY | G_PARAM_WRITABLE)); ++ GParamFlags(G_PARAM_CONSTRUCT_ONLY | G_PARAM_WRITABLE))); + + + g_type_class_add_private (klass, sizeof (PolkitBackendJsAuthorityPrivate)); +@@ -685,7 +685,7 @@ set_property_strv (PolkitBackendJsAuthority *authority, + JSString *jsstr; + jsval val; + +- jsstr = JS_NewStringCopyZ (authority->priv->cx, g_ptr_array_index(value, n)); ++ jsstr = JS_NewStringCopyZ (authority->priv->cx, (char *)g_ptr_array_index(value, n)); + val = STRING_TO_JSVAL (jsstr); + JS_SetElement (authority->priv->cx, array_object, n, &val); + } +@@ -1347,8 +1347,8 @@ spawn_cb (GObject *source_object, + GAsyncResult *res, + gpointer user_data) + { +- SpawnData *data = user_data; +- data->res = g_object_ref (res); ++ SpawnData *data = (SpawnData *)user_data; ++ data->res = (GAsyncResult*)g_object_ref (res); + g_main_loop_quit (data->loop); + } + +@@ -1657,7 +1657,7 @@ static void + utils_on_cancelled (GCancellable *cancellable, + gpointer user_data) + { +- UtilsSpawnData *data = user_data; ++ UtilsSpawnData *data = (UtilsSpawnData *)user_data; + GError *error; + + error = NULL; +@@ -1672,7 +1672,7 @@ utils_read_child_stderr (GIOChannel *channel, + GIOCondition condition, + gpointer user_data) + { +- UtilsSpawnData *data = user_data; ++ UtilsSpawnData *data = (UtilsSpawnData *)user_data; + gchar buf[1024]; + gsize bytes_read; + +@@ -1686,7 +1686,7 @@ utils_read_child_stdout (GIOChannel *channel, + GIOCondition condition, + gpointer user_data) + { +- UtilsSpawnData *data = user_data; ++ UtilsSpawnData *data = (UtilsSpawnData *)user_data; + gchar buf[1024]; + gsize bytes_read; + +@@ -1700,7 +1700,7 @@ utils_child_watch_cb (GPid pid, + gint status, + gpointer user_data) + { +- UtilsSpawnData *data = user_data; ++ UtilsSpawnData *data = (UtilsSpawnData *)user_data; + gchar *buf; + gsize buf_size; + +@@ -1729,7 +1729,7 @@ utils_child_watch_cb (GPid pid, + static gboolean + utils_timeout_cb (gpointer user_data) + { +- UtilsSpawnData *data = user_data; ++ UtilsSpawnData *data = (UtilsSpawnData *)user_data; + + data->timed_out = TRUE; + +@@ -1758,12 +1758,12 @@ utils_spawn (const gchar *const *argv, + data->simple = g_simple_async_result_new (NULL, + callback, + user_data, +- utils_spawn); ++ (gpointer*)utils_spawn); + data->main_context = g_main_context_get_thread_default (); + if (data->main_context != NULL) + g_main_context_ref (data->main_context); + +- data->cancellable = cancellable != NULL ? g_object_ref (cancellable) : NULL; ++ data->cancellable = cancellable != NULL ? (GCancellable*)g_object_ref (cancellable) : NULL; + + data->child_stdout = g_string_new (NULL); + data->child_stderr = g_string_new (NULL); +@@ -1796,7 +1796,7 @@ utils_spawn (const gchar *const *argv, + if (!g_spawn_async_with_pipes (NULL, /* working directory */ + (gchar **) argv, + NULL, /* envp */ +- G_SPAWN_SEARCH_PATH | G_SPAWN_DO_NOT_REAP_CHILD, ++ GSpawnFlags(G_SPAWN_SEARCH_PATH | G_SPAWN_DO_NOT_REAP_CHILD), + NULL, /* child_setup */ + NULL, /* child_setup's user_data */ + &(data->child_pid), +@@ -1863,7 +1863,7 @@ utils_spawn_finish (GAsyncResult *res, + if (g_simple_async_result_propagate_error (simple, error)) + goto out; + +- data = g_simple_async_result_get_op_res_gpointer (simple); ++ data = (UtilsSpawnData*)g_simple_async_result_get_op_res_gpointer (simple); + + if (data->timed_out) + { +-- +2.12.1 + +From 2d4d117eeadde9b56ac49e82a2d701a6f6e387b5 Mon Sep 17 00:00:00 2001 +From: Jeremy Linton +Date: Fri, 26 Aug 2016 14:01:49 -0500 +Subject: [PATCH 27/29] Replace autocompartment + +The autocompartment definition in the previous patches seems to be fine, but +constructing the autocompartment for the lifetime of the global object is probably +a better way to handle this. + +Signed-off-by: Jeremy Linton +--- + src/polkitbackend/polkitbackendjsauthority.cpp | 15 ++++++++------- + 1 file changed, 8 insertions(+), 7 deletions(-) + +diff --git a/src/polkitbackend/polkitbackendjsauthority.cpp b/src/polkitbackend/polkitbackendjsauthority.cpp +index ce3a980..6a0b4ab 100644 +--- a/src/polkitbackend/polkitbackendjsauthority.cpp ++++ b/src/polkitbackend/polkitbackendjsauthority.cpp +@@ -76,6 +76,7 @@ struct _PolkitBackendJsAuthorityPrivate + JSRuntime *rt; + JSContext *cx; + JSObject *js_global; ++ JSAutoCompartment *ac; + JSObject *js_polkit; + + GThread *runaway_killer_thread; +@@ -335,8 +336,6 @@ reload_scripts (PolkitBackendJsAuthority *authority) + + JS_BeginRequest (authority->priv->cx); + +- JSAutoCompartment ac(authority->priv->cx, authority->priv->js_global); +- + if (!JS_CallFunctionName(authority->priv->cx, + authority->priv->js_polkit, + "_deleteRules", +@@ -467,10 +466,15 @@ polkit_backend_js_authority_constructed (GObject *object) + JS::CompartmentOptions compart_opts; + compart_opts.setVersion(JSVERSION_LATEST); + authority->priv->js_global = JS_NewGlobalObject (authority->priv->cx, &js_global_class, NULL, compart_opts); +- JSAutoCompartment ac(authority->priv->cx, authority->priv->js_global); + + if (authority->priv->js_global == NULL) + goto fail; ++ ++ authority->priv->ac = new JSAutoCompartment(authority->priv->cx, authority->priv->js_global); ++ ++ if (authority->priv->ac == NULL) ++ goto fail; ++ + JS_AddObjectRoot (authority->priv->cx, &authority->priv->js_global); + + if (!JS_InitStandardClasses (authority->priv->cx, authority->priv->js_global)) +@@ -568,6 +572,7 @@ polkit_backend_js_authority_finalize (GObject *object) + + JS_BeginRequest (authority->priv->cx); + JS_RemoveObjectRoot (authority->priv->cx, &authority->priv->js_polkit); ++ delete authority->priv->ac; + JS_RemoveObjectRoot (authority->priv->cx, &authority->priv->js_global); + JS_EndRequest (authority->priv->cx); + +@@ -1071,8 +1076,6 @@ polkit_backend_js_authority_get_admin_auth_identities (PolkitBackendInteractiveA + + JS_BeginRequest (authority->priv->cx); + +- JSAutoCompartment ac(authority->priv->cx, authority->priv->js_global); +- + if (!action_and_details_to_jsval (authority, action_id, details, &argv[0], &error)) + { + polkit_backend_authority_log (POLKIT_BACKEND_AUTHORITY (authority), +@@ -1182,8 +1185,6 @@ polkit_backend_js_authority_check_authorization_sync (PolkitBackendInteractiveAu + + JS_BeginRequest (authority->priv->cx); + +- JSAutoCompartment ac(authority->priv->cx, authority->priv->js_global); +- + if (!action_and_details_to_jsval (authority, action_id, details, &argv[0], &error)) + { + polkit_backend_authority_log (POLKIT_BACKEND_AUTHORITY (authority), +-- +2.12.1 + diff --git a/polkit-remove-polkitbackendconfigsource.-ch.patch b/polkit-remove-polkitbackendconfigsource.-ch.patch new file mode 100644 index 0000000..d8080d3 --- /dev/null +++ b/polkit-remove-polkitbackendconfigsource.-ch.patch @@ -0,0 +1,720 @@ +From 6ff6548e021938b1ec41137b8964e5079dfe2bfa Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Miloslav=20Trma=C4=8D?= +Date: Wed, 23 Mar 2016 13:18:58 +0100 +Subject: [PATCH 17/29] Remove polkitbackendconfigsource.[ch] + +It is no longer used since the move to JavaScript, and we don't want to +maintain it unnecessarily. + +https://bugs.freedesktop.org/show_bug.cgi?id=94670 +--- + src/polkitbackend/Makefile.am | 1 - + src/polkitbackend/polkitbackendconfigsource.c | 565 --------------------- + src/polkitbackend/polkitbackendconfigsource.h | 98 ---- + .../polkitbackendinteractiveauthority.c | 1 - + 4 files changed, 665 deletions(-) + delete mode 100644 src/polkitbackend/polkitbackendconfigsource.c + delete mode 100644 src/polkitbackend/polkitbackendconfigsource.h + +diff --git a/src/polkitbackend/Makefile.am b/src/polkitbackend/Makefile.am +index 547ca82..a80ca36 100644 +--- a/src/polkitbackend/Makefile.am ++++ b/src/polkitbackend/Makefile.am +@@ -34,7 +34,6 @@ libpolkit_backend_1_la_SOURCES = \ + polkitbackendinteractiveauthority.h polkitbackendinteractiveauthority.c \ + polkitbackendjsauthority.h polkitbackendjsauthority.c \ + polkitbackendactionpool.h polkitbackendactionpool.c \ +- polkitbackendconfigsource.h polkitbackendconfigsource.c \ + polkitbackendactionlookup.h polkitbackendactionlookup.c \ + $(NULL) + +diff --git a/src/polkitbackend/polkitbackendconfigsource.c b/src/polkitbackend/polkitbackendconfigsource.c +deleted file mode 100644 +index 838bc6a..0000000 +--- a/src/polkitbackend/polkitbackendconfigsource.c ++++ /dev/null +@@ -1,565 +0,0 @@ +-/* +- * Copyright (C) 2008 Red Hat, Inc. +- * +- * This library is free software; you can redistribute it and/or +- * modify it under the terms of the GNU Lesser General Public +- * License as published by the Free Software Foundation; either +- * version 2 of the License, or (at your option) any later version. +- * +- * This library is distributed in the hope that it will be useful, +- * but WITHOUT ANY WARRANTY; without even the implied warranty of +- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +- * Lesser General Public License for more details. +- * +- * You should have received a copy of the GNU Lesser General +- * Public License along with this library; if not, write to the +- * Free Software Foundation, Inc., 59 Temple Place, Suite 330, +- * Boston, MA 02111-1307, USA. +- * +- * Author: David Zeuthen +- */ +- +-#include "config.h" +- +-#include +-#include "polkitbackendconfigsource.h" +- +-/* +- * SECTION:polkitbackendconfigsource +- * @title: PolkitBackendConfigSource +- * @short_description: Access configuration files +- * +- * The #PolkitBackendConfigSource class is a utility class to read +- * configuration data from a set of prioritized key-value files in a +- * given directory. +- */ +- +-struct _PolkitBackendConfigSourcePrivate +-{ +- GFile *directory; +- +- GFileMonitor *directory_monitor; +- +- /* sorted according to priority, higher priority is first */ +- GList *key_files; +- +- gboolean has_data; +-}; +- +-enum +-{ +- PROP_0, +- PROP_DIRECTORY, +-}; +- +-enum +-{ +- CHANGED_SIGNAL, +- LAST_SIGNAL, +-}; +- +-static guint signals[LAST_SIGNAL] = {0}; +- +-static void polkit_backend_config_source_purge (PolkitBackendConfigSource *source); +- +-static void polkit_backend_config_source_ensure (PolkitBackendConfigSource *source); +- +-G_DEFINE_TYPE (PolkitBackendConfigSource, polkit_backend_config_source, G_TYPE_OBJECT); +- +-/* ---------------------------------------------------------------------------------------------------- */ +- +-static void +-polkit_backend_config_source_init (PolkitBackendConfigSource *source) +-{ +- source->priv = G_TYPE_INSTANCE_GET_PRIVATE (source, +- POLKIT_BACKEND_TYPE_CONFIG_SOURCE, +- PolkitBackendConfigSourcePrivate); +-} +- +-static void +-polkit_backend_config_source_finalize (GObject *object) +-{ +- PolkitBackendConfigSource *source = POLKIT_BACKEND_CONFIG_SOURCE (object); +- +- if (source->priv->directory != NULL) +- g_object_unref (source->priv->directory); +- +- if (source->priv->directory_monitor != NULL) +- g_object_unref (source->priv->directory_monitor); +- +- g_list_foreach (source->priv->key_files, (GFunc) g_key_file_free, NULL); +- g_list_free (source->priv->key_files); +- +- if (G_OBJECT_CLASS (polkit_backend_config_source_parent_class)->finalize != NULL) +- G_OBJECT_CLASS (polkit_backend_config_source_parent_class)->finalize (object); +-} +- +- +-static void +-polkit_backend_config_source_get_property (GObject *object, +- guint prop_id, +- GValue *value, +- GParamSpec *pspec) +-{ +- PolkitBackendConfigSource *source = POLKIT_BACKEND_CONFIG_SOURCE (object); +- +- switch (prop_id) +- { +- case PROP_DIRECTORY: +- g_value_set_object (value, source->priv->directory); +- break; +- +- default: +- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); +- break; +- } +-} +- +-static void +-polkit_backend_config_source_set_property (GObject *object, +- guint prop_id, +- const GValue *value, +- GParamSpec *pspec) +-{ +- PolkitBackendConfigSource *source = POLKIT_BACKEND_CONFIG_SOURCE (object); +- +- switch (prop_id) +- { +- case PROP_DIRECTORY: +- source->priv->directory = g_value_dup_object (value); +- break; +- +- default: +- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); +- break; +- } +-} +- +-static void +-directory_monitor_changed (GFileMonitor *monitor, +- GFile *file, +- GFile *other_file, +- GFileMonitorEvent event_type, +- gpointer user_data) +-{ +- PolkitBackendConfigSource *source; +- +- source = POLKIT_BACKEND_CONFIG_SOURCE (user_data); +- +- if (file != NULL) +- { +- gchar *name; +- +- name = g_file_get_basename (file); +- +- //g_debug ("event_type=%d file=%p name=%s", event_type, file, name); +- +- if (!g_str_has_prefix (name, ".") && +- !g_str_has_prefix (name, "#") && +- g_str_has_suffix (name, ".conf") && +- (event_type == G_FILE_MONITOR_EVENT_CREATED || +- event_type == G_FILE_MONITOR_EVENT_DELETED || +- event_type == G_FILE_MONITOR_EVENT_CHANGES_DONE_HINT)) +- { +- +- //g_debug ("match"); +- +- /* now throw away all caches */ +- polkit_backend_config_source_purge (source); +- g_signal_emit_by_name (source, "changed"); +- } +- +- g_free (name); +- } +-} +- +-static void +-polkit_backend_config_source_constructed (GObject *object) +-{ +- PolkitBackendConfigSource *source = POLKIT_BACKEND_CONFIG_SOURCE (object); +- GError *error; +- +- error = NULL; +- source->priv->directory_monitor = g_file_monitor_directory (source->priv->directory, +- G_FILE_MONITOR_NONE, +- NULL, +- &error); +- if (source->priv->directory_monitor == NULL) +- { +- gchar *dir_name; +- dir_name = g_file_get_uri (source->priv->directory); +- g_warning ("Error monitoring directory %s: %s", dir_name, error->message); +- g_free (dir_name); +- g_error_free (error); +- } +- else +- { +- g_signal_connect (source->priv->directory_monitor, +- "changed", +- (GCallback) directory_monitor_changed, +- source); +- } +- +- if (G_OBJECT_CLASS (polkit_backend_config_source_parent_class)->constructed != NULL) +- G_OBJECT_CLASS (polkit_backend_config_source_parent_class)->constructed (object); +-} +- +-static void +-polkit_backend_config_source_class_init (PolkitBackendConfigSourceClass *klass) +-{ +- GObjectClass *gobject_class; +- +- gobject_class = G_OBJECT_CLASS (klass); +- +- gobject_class->get_property = polkit_backend_config_source_get_property; +- gobject_class->set_property = polkit_backend_config_source_set_property; +- gobject_class->constructed = polkit_backend_config_source_constructed; +- gobject_class->finalize = polkit_backend_config_source_finalize; +- +- g_type_class_add_private (klass, sizeof (PolkitBackendConfigSourcePrivate)); +- +- /** +- * PolkitBackendConfigSource:directory: +- * +- * The directory to watch for configuration files. +- */ +- g_object_class_install_property (gobject_class, +- PROP_DIRECTORY, +- g_param_spec_object ("directory", +- "Directory", +- "The directory to watch for configuration files", +- G_TYPE_FILE, +- G_PARAM_CONSTRUCT_ONLY | +- G_PARAM_READWRITE | +- G_PARAM_STATIC_NAME | +- G_PARAM_STATIC_BLURB | +- G_PARAM_STATIC_NICK)); +- +- /** +- * PolkitBackendConfiguSource::changed: +- * @source: A #PolkitBackendConfigSource. +- * +- * Emitted when configuration files in #PolkitBackendConfiguSource:directory changes. +- */ +- signals[CHANGED_SIGNAL] = g_signal_new ("changed", +- POLKIT_BACKEND_TYPE_CONFIG_SOURCE, +- G_SIGNAL_RUN_LAST, +- G_STRUCT_OFFSET (PolkitBackendConfigSourceClass, changed), +- NULL, +- NULL, +- g_cclosure_marshal_VOID__VOID, +- G_TYPE_NONE, +- 0); +-} +- +-/** +- * polkit_backend_config_source_new: +- * @directory: The directory to watch. +- * +- * Creates a new #PolkitBackendConfigSource object that reads +- * configuration from @directory. To watch for configuration changes, +- * connect to the #PolkitBackendConfigSource::changed signal. +- * +- * Returns: A #PolkitBackendConfigSource for @directory. Free with +- * g_object_unref(). +- **/ +-PolkitBackendConfigSource * +-polkit_backend_config_source_new (GFile *directory) +-{ +- PolkitBackendConfigSource *source; +- +- source = POLKIT_BACKEND_CONFIG_SOURCE (g_object_new (POLKIT_BACKEND_TYPE_CONFIG_SOURCE, +- "directory", directory, +- NULL)); +- +- return source; +-} +- +-static void +-polkit_backend_config_source_purge (PolkitBackendConfigSource *source) +-{ +- g_list_foreach (source->priv->key_files, (GFunc) g_key_file_free, NULL); +- g_list_free (source->priv->key_files); +- source->priv->key_files = NULL; +- +- source->priv->has_data = FALSE; +-} +- +-static gint +-compare_filename (GFile *a, GFile *b) +-{ +- gchar *a_uri; +- gchar *b_uri; +- gint ret; +- +- a_uri = g_file_get_uri (a); +- b_uri = g_file_get_uri (b); +- +- /* TODO: use ASCII sort function? */ +- ret = -g_strcmp0 (a_uri, b_uri); +- +- return ret; +-} +- +-static void +-polkit_backend_config_source_ensure (PolkitBackendConfigSource *source) +-{ +- GFileEnumerator *enumerator; +- GFileInfo *file_info; +- GError *error; +- GList *files; +- GList *l; +- +- files = NULL; +- +- if (source->priv->has_data) +- goto out; +- +- polkit_backend_config_source_purge (source); +- +- error = NULL; +- enumerator = g_file_enumerate_children (source->priv->directory, +- "standard::name", +- G_FILE_QUERY_INFO_NONE, +- NULL, +- &error); +- if (enumerator == NULL) +- { +- gchar *dir_name; +- dir_name = g_file_get_uri (source->priv->directory); +- g_warning ("Error enumerating files in %s: %s", dir_name, error->message); +- g_free (dir_name); +- g_error_free (error); +- goto out; +- } +- +- while ((file_info = g_file_enumerator_next_file (enumerator, NULL, &error)) != NULL) +- { +- const gchar *name; +- +- name = g_file_info_get_name (file_info); +- +- /* only consider files ending in .conf */ +- if (g_str_has_suffix (name, ".conf")) +- files = g_list_prepend (files, g_file_get_child (source->priv->directory, name)); +- +- g_object_unref (file_info); +- } +- g_object_unref (enumerator); +- if (error != NULL) +- { +- g_warning ("Error enumerating files: %s", error->message); +- g_error_free (error); +- goto out; +- } +- +- files = g_list_sort (files, (GCompareFunc) compare_filename); +- +- /* process files; highest priority comes first */ +- for (l = files; l != NULL; l = l->next) +- { +- GFile *file = G_FILE (l->data); +- gchar *filename; +- GKeyFile *key_file; +- +- filename = g_file_get_path (file); +- +- key_file = g_key_file_new (); +- +- error = NULL; +- if (!g_key_file_load_from_file (key_file, +- filename, +- G_KEY_FILE_NONE, +- NULL)) +- { +- g_warning ("Error loading key-file %s: %s", filename, error->message); +- g_error_free (error); +- error = NULL; +- g_key_file_free (key_file); +- } +- else +- { +- source->priv->key_files = g_list_prepend (source->priv->key_files, key_file); +- } +- +- g_free (filename); +- } +- +- source->priv->key_files = g_list_reverse (source->priv->key_files); +- source->priv->has_data = TRUE; +- +- out: +- g_list_foreach (files, (GFunc) g_object_unref, NULL); +- g_list_free (files); +-} +- +-static GKeyFile * +-find_key_file (PolkitBackendConfigSource *source, +- const gchar *group, +- const gchar *key, +- GError **error) +-{ +- GList *l; +- GKeyFile *ret; +- +- ret = NULL; +- +- for (l = source->priv->key_files; l != NULL; l = l->next) +- { +- GKeyFile *key_file = l->data; +- +- if (g_key_file_has_key (key_file, group, key, NULL)) +- { +- ret = key_file; +- goto out; +- } +- } +- +- out: +- if (ret == NULL) +- g_set_error_literal (error, +- G_KEY_FILE_ERROR, +- G_KEY_FILE_ERROR_NOT_FOUND, +- "Group/Key combo not found in any config file"); +- return ret; +-} +- +-/** +- * polkit_backend_config_source_get_integer: +- * @source: A PolkitBackendConfigSource. +- * @group: A group name. +- * @key: A key name. +- * @error: Return location for error or %NULL. +- * +- * Gets the value associated with @key under @group_name. +- * +- * Returns: The value or 0 if @error is set. +- **/ +-gint +-polkit_backend_config_source_get_integer (PolkitBackendConfigSource *source, +- const gchar *group, +- const gchar *key, +- GError **error) +-{ +- GKeyFile *key_file; +- +- polkit_backend_config_source_ensure (source); +- +- key_file = find_key_file (source, group, key, error); +- if (key_file == NULL) +- return 0; +- +- return g_key_file_get_integer (key_file, group, key, error); +-} +- +-/** +- * polkit_backend_config_source_get_boolean: +- * @source: A PolkitBackendConfigSource. +- * @group: A group name. +- * @key: A key name. +- * @error: Return location for error or %NULL. +- * +- * Gets the value associated with @key under @group_name. +- * +- * Returns: The value or %FALSE if @error is set. +- **/ +-gboolean +-polkit_backend_config_source_get_boolean (PolkitBackendConfigSource *source, +- const gchar *group, +- const gchar *key, +- GError **error) +-{ +- GKeyFile *key_file; +- +- polkit_backend_config_source_ensure (source); +- +- key_file = find_key_file (source, group, key, error); +- if (key_file == NULL) +- return FALSE; +- +- return g_key_file_get_boolean (key_file, group, key, error); +-} +- +-/** +- * polkit_backend_config_source_get_double: +- * @source: A PolkitBackendConfigSource. +- * @group: A group name. +- * @key: A key name. +- * @error: Return location for error or %NULL. +- * +- * Gets the value associated with @key under @group_name. +- * +- * Returns: The value or 0.0 if @error is set. +- **/ +-gdouble +-polkit_backend_config_source_get_double (PolkitBackendConfigSource *source, +- const gchar *group, +- const gchar *key, +- GError **error) +-{ +- GKeyFile *key_file; +- +- polkit_backend_config_source_ensure (source); +- +- key_file = find_key_file (source, group, key, error); +- if (key_file == NULL) +- return 0.0; +- +- return g_key_file_get_double (key_file, group, key, error); +-} +- +-/** +- * polkit_backend_config_source_get_string: +- * @source: A PolkitBackendConfigSource. +- * @group: A group name. +- * @key: A key name. +- * @error: Return location for error or %NULL. +- * +- * Gets the value associated with @key under @group_name. +- * +- * Returns: The value or %NULL if @error is set. +- **/ +-gchar * +-polkit_backend_config_source_get_string (PolkitBackendConfigSource *source, +- const gchar *group, +- const gchar *key, +- GError **error) +-{ +- GKeyFile *key_file; +- +- polkit_backend_config_source_ensure (source); +- +- key_file = find_key_file (source, group, key, error); +- if (key_file == NULL) +- return NULL; +- +- return g_key_file_get_string (key_file, group, key, error); +-} +- +-/** +- * polkit_backend_config_source_get_string_list: +- * @source: A PolkitBackendConfigSource. +- * @group: A group name. +- * @key: A key name. +- * @error: Return location for error or %NULL. +- * +- * Gets the values associated with @key under @group_name. +- * +- * Returns: The value or %NULL if @error is set. +- **/ +-gchar ** +-polkit_backend_config_source_get_string_list (PolkitBackendConfigSource *source, +- const gchar *group, +- const gchar *key, +- GError **error) +-{ +- GKeyFile *key_file; +- +- polkit_backend_config_source_ensure (source); +- +- key_file = find_key_file (source, group, key, error); +- if (key_file == NULL) +- return NULL; +- +- return g_key_file_get_string_list (key_file, group, key, NULL, error); +-} +diff --git a/src/polkitbackend/polkitbackendconfigsource.h b/src/polkitbackend/polkitbackendconfigsource.h +deleted file mode 100644 +index f9a48c8..0000000 +--- a/src/polkitbackend/polkitbackendconfigsource.h ++++ /dev/null +@@ -1,98 +0,0 @@ +-/* +- * Copyright (C) 2008 Red Hat, Inc. +- * +- * This library is free software; you can redistribute it and/or +- * modify it under the terms of the GNU Lesser General Public +- * License as published by the Free Software Foundation; either +- * version 2 of the License, or (at your option) any later version. +- * +- * This library is distributed in the hope that it will be useful, +- * but WITHOUT ANY WARRANTY; without even the implied warranty of +- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +- * Lesser General Public License for more details. +- * +- * You should have received a copy of the GNU Lesser General +- * Public License along with this library; if not, write to the +- * Free Software Foundation, Inc., 59 Temple Place, Suite 330, +- * Boston, MA 02111-1307, USA. +- * +- * Author: David Zeuthen +- */ +- +-#if !defined (_POLKIT_BACKEND_COMPILATION) || defined(_POLKIT_BACKEND_INSIDE_POLKIT_BACKEND_H) +-#error "This is a private header file." +-#endif +- +-#ifndef __POLKIT_BACKEND_CONFIG_SOURCE_H +-#define __POLKIT_BACKEND_CONFIG_SOURCE_H +- +-#include +-#include +-#include +- +-G_BEGIN_DECLS +- +-#define POLKIT_BACKEND_TYPE_CONFIG_SOURCE (polkit_backend_config_source_get_type ()) +-#define POLKIT_BACKEND_CONFIG_SOURCE(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), POLKIT_BACKEND_TYPE_CONFIG_SOURCE, PolkitBackendConfigSource)) +-#define POLKIT_BACKEND_CONFIG_SOURCE_CLASS(k) (G_TYPE_CHECK_CLASS_CAST ((k), POLKIT_BACKEND_TYPE_CONFIG_SOURCE, PolkitBackendConfigSourceClass)) +-#define POLKIT_BACKEND_CONFIG_SOURCE_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), POLKIT_BACKEND_TYPE_CONFIG_SOURCE,PolkitBackendConfigSourceClass)) +-#define POLKIT_BACKEND_IS_CONFIG_SOURCE(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), POLKIT_BACKEND_TYPE_CONFIG_SOURCE)) +-#define POLKIT_BACKEND_IS_CONFIG_SOURCE_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), POLKIT_BACKEND_TYPE_CONFIG_SOURCE)) +- +-typedef struct _PolkitBackendConfigSource PolkitBackendConfigSource; +-typedef struct _PolkitBackendConfigSourceClass PolkitBackendConfigSourceClass; +-typedef struct _PolkitBackendConfigSourcePrivate PolkitBackendConfigSourcePrivate; +- +-struct _PolkitBackendConfigSource +-{ +- GObject parent_instance; +- PolkitBackendConfigSourcePrivate *priv; +-}; +- +-struct _PolkitBackendConfigSourceClass +-{ +- /*< public >*/ +- GObjectClass parent_class; +- +- /* Signals */ +- void (*changed) (PolkitBackendConfigSource *config_source); +- +- /*< private >*/ +- /* Padding for future expansion */ +- void (*_polkit_reserved1) (void); +- void (*_polkit_reserved2) (void); +- void (*_polkit_reserved3) (void); +- void (*_polkit_reserved4) (void); +- void (*_polkit_reserved5) (void); +- void (*_polkit_reserved6) (void); +- void (*_polkit_reserved7) (void); +- void (*_polkit_reserved8) (void); +-}; +- +-GType polkit_backend_config_source_get_type (void) G_GNUC_CONST; +-PolkitBackendConfigSource *polkit_backend_config_source_new (GFile *directory); +-gint polkit_backend_config_source_get_integer (PolkitBackendConfigSource *source, +- const gchar *group, +- const gchar *key, +- GError **error); +-gboolean polkit_backend_config_source_get_boolean (PolkitBackendConfigSource *source, +- const gchar *group, +- const gchar *key, +- GError **error); +-gdouble polkit_backend_config_source_get_double (PolkitBackendConfigSource *source, +- const gchar *group, +- const gchar *key, +- GError **error); +-gchar *polkit_backend_config_source_get_string (PolkitBackendConfigSource *source, +- const gchar *group, +- const gchar *key, +- GError **error); +-gchar **polkit_backend_config_source_get_string_list (PolkitBackendConfigSource *source, +- const gchar *group, +- const gchar *key, +- GError **error); +- +-G_END_DECLS +- +-#endif /* __POLKIT_BACKEND_CONFIG_SOURCE_H */ +- +diff --git a/src/polkitbackend/polkitbackendinteractiveauthority.c b/src/polkitbackend/polkitbackendinteractiveauthority.c +index 967b764..ccfd608 100644 +--- a/src/polkitbackend/polkitbackendinteractiveauthority.c ++++ b/src/polkitbackend/polkitbackendinteractiveauthority.c +@@ -36,7 +36,6 @@ + #include "polkitbackendinteractiveauthority.h" + #include "polkitbackendactionpool.h" + #include "polkitbackendsessionmonitor.h" +-#include "polkitbackendconfigsource.h" + + #include + +-- +2.12.1 + diff --git a/polkit.spec b/polkit.spec index ff75d62..5b7bc36 100644 --- a/polkit.spec +++ b/polkit.spec @@ -1,3 +1,5 @@ +%global _default_patch_fuzz 2 + # Only enable if using patches that touches configure.ac, # Makefile.am or other build system related files # @@ -6,19 +8,19 @@ Summary: An authorization framework Name: polkit Version: 0.113 -Release: 10.git2919920%{?dist} +Release: 9%{?dist} License: LGPLv2+ URL: http://www.freedesktop.org/wiki/Software/polkit -# Source0: http://www.freedesktop.org/software/polkit/releases/%{name}-%{version}.tar.gz -# Source1: http://www.freedesktop.org/software/polkit/releases/%{name}-%{version}.tar.gz.sign -# git archive --format=tar --prefix=polkit-0.113/ 2919920 | gzip > polkit-0.113-2919920.tar.gz -Source0: polkit-0.113-2919920.tar.gz - +Source0: http://www.freedesktop.org/software/polkit/releases/%{name}-%{version}.tar.gz +Source1: http://www.freedesktop.org/software/polkit/releases/%{name}-%{version}.tar.gz.sign # https://bugs.freedesktop.org/show_bug.cgi?id=99741 Patch0: polkit-0.113-agent-leaks.patch +Patch1: polkit-remove-polkitbackendconfigsource.-ch.patch +Patch2: polkit-mozjs24.patch +Patch3: polkit-build-Pull-in-GCC-warning-infra-from-ostree.patch # https://lists.freedesktop.org/archives/polkit-devel/2017-March/000527.html -Patch1: polkit-mozjs38.patch +Patch4: polkit-mozjs38.patch BuildRequires: glib2-devel >= 2.30.0 BuildRequires: expat-devel @@ -87,17 +89,20 @@ Libraries files for polkit. %prep %setup -q %patch0 -p1 -b .agent-leaks -%patch1 -p1 -b .js38 +%patch1 -p1 -b .rem +%patch2 -p1 -b .js24 +%patch3 -p1 -b .ost +%patch4 -p1 -b .js38 %build %if 0%{?enable_autoreconf} -./autogen.sh +autoreconf -vif %endif %configure --enable-gtk-doc \ --disable-static \ --enable-introspection \ --disable-examples \ - --enable-libsystemd-login=yes --with-mozjs=mozjs-38.0 + --enable-libsystemd-login=yes --with-mozjs=mozjs-17.0 make %{?_smp_mflags} V=1 @@ -106,7 +111,6 @@ make install DESTDIR=%{buildroot} INSTALL='install -p' # Remove libtool archives and static libs find %{buildroot} -type f -name "*.la" -delete -rm -rf %{buildroot}/%{_datadir}/gettext/ %find_lang polkit-1 @@ -171,9 +175,6 @@ exit 0 %{_libdir}/girepository-1.0/*.typelib %changelog -* Tue Apr 4 2017 Peter Robinson 0.113-10 -- Move to an upstream snapshot, rebase patches - * Fri Mar 31 2017 Rex Dieter - 0.113-9 - restore Provides: polkit-desktop-policy polkit-js-engine diff --git a/sources b/sources index 77224ed..afa6554 100644 --- a/sources +++ b/sources @@ -1 +1,2 @@ -SHA512 (polkit-0.113-2919920.tar.gz) = 62b4ccdf6353dd4037354443eb9b56b9cf01de3dbbe33290fa7172314dd0ef765d88f7e35b6cba105f4ca1e071d3e32e4cde578725acfe2e3ec22fe8ec2a0415 +4b77776c9e4f897dcfe03b2c34198edf polkit-0.113.tar.gz +86b92a63394de618898b43f5722e9fe2 polkit-0.113.tar.gz.sign