summaryrefslogtreecommitdiffstats
path: root/src/sbus
Commit message (Collapse)AuthorAgeFilesLines
* DEBUG: Add missing new linesLukas Slebodnik2015-12-141-2/+2
| | | | Reviewed-by: Petr Cech <pcech@redhat.com>
* sbus: Check string arguments for valid UTF-8 stringsJakub Hrozek2015-11-141-1/+45
| | | | | | | | libdbus abort()s when a string argument is not valid UTF-8. Since the arguments sometimes come from untrusted sources, it's better to check the string validity explicitly. Reviewed-by: Sumit Bose <sbose@redhat.com>
* SBUS: Fix warnings -WshadowLukas Slebodnik2015-11-103-47/+48
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | src/sbus/sssd_dbus_invokers.c -fPIC -DPIC -o src/sbus/.libs/libsss_util_la-sssd_dbus_invokers.o src/sbus/sssd_dbus_introspect.c: In function 'sbus_introspect_generate_signals': src/sbus/sssd_dbus_introspect.c:206: warning: declaration of 'signal' shadows a global declaration /usr/include/signal.h:101: warning: shadowed declaration is here src/sbus/sssd_dbus_introspect.c: In function 'sbus_introspect_generate_properties': src/sbus/sssd_dbus_introspect.c:243: warning: declaration of 'access' shadows a global declaration /usr/include/unistd.h:288: warning: shadowed declaration is here src/sbus/sssd_dbus_signals.c:29: warning: declaration of 'signal' shadows a global declaration /usr/include/signal.h:101: warning: shadowed declaration is here src/sbus/sssd_dbus_signals.c: In function 'sbus_new_incoming_signal': src/sbus/sssd_dbus_signals.c:39: warning: declaration of 'signal' shadows a global declaration /usr/include/signal.h:101: warning: shadowed declaration is here src/sbus/sssd_dbus_signals.c: In function 'sbus_incoming_signal_hash_add': src/sbus/sssd_dbus_signals.c:73: warning: declaration of 'signal' shadows a global declaration /usr/include/signal.h:101: warning: shadowed declaration is here src/sbus/sssd_dbus_signals.c: In function 'sbus_incoming_signal_hash_lookup': src/sbus/sssd_dbus_signals.c:134: warning: declaration of 'signal' shadows a global declaration /usr/include/signal.h:101: warning: shadowed declaration is here src/sbus/sssd_dbus_signals.c: In function 'sbus_signal_listen': src/sbus/sssd_dbus_signals.c:168: warning: declaration of 'signal' shadows a global declaration /usr/include/signal.h:101: warning: shadowed declaration is here src/sbus/sssd_dbus_signals.c: In function 'sbus_signal_handler': src/sbus/sssd_dbus_signals.c:227: warning: declaration of 'signal' shadows a global declaration /usr/include/signal.h:101: warning: shadowed declaration is here src/sbus/sssd_dbus_signals.c: In function 'sbus_signal_handler_got_caller_id': src/sbus/sssd_dbus_signals.c:264: warning: declaration of 'signal' shadows a global declaration /usr/include/signal.h:101: warning: shadowed declaration is here src/sbus/sssd_dbus_common_signals.c: In function 'sbus_signal_name_owner_changed': src/sbus/sssd_dbus_common_signals.c:30: warning: declaration of 'signal' shadows a global declaration /usr/include/signal.h:101: warning: shadowed declaration is here src/sbus/sssd_dbus_common_signals.c: In function ‘sbus_signal_name_owner_changed’: src/sbus/sssd_dbus_common_signals.c:30: warning: declaration of ‘signal’ shadows a global declaration /usr/include/signal.h:101: warning: shadowed declaration is here Reviewed-by: Jakub Hrozek <jhrozek@redhat.com>
* sbus: Add a special error code for messages sent by the bus itselfJakub Hrozek2015-09-012-1/+8
| | | | Reviewed-by: Pavel Březina <pbrezina@redhat.com>
* sbus: Initialize errno if constructing message fails and add debug messagesJakub Hrozek2015-09-011-0/+6
| | | | Reviewed-by: Pavel Březina <pbrezina@redhat.com>
* sbus: listen to NameOwnerChangedPavel Březina2015-06-193-0/+95
| | | | | | | Resolves: https://fedorahosted.org/sssd/ticket/2326 Reviewed-by: Jakub Hrozek <jhrozek@redhat.com>
* sbus: add support for incoming signalsPavel Březina2015-06-194-0/+340
| | | | Reviewed-by: Jakub Hrozek <jhrozek@redhat.com>
* SBUS: Add support for <node /> in introspectionPavel Březina2015-06-185-4/+180
| | | | Reviewed-by: Jakub Hrozek <jhrozek@redhat.com>
* SBUS: Use default GetAll invoker if none is setPavel Březina2015-06-181-1/+8
| | | | | | | | It is alright for an interface to not have any GetAll invoker set if it doesn't have any properties, but we still want to return an empty message. Reviewed-by: Jakub Hrozek <jhrozek@redhat.com>
* sbus: add a{sas} get invokerPavel Březina2015-05-223-8/+146
| | | | Reviewed-by: Jakub Hrozek <jhrozek@redhat.com>
* sbus: add sbus_opath_decompose[_exact]Pavel Březina2015-05-222-0/+107
| | | | | | | | This function decomposes object path into array of strings. The "_exact" version expects a certain number of parts otherwise an error is thrown. Reviewed-by: Jakub Hrozek <jhrozek@redhat.com>
* sbus: provide custom error namesPavel Březina2015-05-221-0/+29
| | | | | | | Errors provided directly by D-Bus are not sufficient to fulfill all our needs. Reviewed-by: Jakub Hrozek <jhrozek@redhat.com>
* sbus: sbus_opath_hash_add_iface free tmp talloc ctxPavel Reichl2015-05-111-2/+1
| | | | Reviewed-by: Pavel Březina <pbrezina@redhat.com>
* Add missing new lines to debug messagesLukas Slebodnik2015-03-171-2/+2
| | | | Reviewed-by: Jakub Hrozek <jhrozek@redhat.com>
* sbus_codegen: Port to python3Lukas Slebodnik2015-03-131-8/+13
| | | | | | | Resolves: https://fedorahosted.org/sssd/ticket/2017 Reviewed-by: Petr Viktorin <pviktori@redhat.com>
* sbus: add constant to represent subtreePavel Březina2015-02-171-0/+7
| | | | Reviewed-by: Jakub Hrozek <jhrozek@redhat.com>
* sbus codegen: do not prefix getters with iface namePavel Březina2015-02-171-1/+1
| | | | | | | | | | | | | | | | | | Prefixing getters with C name of the interface is just redundant since it is the same as the name of the structure that contains those fields. The following structure: struct test_pilot { $type test_pilot_get_name; } changes to: struct test_pilot { $type get_name; } Reviewed-by: Jakub Hrozek <jhrozek@redhat.com>
* sbus: remove unused 'reply as' functionsPavel Březina2015-02-173-350/+0
| | | | | | These functions became unused after previous patch. Reviewed-by: Jakub Hrozek <jhrozek@redhat.com>
* sbus: use hard coded getters instead of generatedPavel Březina2015-02-175-148/+636
| | | | | | | | | | | | | | | Properties are single value of a small number of predefined D-Bus types. There is no need to generate them with codegen. Actually, the source generator for property getters is already quite mess with branching for array, strings and object paths. Adding any more complex type in the future (such as dictionary) would require even more branching or creating a separate path for it. Hard coding the getters will simplify creating new ones for more complex types. This patch also reduces lots of code duplication and creates a simple function for GetAll. Reviewed-by: Jakub Hrozek <jhrozek@redhat.com>
* Remove strict requirements of python2Lukas Slebodnik2015-02-131-1/+1
| | | | | | | | | | * fix hashbangs * remove strict requirements of python2 in build system Resolves: https://fedorahosted.org/sssd/ticket/2017 Reviewed-by: Petr Viktorin <pviktori@redhat.com>
* sbus: add sbus_opath_get_object_name()Pavel Březina2015-01-232-0/+25
| | | | | | | This function assumes that the last component of the object path is an object name. It will return the part unescaped. Reviewed-by: Jakub Hrozek <jhrozek@redhat.com>
* sbus: move common opath functions from ifp to sbus codePavel Březina2015-01-232-0/+214
| | | | | | | These functions are quite general thus they may be part of sbus interface. Reviewed-by: Jakub Hrozek <jhrozek@redhat.com>
* sbus: unify naming of handler data variablePavel Březina2015-01-234-15/+15
| | | | | | | | | We used three different names to express handler data: - pvt - instace_data - handler_data Reviewed-by: Jakub Hrozek <jhrozek@redhat.com>
* sbus: support org.freedesktop.DBus.PropertiesPavel Březina2015-01-233-220/+312
| | | | | | | Bring back org.freedesktop.DBus.Properties with support of multiple interfaces on single object path. Reviewed-by: Jakub Hrozek <jhrozek@redhat.com>
* sbus: support org.freedesktop.DBus.IntrospectablePavel Březina2015-01-233-248/+264
| | | | | | | | | This commit brings back support of Introspectable interface and enables support of multiple interfaces there. It also refactors the old code so the generator and introspect xml format especially is more readable. Reviewed-by: Jakub Hrozek <jhrozek@redhat.com>
* sbus: add sbus_opath_hash_lookup_supported()Pavel Březina2015-01-232-5/+129
| | | | | | | This function acquires list of all interfaces that are supported on given object path. It is a preparation for Introspect interface. Reviewed-by: Jakub Hrozek <jhrozek@redhat.com>
* sbus: add object path to sbus requestPavel Březina2015-01-232-0/+2
| | | | | | | | | Object path is heavily used in implementation of methods from interfaces that are supported on whole subtrees. Although it can be obtained from a D-Bus message, it is nice to have it accessible directly. Reviewed-by: Jakub Hrozek <jhrozek@redhat.com>
* sbus: support multiple interfaces on single pathPavel Březina2015-01-234-301/+451
| | | | | | | | | | | | | | | | | | | This patch removes the old message handler which is replaced with a new one that supports multiple interfaces registered on single object path. A hash table is used to store registered object paths and their interfaces. When an entry or the table itself is destroyed, registered object path is unregistered through delete callback. It temporarily removes support of Introspect and Properties standard D-Bus interfaces and disables unit tests of those interfaces. The support is brought back by following patches. Resolves: https://fedorahosted.org/sssd/ticket/2339 Reviewed-by: Jakub Hrozek <jhrozek@redhat.com>
* sbus: use 'path/*' to represent a D-Bus fallbackPavel Březina2015-01-231-36/+56
| | | | | | | | | | | | | | | | | | | | | Use 'path/*' instead of 'path*' since it better describes what we are actually doing i.e. registering a message handler for a subtree. Although D-Bus fallback will invoke a message handler for both 'path' and 'path/subtree' object paths it does not make usually sence to support the same interfaces for both parent and it children. This commit also renames related functions to better describe what are they doing. Note: the tilda in comments is used to suppress -Wcomment warning Preparation for: https://fedorahosted.org/sssd/ticket/2339 Reviewed-by: Jakub Hrozek <jhrozek@redhat.com>
* sbus: move iface and object path code to separate filePavel Březina2015-01-233-190/+219
| | | | | | | | | | This is done to better distinguish between connection code and interface stuff. It will help with orientation and thus simplify next changes. Preparation for: https://fedorahosted.org/sssd/ticket/2339 Reviewed-by: Jakub Hrozek <jhrozek@redhat.com>
* sbus: add new iface via sbus_conn_register_iface()Pavel Březina2015-01-232-24/+26
| | | | | | | | | | | | | | | | | | | Rename sbus_conn_add_interface() to sbus_conn_register_iface() and remove sbus_new_interface() calls since it is just one more unnecessary call outside the sbus code. The function sbus_new_interface() is made static and used directly in sbus_conn_register_iface(). The name was chosen to better describe what the function is doing. That it registers an interface on a given object path. The same interface can be used with different paths so it is not really about adding an interface. Preparation for: https://fedorahosted.org/sssd/ticket/2339 Reviewed-by: Jakub Hrozek <jhrozek@redhat.com>
* Fix: always check return value of unlink()Pavel Reichl2014-11-281-2/+10
| | | | | | | Resolves: https://fedorahosted.org/sssd/ticket/2506 Reviewed-by: Lukáš Slebodník <lslebodn@redhat.com>
* SBUS: Initialize DBusError before using itJakub Hrozek2014-11-251-0/+1
| | | | | | | | In case either handler_fn() or invoker_fn() failed in sbus_request_invoke_or_finish() we would have accessed an uninitialized DBusError variable, causing a segfault. Reviewed-by: Lukáš Slebodník <lslebodn@redhat.com>
* SBUS: Fix error handling after closing containerLukas Slebodnik2014-10-221-0/+2
| | | | | | | | If function dbus_message_iter_close_container fail the return variable ret will be set to EINVAL, but function will not be immediately terminated. "goto done" was missing. Reviewed-by: Jakub Hrozek <jhrozek@redhat.com>
* SBUS: Allow connections from other UIDsJakub Hrozek2014-10-222-0/+24
| | | | | | | | | Unless dbus_connection_set_unix_user_function() is used, D-Bus only allows connections from UID 0. This patch adds a custom checker function that allows either UID 0 or the pre-configured SSSD user ID. Reviewed-by: Pavel Reichl <preichl@redhat.com> Reviewed-by: Simo Sorce <simo@redhat.com>
* SBUS: Chown the sbus socket if neededJakub Hrozek2014-10-223-4/+30
| | | | | | | | | When setting up the sbus server, we might need to chown the sbus socket to make sure non-root peers, running as the SSSD user are able to access the file. Reviewed-by: Pavel Reichl <preichl@redhat.com> Reviewed-by: Simo Sorce <simo@redhat.com>
* sbus_request: fix potential NULL dereferencePavel Březina2014-07-012-5/+10
| | | | Reviewed-by: Lukáš Slebodník <lslebodn@redhat.com>
* Use DISCARD_ALIGN in VTABLE_FUNC macroMichal Zidek2014-07-011-1/+1
| | | | | | fixes: https://fedorahosted.org/sssd/ticket/1359 Reviewed-by: Lukáš Slebodník <lslebodn@redhat.com>
* Use python2 in shebang for python scripts.Lukas Slebodnik2014-06-181-1/+1
| | | | | | | | | https://fedorahosted.org/sssd/ticket/2356 The python scripts are not tested with python3 and /usr/bin/python can be symbolic link to python3 on some distributions. Reviewed-by: Sumit Bose <sbose@redhat.com>
* SBUS: Add org.freedesktop.DBus.Properties.GetAll to IntrospectionJakub Hrozek2014-05-271-0/+4
| | | | | Reviewed-by: Pavel Březina <pbrezina@redhat.com> Reviewed-by: Lukáš Slebodník <lslebodn@redhat.com>
* SBUS: Implement org.freedesktop.DBus.Properties.GetAll for primitive typesJakub Hrozek2014-05-272-10/+92
| | | | | | | | | | | | This patch implements the GetAll method of the org.freedesktop.DBus.Properties interface by iterating over the available getters and putting all the results into a single getter. The patch includes a unit test that exercies all currently supported array types. Reviewed-by: Pavel Březina <pbrezina@redhat.com> Reviewed-by: Lukáš Slebodník <lslebodn@redhat.com>
* SBUS: Consolidate VTABLE_FUNC definitions in sssd_dbus_meta.hJakub Hrozek2014-05-273-8/+4
| | | | | | | | | | We had several duplicated declarations of the VTABLE_FUNC macro in the SSSD source code. This patch consolidates on one definition in sssd_dbus_meta.h that is usable by all consumers, including the upcoming GetAll method implementation. Reviewed-by: Pavel Březina <pbrezina@redhat.com> Reviewed-by: Lukáš Slebodník <lslebodn@redhat.com>
* SBUS: Add utility function sbus_add_array_as_variant_to_dictPavel Březina2014-05-272-0/+83
| | | | | Reviewed-by: Pavel Březina <pbrezina@redhat.com> Reviewed-by: Lukáš Slebodník <lslebodn@redhat.com>
* SBUS: Add utility function sbus_add_variant_to_dictJakub Hrozek2014-05-273-0/+122
| | | | | Reviewed-by: Pavel Březina <pbrezina@redhat.com> Reviewed-by: Lukáš Slebodník <lslebodn@redhat.com>
* SBUS: Include config.h for enabling function in stdio.hLukas Slebodnik2014-05-261-0/+3
| | | | | | | | | | | | | | | | | Older versions of glibc requires extra feature macros for function open_memstream. fmemopen(), open_memstream(), open_wmemstream(): Since glibc 2.10: _XOPEN_SOURCE >= 700 || _POSIX_C_SOURCE >= 200809L Before glibc 2.10: _GNU_SOURCE src/sbus/sssd_dbus_introspect.c: In function 'introspect_begin': src/sbus/sssd_dbus_introspect.c:82: error: implicit declaration of function 'open_memstream' src/sbus/sssd_dbus_introspect.c:82: warning: assignment makes pointer from integer without a cast Reviewed-by: Jakub Hrozek <jhrozek@redhat.com>
* SBUS: Define DBUS_ERROR_INIT for old version of dbusLukas Slebodnik2014-05-261-0/+4
| | | | Reviewed-by: Jakub Hrozek <jhrozek@redhat.com>
* SBUS: Add org.freedesktop.DBus.Properties.Get to IntrospectionJakub Hrozek2014-05-221-0/+11
| | | | | Reviewed-by: Stef Walter <stefw@redhat.com> Reviewed-by: Pavel Březina <pbrezina@redhat.com>
* SBUS: Add several error constant definitionsJakub Hrozek2014-05-221-0/+20
| | | | | | | | Several error constants we use were added in later DBus versions. This patch conditionally #defines them. Reviewed-by: Stef Walter <stefw@redhat.com> Reviewed-by: Pavel Březina <pbrezina@redhat.com>
* SBUS: Return / if an object path getter returns NULLJakub Hrozek2014-05-221-0/+2
| | | | | Reviewed-by: Stef Walter <stefw@redhat.com> Reviewed-by: Pavel Březina <pbrezina@redhat.com>
* SBUS: Return empty string if a string getter returns NULLPavel Březina2014-05-221-1/+4
| | | | | | | | | In line with getters never returning errors, a getter should return an empty string instead of NULL in case a string-like property in SSSD is not set. Reviewed-by: Stef Walter <stefw@redhat.com> Reviewed-by: Pavel Březina <pbrezina@redhat.com>