History log of /sssd/src/sbus/sssd_dbus_request.c
Revision Date Author Comments Expand
a06e23c0bcf0c8669a29b801876aca8aac422931 16-Aug-2016 Pavel Březina <pbrezina@redhat.com>

sbus: add sbus_request_reply_error() This simplifies error handling in sbus requests since we avoid creating DBusError and checking for NULL manually. It removes few lines of code. This patch does not replace all calls to sbus_request_fail_and_finish since sometimes it is desirable to create the error manualy. But it replaces it in most recent places. Reviewed-by: Lukáš Slebodník <lslebodn@redhat.com> Reviewed-by: Jakub Hrozek <jhrozek@redhat.com>

91c637615fc45679235b3371792e2eaf63a62b4f 20-Jun-2016 Pavel Březina <pbrezina@redhat.com>

SBUS: Print debug message when handler fails Reviewed-by: Sumit Bose <sbose@redhat.com> Reviewed-by: Jakub Hrozek <jhrozek@redhat.com> Reviewed-by: Lukáš Slebodník <lslebodn@redhat.com>

c30b7a1931211fdcae0564551a7625cc4f6dee9f 10-May-2016 Jakub Hrozek <jhrozek@redhat.com>

UTIL: Add ERR_SBUS_REQUEST_HANDLED In most cases when sbus request parsing finishes, the request is handled internally and a reply is sent to the caller. However, in handlers that are parsed and handled completely manually, we might want to be notified about this case so that the called of sbus_request_parse_or_finish() aborts the request and doesn't proceed with using the sbus request which is already freed internally in sbus_request_parse_or_finish(). Reviewed-by: Pavel Březina <pbrezina@redhat.com>

de1131abe5ba7aaeb59f81fc3a9cd2a71c0b52dd 14-Dec-2015 Lukas Slebodnik <lslebodn@redhat.com>

DEBUG: Add missing new lines Reviewed-by: Petr Cech <pcech@redhat.com>

6b01dae732eedee808f32a9cdd4b5656a9f839c4 14-Nov-2015 Jakub Hrozek <jhrozek@redhat.com>

sbus: Check string arguments for valid UTF-8 strings 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>

9118a539a5d59f669f551114f880fe91d6bb8741 01-Sep-2015 Jakub Hrozek <jhrozek@redhat.com>

sbus: Add a special error code for messages sent by the bus itself Reviewed-by: Pavel Březina <pbrezina@redhat.com>

6c2a29a912f4c995343315f1f70c825ca2200640 01-Sep-2015 Jakub Hrozek <jhrozek@redhat.com>

sbus: Initialize errno if constructing message fails and add debug messages Reviewed-by: Pavel Březina <pbrezina@redhat.com>

16cf65323a41b3de4a98f309cdf900f3b0d9ec25 17-Feb-2015 Pavel Březina <pbrezina@redhat.com>

sbus: remove unused 'reply as' functions These functions became unused after previous patch. Reviewed-by: Jakub Hrozek <jhrozek@redhat.com>

71c9027d4192bf149afa4fcf9fef93bf6e901121 23-Jan-2015 Pavel Březina <pbrezina@redhat.com>

sbus: add object path to sbus request 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>

6c4b1250ece32296ccdc15eccf2a0f740b3768b0 25-Nov-2014 Jakub Hrozek <jhrozek@redhat.com>

SBUS: Initialize DBusError before using it 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>

82b5395c1519b9392ddd323ece0845b51a994bbc 22-Oct-2014 Lukas Slebodnik <lslebodn@redhat.com>

SBUS: Fix error handling after closing container 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>

a2ac7f081721cae6a6c4671fee3dfd9fe7d7da48 01-Jul-2014 Pavel Březina <pbrezina@redhat.com>

sbus_request: fix potential NULL dereference Reviewed-by: Lukáš Slebodník <lslebodn@redhat.com>

f2ea63e48812b042d36ac8357f0cb13b2f2184fe 22-May-2014 Pavel Březina <pbrezina@redhat.com>

SBUS: Utility function sbus_request_return_array_as_variant Adds a utility function that returns an array of types values, each of a given size, with a given type in a variant. This utility function will be used by the GetAll property call. Reviewed-by: Stef Walter <stefw@redhat.com> Reviewed-by: Pavel Březina <pbrezina@redhat.com>

e871517a0bfb806cb2fddc76ff2f59360437a73c 22-May-2014 Jakub Hrozek <jhrozek@redhat.com>

SBUS: Utility function sbus_request_return_as_variant Adds a utility function that returns a single value with a given type in a variant. This utility function will be used by the Get property call. Reviewed-by: Stef Walter <stefw@redhat.com> Reviewed-by: Pavel Březina <pbrezina@redhat.com>

0161a3c5637a0c0092bf54c436bb3d6508d7df26 13-May-2014 Jakub Hrozek <jhrozek@redhat.com>

SBUS: Add an async request to retrieve the caller ID Adds an async request sbus_get_sender_id_{send,recv} that allows retrieval of UID based on "sender" as returned by dbus_message_get_sender(). The UID is an int64_t to be able to use "-1" to as a fallback value for uknown or error cases. The unit test is added as a standalone one, not part of the sbus_tests because the request, and by extension the unit test relies on being connected to the system bus, which is very unlikely to work in a build system. Reviewed-by: Pavel Březina <pbrezina@redhat.com> Reviewed-by: Stef Walter <stefw@redhat.com>

