From afc7bd6f1e04f82cde2478abb788b766a5ab651f Mon Sep 17 00:00:00 2001 From: Jakub Hrozek Date: Thu, 28 Mar 2013 11:05:30 +0100 Subject: [PATCH] Return the corrent number of entries found to the autofs client (related: #928447) --- ...id-header-number-of-entries-in-packe.patch | 53 +++++++++++++++++++ sssd.spec | 6 ++- 2 files changed, 58 insertions(+), 1 deletion(-) create mode 100644 0008-autofs-fix-invalid-header-number-of-entries-in-packe.patch diff --git a/0008-autofs-fix-invalid-header-number-of-entries-in-packe.patch b/0008-autofs-fix-invalid-header-number-of-entries-in-packe.patch new file mode 100644 index 0000000..8920f55 --- /dev/null +++ b/0008-autofs-fix-invalid-header-number-of-entries-in-packe.patch @@ -0,0 +1,53 @@ +From cd2327153a9ac55f3cf470c294691506096bd1eb Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Pavel=20B=C5=99ezina?= +Date: Wed, 27 Feb 2013 12:12:19 +0100 +Subject: [PATCH] autofs: fix invalid header 'number of entries' in packet + +https://fedorahosted.org/sssd/ticket/1739 + +Pointer to packet body may change while filling packet with autofs +mount points. As a consequence, we sometimes wrote the number of +entries into invalid body and we recieved an arbitrary number +on the client side. + +If the number was 0, there were some skipped entries. If the number +was greater than 0, everything worked correctly, because we iterate +through the cached entries until we reach packet length - we don't +compare to the number. +--- + src/responder/autofs/autofssrv_cmd.c | 6 +++++- + 1 file changed, 5 insertions(+), 1 deletion(-) + +diff --git a/src/responder/autofs/autofssrv_cmd.c b/src/responder/autofs/autofssrv_cmd.c +index 550c981a73e40804701268d0b34f8d7198f3ecc6..491afbb1de057dae996cfc7d084cdaed0220b8e3 100644 +--- a/src/responder/autofs/autofssrv_cmd.c ++++ b/src/responder/autofs/autofssrv_cmd.c +@@ -1085,13 +1085,13 @@ getautomntent_process(struct autofs_cmd_ctx *cmdctx, + goto done; + } + ++ /* allocate memory for number of entries in the packet */ + ret = sss_packet_grow(client->creq->out, sizeof(uint32_t)); + if (ret != EOK) { + DEBUG(SSSDBG_OP_FAILURE, ("Cannot grow packet\n")); + goto done; + } + +- sss_packet_get_body(client->creq->out, &body, &blen); + rp = sizeof(uint32_t); /* We'll write the number of entries here */ + + left = map->entry_count - cursor; +@@ -1111,6 +1111,10 @@ getautomntent_process(struct autofs_cmd_ctx *cmdctx, + nentries++; + } + ++ /* packet grows in fill_autofs_entry, body pointer may change, ++ * thus we have to obtain it here */ ++ sss_packet_get_body(client->creq->out, &body, &blen); ++ + rp = 0; + SAFEALIGN_SET_UINT32(&body[rp], nentries, &rp); + +-- +1.8.1.4 + diff --git a/sssd.spec b/sssd.spec index c555385..74d0a7d 100644 --- a/sssd.spec +++ b/sssd.spec @@ -16,7 +16,7 @@ Name: sssd Version: 1.9.4 -Release: 1%{?dist} +Release: 2%{?dist} Group: Applications/System Summary: System Security Services Daemon License: GPLv3+ @@ -32,6 +32,7 @@ Patch0004: 0004-Add-unit-tests-for-simple-access-test-by-groups.patch Patch0005: 0005-Do-not-compile-main-in-DP-if-UNIT_TESTING-is-defined.patch Patch0006: 0006-Provide-a-be_get_account_info_send-function.patch Patch0007: 0007-Resolve-GIDs-in-the-simple-access-provider.patch +Patch0008: 0008-autofs-fix-invalid-header-number-of-entries-in-packe.patch ### Dependencies ### @@ -529,6 +530,9 @@ fi %postun -n libsss_sudo -p /sbin/ldconfig %changelog +* Thu Mar 28 2013 Jakub Hrozek - 1.9.4-2 +- autofs: return the correct number of maps to the client + * Mon Mar 25 2013 Jakub Hrozek - 1.9.4-1 - New upstream release 1.9.4 - https://fedorahosted.org/sssd/wiki/Releases/Notes-1.9.4