
# HG changeset patch # User Kaitlin Rupert <karupert@us.ibm.com> # Date 1194649591 28800 # Node ID 11f579d7363d783dab97b0d59b2fd5d2eedb7034 # Parent 5f84fd6c5cdefb2dfe41e4d8ec6ca750d3e69faa Some minor std_association fixes. Change result_list to tmp_list since the list is freed before filter_results() returns. The CU_DEBUG() call before the match_class() call on info->assoc_class has a typo. The string text prints info->assoc_class, but the value passed in for info->assoc_class is info->result_class. Return an error if match_class() fails. This needs to be done in both do_assoc() and do_ref() Signed-off-by: Kaitlin Rupert <karupert@us.ibm.com> diff -r 5f84fd6c5cde -r 11f579d7363d std_association.c --- a/std_association.c Thu Nov 08 11:21:50 2007 -0800 +++ b/std_association.c Fri Nov 09 15:06:31 2007 -0800 @@ -80,16 +80,16 @@ static CMPIStatus filter_results(struct const char *filter_class, const CMPIBroker *broker) { - struct inst_list result_list; + struct inst_list tmp_list; CMPIStatus s = {CMPI_RC_OK, NULL}; CMPIObjectPath *op; int i; - result_list = *list; + tmp_list = *list; inst_list_init(list); - for (i = 0; result_list.list[i] != NULL; i++) { - op = CMGetObjectPath(result_list.list[i], &s); + for (i = 0; tmp_list.list[i] != NULL; i++) { + op = CMGetObjectPath(tmp_list.list[i], &s); if ((s.rc != CMPI_RC_OK) || CMIsNullObject(op)) goto out; @@ -100,11 +100,11 @@ static CMPIStatus filter_results(struct if (!match_op(broker, op, filter_class)) continue; - inst_list_add(list, result_list.list[i]); + inst_list_add(list, tmp_list.list[i]); } out: - inst_list_free(&result_list); + inst_list_free(&tmp_list); return s; } @@ -163,18 +163,24 @@ static CMPIStatus do_assoc(struct std_as handler->target_class); if (!rc) { CU_DEBUG("Match_class failed.\n"); + cu_statusf(ctx->brkr, &s, + CMPI_RC_ERR_FAILED, + "Result class is not valid for this association"); goto out; } CU_DEBUG("Match_class succeeded.\n"); CU_DEBUG("Calling match_class: \n\tinfo->assoc_class: '%s'\n", - info->result_class); + info->assoc_class); rc = match_class(ctx->brkr, NAMESPACE(ref), info->assoc_class, handler->assoc_class); if (!rc) { CU_DEBUG("Match_class failed.\n"); + cu_statusf(ctx->brkr, &s, + CMPI_RC_ERR_FAILED, + "Association class given does not this association"); goto out; } CU_DEBUG("Match_class succeeded.\n"); @@ -248,8 +254,13 @@ static CMPIStatus do_ref(struct std_asso NAMESPACE(ref), info->result_class, handler->assoc_class); - if (!rc) - goto out; + if (!rc) { + cu_statusf(ctx->brkr, &s, + CMPI_RC_ERR_FAILED, + "Result class is not valid for this association"); + goto out; + } + s = handler->handler(ref, info, &list); if ((s.rc != CMPI_RC_OK) || (list.list == NULL))