PullBusinessCard
PATCH 1/1 PullBusinessCard
Hello.
There is a method named org.openobex.Client.PullBusinessCard in obexd which should write downloaded vcard to a named file. At least that's what client-api.txt says. This patch makes the method actually do what it is supposed to. Please, however, check the way I open the file for I am not sure of security implications.
--8<---------------cut here---------------start------------->8---
main.c +18 -0
@@ -29,6 +29,7 @@#include <stdlib.h> #include <string.h> #include <signal.h> +#include <fcntl.h> #include <glib.h> #include <gdbus.h>
@@ -204,7 +205,24 @@static void pull_complete_callback (struct session_data *session,void *user_data) { +DBusMessageIter iter;struct send_data *data = user_data; +char * filename; + +dbus_message_iter_init (data->message, &iter); + +if (dbus_message_iter_next (&iter) && +DBUS_TYPE_STRING ==dbus_message_iter_get_arg_type (&iter)) { +dbus_message_iter_get_basic (&iter, &filename); +int fd; + +/* XXX This must be done the safest way possible. */ + fd =open (filename,O_WRONLY |O_CREAT |O_EXCL ,0600 ); +if (fd >=0 ) { +write (fd, session->buffer, session->filled); +close (fd); + } + }g_dbus_send_reply (data->connection, data->message,DBUS_TYPE_INVALID );
--8<---------------cut here---------------end--------------->8---
Signature · 1 line
Było mi bardzo miło. Young man and young woman,
Quoted 1 line
Łukasz< Wszyscy ci co słuchają Marylina Mansona.
----------------------------------------------------------------------
Sprawdz warunki na drogach!
Kliknij >>> http://link.interia.pl/f259f