[Libvirt-cim] [PATCH] [CU] Add function to validate a client given object path

Heidi Eckhart heidieck at linux.vnet.ibm.com
Tue Jan 15 10:56:55 UTC 2008


# HG changeset patch
# User Heidi Eckhart <heidieck at linux.vnet.ibm.com>
# Date 1200398044 -3600
# Node ID feaf6295a3fbc749d5c57ee29f6391880e692493
# Parent  2a52fc3c4bbcc3efe93d2943928c8d3128dca03b
[CU] Add function to validate a client given object path
Signed-off-by: Heidi Eckhart <heidieck at linux.vnet.ibm.com>

diff -r 2a52fc3c4bbc -r feaf6295a3fb instance_util.c
--- a/instance_util.c	Thu Dec 13 11:10:59 2007 +0100
+++ b/instance_util.c	Tue Jan 15 12:54:04 2008 +0100
@@ -154,6 +154,23 @@ const char *cu_compare_ref(const CMPIObj
         prop = NULL;
  out:
         return prop;
+}
+
+CMPIStatus cu_validate_ref(const CMPIBroker *broker,
+                           const CMPIObjectPath *ref,
+                           const CMPIInstance *inst)
+{
+        CMPIStatus s = {CMPI_RC_OK, NULL};
+        const char *prop;
+        
+        prop = cu_compare_ref(ref, inst);
+        if (prop != NULL) {
+                cu_statusf(broker, &s,
+                           CMPI_RC_ERR_NOT_FOUND,
+                           "No such instance (%s)", prop);
+        }
+        
+        return s;
 }
 
 CMPIStatus cu_copy_prop(const CMPIBroker *broker,
diff -r 2a52fc3c4bbc -r feaf6295a3fb libcmpiutil.h
--- a/libcmpiutil.h	Thu Dec 13 11:10:59 2007 +0100
+++ b/libcmpiutil.h	Tue Jan 15 12:54:04 2008 +0100
@@ -377,6 +377,22 @@ int inst_list_add(struct inst_list *list
  *          or NULL if all match
  */
 const char *cu_compare_ref(const CMPIObjectPath *ref,
+                           const CMPIInstance *inst);
+
+/**
+ * Validate a client given reference against the system instance.
+ * This is done by comparing the key values of the reference 
+ * against the key properties found in the system instance.
+ *
+ * @param broker A pointer to the current broker
+ * @param ref The ObjectPath to examine
+ * @param inst The Instance to compare
+ * @returns The status of the comparision:
+ *          CMPI_RC_OK in case of match
+ *          CMPI_RC_ERR_NOT_FOUND in case of not matching
+ */
+CMPIStatus cu_validate_ref(const CMPIBroker *broker,
+                           const CMPIObjectPath *ref,
                            const CMPIInstance *inst);
 
 #define DEFAULT_EIN(pn)                                                 \




More information about the Libvirt-cim mailing list