
# HG changeset patch # User Heidi Eckhart <heidieck@linux.vnet.ibm.com> # Date 1200043988 -3600 # Node ID 393ba1344f5be2ea42b21adea0d377de440516dc # Parent 2a52fc3c4bbcc3efe93d2943928c8d3128dca03b [CU] Add function to validate a client given object path Signed-off-by: Heidi Eckhart <heidieck@linux.vnet.ibm.com> diff -r 2a52fc3c4bbc -r 393ba1344f5b instance_util.c --- a/instance_util.c Thu Dec 13 11:10:59 2007 +0100 +++ b/instance_util.c Fri Jan 11 10:33:08 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 393ba1344f5b libcmpiutil.h --- a/libcmpiutil.h Thu Dec 13 11:10:59 2007 +0100 +++ b/libcmpiutil.h Fri Jan 11 10:33:08 2008 +0100 @@ -377,6 +377,10 @@ int inst_list_add(struct inst_list *list * or NULL if all match */ const char *cu_compare_ref(const CMPIObjectPath *ref, + const CMPIInstance *inst); + +CMPIStatus cu_validate_ref(const CMPIBroker *broker, + const CMPIObjectPath *ref, const CMPIInstance *inst); #define DEFAULT_EIN(pn) \