[Pkg-gnupg-commit] [libassuan] 280/437: Return and parse comment lines with the assuan_client_ functions.

Eric Dorland eric at moszumanska.debian.org
Fri May 22 05:33:53 UTC 2015


This is an automated email from the git hooks/post-receive script.

eric pushed a commit to branch master
in repository libassuan.

commit 3fd1733f47d977d5f1bcf406022e15532d6bfda6
Author: Werner Koch <wk at gnupg.org>
Date:   Mon Dec 14 12:16:30 2009 +0000

    Return and parse comment lines with the assuan_client_ functions.
---
 src/ChangeLog |  7 +++++++
 src/assuan.h  |  1 +
 src/client.c  | 22 ++++++++++++++++------
 3 files changed, 24 insertions(+), 6 deletions(-)

diff --git a/src/ChangeLog b/src/ChangeLog
index 92c9d0b..c5469c7 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,10 @@
+2009-12-14  Werner Koch  <wk at g10code.com>
+
+	* assuan.h (ASSUAN_RESPONSE_COMMENT): New.
+	* client.c (assuan_client_read_response): Return comment lines.
+	(assuan_client_parse_response): Return ASSUAN_RESPONSE_COMMENT.
+	(_assuan_read_from_server): Skip comment lines.
+
 2009-12-08  Marcus Brinkmann  <marcus at g10code.de>
 
 	* assuan.h (struct assuan_system_hooks): Don't use "namespace" as
diff --git a/src/assuan.h b/src/assuan.h
index 604ecc6..0cd943b 100644
--- a/src/assuan.h
+++ b/src/assuan.h
@@ -431,6 +431,7 @@ gpg_error_t assuan_get_peercred (assuan_context_t ctx,
 #define ASSUAN_RESPONSE_INQUIRE 3
 #define ASSUAN_RESPONSE_STATUS 4
 #define ASSUAN_RESPONSE_END 5
+#define ASSUAN_RESPONSE_COMMENT 6
 typedef int assuan_response_t;
 
 /* This already de-escapes data lines.  */
diff --git a/src/client.c b/src/client.c
index 5420e44..05cb579 100644
--- a/src/client.c
+++ b/src/client.c
@@ -91,7 +91,7 @@ assuan_client_read_response (assuan_context_t ctx,
       line = ctx->inbound.line;
       linelen = ctx->inbound.linelen;
     }    
-  while (*line == '#' || !linelen);
+  while (!linelen);
 
   /* For data lines, we deescape immediately.  The user will never
      have to worry about it.  */
@@ -181,6 +181,11 @@ assuan_client_parse_response (assuan_context_t ctx, char *line, int linelen,
       *response = ASSUAN_RESPONSE_END;
       *off = 3;
     }
+  else if (linelen >= 1 && line[0] == '#')
+    {
+      *response = ASSUAN_RESPONSE_COMMENT;
+      *off = 1;
+    }
   else
     return _assuan_error (ctx, GPG_ERR_ASS_INV_RESPONSE);
 
@@ -196,11 +201,16 @@ _assuan_read_from_server (assuan_context_t ctx, assuan_response_t *response,
   char *line;
   int linelen;
 
-  *response = ASSUAN_RESPONSE_ERROR;
-  *off = 0;
-  rc = assuan_client_read_response (ctx, &line, &linelen);
-  if (!rc)
-    rc = assuan_client_parse_response (ctx, line, linelen, response, off);
+  do
+    {
+      *response = ASSUAN_RESPONSE_ERROR;
+      *off = 0;
+      rc = assuan_client_read_response (ctx, &line, &linelen);
+      if (!rc)
+        rc = assuan_client_parse_response (ctx, line, linelen, response, off);
+    }
+  while (!rc && *response == ASSUAN_RESPONSE_COMMENT);
+
   return rc;
 }
 

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-gnupg/libassuan.git



More information about the Pkg-gnupg-commit mailing list