Hello community,
here is the log from the commit of package liblazy
checked in at Thu Aug 16 14:10:42 CEST 2007.
--------
--- liblazy/liblazy.changes 2006-11-17 16:57:24.000000000 +0100
+++ /mounts/work_src_done/STABLE/liblazy/liblazy.changes 2007-08-16 11:43:00.000000000 +0200
@@ -1,0 +2,10 @@
+Wed Aug 15 15:57:17 CEST 2007 - hmacht@suse.de
+
+- update to v0.2 due to PolicyKit update (novell bug 299733):
+ - use new PolicyKit API >= 0.4
+ - fix bug that liblazy_hal_query_capability doesn't always
+ return 'false'
+ - add function to use private D-Bus connection so that apps
+ survive a D-Bus restart
+
+-------------------------------------------------------------------
Old:
----
liblazy-0.1.1.tar.bz2
New:
----
liblazy-0.2-rpmlintrc
liblazy-0.2.tar.bz2
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ liblazy.spec ++++++
--- /var/tmp/diff_new_pack.bg2183/_old 2007-08-16 14:10:32.000000000 +0200
+++ /var/tmp/diff_new_pack.bg2183/_new 2007-08-16 14:10:32.000000000 +0200
@@ -1,7 +1,7 @@
#
-# spec file for package liblazy (Version 0.1.1)
+# spec file for package liblazy (Version 0.2)
#
-# Copyright (c) 2006 SUSE LINUX Products GmbH, Nuernberg, Germany.
+# Copyright (c) 2007 SUSE LINUX Products GmbH, Nuernberg, Germany.
# This file and all modifications and additions to the pristine
# package are under the same license as the package itself.
#
@@ -13,11 +13,12 @@
Name: liblazy
BuildRequires: dbus-1-devel pkgconfig
Summary: Liblazy - D-Bus methods provided for convenience
-Version: 0.1.1
+Version: 0.2
Release: 1
-License: GNU Library General Public License v. 2.0 and 2.1 (LGPL)
+License: LGPL v2 or later
Group: Development/Libraries/C and C++
Source: %{name}-%{version}.tar.bz2
+Source1: liblazy-0.2-rpmlintrc
BuildRoot: %{_tmppath}/%{name}-%{version}-build
Autoreqprov: on
@@ -46,6 +47,12 @@
%install
make DESTDIR=$RPM_BUILD_ROOT install
+%post
+%run_ldconfig
+
+%postun
+%run_ldconfig
+
%clean
rm -rf %{buildroot}
@@ -56,7 +63,14 @@
%_includedir/liblazy.h
%_libdir/pkgconfig/*.pc
-%changelog -n liblazy
+%changelog
+* Wed Aug 15 2007 - hmacht@suse.de
+- update to v0.2 due to PolicyKit update (novell bug 299733):
+ - use new PolicyKit API >= 0.4
+ - fix bug that liblazy_hal_query_capability doesn't always
+ return 'false'
+ - add function to use private D-Bus connection so that apps
+ survive a D-Bus restart
* Fri Nov 17 2006 - hmacht@suse.de
- add more error handling (novell bug 220912)
* Thu Oct 26 2006 - hmacht@suse.de
++++++ liblazy-0.1.1.tar.bz2 -> liblazy-0.2.tar.bz2 ++++++
++++ 10245 lines of diff (skipped)
++++ retrying with extended exclude list
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/liblazy-0.1.1/compile new/liblazy-0.2/compile
--- old/liblazy-0.1.1/compile 2006-11-10 19:34:29.000000000 +0100
+++ new/liblazy-0.2/compile 1970-01-01 01:00:00.000000000 +0100
@@ -1,142 +0,0 @@
-#! /bin/sh
-# Wrapper for compilers which do not understand `-c -o'.
-
-scriptversion=2005-05-14.22
-
-# Copyright (C) 1999, 2000, 2003, 2004, 2005 Free Software Foundation, Inc.
-# Written by Tom Tromey .
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2, or (at your option)
-# any later version.
-#
-# This program 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 General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-
-# As a special exception to the GNU General Public License, if you
-# distribute this file as part of a program that contains a
-# configuration script generated by Autoconf, you may include it under
-# the same distribution terms that you use for the rest of that program.
-
-# This file is maintained in Automake, please report
-# bugs to or send patches to
-# .
-
-case $1 in
- '')
- echo "$0: No command. Try \`$0 --help' for more information." 1>&2
- exit 1;
- ;;
- -h | --h*)
- cat <<\EOF
-Usage: compile [--help] [--version] PROGRAM [ARGS]
-
-Wrapper for compilers which do not understand `-c -o'.
-Remove `-o dest.o' from ARGS, run PROGRAM with the remaining
-arguments, and rename the output as expected.
-
-If you are trying to build a whole package this is not the
-right script to run: please start by reading the file `INSTALL'.
-
-Report bugs to .
-EOF
- exit $?
- ;;
- -v | --v*)
- echo "compile $scriptversion"
- exit $?
- ;;
-esac
-
-ofile=
-cfile=
-eat=
-
-for arg
-do
- if test -n "$eat"; then
- eat=
- else
- case $1 in
- -o)
- # configure might choose to run compile as `compile cc -o foo foo.c'.
- # So we strip `-o arg' only if arg is an object.
- eat=1
- case $2 in
- *.o | *.obj)
- ofile=$2
- ;;
- *)
- set x "$@" -o "$2"
- shift
- ;;
- esac
- ;;
- *.c)
- cfile=$1
- set x "$@" "$1"
- shift
- ;;
- *)
- set x "$@" "$1"
- shift
- ;;
- esac
- fi
- shift
-done
-
-if test -z "$ofile" || test -z "$cfile"; then
- # If no `-o' option was seen then we might have been invoked from a
- # pattern rule where we don't need one. That is ok -- this is a
- # normal compilation that the losing compiler can handle. If no
- # `.c' file was seen then we are probably linking. That is also
- # ok.
- exec "$@"
-fi
-
-# Name of file we expect compiler to create.
-cofile=`echo "$cfile" | sed -e 's|^.*/||' -e 's/\.c$/.o/'`
-
-# Create the lock directory.
-# Note: use `[/.-]' here to ensure that we don't use the same name
-# that we are using for the .o file. Also, base the name on the expected
-# object file name, since that is what matters with a parallel build.
-lockdir=`echo "$cofile" | sed -e 's|[/.-]|_|g'`.d
-while true; do
- if mkdir "$lockdir" >/dev/null 2>&1; then
- break
- fi
- sleep 1
-done
-# FIXME: race condition here if user kills between mkdir and trap.
-trap "rmdir '$lockdir'; exit 1" 1 2 15
-
-# Run the compile.
-"$@"
-ret=$?
-
-if test -f "$cofile"; then
- mv "$cofile" "$ofile"
-elif test -f "${cofile}bj"; then
- mv "${cofile}bj" "$ofile"
-fi
-
-rmdir "$lockdir"
-exit $ret
-
-# Local Variables:
-# mode: shell-script
-# sh-indentation: 2
-# eval: (add-hook 'write-file-hooks 'time-stamp)
-# time-stamp-start: "scriptversion="
-# time-stamp-format: "%:y-%02m-%02d.%02H"
-# time-stamp-end: "$"
-# End:
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/liblazy-0.1.1/config.h.in new/liblazy-0.2/config.h.in
--- old/liblazy-0.1.1/config.h.in 1970-01-01 01:00:00.000000000 +0100
+++ new/liblazy-0.2/config.h.in 2007-08-15 15:53:49.000000000 +0200
@@ -0,0 +1,64 @@
+/* config.h.in. Generated from configure.in by autoheader. */
+
+/* dbus system bus socket path */
+#undef DBUS_SYSTEM_BUS_SOCKET
+
+/* Define to 1 if you have the header file. */
+#undef HAVE_DLFCN_H
+
+/* Define to 1 if you have the header file. */
+#undef HAVE_ERRNO_H
+
+/* Define to 1 if you have the header file. */
+#undef HAVE_INTTYPES_H
+
+/* Define to 1 if you have the header file. */
+#undef HAVE_MEMORY_H
+
+/* Define to 1 if you have the header file. */
+#undef HAVE_STDINT_H
+
+/* Define to 1 if you have the header file. */
+#undef HAVE_STDIO_H
+
+/* Define to 1 if you have the header file. */
+#undef HAVE_STDLIB_H
+
+/* Define to 1 if you have the header file. */
+#undef HAVE_STRINGS_H
+
+/* Define to 1 if you have the header file. */
+#undef HAVE_STRING_H
+
+/* Define to 1 if you have the header file. */
+#undef HAVE_SYS_STAT_H
+
+/* Define to 1 if you have the header file. */
+#undef HAVE_SYS_TYPES_H
+
+/* Define to 1 if you have the header file. */
+#undef HAVE_UNISTD_H
+
+/* Name of package */
+#undef PACKAGE
+
+/* Define to the address where bug reports for this package should be sent. */
+#undef PACKAGE_BUGREPORT
+
+/* Define to the full name of this package. */
+#undef PACKAGE_NAME
+
+/* Define to the full name and version of this package. */
+#undef PACKAGE_STRING
+
+/* Define to the one symbol short name of this package. */
+#undef PACKAGE_TARNAME
+
+/* Define to the version of this package. */
+#undef PACKAGE_VERSION
+
+/* Define to 1 if you have the ANSI C header files. */
+#undef STDC_HEADERS
+
+/* Version number of package */
+#undef VERSION
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/liblazy-0.1.1/configure.in new/liblazy-0.2/configure.in
--- old/liblazy-0.1.1/configure.in 2006-11-15 21:59:16.000000000 +0100
+++ new/liblazy-0.2/configure.in 2007-08-15 15:44:00.000000000 +0200
@@ -3,9 +3,10 @@
AC_PREREQ(2.59)
-AC_INIT(liblazy, 0.1.1, hmacht@suse.de)
+AC_INIT(liblazy, 0.2, hmacht@suse.de)
AM_INIT_AUTOMAKE
AC_CONFIG_SRCDIR([liblazy/liblazy_hal.c])
+AM_CONFIG_HEADER(config.h)
# Checks for programs.
AC_PROG_CC
@@ -19,6 +20,13 @@
DBUS_VERSION="`pkg-config --modversion dbus-1`"
+DBUS_SYSTEM_BUS_SOCKET="`pkg-config --variable=system_bus_default_address dbus-1`"
+if test -z "$DBUS_SYSTEM_BUS_SOCKET"; then
+ # use default
+ DBUS_SYSTEM_BUS_SOCKET="unix:path=/var/run/dbus/system_bus_socket"
+fi
+AC_DEFINE_UNQUOTED(DBUS_SYSTEM_BUS_SOCKET, ["$DBUS_SYSTEM_BUS_SOCKET"],
+ [dbus system bus socket path])
# check for doxygen
AC_CHECK_PROG(DOXYGEN, [doxygen], [doxygen], [])
@@ -33,4 +41,3 @@
docs/autodocs/Makefile])
AC_OUTPUT
-
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/liblazy-0.1.1/INSTALL new/liblazy-0.2/INSTALL
--- old/liblazy-0.1.1/INSTALL 2006-11-10 19:34:29.000000000 +0100
+++ new/liblazy-0.2/INSTALL 2007-08-15 15:36:38.000000000 +0200
@@ -1,8 +1,8 @@
Installation Instructions
*************************
-Copyright (C) 1994, 1995, 1996, 1999, 2000, 2001, 2002, 2004, 2005 Free
-Software Foundation, Inc.
+Copyright (C) 1994, 1995, 1996, 1999, 2000, 2001, 2002, 2004, 2005,
+2006 Free Software Foundation, Inc.
This file is free documentation; the Free Software Foundation gives
unlimited permission to copy, distribute and modify it.
@@ -10,7 +10,10 @@
Basic Installation
==================
-These are generic installation instructions.
+Briefly, the shell commands `./configure; make; make install' should
+configure, build, and install this package. The following
+more-detailed instructions are generic; see the `README' file for
+instructions specific to this package.
The `configure' shell script attempts to guess correct values for
various system-dependent variables used during compilation. It uses
@@ -23,9 +26,9 @@
It can also use an optional file (typically called `config.cache'
and enabled with `--cache-file=config.cache' or simply `-C') that saves
-the results of its tests to speed up reconfiguring. (Caching is
+the results of its tests to speed up reconfiguring. Caching is
disabled by default to prevent problems with accidental use of stale
-cache files.)
+cache files.
If you need to do unusual things to compile the package, please try
to figure out how `configure' could check whether to do them, and mail
@@ -35,20 +38,17 @@
may remove or edit it.
The file `configure.ac' (or `configure.in') is used to create
-`configure' by a program called `autoconf'. You only need
-`configure.ac' if you want to change it or regenerate `configure' using
-a newer version of `autoconf'.
+`configure' by a program called `autoconf'. You need `configure.ac' if
+you want to change it or regenerate `configure' using a newer version
+of `autoconf'.
The simplest way to compile this package is:
1. `cd' to the directory containing the package's source code and type
- `./configure' to configure the package for your system. If you're
- using `csh' on an old version of System V, you might need to type
- `sh ./configure' instead to prevent `csh' from trying to execute
- `configure' itself.
+ `./configure' to configure the package for your system.
- Running `configure' takes awhile. While running, it prints some
- messages telling which features it is checking for.
+ Running `configure' might take a while. While running, it prints
+ some messages telling which features it is checking for.
2. Type `make' to compile the package.
@@ -78,7 +78,7 @@
by setting variables in the command line or in the environment. Here
is an example:
- ./configure CC=c89 CFLAGS=-O2 LIBS=-lposix
+ ./configure CC=c99 CFLAGS=-g LIBS=-lposix
*Note Defining Variables::, for more details.
@@ -87,17 +87,15 @@
You can compile the package for more than one kind of computer at the
same time, by placing the object files for each architecture in their
-own directory. To do this, you must use a version of `make' that
-supports the `VPATH' variable, such as GNU `make'. `cd' to the
+own directory. To do this, you can use GNU `make'. `cd' to the
directory where you want the object files and executables to go and run
the `configure' script. `configure' automatically checks for the
source code in the directory that `configure' is in and in `..'.
- If you have to use a `make' that does not support the `VPATH'
-variable, you have to compile the package for one architecture at a
-time in the source code directory. After you have installed the
-package for one architecture, use `make distclean' before reconfiguring
-for another architecture.
+ With a non-GNU `make', it is safer to compile the package for one
+architecture at a time in the source code directory. After you have
+installed the package for one architecture, use `make distclean' before
+reconfiguring for another architecture.
Installation Names
==================
@@ -190,12 +188,12 @@
./configure CC=/usr/local2/bin/gcc
causes the specified `gcc' to be used as the C compiler (unless it is
-overridden in the site shell script). Here is a another example:
+overridden in the site shell script).
- /bin/bash ./configure CONFIG_SHELL=/bin/bash
+Unfortunately, this technique does not work for `CONFIG_SHELL' due to
+an Autoconf bug. Until the bug is fixed you can use this workaround:
-Here the `CONFIG_SHELL=/bin/bash' operand causes subsequent
-configuration-related scripts to be executed by `/bin/bash'.
+ CONFIG_SHELL=/bin/bash /bin/bash ./configure CONFIG_SHELL=/bin/bash
`configure' Invocation
======================
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/liblazy-0.1.1/liblazy/liblazy_dbus.c new/liblazy-0.2/liblazy/liblazy_dbus.c
--- old/liblazy-0.1.1/liblazy/liblazy_dbus.c 2006-11-17 16:40:31.000000000 +0100
+++ new/liblazy-0.2/liblazy/liblazy_dbus.c 2007-08-15 13:56:22.000000000 +0200
@@ -25,12 +25,19 @@
#include "liblazy.h"
#include "liblazy_local.h"
+#include "config.h"
#include
#include
#include
#include
+static int dbus_system_use_private_connection = 0;
+
+void liblazy_dbus_system_use_private_connection(int use_private) {
+ dbus_system_use_private_connection = use_private;
+}
+
int liblazy_dbus_send_method_call(const char *destination, const char *path,
const char *interface, const char *method,
int bus_type,
@@ -47,12 +54,31 @@
dbus_error_init(&dbus_error);
- dbus_connection = dbus_bus_get(bus_type, &dbus_error);
- if (dbus_connection == NULL || dbus_error_is_set(&dbus_error)) {
- ERROR("Connection to dbus not ready, skipping method call %s: %s",
- method, dbus_error.message);
- ret = LIBLAZY_ERROR_DBUS_NOT_READY;
- goto Free_Error;
+ if (bus_type == DBUS_BUS_SYSTEM && dbus_system_use_private_connection) {
+ dbus_connection = dbus_connection_open_private(DBUS_SYSTEM_BUS_SOCKET,
+ &dbus_error);
+ if (dbus_connection == NULL || dbus_error_is_set(&dbus_error)) {
+ ERROR("Connection to dbus not ready, skipping method call %s: %s",
+ method, dbus_error.message);
+ ret = LIBLAZY_ERROR_DBUS_NOT_READY;
+ goto Free_Error;
+ }
+
+ dbus_bus_register(dbus_connection, &dbus_error);
+ if (dbus_error_is_set(&dbus_error)) {
+ ERROR("Could not register private connection, skipping method call %s: %s",
+ method, dbus_error.message);
+ ret = LIBLAZY_ERROR_DBUS_NOT_READY;
+ goto Free_Error;
+ }
+ } else {
+ dbus_connection = dbus_bus_get(bus_type, &dbus_error);
+ if (dbus_connection == NULL || dbus_error_is_set(&dbus_error)) {
+ ERROR("Connection to dbus not ready, skipping method call %s: %s",
+ method, dbus_error.message);
+ ret = LIBLAZY_ERROR_DBUS_NOT_READY;
+ goto Free_Error;
+ }
}
message = dbus_message_new_method_call(destination, path, interface, method);
@@ -74,6 +100,10 @@
}
dbus_message_unref(message);
+ if (dbus_system_use_private_connection) {
+ dbus_connection_close(dbus_connection);
+ dbus_connection_unref(dbus_connection);
+ }
Free_Error:
dbus_error_free(&dbus_error);
return ret;
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/liblazy-0.1.1/liblazy/liblazy.h new/liblazy-0.2/liblazy/liblazy.h
--- old/liblazy-0.1.1/liblazy/liblazy.h 2006-11-15 21:47:57.000000000 +0100
+++ new/liblazy-0.2/liblazy/liblazy.h 2007-08-15 15:31:20.000000000 +0200
@@ -157,6 +157,22 @@
int liblazy_dbus_message_get_strlist_arg(DBusMessage *message,
char ***strlist, int no);
+/** @brief use a private connection for system bus messages
+ *
+ * Call this function with a boolean value to tell the library whether to
+ * use a private connection for system bus messages
+ * (liblazy_dbus_system*). Defaults to false. If a private connection is
+ * used, the libarary creates a new connection on _every_ call and
+ * immediately closes it. So this should be used very carefully. Only use
+ * if your application does very rare dbus calls and doesn't have a
+ * mainloop to listen if D-Bus died but still should be able to survive
+ * D-Bus restarts.
+ *
+ * @param use_privat 1 if the library should use a private connection, 0
+ * otherwise
+ */
+void liblazy_dbus_system_use_private_connection(int use_private);
+
/** @brief get integer property from HAL
*
* fetches one interger value from HAL.
@@ -248,8 +264,7 @@
*
* @return 0 on success, LIBLAZY_ERROR_* on failure
*/
-int liblazy_polkit_is_user_allowed_by_name(char *user, char *privilege,
- char *ressource);
+int liblazy_polkit_is_user_allowed_by_name(char *user, char *privilege);
/** @brief check if a user possesses a privilege
*
@@ -262,8 +277,7 @@
*
* @return 0 on success, LIBLAZY_ERROR_* on failure
*/
-int liblazy_polkit_is_user_allowed_by_uid(int uid, char *privilege,
- char *ressource);
+int liblazy_polkit_is_user_allowed_by_uid(int uid, char *privilege);
/** @brief check if a user possesses a privilege
*
@@ -275,7 +289,7 @@
*
* @return 0 on success, LIBLAZY_ERROR_* on failure
*/
-int liblazy_polkit_is_user_allowed(char *privilege, char *ressource);
+int liblazy_polkit_is_user_allowed(char *privilege);
#ifdef __cplusplus
}
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/liblazy-0.1.1/liblazy/liblazy_hal.c new/liblazy-0.2/liblazy/liblazy_hal.c
--- old/liblazy-0.1.1/liblazy/liblazy_hal.c 2006-11-17 16:45:24.000000000 +0100
+++ new/liblazy-0.2/liblazy/liblazy_hal.c 2007-08-15 13:57:24.000000000 +0200
@@ -235,16 +235,17 @@
return LIBLAZY_ERROR_INVALID_ARGUMENT;
error = liblazy_hal_get_property_strlist(udi, "info.capabilities", &caps);
- if (caps != NULL && !error) {
+ if (error)
+ return error;
+
+ if (caps != NULL) {
for (i = 0; caps[i] != NULL; i++) {
- if (strcmp(caps[i], capability) == 0) {
+ if (strcmp(caps[i], capability) == 0)
error = 1;
- break;
- }
}
liblazy_free_strlist(caps);
- error = 0;
}
+
return error;
}
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/liblazy-0.1.1/liblazy/liblazy_polkit.c new/liblazy-0.2/liblazy/liblazy_polkit.c
--- old/liblazy-0.1.1/liblazy/liblazy_polkit.c 2006-11-17 14:45:33.000000000 +0100
+++ new/liblazy-0.2/liblazy/liblazy_polkit.c 2007-08-15 15:31:33.000000000 +0200
@@ -32,19 +32,17 @@
#include
#include
-#define DBUS_POLKIT_SERVICE "org.freedesktop.PolicyKit"
-#define DBUS_POLKIT_PATH "/org/freedesktop/PolicyKit/Manager"
-#define DBUS_POLKIT_INTERFACE "org.freedesktop.PolicyKit.Manager"
-
-int liblazy_polkit_is_user_allowed_by_name(char *user,
- char *privilege,
- char *ressource)
+#define DBUS_HAL_SERVICE "org.freedesktop.Hal"
+#define DBUS_HAL_DEVICE_INTERFACE "org.freedesktop.Hal.Device"
+#define DBUS_HAL_COMPUTER_PATH "/org/freedesktop/Hal/devices/computer"
+
+int liblazy_polkit_is_user_allowed_by_name(char *user, char *privilege)
{
DBusMessage *reply;
DBusError dbus_error;
DBusConnection *dbus_connection;
const char *unique_name;
- int is_allowed;
+ char *allowed;
int error = 0;
if (user == NULL || privilege == NULL )
@@ -63,34 +61,31 @@
unique_name = dbus_bus_get_unique_name(dbus_connection);
- if (ressource == NULL)
- ressource = "";
-
- error = liblazy_dbus_system_send_method_call(DBUS_POLKIT_SERVICE,
- DBUS_POLKIT_PATH,
- DBUS_POLKIT_INTERFACE,
- "IsUserPrivileged",
+ error = liblazy_dbus_system_send_method_call(DBUS_HAL_SERVICE,
+ DBUS_HAL_COMPUTER_PATH,
+ DBUS_HAL_DEVICE_INTERFACE,
+ "IsCallerPrivileged",
&reply,
+ DBUS_TYPE_STRING, &privilege,
DBUS_TYPE_STRING, &unique_name,
- DBUS_TYPE_STRING, &user,
- DBUS_TYPE_STRING, &privilege,
- DBUS_TYPE_STRING, &ressource,
DBUS_TYPE_INVALID);
if (error)
return error;
- error = liblazy_dbus_message_get_basic_arg(reply, DBUS_TYPE_BOOLEAN,
- &is_allowed, 0);
+ error = liblazy_dbus_message_get_basic_arg(reply, DBUS_TYPE_STRING,
+ &allowed, 0);
+
if (reply != NULL)
dbus_message_unref(reply);
if (error)
return error;
- return is_allowed;
+ if (strcmp(allowed, "yes") == 0)
+ return 1;
+ return 0;
}
-int liblazy_polkit_is_user_allowed_by_uid(int uid, char *privilege,
- char *ressource)
+int liblazy_polkit_is_user_allowed_by_uid(int uid, char *privilege)
{
struct passwd *pw = getpwuid(uid);
@@ -99,14 +94,12 @@
return LIBLAZY_ERROR_GENERAL;
}
- return liblazy_polkit_is_user_allowed_by_name(pw->pw_name, privilege,
- ressource);
+ return liblazy_polkit_is_user_allowed_by_name(pw->pw_name, privilege);
}
-int liblazy_polkit_is_user_allowed(char *privilege, char *ressource)
+int liblazy_polkit_is_user_allowed(char *privilege)
{
char *user = getenv("USER");
- return liblazy_polkit_is_user_allowed_by_name(user, privilege,
- ressource);
+ return liblazy_polkit_is_user_allowed_by_name(user, privilege);
}
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/liblazy-0.1.1/liblazy/Makefile.am new/liblazy-0.2/liblazy/Makefile.am
--- old/liblazy-0.1.1/liblazy/Makefile.am 2006-11-12 01:11:54.000000000 +0100
+++ new/liblazy-0.2/liblazy/Makefile.am 2007-08-15 15:34:59.000000000 +0200
@@ -8,7 +8,7 @@
liblazy_la_SOURCES = liblazy_hal.c liblazy_dbus.c liblazy_polkit.c liblazy.c liblazy_local.h
liblazy_la_CFLAGS = $(DBUS_CFLAGS) -Wall
-liblazy_la_LDFLAGS = -version-info 0:0:0 $(DBUS_LIBS)
+liblazy_la_LDFLAGS = -version-info 1:0:0 $(DBUS_LIBS)
pkgconfigdir = $(libdir)/pkgconfig
pkgconfig_DATA = lazy.pc
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/liblazy-0.1.1/missing new/liblazy-0.2/missing
--- old/liblazy-0.1.1/missing 2006-11-10 19:34:29.000000000 +0100
+++ new/liblazy-0.2/missing 2007-08-15 15:36:36.000000000 +0200
@@ -1,9 +1,9 @@
#! /bin/sh
# Common stub for a few missing GNU programs while installing.
-scriptversion=2005-06-08.21
+scriptversion=2006-05-10.23
-# Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003, 2004, 2005
+# Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003, 2004, 2005, 2006
# Free Software Foundation, Inc.
# Originally by Fran,cois Pinard , 1996.
@@ -33,6 +33,8 @@
fi
run=:
+sed_output='s/.* --output[ =]\([^ ]*\).*/\1/p'
+sed_minuso='s/.* -o \([^ ]*\).*/\1/p'
# In the cases where this matters, `missing' is being run in the
# srcdir already.
@@ -44,7 +46,7 @@
msg="missing on your system"
-case "$1" in
+case $1 in
--run)
# Try to run requested program, and just exit if it succeeds.
run=
@@ -77,6 +79,7 @@
aclocal touch file \`aclocal.m4'
autoconf touch file \`configure'
autoheader touch file \`config.h.in'
+ autom4te touch the output file, or create a stub one
automake touch all \`Makefile.in' files
bison create \`y.tab.[ch]', if possible, from existing .[ch]
flex create \`lex.yy.c', if possible, from existing .c
@@ -106,7 +109,7 @@
# Now exit if we have it, but it failed. Also exit now if we
# don't have it and --version was passed (most likely to detect
# the program).
-case "$1" in
+case $1 in
lex|yacc)
# Not GNU programs, they don't have --version.
;;
@@ -135,7 +138,7 @@
# If it does not exist, or fails to run (possibly an outdated version),
# try to emulate it.
-case "$1" in
+case $1 in
aclocal*)
echo 1>&2 "\
WARNING: \`$1' is $msg. You should only need it if
@@ -164,7 +167,7 @@
test -z "$files" && files="config.h"
touch_files=
for f in $files; do
- case "$f" in
+ case $f in
*:*) touch_files="$touch_files "`echo "$f" |
sed -e 's/^[^:]*://' -e 's/:.*//'`;;
*) touch_files="$touch_files $f.in";;
@@ -192,8 +195,8 @@
You can get \`$1' as part of \`Autoconf' from any GNU
archive site."
- file=`echo "$*" | sed -n 's/.*--output[ =]*\([^ ]*\).*/\1/p'`
- test -z "$file" && file=`echo "$*" | sed -n 's/.*-o[ ]*\([^ ]*\).*/\1/p'`
+ file=`echo "$*" | sed -n "$sed_output"`
+ test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"`
if test -f "$file"; then
touch $file
else
@@ -214,25 +217,25 @@
in order for those modifications to take effect. You can get
\`Bison' from any GNU archive site."
rm -f y.tab.c y.tab.h
- if [ $# -ne 1 ]; then
+ if test $# -ne 1; then
eval LASTARG="\${$#}"
- case "$LASTARG" in
+ case $LASTARG in
*.y)
SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'`
- if [ -f "$SRCFILE" ]; then
+ if test -f "$SRCFILE"; then
cp "$SRCFILE" y.tab.c
fi
SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'`
- if [ -f "$SRCFILE" ]; then
+ if test -f "$SRCFILE"; then
cp "$SRCFILE" y.tab.h
fi
;;
esac
fi
- if [ ! -f y.tab.h ]; then
+ if test ! -f y.tab.h; then
echo >y.tab.h
fi
- if [ ! -f y.tab.c ]; then
+ if test ! -f y.tab.c; then
echo 'main() { return 0; }' >y.tab.c
fi
;;
@@ -244,18 +247,18 @@
in order for those modifications to take effect. You can get
\`Flex' from any GNU archive site."
rm -f lex.yy.c
- if [ $# -ne 1 ]; then
+ if test $# -ne 1; then
eval LASTARG="\${$#}"
- case "$LASTARG" in
+ case $LASTARG in
*.l)
SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'`
- if [ -f "$SRCFILE" ]; then
+ if test -f "$SRCFILE"; then
cp "$SRCFILE" lex.yy.c
fi
;;
esac
fi
- if [ ! -f lex.yy.c ]; then
+ if test ! -f lex.yy.c; then
echo 'main() { return 0; }' >lex.yy.c
fi
;;
@@ -267,11 +270,9 @@
\`Help2man' package in order for those modifications to take
effect. You can get \`Help2man' from any GNU archive site."
- file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'`
- if test -z "$file"; then
- file=`echo "$*" | sed -n 's/.*--output=\([^ ]*\).*/\1/p'`
- fi
- if [ -f "$file" ]; then
+ file=`echo "$*" | sed -n "$sed_output"`
+ test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"`
+ if test -f "$file"; then
touch $file
else
test -z "$file" || exec >$file
@@ -289,11 +290,17 @@
DU, IRIX). You might want to install the \`Texinfo' package or
the \`GNU make' package. Grab either from any GNU archive site."
# The file to touch is that specified with -o ...
- file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'`
+ file=`echo "$*" | sed -n "$sed_output"`
+ test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"`
if test -z "$file"; then
# ... or it is the one specified with @setfilename ...
infile=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'`
- file=`sed -n '/^@setfilename/ { s/.* \([^ ]*\) *$/\1/; p; q; }' $infile`
+ file=`sed -n '
+ /^@setfilename/{
+ s/.* \([^ ]*\) *$/\1/
+ p
+ q
+ }' $infile`
# ... or it is derived from the source name (dir/f.texi becomes f.info)
test -z "$file" && file=`echo "$infile" | sed 's,.*/,,;s,.[^.]*$,,'`.info
fi
@@ -317,13 +324,13 @@
fi
firstarg="$1"
if shift; then
- case "$firstarg" in
+ case $firstarg in
*o*)
firstarg=`echo "$firstarg" | sed s/o//`
tar "$firstarg" "$@" && exit 0
;;
esac
- case "$firstarg" in
+ case $firstarg in
*h*)
firstarg=`echo "$firstarg" | sed s/h//`
tar "$firstarg" "$@" && exit 0
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/liblazy-0.1.1/NEWS new/liblazy-0.2/NEWS
--- old/liblazy-0.1.1/NEWS 2006-11-12 01:11:54.000000000 +0100
+++ new/liblazy-0.2/NEWS 2007-08-15 15:43:33.000000000 +0200
@@ -0,0 +1,2 @@
+- converted to PokicyKit >= 0.4 API
+- add method to use private dbus connection
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/liblazy-0.1.1/tools/test.c new/liblazy-0.2/tools/test.c
--- old/liblazy-0.1.1/tools/test.c 2006-11-17 16:39:36.000000000 +0100
+++ new/liblazy-0.2/tools/test.c 2007-08-15 15:49:01.000000000 +0200
@@ -23,6 +23,7 @@
DBusMessage *reply = NULL;
printf("Try to set the ondemand governor\n");
+/* liblazy_dbus_system_use_private_connection(1);*/
ret = liblazy_dbus_system_send_method_call(DBUS_HAL_INTERFACE,
DBUS_HAL_UDI_COMPUTER,
DBUS_HAL_CPUFREQ_INTERFACE,
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Remember to have fun...
---------------------------------------------------------------------
To unsubscribe, e-mail: opensuse-commit+unsubscribe@opensuse.org
For additional commands, e-mail: opensuse-commit+help@opensuse.org