summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohn Dennis <jdennis@redhat.com>2013-04-10 11:26:23 -0400
committerJohn Dennis <jdennis@redhat.com>2013-04-10 11:26:23 -0400
commitfbd399cc664a1f35cca7968738197645eabf58f9 (patch)
treed1b89ed0a13f061e410efa70755ceb5ee8716377
parent9d604d10b8774f8115b5562cc7dc58502137d1a9 (diff)
downloadrealmd-cim-fbd399cc664a1f35cca7968738197645eabf58f9.tar.gz
realmd-cim-fbd399cc664a1f35cca7968738197645eabf58f9.tar.xz
realmd-cim-fbd399cc664a1f35cca7968738197645eabf58f9.zip
Use short names for interface names, divorce from DBus syntax
-rwxr-xr-xdoc/examples/realmd-cim6
-rw-r--r--mof/LMI_Realmd.mof8
-rw-r--r--rdcp_dbus.c56
-rw-r--r--rdcp_dbus.h3
-rw-r--r--rdcp_realmdrealm.h14
-rw-r--r--rdcp_util.c5
6 files changed, 76 insertions, 16 deletions
diff --git a/doc/examples/realmd-cim b/doc/examples/realmd-cim
index 01d59a4..90ae9d5 100755
--- a/doc/examples/realmd-cim
+++ b/doc/examples/realmd-cim
@@ -8,10 +8,6 @@ import pywbem
#----------------------------------------------------------------------
-REALM_DBUS_KERBEROS_MEMBERSHIP_INTERFACE = "org.freedesktop.realmd.KerberosMembership"
-
-#----------------------------------------------------------------------
-
def do_list(conn, options, args):
realms = conn.EnumerateInstances('LMI_RealmdKerberosRealm')
@@ -35,7 +31,7 @@ def do_list(conn, options, args):
if not configured:
configured = "no"
is_configured = False
- elif configured == REALM_DBUS_KERBEROS_MEMBERSHIP_INTERFACE:
+ elif configured == "KerberosMembership":
configured = "kerberos-member"
print " configured: %s" % configured
diff --git a/mof/LMI_Realmd.mof b/mof/LMI_Realmd.mof
index 20792e9..e1940d2 100644
--- a/mof/LMI_Realmd.mof
+++ b/mof/LMI_Realmd.mof
@@ -184,13 +184,13 @@ class LMI_RealmdRealm : CIM_LogicalElement
[Description (
"If this property is NULL then the realm is not configured."
"Otherwise the realm is configured and the property contains "
- "a string which is the interface that represents how it was configured.")]
- // FIXME - should this be a boolean? Does a CIM client care about the DBus interface?
+ "a string which is the interface that represents how it was "
+ "configured, e.g. \"KerberosMembership\".")]
string Configured;
[Description (
- "xxx")]
- // FIXME - Does a CIM client care about the DBus interface?
+ "Indicates the types of operations this realm is capable of."
+ "Current possible values are: \"Kerberos\", \"KerberosMembership\".)]
string SupportedInterfaces[];
[Description (
diff --git a/rdcp_dbus.c b/rdcp_dbus.c
index c1cc93c..e879fff 100644
--- a/rdcp_dbus.c
+++ b/rdcp_dbus.c
@@ -1960,6 +1960,62 @@ dbus_leave_call(DBusConnection *bus, const gchar *dbus_path,
/*----------------------------------------------------------------------------*/
+/**
+ * get_short_dbus_interface_name
+ * @interface fully qualified DBus interface name
+ *
+ * Given a DBus interface name return a friendly short name
+ * appropriate for users to see. Currently the known short names are:
+ *
+ * * "Kerberos"
+ * * "KerberosMembership"
+ * * "Realm"
+ * * "Provider"
+ * * "Service"
+ *
+ * If the interface is not recognized the portion of the interface
+ * following the last period (".") will be returned. If there is no
+ * period in the interface name then the entire interface string is returned.
+ * If the interface is NULL then "(null)" is returned.
+ *
+ * Returns: pointer to string, must free with g_free()
+ */
+
+char *
+get_short_dbus_interface_name(const char *interface)
+{
+ char *token = NULL;
+
+ if (interface == NULL) {
+ return g_strdup("(null)");
+ }
+
+ if (strcmp(interface, REALM_DBUS_KERBEROS_INTERFACE) == 0) {
+ return g_strdup("Kerberos");
+ }
+ if (strcmp(interface, REALM_DBUS_KERBEROS_MEMBERSHIP_INTERFACE) == 0) {
+ return g_strdup("KerberosMembership");
+ }
+ if (strcmp(interface, REALM_DBUS_REALM_INTERFACE) == 0) {
+ return g_strdup("Realm");
+ }
+ if (strcmp(interface, REALM_DBUS_PROVIDER_INTERFACE) == 0) {
+ return g_strdup("Provider");
+ }
+ if (strcmp(interface, REALM_DBUS_SERVICE_INTERFACE) == 0) {
+ return g_strdup("Service");
+ }
+ /* Return string which begins after last period */
+ if ((token = rindex(interface, '.'))) {
+ token++; /* skip "." char */
+ return g_strdup(token);
+ } else {
+ return g_strdup(interface);
+ }
+
+}
+
+/*----------------------------------------------------------------------------*/
/**
* rdcp_dbus_initialize:
diff --git a/rdcp_dbus.h b/rdcp_dbus.h
index 21c9086..849d6f8 100644
--- a/rdcp_dbus.h
+++ b/rdcp_dbus.h
@@ -39,6 +39,9 @@ gboolean
dbus_leave_call(DBusConnection *bus, const gchar *dbus_path,
GVariant *credentials, GVariant *options, GError **g_error);
+char *
+get_short_dbus_interface_name(const char *interface);
+
gboolean
rdcp_dbus_initialize(GError **g_error);
diff --git a/rdcp_realmdrealm.h b/rdcp_realmdrealm.h
index cc70395..a59957c 100644
--- a/rdcp_realmdrealm.h
+++ b/rdcp_realmdrealm.h
@@ -175,19 +175,27 @@ KINLINE bool SupportsDBusInterface(GVariant *dbus_props, const char *dbus_interf
} \
\
if (g_variant_lookup(dbus_props, "Configured", "&s", &value)) { \
- klass##_Set_Configured(obj, value); \
+ if (strlen(value) == 0) { \
+ klass##_Null_Configured(obj); \
+ } else { \
+ char *interface_name = get_short_dbus_interface_name(value); \
+ klass##_Set_Configured(obj, interface_name); \
+ g_free(interface_name); \
+ } \
} \
\
if (g_variant_lookup(dbus_props, "SupportedInterfaces", "as", &iter)) { \
n_items = g_variant_iter_n_children(iter); \
klass##_Init_SupportedInterfaces(obj, n_items); \
for (i = 0; g_variant_iter_next(iter, "&s", &value); i++) { \
- klass##_Set_SupportedInterfaces(obj, i, value); \
+ char *interface_name = get_short_dbus_interface_name(value); \
+ klass##_Set_SupportedInterfaces(obj, i, interface_name); \
+ g_free(interface_name); \
} \
g_variant_iter_free(iter); \
} \
\
- if (g_variant_lookup(dbus_props, "Details", "a(ss)", &iter)) { \
+ if (g_variant_lookup(dbus_props, "Details", "a(ss)", &iter)) { \
n_items = g_variant_iter_n_children(iter); \
klass##_Init_DetailNames(obj, n_items); \
klass##_Init_DetailValues(obj, n_items); \
diff --git a/rdcp_util.c b/rdcp_util.c
index 5f745e6..ac9b57a 100644
--- a/rdcp_util.c
+++ b/rdcp_util.c
@@ -79,13 +79,10 @@ print_paths(gchar **paths, gchar *format, ...) {
}
}
-
-
-
/*----------------------------------------------------------------------------*/
/**
- * build_g_variant_options_from_KStringA:
+ * build_g_variant_options_from_KStringA
* @keys An array of dictionary keys.
* @values An array of dictionary values.
* @g_variant_return Pointer to location where GVariant will be returned,