aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWerner Koch <[email protected]>2002-01-10 19:46:20 +0000
committerWerner Koch <[email protected]>2002-01-10 19:46:20 +0000
commit8bad9e344b6a084b506ba6d2117cc433a8383734 (patch)
treee23fb2bd882894cd6c1cef684baafedf05f0e931
parent* assuan-handler.c (assuan_set_okay_line): New. (diff)
downloadgnupg-8bad9e344b6a084b506ba6d2117cc433a8383734.tar.gz
gnupg-8bad9e344b6a084b506ba6d2117cc433a8383734.zip
*** empty log message ***
-rw-r--r--common/ChangeLog11
-rw-r--r--common/errors.h2
-rw-r--r--common/maperror.c53
-rw-r--r--common/util.h8
4 files changed, 72 insertions, 2 deletions
diff --git a/common/ChangeLog b/common/ChangeLog
index 8323104b4..37f6a7348 100644
--- a/common/ChangeLog
+++ b/common/ChangeLog
@@ -1,3 +1,12 @@
+2002-01-08 Werner Koch <[email protected]>
+
+ * util.h (spacep): New.
+
+2002-01-02 Werner Koch <[email protected]>
+
+ * maperror.c (map_to_assuan_status): New. Merged from ../agent
+ and ../sm.
+
2001-12-20 Werner Koch <[email protected]>
* maperror.c (map_gcry_err): Add some mappings.
@@ -12,7 +21,7 @@
(atoi_1,atoi_2,atoi_4,xtoi_1,xtoi_2): New.
- Copyright 2001 Free Software Foundation, Inc.
+ Copyright 2001, 2002 Free Software Foundation, Inc.
This file is free software; as a special exception the author gives
unlimited permission to copy and/or distribute it, with or without
diff --git a/common/errors.h b/common/errors.h
index cea4950f3..bd0c1af52 100644
--- a/common/errors.h
+++ b/common/errors.h
@@ -67,6 +67,8 @@ enum {
GNUPG_Bad_Public_Key = 38,
GNUPG_Bad_Secret_Key = 39,
GNUPG_Bad_Data = 40,
+ GNUPG_Invalid_Parameter = 41,
+ GNUPG_Tribute_to_D_A = 42
};
/* Status codes - fixme: should go into another file */
diff --git a/common/maperror.c b/common/maperror.c
index 0c259ddd0..ee1bdc86a 100644
--- a/common/maperror.c
+++ b/common/maperror.c
@@ -1,5 +1,5 @@
/* maperror.c - Error mapping
- * Copyright (C) 2001 Free Software Foundation, Inc.
+ * Copyright (C) 2001, 2002 Free Software Foundation, Inc.
*
* This file is part of GnuPG.
*
@@ -147,3 +147,54 @@ map_assuan_err (int err)
return err;
}
+/* Map GNUPG_xxx error codes to Assuan status codes */
+int
+map_to_assuan_status (int rc)
+{
+ switch (rc)
+ {
+ case 0: break;
+ case GNUPG_Bad_Certificate: rc = ASSUAN_Bad_Certificate; break;
+ case GNUPG_Bad_Certificate_Path: rc = ASSUAN_Bad_Certificate_Path; break;
+ case GNUPG_Missing_Certificate: rc = ASSUAN_Missing_Certificate; break;
+ case GNUPG_No_Data: rc = ASSUAN_No_Data_Available; break;
+ case GNUPG_Bad_Signature: rc = ASSUAN_Bad_Signature; break;
+ case GNUPG_Not_Implemented: rc = ASSUAN_Not_Implemented; break;
+ case GNUPG_No_Agent: rc = ASSUAN_No_Agent; break;
+ case GNUPG_Agent_Error: rc = ASSUAN_Agent_Error; break;
+ case GNUPG_No_Public_Key: rc = ASSUAN_No_Public_Key; break;
+ case GNUPG_No_Secret_Key: rc = ASSUAN_No_Secret_Key; break;
+ case GNUPG_Invalid_Data: rc = ASSUAN_Invalid_Data; break;
+ case GNUPG_Invalid_Name: rc = ASSUAN_Invalid_Name; break;
+
+ case GNUPG_Bad_PIN:
+ case GNUPG_Bad_Passphrase:
+ rc = ASSUAN_No_Secret_Key;
+ break;
+
+ case GNUPG_Read_Error:
+ case GNUPG_Write_Error:
+ case GNUPG_IO_Error:
+ rc = ASSUAN_Server_IO_Error;
+ break;
+ case GNUPG_Out_Of_Core:
+ case GNUPG_Resource_Limit:
+ rc = ASSUAN_Server_Resource_Problem;
+ break;
+ case GNUPG_Bug:
+ case GNUPG_Internal_Error:
+ rc = ASSUAN_Server_Bug;
+ break;
+ default:
+ rc = ASSUAN_Server_Fault;
+ break;
+ }
+ return rc;
+}
+
+
+
+
+
+
+
diff --git a/common/util.h b/common/util.h
index 35529253a..fa22b1571 100644
--- a/common/util.h
+++ b/common/util.h
@@ -53,9 +53,11 @@ int map_ksba_err (int err);
int map_gcry_err (int err);
int map_kbx_err (int err);
int map_assuan_err (int err);
+int map_to_assuan_status (int rc);
/* some macros to replace ctype ones and avoid locale problems */
+#define spacep(p) (*(p) == ' ' || *(p) == '\t')
#define digitp(p) (*(p) >= '0' && *(p) <= '9')
#define hexdigitp(a) (digitp (a) \
|| (*(a) >= 'A' && *(a) <= 'F') \
@@ -73,3 +75,9 @@ int map_assuan_err (int err);
#endif /*GNUPG_COMMON_UTIL_H*/
+
+
+
+
+
+