# HG changeset patch
# User Kaitlin Rupert <karupert(a)us.ibm.com>
# Date 1201551293 28800
# Node ID 21c3975da22cbea8218aca2923cfd68abf293a97
# Parent a6352980c902f4a0e3d60e97b4c2c9bc6c594674
[CU] Add parse_inst_arg() to validate_args() call in std_invokemethod.
Signed-off-by: Kaitlin Rupert <karupert(a)us.ibm.com>
diff -r a6352980c902 -r 21c3975da22c std_invokemethod.c
--- a/std_invokemethod.c Mon Jan 28 12:14:52 2008 -0800
+++ b/std_invokemethod.c Mon Jan 28 12:14:53 2008 -0800
@@ -180,9 +180,14 @@ static int parse_eo_param(CMPIArgs **arg
static int validate_arg_type(struct method_arg *arg,
const CMPIArgs *args,
+ const CMPIBroker *broker,
+ const char *ns,
+ CMPIArgs **new_args,
CMPIStatus *s)
{
CMPIData argdata;
+ CMPIType type;
+ int ret;
argdata = CMGetArg(args, arg->name, s);
if ((s->rc != CMPI_RC_OK) || (CMIsNullValue(argdata))) {
@@ -193,10 +198,33 @@ static int validate_arg_type(struct meth
}
if (argdata.type != arg->type) {
- CMSetStatus(s, CMPI_RC_ERR_TYPE_MISMATCH);
- CU_DEBUG("Method parameter `%s' type check failed",
- arg->name);
- return 0;
+ if (check_for_eo(argdata.type, arg->type, &type) == 1) {
+ ret = parse_eo_param(new_args,
+ broker,
+ argdata,
+ type,
+ arg->name,
+ ns,
+ s);
+
+ if (ret != 1)
+ return 0;
+ } else {
+ CMSetStatus(s, CMPI_RC_ERR_TYPE_MISMATCH);
+ CU_DEBUG("Method parameter `%s' type check
failed",
+ arg->name);
+ return 0;
+ }
+ } else {
+ *s = CMAddArg(*new_args,
+ arg->name,
+ &(argdata.value),
+ argdata.type);
+
+ if (s->rc != CMPI_RC_OK) {
+ CU_DEBUG("Unable to update method argument");
+ return 0;
+ }
}
CU_DEBUG("Method parameter `%s' validated type 0x%x",
@@ -207,19 +235,31 @@ static int validate_arg_type(struct meth
}
static int validate_args(struct method_handler *h,
- const CMPIArgs *args,
+ const CMPIArgs **args,
+ const CMPIObjectPath *ref,
+ const CMPIBroker *broker,
CMPIStatus *s)
{
+ CMPIArgs *new_args;
int i;
+
+ new_args = CMNewArgs(broker, s);
for (i = 0; h->args[i].name; i++) {
int ret;
struct method_arg *arg = &h->args[i];
- ret = validate_arg_type(arg, args, s);
+ ret = validate_arg_type(arg,
+ *args,
+ broker,
+ NAMESPACE(ref),
+ &new_args,
+ s);
if (!ret)
return 0;
}
+
+ *args = new_args;
return 1;
}
@@ -254,7 +294,11 @@ CMPIStatus _std_invokemethod(CMPIMethodM
goto exit;
}
- ret = validate_args(h, argsin, &s);
+ ret = validate_args(h,
+ &argsin,
+ reference,
+ ctx->broker,
+ &s);
if (!ret)
goto exit;