diff options
author | Werner Koch <wk@gnupg.org> | 2002-02-28 12:05:57 +0100 |
---|---|---|
committer | Werner Koch <wk@gnupg.org> | 2002-02-28 12:05:57 +0100 |
commit | f8c8ca26d4608b1e1543e8b7ca7293c4473a7e7d (patch) | |
tree | 8ae5fab07a2fc8e4903fe0874c458e9a1c554351 /assuan | |
parent | * server.c (option_handler): Allow to use -2 for "send all certs (diff) | |
download | gnupg2-f8c8ca26d4608b1e1543e8b7ca7293c4473a7e7d.tar.xz gnupg2-f8c8ca26d4608b1e1543e8b7ca7293c4473a7e7d.zip |
* 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.
Diffstat (limited to 'assuan')
-rw-r--r-- | assuan/ChangeLog | 8 | ||||
-rw-r--r-- | assuan/assuan-client.c | 22 | ||||
-rw-r--r-- | assuan/assuan-handler.c | 8 | ||||
-rw-r--r-- | assuan/assuan.h | 8 |
4 files changed, 42 insertions, 4 deletions
diff --git a/assuan/ChangeLog b/assuan/ChangeLog index a46f55421..867f1250c 100644 --- a/assuan/ChangeLog +++ b/assuan/ChangeLog @@ -1,3 +1,11 @@ +2002-02-27 Werner Koch <wk@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@gnupg.org> * assuan-inquire.c (assuan_inquire): Check for a cancel command diff --git a/assuan/assuan-client.c b/assuan/assuan-client.c index d56357dc6..41984fdac 100644 --- a/assuan/assuan-client.c +++ b/assuan/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/assuan/assuan-handler.c b/assuan/assuan-handler.c index 1c8aded7b..69b34b4fc 100644 --- a/assuan/assuan-handler.c +++ b/assuan/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/assuan/assuan.h b/assuan/assuan.h index fed4e3468..3c679725f 100644 --- a/assuan/assuan.h +++ b/assuan/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 --*/ |