diff options
Diffstat (limited to 'g10')
-rw-r--r-- | g10/ChangeLog | 5 | ||||
-rw-r--r-- | g10/app-common.h | 2 | ||||
-rw-r--r-- | g10/cardglue.c | 52 | ||||
-rw-r--r-- | g10/cardglue.h | 1 | ||||
-rw-r--r-- | g10/keydb.h | 5 | ||||
-rw-r--r-- | g10/tlv.c | 6 |
6 files changed, 60 insertions, 11 deletions
diff --git a/g10/ChangeLog b/g10/ChangeLog index 274c673d8..88ec84a3e 100644 --- a/g10/ChangeLog +++ b/g10/ChangeLog @@ -1,5 +1,10 @@ 2005-05-31 Werner Koch <[email protected]> + * keydb.h [!ENABLE_AGENT_SUPPORT]: Define dummy types. + + * cardglue.c (assuan_strerror, assuan_transact): Dummy functions + if not build with agent support. + * armor.c (check_input): Don't bail out on invalid header lines unless in struict rfc2440 mode. Suggested by Richard Patterson. diff --git a/g10/app-common.h b/g10/app-common.h index 756624c5b..c80bfb527 100644 --- a/g10/app-common.h +++ b/g10/app-common.h @@ -46,7 +46,7 @@ struct app_ctx_s { in case we need to divert the operation to an already running agent. This if ASSUAN_CTX is not NULL we take this as indication that all operations are diverted to gpg-agent. */ -#if GNUPG_MAJOR_VERSION == 1 && defined(ENABLE_AGENT_SUPPORT) +#if GNUPG_MAJOR_VERSION == 1 assuan_context_t assuan_ctx; #endif /*GNUPG_MAJOR_VERSION == 1*/ diff --git a/g10/cardglue.c b/g10/cardglue.c index ae4d37ab0..6ab241dc2 100644 --- a/g10/cardglue.c +++ b/g10/cardglue.c @@ -44,11 +44,6 @@ #include "apdu.h" #include "app-common.h" -/* If we build w/o agent support, assuan.h won't be included and thus - we need to define a repalcement for the assuan error type. */ -#ifndef ENABLE_AGENT_SUPPORT -typedef int assuan_error_t; -#endif struct ctrl_ctx_s @@ -81,6 +76,48 @@ static app_t current_app; static assuan_error_t learn_status_cb (void *opaque, const char *line); +/* To avoid cluttering the code with bunches of ifdefs we use a few + dummy functions instead and defines. */ +#ifndef ENABLE_AGENT_SUPPORT + +#define ASSUAN_LINELENGTH 100 + +static assuan_context_t +agent_open (int try) +{ + return NULL; +} + +void +agent_close (assuan_context_t ctx) +{ +} + +const char * +assuan_strerror (assuan_error_t err) +{ + return "no Assuan support"; +} + +assuan_error_t +assuan_transact (assuan_context_t ctx, + const char *command, + assuan_error_t (*data_cb)(void *, const void *, size_t), + void *data_cb_arg, + assuan_error_t (*inquire_cb)(void*, const char *), + void *inquire_cb_arg, + assuan_error_t (*status_cb)(void*, const char *), + void *status_cb_arg) +{ + return 100; /* ASSUAN_NOT_IMPLEMENTED */ +} +assuan_error_t +assuan_send_data (assuan_context_t ctx, const void *buffer, size_t length) +{ + return 100; /* ASSUAN_NOT_IMPLEMENTED */ +} +#endif /*!ENABLE_AGENT_SUPPORT*/ + /* Create a serialno/fpr string from the serial number and the secret key. caller must free the returned string. There is no error @@ -253,9 +290,6 @@ app_get_serial_and_stamp (app_t app, char **serial, time_t *stamp) - - - /* Release the card info structure. */ void agent_release_card_info (struct agent_card_info_s *info) @@ -280,7 +314,7 @@ agent_release_card_info (struct agent_card_info_s *info) } -/* Print an error message for a failed assuan-Transact and return a +/* Print an error message for a failed assuan_transact and return a gpg error code. No error is printed if RC is 0. */ static gpg_error_t test_transact (int rc, const char *command) diff --git a/g10/cardglue.h b/g10/cardglue.h index 8d7ec369e..2e652b378 100644 --- a/g10/cardglue.h +++ b/g10/cardglue.h @@ -92,6 +92,7 @@ typedef struct ctrl_ctx_s *ctrl_t; #define GPG_ERR_INV_ID G10ERR_GENERAL #define GPG_ERR_INV_NAME G10ERR_GENERAL #define GPG_ERR_INV_VALUE G10ERR_INV_ARG +#define GPG_ERR_INV_SEXP G10ERR_INV_ARG #define GPG_ERR_NOT_SUPPORTED G10ERR_UNSUPPORTED #define GPG_ERR_NO_OBJ G10ERR_GENERAL #define GPG_ERR_PIN_BLOCKED G10ERR_PASSPHRASE diff --git a/g10/keydb.h b/g10/keydb.h index e2b32e32e..db3d9e35c 100644 --- a/g10/keydb.h +++ b/g10/keydb.h @@ -191,6 +191,11 @@ int build_sk_list( STRLIST locusr, SK_LIST *ret_sk_list, #ifdef ENABLE_AGENT_SUPPORT assuan_context_t agent_open (int try); void agent_close (assuan_context_t ctx); +#else +/* If we build w/o agent support, assuan.h won't get included and thus + we need to define a replacement for some Assuan types. */ +typedef int assuan_error_t; +typedef void *assuan_context_t; #endif int have_static_passphrase(void); void read_passphrase_from_fd( int fd ); @@ -27,7 +27,11 @@ #include <assert.h> #if GNUPG_MAJOR_VERSION == 1 -#include "cardglue.h" +#define GPG_ERR_EOF (-1) +#define GPG_ERR_BAD_BER (1) /*G10ERR_GENERAL*/ +#define GPG_ERR_INV_SEXP (45) /*G10ERR_INV_ARG*/ +typedef int gpg_error_t; +#define gpg_error(n) (n) #else #include <gpg-error.h> #endif |