87729e3a6c56383642a8d3a86b2856487f2ee064 13-May-2014 Jakub Hrozek <jhrozek@redhat.com>

SBUS: Add a convenience function sbus_error_new Adds a convenience function that constructs a DBusError on top of a talloc context and as such can be used to mark an sbus request as failed without having to create a DBusError instance by the caller. Reviewed-by: Pavel Březina <pbrezina@redhat.com> Reviewed-by: Stef Walter <stefw@redhat.com>

94f07a6f4375ec25d8fa5c99a0c4f68de7002457 13-May-2014 Jakub Hrozek <jhrozek@redhat.com>

SBUS: Fix error handling condition Reviewed-by: Pavel Březina <pbrezina@redhat.com> Reviewed-by: Stef Walter <stefw@redhat.com>

3d5908ed0faf400a5c7d9c3e4312597ee1b7786a 13-May-2014 Jakub Hrozek <jhrozek@redhat.com>

SBUS: several trivial style fixes In SSSD we tend to use {} brackets around single-line blocks, too to make sure we don't forget to add them should the block become larger. We also don't add a space between function name and the opening "(". Reviewed-by: Pavel Březina <pbrezina@redhat.com> Reviewed-by: Stef Walter <stefw@redhat.com>

8779b9ee101ed3e5a6836b5366c006dc21dd36c0 19-Apr-2014 Pavel Březina <pbrezina@redhat.com>

sbus request: fix error initialization fixes: sssd_dbus_request.c:28:1: error: missing initializer [-Werror=missing-field-initializers] sssd_dbus_request.c:28:1: error: (near initialization for 'error_internal.dummy1') [-Werror=missing-field-initializers]

dff909d473f43a6bd0f0286fa2d279c0ebe945c6 19-Apr-2014 Stef Walter <stefw@redhat.com>

sbus: Add type-safe DBus method handlers and finish functions Type safe method handlers allow methods not to have to do tedious unwrapping and wrapping of DBus method call messages or replies. Arguments of the following DBus types are supported in type-safe method handlers. In addition arrays of these are supported. y: uint8_t b: bool (but no arrays, yet) n: int16_t q: uint16_t i: int32_t u: uint32_t x: int64_t t: uint64_t d: double s: char * (utf8 string) o: char * (object path) As an exception, arrays of booleans are not supported, but could be added later. Other more complex types could be added later if desired. If a method has other argument types, then it must be marked as having a raw handler (see below). Internally each method can have a type specific invoker function which unpacks the incoming arguments and invokes the method handler with the correct arguments. Each method also has a finish which accepts the type-safe out arguments (ie: return values) and builds the reply message. Like other request 'finish' functions, these free the request talloc context, and are to be used in place of sbus_request_finish() or friends. Raw method handlers parse their own method arguments, and prepare their own reply (ideally using sbus_request_finish() helpers). They can also do strange things like have variable arguments. To mark a DBus method as having a raw method handler use the following annotation: <annotation name="org.freedesktop.sssd.RawHandler" value="true"/> Raw methods do not have invokers or finish functions. I've left all of the internal peer to peer communication using raw method handlers. No code changes here.

06b7bc8ca2e005ed510210d3b8dee16afbabbcc9 14-Mar-2014 Stef Walter <stefw@redhat.com>

sbus: Add the sbus_request_parse_or_finish() method Some DBus types returned from dbus_message_get_args() require memory to be released when done. We automatically attach these to the talloc struct sbus_request memory context in this function. This accepts varargs similar to dbus_message_get_args(), which are rather awkward. However instead of reworking them completely, future generated marshalling code will replace most uses of these varargs. If parsing the dbus message fails, then it responds to the DBus caller with an appropriate error such as o.f.D.Error.InvalidArgs. In these cases (ie: when it returns FALSE) the sbus_request is finished. Migrated some, but not all, uses of dbus_message_get_args() to the new function. Some instances have uncommon semantics such as terminating the connection upon failure to parse a message. Reviewed-by: Jakub Hrozek <jhrozek@redhat.com> Reviewed-by: Pavel Březina <pbrezina@redhat.com> Reviewed-by: Lukáš Slebodník <lslebodn@redhat.com>

d9577dbd92555b0755881e37724019ef9c578404 14-Mar-2014 Stef Walter <stefw@gnome.org>

sbus: Add struct sbus_request to represent a DBus invocation struct sbus_request represents a request from a dbus client being handled by a dbus server implementation. The struct contains the message, connection and method (and in the future teh property) which is being requested. In the future it will contain caller information as well. sbus_request is a talloc memory context, and is a good place to attach any allocations and memory specific to the request. Each handler accepts an sbus_request. If a handler returns EOK, it is assumed that the handler will finish the request. Any of the sbus_request_*finish() methods can be used to complete the request and send back a reply. sbus_request_return_and_finish() uses the same argument varargs syntax as dbus_message_append_args(), which isn't a great syntax. Document it a bit, but don't try to redesign: The marshalling work (will follow this patch set) will remove the need to use varargs for most DBus implementation code. This patch migrates the monitor and data provider dbus code to use sbus_request, but does not try to rework the talloc context's to use it. Reviewed-by: Jakub Hrozek <jhrozek@redhat.com> Reviewed-by: Pavel Březina <pbrezina@redhat.com> Reviewed-by: Lukáš Slebodník <lslebodn@redhat.com>