diff options
author | Lennart Poettering <lennart@poettering.net> | 2011-06-17 00:15:02 +0200 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2011-06-21 19:29:45 +0200 |
commit | 91f9dcaf9270fe465525638cc08bd94590273349 (patch) | |
tree | 1c837a0f3767453d8bb65381c8c32ddc44383cbc /src | |
parent | 05a4abb9146eebd75f5d9b9cac38f183818a9f6d (diff) |
dbus: add dbus introspection extraction
Diffstat (limited to 'src')
-rw-r--r-- | src/hostnamed.c | 21 | ||||
-rw-r--r-- | src/localed.c | 21 | ||||
-rw-r--r-- | src/logind.h | 1 | ||||
-rw-r--r-- | src/org.freedesktop.login1.policy | 29 | ||||
-rw-r--r-- | src/org.freedesktop.login1.service | 12 | ||||
-rw-r--r-- | src/timedated.c | 23 |
6 files changed, 94 insertions, 13 deletions
diff --git a/src/hostnamed.c b/src/hostnamed.c index f579e112ad..d05c9023c7 100644 --- a/src/hostnamed.c +++ b/src/hostnamed.c @@ -31,9 +31,7 @@ #include "dbus-common.h" #include "polkit.h" -#define INTROSPECTION \ - DBUS_INTROSPECT_1_0_XML_DOCTYPE_DECL_NODE \ - "<node>\n" \ +#define INTERFACE \ " <interface name=\"org.freedesktop.hostname1\">\n" \ " <property name=\"Hostname\" type=\"s\" access=\"read\"/>\n" \ " <property name=\"StaticHostname\" type=\"s\" access=\"read\"/>\n" \ @@ -55,7 +53,12 @@ " <arg name=\"name\" type=\"s\" direction=\"in\"/>\n" \ " <arg name=\"user_interaction\" type=\"b\" direction=\"in\"/>\n" \ " </method>\n" \ - " </interface>\n" \ + " </interface>\n" + +#define INTROSPECTION \ + DBUS_INTROSPECT_1_0_XML_DOCTYPE_DECL_NODE \ + "<node>\n" \ + INTERFACE \ BUS_PROPERTIES_INTERFACE \ BUS_INTROSPECTABLE_INTERFACE \ BUS_PEER_INTERFACE \ @@ -65,6 +68,8 @@ BUS_GENERIC_INTERFACES_LIST \ "org.freedesktop.hostname1\0" +const char hostname_interface[] _introspect_("hostname1") = INTERFACE; + enum { PROP_HOSTNAME, PROP_STATIC_HOSTNAME, @@ -547,6 +552,14 @@ int main(int argc, char *argv[]) { log_parse_environment(); log_open(); + if (argc == 2 && streq(argv[1], "--introspect")) { + fputs(DBUS_INTROSPECT_1_0_XML_DOCTYPE_DECL_NODE + "<node>\n", stdout); + fputs(hostname_interface, stdout); + fputs("</node>\n", stdout); + return 0; + } + if (argc != 1) { log_error("This program takes no arguments."); r = -EINVAL; diff --git a/src/localed.c b/src/localed.c index 0fbe74787a..353e88efbe 100644 --- a/src/localed.c +++ b/src/localed.c @@ -30,16 +30,19 @@ #include "dbus-common.h" #include "polkit.h" -#define INTROSPECTION \ - DBUS_INTROSPECT_1_0_XML_DOCTYPE_DECL_NODE \ - "<node>\n" \ +#define INTERFACE \ " <interface name=\"org.freedesktop.locale1\">\n" \ " <property name=\"Locale\" type=\"as\" access=\"read\"/>\n" \ " <method name=\"SetLocale\">\n" \ " <arg name=\"locale\" type=\"as\" direction=\"in\"/>\n" \ " <arg name=\"user_interaction\" type=\"b\" direction=\"in\"/>\n" \ " </method>\n" \ - " </interface>\n" \ + " </interface>\n" + +#define INTROSPECTION \ + DBUS_INTROSPECT_1_0_XML_DOCTYPE_DECL_NODE \ + "<node>\n" \ + INTERFACE \ BUS_PROPERTIES_INTERFACE \ BUS_INTROSPECTABLE_INTERFACE \ BUS_PEER_INTERFACE \ @@ -49,6 +52,8 @@ BUS_GENERIC_INTERFACES_LIST \ "org.freedesktop.locale1\0" +const char locale_interface[] _introspect_("locale1") = INTERFACE; + enum { /* We don't list LC_ALL here on purpose. People should be * using LANG instead. */ @@ -563,6 +568,14 @@ int main(int argc, char *argv[]) { log_parse_environment(); log_open(); + if (argc == 2 && streq(argv[1], "--introspect")) { + fputs(DBUS_INTROSPECT_1_0_XML_DOCTYPE_DECL_NODE + "<node>\n", stdout); + fputs(locale_interface, stdout); + fputs("</node>\n", stdout); + return 0; + } + if (argc != 1) { log_error("This program takes no arguments."); r = -EINVAL; diff --git a/src/logind.h b/src/logind.h index 95db35ddfd..fdc780feb6 100644 --- a/src/logind.h +++ b/src/logind.h @@ -38,6 +38,7 @@ * PAM rewrite * spawn user systemd * dbus API + * direct client API * * non-local X11 server * reboot/shutdown halt management diff --git a/src/org.freedesktop.login1.policy b/src/org.freedesktop.login1.policy new file mode 100644 index 0000000000..b81e4888ff --- /dev/null +++ b/src/org.freedesktop.login1.policy @@ -0,0 +1,29 @@ +<?xml version="1.0" encoding="UTF-8"?> <!--*-nxml-*--> +<!DOCTYPE policyconfig PUBLIC "-//freedesktop//DTD PolicyKit Policy Configuration 1.0//EN" + "http://www.freedesktop.org/standards/PolicyKit/1/policyconfig.dtd"> + +<!-- + This file is part of systemd. + + systemd 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. +--> + +<policyconfig> + + <vendor>The systemd Project</vendor> + <vendor_url>http://www.freedesktop.org/wiki/Software/systemd</vendor_url> + + <action id="org.freedesktop.login1.enable-user-linger"> + <description>Allow non-logged-in users to run programs</description> + <message>Authentication is required to allow a non-logged-in user to run programs</message> + <defaults> + <allow_any>auth_admin_keep</allow_any> + <allow_inactive>auth_admin_keep</allow_inactive> + <allow_active>auth_admin_keep</allow_active> + </defaults> + </action> + +</policyconfig> diff --git a/src/org.freedesktop.login1.service b/src/org.freedesktop.login1.service new file mode 100644 index 0000000000..4a64177e30 --- /dev/null +++ b/src/org.freedesktop.login1.service @@ -0,0 +1,12 @@ +# This file is part of systemd. +# +# systemd 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. + +[D-BUS Service] +Name=org.freedesktop.login1 +Exec=/bin/false +User=root +SystemdService=dbus-org.freedesktop.login1.service diff --git a/src/timedated.c b/src/timedated.c index daa3d9c821..a6ec26276b 100644 --- a/src/timedated.c +++ b/src/timedated.c @@ -33,9 +33,7 @@ #define NULL_ADJTIME_UTC "0.0 0 0\n0\nUTC\n" #define NULL_ADJTIME_LOCAL "0.0 0 0\n0\nLOCAL\n" -#define INTROSPECTION \ - DBUS_INTROSPECT_1_0_XML_DOCTYPE_DECL_NODE \ - "<node>\n" \ +#define INTERFACE \ " <interface name=\"org.freedesktop.timedate1\">\n" \ " <property name=\"Timezone\" type=\"s\" access=\"read\"/>\n" \ " <property name=\"LocalRTC\" type=\"b\" access=\"read\"/>\n" \ @@ -50,10 +48,15 @@ " </method>\n" \ " <method name=\"SetLocalRTC\">\n" \ " <arg name=\"local_rtc\" type=\"b\" direction=\"in\"/>\n" \ - " <arg name=\"fix_system\" type=\"b\" direction=\"in\"/>\n" \ + " <arg name=\"fix_system\" type=\"b\" direction=\"in\"/>\n" \ " <arg name=\"user_interaction\" type=\"b\" direction=\"in\"/>\n" \ " </method>\n" \ - " </interface>\n" \ + " </interface>\n" + +#define INTROSPECTION \ + DBUS_INTROSPECT_1_0_XML_DOCTYPE_DECL_NODE \ + "<node>\n" \ + INTERFACE \ BUS_PROPERTIES_INTERFACE \ BUS_INTROSPECTABLE_INTERFACE \ BUS_PEER_INTERFACE \ @@ -63,6 +66,8 @@ BUS_GENERIC_INTERFACES_LIST \ "org.freedesktop.locale1\0" +const char timedate_interface[] _introspect_("timedate1") = INTERFACE; + static char *zone = NULL; static bool local_rtc = false; @@ -566,6 +571,14 @@ int main(int argc, char *argv[]) { log_parse_environment(); log_open(); + if (argc == 2 && streq(argv[1], "--introspect")) { + fputs(DBUS_INTROSPECT_1_0_XML_DOCTYPE_DECL_NODE + "<node>\n", stdout); + fputs(timedate_interface, stdout); + fputs("</node>\n", stdout); + return 0; + } + if (argc != 1) { log_error("This program takes no arguments."); r = -EINVAL; |