summaryrefslogtreecommitdiffstats
path: root/src/software-dbus/sw-utils.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/software-dbus/sw-utils.c')
-rw-r--r--src/software-dbus/sw-utils.c40
1 files changed, 40 insertions, 0 deletions
diff --git a/src/software-dbus/sw-utils.c b/src/software-dbus/sw-utils.c
index 89f843a..6922015 100644
--- a/src/software-dbus/sw-utils.c
+++ b/src/software-dbus/sw-utils.c
@@ -1116,6 +1116,46 @@ void create_instance_id(const char *class_name, const char *id,
}
/*******************************************************************************
+ * Object path checks
+ ******************************************************************************/
+bool check_system_software_collection(const CMPIBroker *cb,
+ const CMPIObjectPath *path)
+{
+ CMPIString *str_namespace;
+ CMPIData data;
+ CMPIStatus status;
+ char *our_namespace;
+ char instance_id[BUFLEN] = "";
+
+ if ((our_namespace = lmi_read_config("CIM", "Namespace")) == NULL)
+ goto err_l;
+ if ((str_namespace = CMGetNameSpace(path, NULL)) == NULL)
+ goto namespace_err_l;
+ if (strcmp(KChars(str_namespace), our_namespace))
+ goto namespace_err_l;
+ g_free(our_namespace);
+
+ if (!CMClassPathIsA(cb, path, LMI_SystemSoftwareCollection_ClassName, NULL))
+ goto err_l;
+
+ create_instance_id(LMI_SystemSoftwareCollection_ClassName, NULL, instance_id,
+ BUFLEN);
+ data = CMGetKey(path, "InstanceID", &status);
+ if (status.rc || data.type != CMPI_string ||
+ data.state != (CMPI_goodValue | CMPI_keyValue))
+ goto err_l;
+ if (strcmp(KChars(data.value.string), instance_id))
+ goto err_l;
+
+ return true;
+
+namespace_err_l:
+ g_free(our_namespace);
+err_l:
+ return false;
+}
+
+/*******************************************************************************
* General functions
******************************************************************************/