[Pkg-gnupg-commit] [libassuan] 326/437: Add ASSUAN_CONVEY_COMMENTS flag.
Eric Dorland
eric at moszumanska.debian.org
Fri May 22 05:33:59 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 5650dc358bda65d04558cc71992d7a0b8e48e65c
Author: Werner Koch <wk at gnupg.org>
Date: Wed Aug 11 13:10:08 2010 +0000
Add ASSUAN_CONVEY_COMMENTS flag.
---
NEWS | 7 +++++++
doc/assuan.texi | 2 +-
src/ChangeLog | 14 ++++++++++++++
src/assuan-defs.h | 4 +++-
src/assuan-pipe-connect.c | 2 +-
src/assuan-socket-connect.c | 6 +++---
src/assuan.h.in | 3 +++
src/client.c | 17 +++++++++++++----
src/context.c | 8 ++++++++
9 files changed, 53 insertions(+), 10 deletions(-)
diff --git a/NEWS b/NEWS
index ed41692..a2fe90b 100644
--- a/NEWS
+++ b/NEWS
@@ -1,6 +1,13 @@
Noteworthy changes in version 2.0.2
------------------------------------------------
+ * A new flag may now be used to convey comments via assuan_transact.
+
+ * Interface changes relative to the 2.0.1 release:
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ ASSUAN_CONVEY_COMMENTS NEW.
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
Noteworthy changes in version 2.0.1 (2010-08-09)
------------------------------------------------
diff --git a/doc/assuan.texi b/doc/assuan.texi
index d1ce90b..f7a5e56 100644
--- a/doc/assuan.texi
+++ b/doc/assuan.texi
@@ -251,7 +251,7 @@ by @code{libgpg-error}.
@item S @var{keyword} <status information depending on keyword>
Informational output by the server, still processing the request. A
client may not send such lines to the server while processing an Inquiry
-command.
+command. @var{keyword} shall start with a letter or an underscore.
@item # <string>
Comment line issued only for debugging purposes. Totally ignored.
diff --git a/src/ChangeLog b/src/ChangeLog
index f37ae26..c85bbde 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,17 @@
+2010-08-11 Werner Koch <wk at g10code.com>
+
+ * assuan.h.in (ASSUAN_CONVEY_COMMENTS): New.
+ * assuan-defs.h (struct assuan_context_s): Add flags.CONVEY_COMMENTS.
+ * context.c (assuan_set_flag, assuan_get_flag): Support this flag.
+ (_assuan_read_from_server): Add arg CONVEY_COMMENTS. Change all
+ callers.
+ * client.c (assuan_transact): Implement new flags.
+
+2010-08-09 Werner Koch <wk at g10code.com>
+
+ * assuan-socket-connect.c (assuan_socket_connect): Fix ipv6
+ literal IP case.
+
2010-08-03 Marcus Brinkmann <marcus at g10code.de>
* gpgcedev.c (GPGCEDEV_IOCTL_ASSIGN_RVID): New call ASSIGN_RVID.
diff --git a/src/assuan-defs.h b/src/assuan-defs.h
index 63f0d10..3cdbc92 100644
--- a/src/assuan-defs.h
+++ b/src/assuan-defs.h
@@ -87,6 +87,7 @@ struct assuan_context_s
unsigned int no_waitpid : 1;
unsigned int confidential : 1;
unsigned int no_fixsignals : 1;
+ unsigned int convey_comments : 1;
} flags;
/* If set, this is called right before logging an I/O line. */
@@ -281,7 +282,8 @@ gpg_error_t _assuan_write_line (assuan_context_t ctx, const char *prefix,
/*-- client.c --*/
gpg_error_t _assuan_read_from_server (assuan_context_t ctx,
- assuan_response_t *okay, int *off);
+ assuan_response_t *okay, int *off,
+ int convey_comments);
/*-- assuan-error.c --*/
diff --git a/src/assuan-pipe-connect.c b/src/assuan-pipe-connect.c
index 92f2bcc..bdcedc1 100644
--- a/src/assuan-pipe-connect.c
+++ b/src/assuan-pipe-connect.c
@@ -96,7 +96,7 @@ initial_handshake (assuan_context_t ctx)
int off;
gpg_error_t err;
- err = _assuan_read_from_server (ctx, &response, &off);
+ err = _assuan_read_from_server (ctx, &response, &off, 0);
if (err)
TRACE1 (ctx, ASSUAN_LOG_SYSIO, "initial_handshake", ctx,
"can't connect server: %s", gpg_strerror (err));
diff --git a/src/assuan-socket-connect.c b/src/assuan-socket-connect.c
index 13b8aa5..a3694c0 100644
--- a/src/assuan-socket-connect.c
+++ b/src/assuan-socket-connect.c
@@ -100,7 +100,7 @@ parse_portno (const char *str, uint16_t *r_port)
file://<fname>
- This is the same as the defualt just with an explicit schemata.
+ This is the same as the default just with an explicit schemata.
assuan://<ipaddr>:<port>
assuan://[<ip6addr>]:<port>
@@ -175,7 +175,7 @@ assuan_socket_connect (assuan_context_t ctx, const char *name,
if (!addrstr)
return _assuan_error (ctx, gpg_err_code_from_syserror ());
- if (*addrstr == '[')
+ if (*name == '[')
{
strcpy (addrstr, name+1);
p = strchr (addrstr, ']');
@@ -276,7 +276,7 @@ assuan_socket_connect (assuan_context_t ctx, const char *name,
assuan_response_t response;
int off;
- err = _assuan_read_from_server (ctx, &response, &off);
+ err = _assuan_read_from_server (ctx, &response, &off, 0);
if (err)
TRACE1 (ctx, ASSUAN_LOG_SYSIO, "assuan_socket_connect", ctx,
"can't connect to server: %s\n", gpg_strerror (err));
diff --git a/src/assuan.h.in b/src/assuan.h.in
index 410b4b7..86733a3 100644
--- a/src/assuan.h.in
+++ b/src/assuan.h.in
@@ -161,6 +161,9 @@ typedef unsigned int assuan_flag_t;
#define ASSUAN_CONFIDENTIAL 2
/* This flag suppresses fix up of signal handlers for pipes. */
#define ASSUAN_NO_FIXSIGNALS 3
+/* This flag changes assuan_transact to return comment lines via the
+ status callback. The default is to skip comment lines. */
+#define ASSUAN_CONVEY_COMMENTS 4
/* For context CTX, set the flag FLAG to VALUE. Values for flags
are usually 1 or 0 but certain flags might allow for other values;
diff --git a/src/client.c b/src/client.c
index 05cb579..3dfcf75 100644
--- a/src/client.c
+++ b/src/client.c
@@ -195,7 +195,7 @@ assuan_client_parse_response (assuan_context_t ctx, char *line, int linelen,
gpg_error_t
_assuan_read_from_server (assuan_context_t ctx, assuan_response_t *response,
- int *off)
+ int *off, int convey_comments)
{
gpg_error_t rc;
char *line;
@@ -209,7 +209,7 @@ _assuan_read_from_server (assuan_context_t ctx, assuan_response_t *response,
if (!rc)
rc = assuan_client_parse_response (ctx, line, linelen, response, off);
}
- while (!rc && *response == ASSUAN_RESPONSE_COMMENT);
+ while (!rc && *response == ASSUAN_RESPONSE_COMMENT && !convey_comments);
return rc;
}
@@ -258,7 +258,8 @@ assuan_transact (assuan_context_t ctx,
return 0; /* Don't expect a response for a comment line. */
again:
- rc = _assuan_read_from_server (ctx, &response, &off);
+ rc = _assuan_read_from_server (ctx, &response, &off,
+ ctx->flags.convey_comments);
if (rc)
return rc; /* error reading from server */
@@ -283,7 +284,7 @@ assuan_transact (assuan_context_t ctx,
if (!inquire_cb)
{
assuan_write_line (ctx, "END"); /* get out of inquire mode */
- _assuan_read_from_server (ctx, &response, &off); /* dummy read */
+ _assuan_read_from_server (ctx, &response, &off, 0); /* dummy read */
rc = _assuan_error (ctx, GPG_ERR_ASS_NO_INQUIRE_CB);
}
else
@@ -302,6 +303,14 @@ assuan_transact (assuan_context_t ctx,
if (!rc)
goto again;
}
+ else if (response == ASSUAN_RESPONSE_COMMENT && ctx->flags.convey_comments)
+ {
+ line -= off; /* Send line with the comment marker. */
+ if (status_cb)
+ rc = status_cb (status_cb_arg, line);
+ if (!rc)
+ goto again;
+ }
else if (response == ASSUAN_RESPONSE_END)
{
if (!data_cb)
diff --git a/src/context.c b/src/context.c
index 2be3a31..c55f626 100644
--- a/src/context.c
+++ b/src/context.c
@@ -80,6 +80,10 @@ assuan_set_flag (assuan_context_t ctx, assuan_flag_t flag, int value)
case ASSUAN_NO_FIXSIGNALS:
ctx->flags.no_fixsignals = value;
break;
+
+ case ASSUAN_CONVEY_COMMENTS:
+ ctx->flags.convey_comments = value;
+ break;
}
}
@@ -108,6 +112,10 @@ assuan_get_flag (assuan_context_t ctx, assuan_flag_t flag)
case ASSUAN_NO_FIXSIGNALS:
res = ctx->flags.no_fixsignals;
break;
+
+ case ASSUAN_CONVEY_COMMENTS:
+ res = ctx->flags.convey_comments;
+ break;
}
return TRACE_SUC1 ("flag_value=%i", res);
--
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