
# HG changeset patch # User Kaitlin Rupert <karupert@us.ibm.com> # Date 1201570264 28800 # Node ID 47150c102ba01067b9efca3ddc0fc125e45a1594 # Parent 13c49e4efc85f1b4dd9adc0f7cb9e707c740f5be [CU] Add parse_inst_arg() to validate_args() call in std_invokemethod. Updates from set 1 to set 2: -check_for_eo() return type changed from int to CMPIType Signed-off-by: Kaitlin Rupert <karupert@us.ibm.com> diff -r 13c49e4efc85 -r 47150c102ba0 std_invokemethod.c --- a/std_invokemethod.c Mon Jan 28 17:30:18 2008 -0800 +++ b/std_invokemethod.c Mon Jan 28 17:31:04 2008 -0800 @@ -173,9 +173,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))) { @@ -186,10 +191,34 @@ 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; + type = check_for_eo(argdata.type, arg->type); + if (type != CMPI_null) { + ret = parse_eo_param(new_args, + argdata, + type, + arg->name, + broker, + 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", @@ -200,19 +229,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; } @@ -247,7 +288,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;