syncing working files between computers...
authorkremlin <ian@kremlin.cc>
Thu, 5 Jun 2014 02:56:17 +0000 (21:56 -0500)
committerkremlin <ian@kremlin.cc>
Thu, 5 Jun 2014 02:56:17 +0000 (21:56 -0500)
conf/hostnamed-dbus.conf [new file with mode: 0644]
src/interfaces/hostnamed/hostnamed.c

diff --git a/conf/hostnamed-dbus.conf b/conf/hostnamed-dbus.conf
new file mode 100644 (file)
index 0000000..7358899
--- /dev/null
@@ -0,0 +1,18 @@
+<!DOCTYPE busconfig PUBLIC
+          "-//freedesktop//DTD D-BUS Bus Configuration 1.0//EN"
+          "http://www.freedesktop.org/standards/dbus/1.0/busconfig.dtd">
+<busconfig>
+
+       <!-- Only members of 'wheel' and user 'daemon' may set hostnames -->
+       <policy group="wheel">
+               <allow own="org.freedesktop.hostname1"/>
+               <allow send_destination="org.freedesktop.hostname1"/>
+               <allow receive_sender="org.freedesktop.hostname1"/>
+       </policy>
+       <policy user="daemon">
+               <allow own="org.freedesktop.hostname1"/>
+               <allow send_destination="org.freedesktop.hostname1"/>
+               <allow receive_sender="org.freedesktop.hostname1"/>
+       </policy>
+
+</busconfig>
index 4b326a1400bc29d2d883e8797b0317861f903ff7..f41892d9991b6f4220c458920302d08d03561756 100644 (file)
@@ -1,8 +1,8 @@
 #include <gio/gio.h>
 #include "hostnamed.h"
 
-GDBusNodeInfo *spect_data;
 GMainLoop *loop;
+GDBusNodeInfo *spect_data;
 
 static void handle_method_call(GDBusConnection *conn,
                                                           const gchar *sender,
@@ -13,11 +13,13 @@ static void handle_method_call(GDBusConnection *conn,
                                                           GDBusMethodInvocation *invc,
                                                           gpointer usrdat) {
 
-       g_printf("%s wants to call %s, at %s with interface %s\n", sender, method_name, obj_path, interf_name);
+       //g_printf("%s wants to call %s, at %s with interface %s\n", sender, method_name, obj_path, interf_name);
 
-       GString  *xml_ret;
-       GVariant *xml_ret_gvar;
+       if(g_strcmp0(method_name, "Introspect"
 
+       GVariant *xml_ret_gvar;
+       GString  *xml_ret;
+       
        g_dbus_interface_info_generate_xml(spect_data->interfaces[0], (guint)0, xml_ret);
        xml_ret_gvar = g_variant_new_string(xml_ret->str);
        g_dbus_method_invocation_return_value(invc, xml_ret_gvar);
@@ -98,7 +100,7 @@ static void on_name_lost(GDBusConnection *conn,
                                                 gpointer user_data) {
 
        g_print("lost name %s, exiting...\n", name);
-       g_print("you might need to run hacks/punch_config.sh\n");
+       //g_print("you might need to run hacks/punch_config.sh\n");
        g_main_loop_quit(loop);
 }
 
@@ -109,7 +111,6 @@ GError * hostnamed_init() {
        GError *err = NULL;     
 
        spect_data = g_dbus_node_info_new_for_xml(SYSTEMD_HOSTNAMED_XML, &err);
-
        bus_descriptor = g_bus_own_name(G_BUS_TYPE_SYSTEM,
                                        (gchar *)"org.freedesktop.hostname1",
                                                    G_BUS_NAME_OWNER_FLAGS_NONE,