summaryrefslogtreecommitdiffstats
path: root/common
diff options
context:
space:
mode:
authorJustus Winter <justus@g10code.com>2016-08-11 09:52:08 +0200
committerJustus Winter <justus@g10code.com>2016-08-11 09:52:08 +0200
commit9e6503b7ce019aa417099ded1dda87b68c33f912 (patch)
treed4a27497ec9f7f07439331c290dc4ad6434e15a6 /common
parentgpg: Print the signer's UID during verification. (diff)
downloadgnupg2-9e6503b7ce019aa417099ded1dda87b68c33f912.tar.xz
gnupg2-9e6503b7ce019aa417099ded1dda87b68c33f912.zip
common: Remove simple password query error codes.
* common/simple-pwquery.h: Remove mapping function. Move all definitions of status codes... * common/simple-pwquery.c: ... here, and define them to meaningful gpg error values. * agent/preset-passphrase.c (preset_passphrase): Use error code as-is. (forget_passphrase): Likewise. * tools/symcryptrun.c (confucius_get_pass): Likewise. Signed-off-by: Justus Winter <justus@g10code.com>
Diffstat (limited to 'common')
-rw-r--r--common/simple-pwquery.c9
-rw-r--r--common/simple-pwquery.h43
2 files changed, 9 insertions, 43 deletions
diff --git a/common/simple-pwquery.c b/common/simple-pwquery.c
index 708b1573d..bd40fdfc1 100644
--- a/common/simple-pwquery.c
+++ b/common/simple-pwquery.c
@@ -50,6 +50,15 @@
#define SIMPLE_PWQUERY_IMPLEMENTATION 1
#include "simple-pwquery.h"
+#define SPWQ_OUT_OF_CORE gpg_error_from_errno (ENOMEM)
+#define SPWQ_IO_ERROR gpg_error_from_errno (EIO)
+#define SPWQ_PROTOCOL_ERROR gpg_error (GPG_ERR_PROTOCOL_VIOLATION)
+#define SPWQ_ERR_RESPONSE gpg_error (GPG_ERR_INV_RESPONSE)
+#define SPWQ_NO_AGENT gpg_error (GPG_ERR_NO_AGENT)
+#define SPWQ_SYS_ERROR gpg_error_from_syserror ()
+#define SPWQ_GENERAL_ERROR gpg_error (GPG_ERR_GENERAL)
+#define SPWQ_NO_PIN_ENTRY gpg_error (GPG_ERR_NO_PIN_ENTRY)
+
#ifndef _
#define _(a) (a)
#endif
diff --git a/common/simple-pwquery.h b/common/simple-pwquery.h
index 5ae696a6d..2b87b11a2 100644
--- a/common/simple-pwquery.h
+++ b/common/simple-pwquery.h
@@ -67,47 +67,4 @@ int simple_query (const char *query);
to be called before any other function. Returns 0 on success. */
int simple_pw_set_socket (const char *name);
-#define SPWQ_OUT_OF_CORE 1
-#define SPWQ_IO_ERROR 2
-#define SPWQ_PROTOCOL_ERROR 3
-#define SPWQ_ERR_RESPONSE 4
-#define SPWQ_NO_AGENT 5
-#define SPWQ_SYS_ERROR 6
-#define SPWQ_GENERAL_ERROR 7
-#define SPWQ_NO_PIN_ENTRY 8
-
-
-/* We often need to map error codes to gpg-error style error codes.
- To have a consistent mapping this macro may be used to implemt the
- mapping function. */
-#define MAP_SPWQ_ERROR_IMPL \
- static gpg_error_t \
- map_spwq_error (int err) \
- { \
- switch (err) \
- { \
- case 0: \
- return 0; \
- case SPWQ_OUT_OF_CORE: \
- return gpg_error_from_errno (ENOMEM); \
- case SPWQ_IO_ERROR: \
- return gpg_error_from_errno (EIO); \
- case SPWQ_PROTOCOL_ERROR: \
- return gpg_error (GPG_ERR_PROTOCOL_VIOLATION); \
- case SPWQ_ERR_RESPONSE: \
- return gpg_error (GPG_ERR_INV_RESPONSE); \
- case SPWQ_NO_AGENT: \
- return gpg_error (GPG_ERR_NO_AGENT); \
- case SPWQ_SYS_ERROR: \
- return gpg_error_from_syserror (); \
- case SPWQ_NO_PIN_ENTRY: \
- return gpg_error (GPG_ERR_NO_PIN_ENTRY); \
- case SPWQ_GENERAL_ERROR: \
- default: \
- return gpg_error (GPG_ERR_GENERAL); \
- } \
- }
-/* End of MAP_SPWQ_ERROR_IMPL. */
-
-
#endif /*SIMPLE_PWQUERY_H*/