[systemd-devel] How to make vtable entry as SD_BUS_VTABLE_UNPRIVILEGED
Lennart Poettering
lennart at poettering.net
Mon Apr 3 09:05:35 UTC 2023
On Fr, 31.03.23 16:01, Lal, Arun (arun.lal at intel.com) wrote:
> Hi Lennart,
>
> Thanks for the reply 😊
>
> I had seen SD_BUS_METHOD function. But my doubt was bit different.
>
> check_access function get the variable v as shown below
>
> /* Then, look for a known method */
> vtable_key.path = (char*) p;
> vtable_key.interface = m->interface;
> vtable_key.member = m->member;
>
> v = hashmap_get(bus->vtable_methods, &vtable_key);
>
> But SD_BUS_METHOD does not show how to add a path and interface, it just takes member. That got me bit confused.
> As in how to mention path and interface while making the vtable entry.
>
> Another question I had is what is the clean way of adding vtable entry in code.
> As in, as maintainer do you have a recommendation on how I do this?
>
> Right now I am thinking of adding a new file and making it part of systemd which will have a function which will make the vtable entry.
> And call this function somewhere from boot of systemd. Your comments here will be helpful.
The man page tells you how to do this. It even comes with an example.
We usually recommend starting out with the docs first. Yes, they are
incomplete, in which case the mailing list can fill in the gaps, but
please, consult the docs, it saves us all time, and we wrote them for
that.
https://www.freedesktop.org/software/systemd/man/sd_bus_add_object.html
Lennart
--
Lennart Poettering, Berlin
More information about the systemd-devel
mailing list