2002-01-30 Marcus Brinkmann <marcus@g10code.de>
* gpgme.c (_gpgme_release_result): Call _gpgme_release_delete_result. * ops.h (_gpgme_release_delete_result): Add prototype. * types.h (DeleteResult): New type. * context.h (gpgme_context_s): Add DeleteResult to member result. * delete.c (enum delete_problem): New type. (struct delete_result_s): New structure. (_gpgme_release_delete_result): New function. (delete_status_handler): Implement more status codes. (gpgme_op_delete): Return error on failure. * import.c (MAX_IMPORTED_FIELDS): Bump up to 14.
This commit is contained in:
parent
088c044792
commit
9f622905cc
@ -1,3 +1,19 @@
|
|||||||
|
2002-01-30 Marcus Brinkmann <marcus@g10code.de>
|
||||||
|
|
||||||
|
* gpgme.c (_gpgme_release_result): Call
|
||||||
|
_gpgme_release_delete_result.
|
||||||
|
* ops.h (_gpgme_release_delete_result): Add prototype.
|
||||||
|
* types.h (DeleteResult): New type.
|
||||||
|
* context.h (gpgme_context_s): Add DeleteResult to member result.
|
||||||
|
|
||||||
|
* delete.c (enum delete_problem): New type.
|
||||||
|
(struct delete_result_s): New structure.
|
||||||
|
(_gpgme_release_delete_result): New function.
|
||||||
|
(delete_status_handler): Implement more status codes.
|
||||||
|
(gpgme_op_delete): Return error on failure.
|
||||||
|
|
||||||
|
* import.c (MAX_IMPORTED_FIELDS): Bump up to 14.
|
||||||
|
|
||||||
2002-01-30 Marcus Brinkmann <marcus@g10code.de>
|
2002-01-30 Marcus Brinkmann <marcus@g10code.de>
|
||||||
|
|
||||||
* import.c (struct import_result_s): New structure.
|
* import.c (struct import_result_s): New structure.
|
||||||
@ -6,7 +22,7 @@
|
|||||||
(import_status_handler): Implement.
|
(import_status_handler): Implement.
|
||||||
* gpgme.c (_gpgme_release_result): Add call to
|
* gpgme.c (_gpgme_release_result): Add call to
|
||||||
_gpgme_release_import_result.
|
_gpgme_release_import_result.
|
||||||
* ops.h (_gpgme_release_impoer_result): Add prototype.
|
* ops.h (_gpgme_release_import_result): Add prototype.
|
||||||
* types.h (ImportResult): New type.
|
* types.h (ImportResult): New type.
|
||||||
* context.h (gpgme_context_s): Add ImportResult to member result.
|
* context.h (gpgme_context_s): Add ImportResult to member result.
|
||||||
|
|
||||||
|
@ -69,6 +69,7 @@ struct gpgme_context_s {
|
|||||||
EncryptResult encrypt;
|
EncryptResult encrypt;
|
||||||
PassphraseResult passphrase;
|
PassphraseResult passphrase;
|
||||||
ImportResult import;
|
ImportResult import;
|
||||||
|
DeleteResult delete;
|
||||||
} result;
|
} result;
|
||||||
|
|
||||||
GpgmeData notation; /* last signature notation */
|
GpgmeData notation; /* last signature notation */
|
||||||
|
@ -30,19 +30,58 @@
|
|||||||
#include "ops.h"
|
#include "ops.h"
|
||||||
#include "key.h"
|
#include "key.h"
|
||||||
|
|
||||||
static void
|
|
||||||
delete_status_handler ( GpgmeCtx ctx, GpgStatusCode code, char *args )
|
enum delete_problem
|
||||||
|
{
|
||||||
|
DELETE_No_Problem = 0,
|
||||||
|
DELETE_No_Such_Key = 1,
|
||||||
|
DELETE_Must_Delete_Secret_Key = 2
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
struct delete_result_s
|
||||||
{
|
{
|
||||||
if ( ctx->out_of_core )
|
enum delete_problem problem;
|
||||||
return;
|
};
|
||||||
|
|
||||||
switch (code) {
|
|
||||||
case STATUS_EOF:
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
void
|
||||||
/* ignore all other codes */
|
_gpgme_release_delete_result (DeleteResult result)
|
||||||
break;
|
{
|
||||||
|
if (!result)
|
||||||
|
return;
|
||||||
|
xfree (result);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static void
|
||||||
|
delete_status_handler (GpgmeCtx ctx, GpgStatusCode code, char *args)
|
||||||
|
{
|
||||||
|
if (ctx->out_of_core)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (!ctx->result.delete)
|
||||||
|
{
|
||||||
|
ctx->result.delete = xtrycalloc (1, sizeof *ctx->result.delete);
|
||||||
|
if (!ctx->result.delete)
|
||||||
|
{
|
||||||
|
ctx->out_of_core = 1;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
switch (code)
|
||||||
|
{
|
||||||
|
case STATUS_EOF:
|
||||||
|
break;
|
||||||
|
|
||||||
|
case STATUS_DELETE_PROBLEM:
|
||||||
|
ctx->result.delete->problem = atoi (args);
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
/* Ignore all other codes. */
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -108,7 +147,23 @@ gpgme_op_delete (GpgmeCtx ctx, const GpgmeKey key, int allow_secret)
|
|||||||
if (!err)
|
if (!err)
|
||||||
{
|
{
|
||||||
gpgme_wait (ctx, 1);
|
gpgme_wait (ctx, 1);
|
||||||
/* FIXME: check for success */
|
if (ctx->result.delete)
|
||||||
|
{
|
||||||
|
switch (ctx->result.delete->problem)
|
||||||
|
{
|
||||||
|
case DELETE_No_Problem:
|
||||||
|
break;
|
||||||
|
case DELETE_No_Such_Key:
|
||||||
|
err = mk_error(Invalid_Key);
|
||||||
|
break;
|
||||||
|
case DELETE_Must_Delete_Secret_Key:
|
||||||
|
err = mk_error(Conflict);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
err = mk_error(General_Error);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
@ -87,6 +87,7 @@ _gpgme_release_result (GpgmeCtx ctx)
|
|||||||
_gpgme_release_encrypt_result (ctx->result.encrypt);
|
_gpgme_release_encrypt_result (ctx->result.encrypt);
|
||||||
_gpgme_release_passphrase_result (ctx->result.passphrase);
|
_gpgme_release_passphrase_result (ctx->result.passphrase);
|
||||||
_gpgme_release_import_result (ctx->result.import);
|
_gpgme_release_import_result (ctx->result.import);
|
||||||
|
_gpgme_release_delete_result (ctx->result.delete);
|
||||||
memset (&ctx->result, 0, sizeof (ctx->result));
|
memset (&ctx->result, 0, sizeof (ctx->result));
|
||||||
_gpgme_set_op_info (ctx, NULL);
|
_gpgme_set_op_info (ctx, NULL);
|
||||||
}
|
}
|
||||||
|
@ -52,7 +52,7 @@ _gpgme_release_import_result (ImportResult result)
|
|||||||
static void
|
static void
|
||||||
append_xml_impinfo (GpgmeData *rdh, GpgStatusCode code, char *args)
|
append_xml_impinfo (GpgmeData *rdh, GpgStatusCode code, char *args)
|
||||||
{
|
{
|
||||||
#define MAX_IMPORTED_FIELDS 13
|
#define MAX_IMPORTED_FIELDS 14
|
||||||
static char *imported_fields[MAX_IMPORTED_FIELDS]
|
static char *imported_fields[MAX_IMPORTED_FIELDS]
|
||||||
= { "keyid", "username", 0 };
|
= { "keyid", "username", 0 };
|
||||||
static char *import_res_fields[MAX_IMPORTED_FIELDS]
|
static char *import_res_fields[MAX_IMPORTED_FIELDS]
|
||||||
|
@ -98,6 +98,9 @@ GpgmeError _gpgme_passphrase_result (GpgmeCtx ctx);
|
|||||||
/*-- import.c --*/
|
/*-- import.c --*/
|
||||||
void _gpgme_release_import_result (ImportResult res);
|
void _gpgme_release_import_result (ImportResult res);
|
||||||
|
|
||||||
|
/*-- delete.c --*/
|
||||||
|
void _gpgme_release_delete_result (DeleteResult res);
|
||||||
|
|
||||||
/*-- version.c --*/
|
/*-- version.c --*/
|
||||||
const char *_gpgme_compare_versions (const char *my_version,
|
const char *_gpgme_compare_versions (const char *my_version,
|
||||||
const char *req_version);
|
const char *req_version);
|
||||||
|
@ -80,10 +80,9 @@ typedef struct passphrase_result_s *PassphraseResult;
|
|||||||
struct import_result_s;
|
struct import_result_s;
|
||||||
typedef struct import_result_s *ImportResult;
|
typedef struct import_result_s *ImportResult;
|
||||||
|
|
||||||
|
/*-- delete.c --*/
|
||||||
|
struct delete_result_s;
|
||||||
|
typedef struct delete_result_s *DeleteResult;
|
||||||
|
|
||||||
|
|
||||||
#endif /* TYPES_H */
|
#endif /* TYPES_H */
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user