[Pkg-gnupg-commit] [libassuan] 44/437: * assuan-client.c (assuan_transact): Add 2 more arguments to support status lines. Passing NULL yields the old behaviour. * assuan-handler.c (process_request): Flush data lines send without using the data fp.
Eric Dorland
eric at moszumanska.debian.org
Fri May 22 05:33:22 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 52d4471e755e1e64c30ac2443cc5b3723241a14e
Author: Werner Koch <wk at gnupg.org>
Date: Thu Feb 28 11:05:57 2002 +0000
* assuan-client.c (assuan_transact): Add 2 more arguments to
support status lines. Passing NULL yields the old behaviour.
* assuan-handler.c (process_request): Flush data lines send
without using the data fp.
---
src/ChangeLog | 8 ++++++++
src/assuan-client.c | 22 +++++++++++++++++++++-
src/assuan-handler.c | 8 +++++++-
src/assuan.h | 8 ++++++--
4 files changed, 42 insertions(+), 4 deletions(-)
diff --git a/src/ChangeLog b/src/ChangeLog
index a46f554..867f125 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,11 @@
+2002-02-27 Werner Koch <wk at gnupg.org>
+
+ * assuan-client.c (assuan_transact): Add 2 more arguments to
+ support status lines. Passing NULL yields the old behaviour.
+
+ * assuan-handler.c (process_request): Flush data lines send
+ without using the data fp.
+
2002-02-14 Werner Koch <wk at gnupg.org>
* assuan-inquire.c (assuan_inquire): Check for a cancel command
diff --git a/src/assuan-client.c b/src/assuan-client.c
index d56357d..41984fd 100644
--- a/src/assuan-client.c
+++ b/src/assuan-client.c
@@ -57,6 +57,15 @@ _assuan_read_from_server (ASSUAN_CONTEXT ctx, int *okay, int *off)
*okay = 2; /* data line */
*off = 2;
}
+ else if (linelen >= 1
+ && line[0] == 'S'
+ && (line[1] == '\0' || line[1] == ' '))
+ {
+ *okay = 4;
+ *off = 1;
+ while (line[*off] == ' ')
+ ++*off;
+ }
else if (linelen >= 2
&& line[0] == 'O' && line[1] == 'K'
&& (line[2] == '\0' || line[2] == ' '))
@@ -101,6 +110,8 @@ _assuan_read_from_server (ASSUAN_CONTEXT ctx, int *okay, int *off)
* @data_cb_arg: first argument passed to @data_cb
* @inquire_cb: Callback function for a inquire response
* @inquire_cb_arg: first argument passed to @inquire_cb
+ * @status_cb: Callback function for a status response
+ * @status_cb_arg: first argument passed to @status_cb
*
* FIXME: Write documentation
*
@@ -114,7 +125,9 @@ assuan_transact (ASSUAN_CONTEXT ctx,
AssuanError (*data_cb)(void *, const void *, size_t),
void *data_cb_arg,
AssuanError (*inquire_cb)(void*, const char *),
- void *inquire_cb_arg)
+ void *inquire_cb_arg,
+ AssuanError (*status_cb)(void*, const char *),
+ void *status_cb_arg)
{
int rc, okay, off;
unsigned char *line;
@@ -181,6 +194,13 @@ assuan_transact (ASSUAN_CONTEXT ctx,
goto again;
}
}
+ else if (okay == 4)
+ {
+ if (status_cb)
+ rc = status_cb (status_cb_arg, line);
+ if (!rc)
+ goto again;
+ }
return rc;
}
diff --git a/src/assuan-handler.c b/src/assuan-handler.c
index 1c8aded..69b34b4 100644
--- a/src/assuan-handler.c
+++ b/src/assuan-handler.c
@@ -464,6 +464,12 @@ process_request (ASSUAN_CONTEXT ctx)
if (!rc && ctx->outbound.data.error)
rc = ctx->outbound.data.error;
}
+ else /* flush any data send w/o using the data fp */
+ {
+ assuan_send_data (ctx, NULL, 0);
+ if (!rc && ctx->outbound.data.error)
+ rc = ctx->outbound.data.error;
+ }
/* Error handling */
if (!rc)
{
@@ -478,7 +484,7 @@ process_request (ASSUAN_CONTEXT ctx)
{
char errline[256];
- if (rc < 100)
+ if (rc < 100)
sprintf (errline, "ERR %d server fault (%.50s)",
ASSUAN_Server_Fault, assuan_strerror (rc));
else
diff --git a/src/assuan.h b/src/assuan.h
index fed4e34..3c67972 100644
--- a/src/assuan.h
+++ b/src/assuan.h
@@ -73,6 +73,7 @@ typedef enum {
ASSUAN_Inquire_Unknown = 120,
ASSUAN_Inquire_Error = 121,
ASSUAN_Invalid_Option = 122,
+ ASSUAN_Invalid_Index = 123,
ASSUAN_Not_Confirmed = 128,
@@ -94,7 +95,8 @@ typedef enum {
ASSUAN_Card_Error = 401,
ASSUAN_Invalid_Card = 402,
ASSUAN_No_PKCS15_App = 403,
- ASSUAN_Card_Not_Present = 404
+ ASSUAN_Card_Not_Present = 404,
+ ASSUAN_Invalid_Id = 405
} AssuanError;
@@ -185,7 +187,9 @@ assuan_transact (ASSUAN_CONTEXT ctx,
AssuanError (*data_cb)(void *, const void *, size_t),
void *data_cb_arg,
AssuanError (*inquire_cb)(void*, const char *),
- void *inquire_cb_arg);
+ void *inquire_cb_arg,
+ AssuanError (*status_cb)(void*, const char *),
+ void *status_cb_arg);
/*-- assuan-inquire.c --*/
--
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