1
0
mirror of git://git.gnupg.org/gnupg.git synced 2024-12-22 10:19:57 +01:00

*** empty log message ***

This commit is contained in:
Werner Koch 2002-01-10 19:46:20 +00:00
parent 489207db37
commit 8bad9e344b
4 changed files with 72 additions and 2 deletions

View File

@ -1,3 +1,12 @@
2002-01-08 Werner Koch <wk@gnupg.org>
* util.h (spacep): New.
2002-01-02 Werner Koch <wk@gnupg.org>
* maperror.c (map_to_assuan_status): New. Merged from ../agent
and ../sm.
2001-12-20 Werner Koch <wk@gnupg.org> 2001-12-20 Werner Koch <wk@gnupg.org>
* maperror.c (map_gcry_err): Add some mappings. * maperror.c (map_gcry_err): Add some mappings.
@ -12,7 +21,7 @@
(atoi_1,atoi_2,atoi_4,xtoi_1,xtoi_2): New. (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 This file is free software; as a special exception the author gives
unlimited permission to copy and/or distribute it, with or without unlimited permission to copy and/or distribute it, with or without

View File

@ -67,6 +67,8 @@ enum {
GNUPG_Bad_Public_Key = 38, GNUPG_Bad_Public_Key = 38,
GNUPG_Bad_Secret_Key = 39, GNUPG_Bad_Secret_Key = 39,
GNUPG_Bad_Data = 40, GNUPG_Bad_Data = 40,
GNUPG_Invalid_Parameter = 41,
GNUPG_Tribute_to_D_A = 42
}; };
/* Status codes - fixme: should go into another file */ /* Status codes - fixme: should go into another file */

View File

@ -1,5 +1,5 @@
/* maperror.c - Error mapping /* 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. * This file is part of GnuPG.
* *
@ -147,3 +147,54 @@ map_assuan_err (int err)
return 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;
}

View File

@ -53,9 +53,11 @@ int map_ksba_err (int err);
int map_gcry_err (int err); int map_gcry_err (int err);
int map_kbx_err (int err); int map_kbx_err (int err);
int map_assuan_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 */ /* some macros to replace ctype ones and avoid locale problems */
#define spacep(p) (*(p) == ' ' || *(p) == '\t')
#define digitp(p) (*(p) >= '0' && *(p) <= '9') #define digitp(p) (*(p) >= '0' && *(p) <= '9')
#define hexdigitp(a) (digitp (a) \ #define hexdigitp(a) (digitp (a) \
|| (*(a) >= 'A' && *(a) <= 'F') \ || (*(a) >= 'A' && *(a) <= 'F') \
@ -73,3 +75,9 @@ int map_assuan_err (int err);
#endif /*GNUPG_COMMON_UTIL_H*/ #endif /*GNUPG_COMMON_UTIL_H*/