Best option to send file descriptors over dbus?
Carlos Perello Marin
carlos at pemas.net
Mon Nov 1 02:51:13 PST 2004
On Mon, 2004-11-01 at 00:57 -0500, Havoc Pennington wrote:
> On Mon, 2004-11-01 at 04:28 +0100, Carlos Perello Marin wrote:
> > Hi, I'm working on a client/server implementation using D-BUS as the IPC
> > and I need a way to send file descriptors over D-BUS.
> What is the specific application?
I want to have a server running as root that will have a service to open
files as root from non root applications.
The client requests to open a file (for instance, /dev/hda) and the
server will see if the user sending the request has been authorised to
do it, in that case the server will open the file and will send the file
descriptor over D-BUS to the client. That's the main concept.
> > This feature is supported with unix sockets so I suppose it's a matter
> > of implement an API around it so D-BUS can handle it without major
> > problems.
> This would break though e.g. if an app connects to the bus over TCP,
> which we'd expect to have when running an X app remotely for example.
I know that it will only work from unix sockets, if it connects over
other transport the server could just send an error message.
> > My first thoughts about it is to add a new type to DBusMessage that
> > stores a file descriptor and then, inside the unix transport send it as
> > cmsg man page (cmsg(3)) specifies, the transports that cannot work with
> > that kind of data could just ignore that part of the message.
> Will it work to pass the fd from one app to the bus and then to another
I suppose that it should be:
1.- The server sends the file to the bus.
2.- The bus get it and resends it to the client.
> It sounds really complicated... it probably makes the way messages are
> buffered and parsed a lot trickier as well.
Could be (yesterday I didn't thought that the channel between the client
and server is not direct so we need to resend it from the bus).
> > With this mail I just want to know if a patch done as I'm suggesting
> > will be accepted into D-BUS so I don't waste my time. If you don't agree
> > with it, any suggestion to get this functionality is welcomed.
> I think the patch would be hard to write, and pose a number of issues (I
> can't predict all of them in advance).
True, I completely forgot the resend problem from the bus...
I think I will take a completely different approach outside D-BUS for
that concrete need.
Thank you for your help.
Carlos Perelló Marín
Ubuntu Warty (PowerPC) => http://www.ubuntulinux.org
Linux Registered User #121232
mailto:carlos at pemas.net || mailto:carlos at gnome.org
Valencia - Spain
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Size: 189 bytes
Desc: This is a digitally signed message part
Url : http://freedesktop.org/pipermail/dbus/attachments/20041101/d54a144a/attachment.pgp
More information about the dbus