439e08cdc5c83b3e5835cb0435983f1da2ffbaf1 |
|
16-Aug-2016 |
Pavel Březina <pbrezina@redhat.com> |
sbus: add utility function to simplify message and reply handling
This patch adds the ability to hook DBusMessage to a talloc context
to remove the need of calling dbus_message_unref(). It also provides
an automatical way to detect error in a reply so the caller does
not need to parse it manually and the whole code around DBusError
can be avoided.
Reviewed-by: Lukáš Slebodník <lslebodn@redhat.com>
Reviewed-by: Jakub Hrozek <jhrozek@redhat.com> |
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> |
d6f1b16baf8106d709e3fac585a12789dcb6bd29 |
|
27-Jun-2016 |
Pavel Březina <pbrezina@redhat.com> |
SBUS: Add string helper macros
Reviewed-by: Jakub Hrozek <jhrozek@redhat.com> |
725c291ccfa46b08d2713133c227ac8d7203eb2f |
|
27-Jun-2016 |
Pavel Březina <pbrezina@redhat.com> |
SBUS: Fix typo in comment
Reviewed-by: Jakub Hrozek <jhrozek@redhat.com> |
397bc52dd09a8c032abc7ea47a6d81dba5957464 |
|
20-Jun-2016 |
Pavel Březina <pbrezina@redhat.com> |
SBUS: Add sbus_conn_register_iface_map
Reviewed-by: Sumit Bose <sbose@redhat.com>
Reviewed-by: Jakub Hrozek <jhrozek@redhat.com>
Reviewed-by: Lukáš Slebodník <lslebodn@redhat.com> |
ae7247551b78a05a5397d3c790afad7ef51b0d9d |
|
19-Jun-2015 |
Pavel Březina <pbrezina@redhat.com> |
sbus: add support for incoming signals
Reviewed-by: Jakub Hrozek <jhrozek@redhat.com> |
f7adbb15dbdcb79e291f7cf361a400ce25f7b382 |
|
18-Jun-2015 |
Pavel Březina <pbrezina@redhat.com> |
SBUS: Add support for <node /> in introspection
Reviewed-by: Jakub Hrozek <jhrozek@redhat.com> |
10a28f461c25d788ff4dcffefa881e7aa724a25d |
|
22-May-2015 |
Pavel Březina <pbrezina@redhat.com> |
sbus: add sbus_opath_decompose[_exact]
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> |
e3a7f7ee06cf0764838c45419bed97eb4cdf00f1 |
|
17-Feb-2015 |
Pavel Březina <pbrezina@redhat.com> |
sbus: add constant to represent subtree
Reviewed-by: Jakub Hrozek <jhrozek@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> |
ca6dd8e7ac91c7f8e3b4d55206d4f39791ab7149 |
|
23-Jan-2015 |
Pavel Březina <pbrezina@redhat.com> |
sbus: add sbus_opath_get_object_name()
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> |
3a8f6b575f4019f21c9425a26f1b346c08a197ae |
|
23-Jan-2015 |
Pavel Březina <pbrezina@redhat.com> |
sbus: move common opath functions from ifp to sbus code
These functions are quite general thus they may be part
of sbus interface.
Reviewed-by: Jakub Hrozek <jhrozek@redhat.com> |
66277b21179d95f6e96abed01a20ccbccf27ce99 |
|
23-Jan-2015 |
Pavel Březina <pbrezina@redhat.com> |
sbus: unify naming of handler data variable
We used three different names to express handler data:
- pvt
- instace_data
- handler_data
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> |
46ee931314e6a5517f5c6b6b14f759364be119cc |
|
23-Jan-2015 |
Pavel Březina <pbrezina@redhat.com> |
sbus: support multiple interfaces on single path
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> |
9fa95168d80beba04b333b06edc492ecb8b085a1 |
|
23-Jan-2015 |
Pavel Březina <pbrezina@redhat.com> |
sbus: add new iface via sbus_conn_register_iface()
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> |
aa871e019f00493dfa53b48f906132bf94eeae9f |
|
22-Oct-2014 |
Jakub Hrozek <jhrozek@redhat.com> |
SBUS: Allow connections from other UIDs
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> |
5960687483a5d3d99093c9d6ab64e11c9bde7f7b |
|
22-Oct-2014 |
Jakub Hrozek <jhrozek@redhat.com> |
SBUS: Chown the sbus socket if needed
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> |
2965f42fed62b77a5b0e7f6cd01c4be1072484f5 |
|
27-May-2014 |
Pavel Březina <pbrezina@redhat.com> |
SBUS: Add utility function sbus_add_array_as_variant_to_dict
Reviewed-by: Pavel Březina <pbrezina@redhat.com>
Reviewed-by: Lukáš Slebodník <lslebodn@redhat.com> |
c43ed56bc5d29e189e529235a3ba4bc17cd1a95f |
|
27-May-2014 |
Jakub Hrozek <jhrozek@redhat.com> |
SBUS: Add utility function sbus_add_variant_to_dict
Reviewed-by: Pavel Březina <pbrezina@redhat.com>
Reviewed-by: Lukáš Slebodník <lslebodn@redhat.com> |
18647db9e275e7aa3e002551237abae756a2afb9 |
|
26-May-2014 |
Lukas Slebodnik <lslebodn@redhat.com> |
SBUS: Define DBUS_ERROR_INIT for old version of dbus
Reviewed-by: Jakub Hrozek <jhrozek@redhat.com> |
c5a592920fab217fdb3aaa897e68f5643de88dc4 |
|
22-May-2014 |
Jakub Hrozek <jhrozek@redhat.com> |
SBUS: Add several error constant definitions
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> |
1319e71fd1680ca4864afe0b1aca2b8c8e4a1ee4 |
|
22-May-2014 |
Stef Walter <stefw@redhat.com> |
SBUS: Start implementing property access
This patch adds the basis of SBUS getters and setters. A new module,
sssd_dbus_properties.c would contain handlers for the property methods
like Get, Set and GetAll.
Type-safe property access works in a similar fashion like type-safe
method calls - the invoker calls the getter which returns the primitive
type, which is in turn marshalled into variant by the invoker.
This patch does not contain the complete functionality, see later
patches that continue implementing the getters and setters.
Reviewed-by: Stef Walter <stefw@redhat.com>
Reviewed-by: Pavel Březina <pbrezina@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> |
b81ad4a7c59cade13d52216f805d904392627136 |
|
13-May-2014 |
Jakub Hrozek <jhrozek@redhat.com> |
SBUS: Add SBUS_CONN_TYPE_SYSBUS
We need to retrieve caller IDs for each call from the system bus. This
commit adds a new SBUS connection type that identifies system bus
connection. The connection is used in the IFP provider.
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> |
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> |
07e941c1bbdc752142bbd3b838c540bc7ecd0ed7 |
|
14-Mar-2014 |
Stef Walter <stefw@redhat.com> |
sbus: Refactor how we export DBus interfaces
Most importantly, stop using per connection private data. This doesn't
scale when you have more than one thing exporting or exported on a
connection.
Remove struct sbus_interface and expand sbus_conn_add_interface()
function. Remove various struct sbus_interface args to connection
initialization functions and make callers use sbus_conn_add_interface()
directly. The old method was optimized for exporting one interface
on a connection. We'll have connections that export zero, one or more
interfaces.
To export an interface on a DBus server, call sbus_conn_add_interface()
from within the sbus_server_conn_init_fn. To export an interface on
a DBus client, call sbus_conn_add_interface() after sbus_new_connection()
returns.
As before struct sbus_interface represents an object exported via DBus.
However it is now talloc allocated. One can set instance data on the
struct sbus_interface. This instance data is passed to the various
handlers and used in their implementation.
However, we now have type safe interface exporting in the various
high level sss_process_init() sss_monitor_init() and so on.
Introspection support was not in use, and is now gone until we
implement it using the metadata (future patch).
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> |
769347ad4d35d43488eb98f980143495b0db415d |
|
24-Feb-2014 |
Stef Walter <stefw@redhat.com> |
sbus: Rework sbus to use interface metadata and vtables
Previous commits added support for interface metadata and
handler vtables. This commit ports sbus_dbus_connection to
use them.
Port the internal uses of dbus to use the new scheme in a
very minimal way. Further cleanup is possible here.
This commit provides basic definitions of the internal
dbus interfaces. The interfaces aren't fully defined, as the
handlers will continue to unpack manually, and often overload
DBus methods with different arguments (which is rather
unorthodox, but not the end of the world).
Reviewed-by: Jakub Hrozek <jhrozek@redhat.com>
Reviewed-by: Sumit Bose <sbose@redhat.com>
Reviewed-by: Lukáš Slebodník <lslebodn@redhat.com>
Reviewed-by: Simo Sorce <simo@redhat.com> |
fcd8093c58638dc7c4f9cddfc97f273b94ce2ead |
|
24-Feb-2014 |
Stef Walter <stefw@redhat.com> |
sbus: Add sbus_vtable and update codegen to support it
Each interface is a vtable structure derived from
sbus_vtable, in the sense that it has an sbus_vtable
struct as its first argument. This lets us upcast the
interface vtable structure to an sbus_vtable and dispatch
to it dynamically and cleanly.
The interface metadata contains information about which
vtable offset in the interface metadata should be dispatched
to for a given function. This is a common scheme, not only
among dbus implementations, but also compiled languages.
Currently all the vtable functions are of type
sbus_msg_handler_fn. These are the handlers we are familiar
with and perform raw processing of the message. Later commits
will introduce type safe handlers that levelage compile checking
and automatic argument packing/unpacking.
Although this may seem contrived now, the remainder of the
dbus infrastructure work will build on this, including
ofd.Properties, ofd.ObjectManager, ofd.Introspect, compiler
checked type safe unpacking/packing, etc.
The codegen now generates vtable structures for each interface
along-side the metadata, and fills in vtable offsets
appropriately.
It is obviously still possible to hand-craft such vtables and
metadata if needed for a special case.
Once again examples output can be found at:
src/tests/sbus_codegen_tests_generated.h
Reviewed-by: Jakub Hrozek <jhrozek@redhat.com>
Reviewed-by: Sumit Bose <sbose@redhat.com>
Reviewed-by: Lukáš Slebodník <lslebodn@redhat.com>
Reviewed-by: Simo Sorce <simo@redhat.com> |
19b4bb652f5cdc2797b66595eaf8811881aa9873 |
|
22-Oct-2013 |
Jakub Hrozek <jhrozek@redhat.com> |
Include external headers with #include <foo.h>
I find it more readable to include headers from outside the sssd tree
with <foo.h>, not "foo.h". The latter should be used for in-tree headers
only. |
c4545b1e910857bc0dae7ce2ed6291d8bd1fc4f2 |
|
12-Sep-2013 |
Jakub Hrozek <jhrozek@redhat.com> |
Remove unused code |
2c9a76e553f9239eaa91f32ccaf18b7a68316ce5 |
|
13-Oct-2011 |
Jakub Hrozek <jhrozek@redhat.com> |
Append PID to sbus server socket name, let clients use a symlink
https://fedorahosted.org/sssd/ticket/1034 |
9fbf00c7802719becd633ecbc45879d5d0ddb985 |
|
15-Mar-2010 |
Stephen Gallagher <sgallagh@redhat.com> |
Properly handle dbus send attempts on a closed connection
dbus_connection_send_with_reply() will report success and return
a NULL pending_reply when the connection is not open for
communication. This patch creates a new wrapper around
dbus_connection_send_with_reply() to properly detect this
condition and report it as an error. |
1c48b5a62f73234ed26bb20f0ab345ab61cda0ab |
|
18-Feb-2010 |
Stephen Gallagher <sgallagh@redhat.com> |
Rename server/ directory to src/
Also update BUILD.txt |