summaryrefslogtreecommitdiffstats
path: root/src/responder
diff options
context:
space:
mode:
authorPetr Čech <pcech@redhat.com>2017-03-28 12:07:55 +0200
committerLukas Slebodnik <lslebodn@redhat.com>2017-08-25 21:02:41 +0200
commit3c31ce392ad9da4ac7c3d8190db89efcdbbc8b85 (patch)
treeb5175b27936ff1b128f5647073d2d4ee791ee2cb /src/responder
parent5fe1e8ba91a1e2e95aadf94ecc5148bec804aa5a (diff)
downloadsssd-3c31ce392ad9da4ac7c3d8190db89efcdbbc8b85.tar.gz
sssd-3c31ce392ad9da4ac7c3d8190db89efcdbbc8b85.tar.xz
sssd-3c31ce392ad9da4ac7c3d8190db89efcdbbc8b85.zip
IFP: Fix of limit = 0 (unlimited result)
If we set limit to 0 it means that result is unlimited. Internally we restrict number of result by allocation of result array. In unlimited case there was a bug and zero array was allocated. This fix allocates neccessary array when we know real result size. Resolves: https://pagure.io/SSSD/sssd/issue/3306 Reviewed-by: Fabiano Fidêncio <fidencio@redhat.com> Reviewed-by: Pavel Březina <pbrezina@redhat.com>
Diffstat (limited to 'src/responder')
-rw-r--r--src/responder/ifp/ifpsrv_util.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/responder/ifp/ifpsrv_util.c b/src/responder/ifp/ifpsrv_util.c
index 643881515..33a49f4b4 100644
--- a/src/responder/ifp/ifpsrv_util.c
+++ b/src/responder/ifp/ifpsrv_util.c
@@ -386,6 +386,15 @@ size_t ifp_list_ctx_remaining_capacity(struct ifp_list_ctx *list_ctx,
{
size_t capacity = list_ctx->limit - list_ctx->path_count;
+ if (list_ctx->limit == 0) {
+ list_ctx->paths = talloc_zero_array(list_ctx, const char *, entries);
+ if (list_ctx->paths == NULL) {
+ DEBUG(SSSDBG_CRIT_FAILURE, "talloc_zero_array() failed\n");
+ return 0;
+ }
+ return entries;
+ }
+
if (capacity < entries) {
DEBUG(SSSDBG_MINOR_FAILURE,
"IFP list request has limit of %"PRIu32" entries but back end "