[Pkg-gnupg-commit] [gnupg2] 122/132: dirmngr, w32: Fix ldap crl read on windows
Daniel Kahn Gillmor
dkg at fifthhorseman.net
Wed May 17 03:07:49 UTC 2017
This is an automated email from the git hooks/post-receive script.
dkg pushed a commit to branch experimental
in repository gnupg2.
commit abe3a9043f86b48b92ddcec47197e032e35a6f4f
Author: Andre Heinecke <aheinecke at intevation.de>
Date: Wed Apr 26 09:39:06 2017 +0200
dirmngr,w32: Fix ldap crl read on windows
Summary:
* dirmngr/ldap-wrapper-ce.c (outstream_cookie_s): Add buffer_read_pos.
(buffer_get_data): Use seperate read pos.
--
Using a single buffer pos for reading and writing caused the read
to return 0 as it read from the end of the buffer. Now we use
a seperate reader position.
Differential: D427
Signed-off-by: Andre Heinecke <aheinecke at intevation.de>
---
dirmngr/ldap-wrapper-ce.c | 11 +++++++----
1 file changed, 7 insertions(+), 4 deletions(-)
diff --git a/dirmngr/ldap-wrapper-ce.c b/dirmngr/ldap-wrapper-ce.c
index 1e42189..01f8f64 100644
--- a/dirmngr/ldap-wrapper-ce.c
+++ b/dirmngr/ldap-wrapper-ce.c
@@ -117,6 +117,7 @@ struct outstream_cookie_s
char buffer[4000]; /* Data ring buffer. */
size_t buffer_len; /* The amount of data in the BUFFER. */
size_t buffer_pos; /* The next read position of the BUFFER. */
+ size_t buffer_read_pos; /* The next read position of the BUFFER. */
};
#define BUFFER_EMPTY(c) ((c)->buffer_len == 0)
@@ -125,6 +126,8 @@ struct outstream_cookie_s
#define BUFFER_SPACE_AVAILABLE(c) (DIM((c)->buffer) - (c)->buffer_len)
#define BUFFER_INC_POS(c,n) (c)->buffer_pos = ((c)->buffer_pos + (n)) % DIM((c)->buffer)
#define BUFFER_CUR_POS(c) (&(c)->buffer[(c)->buffer_pos])
+#define BUFFER_INC_READ_POS(c,n) (c)->buffer_read_pos = ((c)->buffer_read_pos + (n)) % DIM((c)->buffer)
+#define BUFFER_CUR_READ_POS(c) (&(c)->buffer[(c)->buffer_read_pos])
static int
buffer_get_data (struct outstream_cookie_s *cookie, char *dst, int cnt)
@@ -143,15 +146,15 @@ buffer_get_data (struct outstream_cookie_s *cookie, char *dst, int cnt)
if (chunk > left)
chunk = left;
- memcpy (dst, BUFFER_CUR_POS (cookie), chunk);
- BUFFER_INC_POS (cookie, chunk);
+ memcpy (dst, BUFFER_CUR_READ_POS (cookie), chunk);
+ BUFFER_INC_READ_POS (cookie, chunk);
left -= chunk;
dst += chunk;
if (left)
{
- memcpy (dst, BUFFER_CUR_POS (cookie), left);
- BUFFER_INC_POS (cookie, left);
+ memcpy (dst, BUFFER_CUR_READ_POS (cookie), left);
+ BUFFER_INC_READ_POS (cookie, left);
}
return amount;
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-gnupg/gnupg2.git
More information about the Pkg-gnupg-commit
mailing list