diff options
| author | Jakub Hrozek <jhrozek@redhat.com> | 2017-03-28 14:07:29 +0200 |
|---|---|---|
| committer | Jakub Hrozek <jhrozek@redhat.com> | 2017-03-30 14:09:37 +0200 |
| commit | b010f24f4d96d15c5c85021bb4aa83db25cd3df5 (patch) | |
| tree | 44eba5d8178ce0c26eff50f08a8d44a78daf6dce /src | |
| parent | 35f0f5ff9dac790f6c947190fcdc00d01ae9077c (diff) | |
| download | sssd-b010f24f4d96d15c5c85021bb4aa83db25cd3df5.tar.gz sssd-b010f24f4d96d15c5c85021bb4aa83db25cd3df5.tar.xz sssd-b010f24f4d96d15c5c85021bb4aa83db25cd3df5.zip | |
IFP: ListByName: Don't crash when no results are found
If no results were found using the List command, the results variable
was undefined which resulted in a crash.
Instead, only copy the results of the cache_req lookup returns EOK and
we can presume that the results are valid.
Reviewed-by: Pavel Březina <pbrezina@redhat.com>
Reviewed-by: Sumit Bose <sbose@redhat.com>
Diffstat (limited to 'src')
| -rw-r--r-- | src/responder/ifp/ifp_users.c | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/src/responder/ifp/ifp_users.c b/src/responder/ifp/ifp_users.c index ce9557f94..188194f2a 100644 --- a/src/responder/ifp/ifp_users.c +++ b/src/responder/ifp/ifp_users.c @@ -801,7 +801,7 @@ static void ifp_users_list_by_name_done(struct tevent_req *req) DBusError *error; struct ifp_list_ctx *list_ctx; struct sbus_request *sbus_req; - struct cache_req_result *result; + struct cache_req_result *result = NULL; errno_t ret; list_ctx = tevent_req_callback_data(req, struct ifp_list_ctx); @@ -816,12 +816,14 @@ static void ifp_users_list_by_name_done(struct tevent_req *req) return; } - ret = ifp_users_list_copy(list_ctx, result->ldb_result); - if (ret != EOK) { - error = sbus_error_new(sbus_req, SBUS_ERROR_INTERNAL, - "Failed to copy domain result"); - sbus_request_fail_and_finish(sbus_req, error); - return; + if (ret == EOK) { + ret = ifp_users_list_copy(list_ctx, result->ldb_result); + if (ret != EOK) { + error = sbus_error_new(sbus_req, SBUS_ERROR_INTERNAL, + "Failed to copy domain result"); + sbus_request_fail_and_finish(sbus_req, error); + return; + } } list_ctx->dom = get_next_domain(list_ctx->dom, SSS_GND_DESCEND); |
