diff options
Diffstat (limited to 'sfshare-daemon/src/dbus_service.c')
-rw-r--r-- | sfshare-daemon/src/dbus_service.c | 57 |
1 files changed, 47 insertions, 10 deletions
diff --git a/sfshare-daemon/src/dbus_service.c b/sfshare-daemon/src/dbus_service.c index e65aded..da0cabc 100644 --- a/sfshare-daemon/src/dbus_service.c +++ b/sfshare-daemon/src/dbus_service.c @@ -1,3 +1,20 @@ +/* + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + */ + #include <dbus/dbus-glib.h> #include <dbus/dbus-glib-lowlevel.h> #include <glib.h> @@ -64,7 +81,7 @@ gboolean daemon_delete_share (DaemonObject *obj,const gchar *path, DBusGMethodIn #include "dbus_service_glue.h" gchar * -get_error_msg (Error err) +get_error_msg (Error_sfshare err) { gchar *errmsg; @@ -164,7 +181,7 @@ daemon_data_new ( DBusGMethodInvocation *context, AuthorizedCallback auth_cb, co ret->in = g_new0 (gchar *, 6); - int i = 0; + gint i = 0; while(in[i] != NULL) { @@ -179,7 +196,7 @@ daemon_data_new ( DBusGMethodInvocation *context, AuthorizedCallback auth_cb, co void daemon_data_free (DaemonData * data) { - int i; + gint i; i = 0; while (data->in[i] != NULL) @@ -258,7 +275,7 @@ daemon_get_share_status (DaemonObject *obj, const gchar *path, gchar ***result, { puts("daemon_get_share_status"); - Error err; + Error_sfshare err; err = smb_get_share_status(path, result); @@ -271,11 +288,13 @@ daemon_get_share_status (DaemonObject *obj, const gchar *path, gchar ***result, return TRUE; } - +/* +* Authorized call of smb_set_share - write or change share section +*/ void setup_share_authorized (gpointer data) { - Error err; + Error_sfshare err; DaemonData *dd = data; err = smb_set_share (dd->in); @@ -293,7 +312,9 @@ setup_share_authorized (gpointer data) - +/* +* Dbus setup share - polkit authorization check +*/ gboolean daemon_setup_share (DaemonObject *obj,const gchar **parameters, DBusGMethodInvocation *context) { @@ -316,10 +337,14 @@ daemon_setup_share (DaemonObject *obj,const gchar **parameters, DBusGMethodInvoc } + +/* +* Authorized call of smb_delete_share - delete share section +*/ void delete_share_authorized (gpointer data) { - Error err; + Error_sfshare err; DaemonData *dd = data; err = smb_delete_share(dd->in); @@ -336,7 +361,9 @@ delete_share_authorized (gpointer data) } - +/* +* Dbus delete share - polkit authorization check +*/ gboolean daemon_delete_share (DaemonObject *obj, const gchar *path, DBusGMethodInvocation *context) { @@ -363,7 +390,9 @@ daemon_delete_share (DaemonObject *obj, const gchar *path, DBusGMethodInvocation } - +/* +* Start of sfshare deamon +*/ int dbus_sfshare_start () { @@ -380,7 +409,11 @@ dbus_sfshare_start () bus = dbus_g_bus_get (DBUS_BUS_SYSTEM, &error); if (!bus) + { g_warning ("Couldn't connect to system bus : %s", error->message); + g_error_free (error); + return -1; + } /* PolKit */ @@ -396,6 +429,7 @@ dbus_sfshare_start () G_TYPE_INVALID)) { g_warning("Failed to acquire org.fedoraproject.SimpleFileShare : %s", error->message); + g_error_free (error); return -1; } @@ -408,5 +442,8 @@ dbus_sfshare_start () g_main_loop_run (mainloop); + g_object_unref (obj); + + return 0; } |