How to call a varargs function via dbus, like printf?
The server is written in C, the client is written in Python.
My questions are how to write the XML spec file? And how to write my GObject?
Thanks in advance.
[I use DBus-GLib.]
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
There is no way to call a variadic function programmatically with varying number and type of arguments. You could use the corresponding “v” functions (
vprintfetc.) but there’s no way to make theva_listto pass to them from foreign code and pass it over DBus.In any case you really need to rethink your design. It’s unsafe to call
printfwith a format string that’s not 100% controlled by your program. Passing a client-provided format string is a formula for disaster, becauseprintfinvokes undefined behavior if the format string does not match the arguments. In nearly all real-world situations, this will mean privilege elevation vulns!