diff options
Diffstat (limited to 'src/account/LMI_IdentityProvider.c')
-rw-r--r-- | src/account/LMI_IdentityProvider.c | 41 |
1 files changed, 24 insertions, 17 deletions
diff --git a/src/account/LMI_IdentityProvider.c b/src/account/LMI_IdentityProvider.c index e008746..11e3de5 100644 --- a/src/account/LMI_IdentityProvider.c +++ b/src/account/LMI_IdentityProvider.c @@ -162,6 +162,8 @@ static CMPIStatus LMI_IdentityDeleteInstance( struct lu_context *luc = NULL; struct lu_error *error = NULL; struct lu_ent *lue = NULL; + char *errmsg = NULL; + CMPIrc rc = CMPI_RC_OK; LMI_Identity_InitFromObjectPath(&identity, _cb, cop); instance_id = identity.InstanceID.chars; @@ -179,46 +181,51 @@ static CMPIStatus LMI_IdentityDeleteInstance( { /* It's a group */ if (!lu_group_lookup_id(luc, id, lue, &error)) { /* User with that ID is not present */ - lu_ent_free(lue); - lu_end(luc); - KReturn2(_cb, ERR_NOT_FOUND, "Non existing group id: %d\n", id); + asprintf(&errmsg, "Non existing group id: %d\n", id); + rc = CMPI_RC_ERR_NOT_FOUND; + goto fail; } else { if (!lu_group_delete(luc, lue, &error)) { /* user delete error */ - lu_ent_free(lue); - lu_end(luc); - KReturn2(_cb, ERR_FAILED, + rc = CMPI_RC_ERR_FAILED; + asprintf(&errmsg, "Group with id %d could not be deleted: %s\n", id, lu_strerror(error)); + goto fail; } } } else - { /* It's an user */ + { /* It's a user */ if (!lu_user_lookup_id(luc, id, lue, &error)) { /* User with that ID is not present */ - lu_ent_free(lue); - lu_end(luc); - KReturn2(_cb, ERR_NOT_FOUND, "Non existing user id: %d\n", id); + rc = CMPI_RC_ERR_NOT_FOUND; + asprintf(&errmsg, "Non existing user id: %d\n", id); + goto fail; } else { if (!lu_user_delete(luc, lue, &error)) { /* user delete error */ - lu_ent_free(lue); - lu_end(luc); - KReturn2(_cb, ERR_FAILED, - "User with id %d could not be deleted: %s\n", id, - lu_strerror(error)); + rc = CMPI_RC_ERR_FAILED; + asprintf(&errmsg, "User with id %d could not be deleted: %s\n", + id, lu_strerror(error)); + goto fail; } } } +fail: lu_ent_free(lue); lu_end(luc); - - CMReturn(CMPI_RC_OK); + if (errmsg) { + CMPIString *errstr = CMNewString(_cb, errmsg, NULL); + free(errmsg); + CMReturnWithString(rc, errstr); + } else { + CMReturn(rc); + } } static CMPIStatus LMI_IdentityExecQuery( |