token.
(prepare_new_sig): New.
(parse_new_sig): Use prepare_new_sig when required.
(_gpgme_verify_status_handler): Handle STATUS_NEWSIG.
* engine-gpgsm.c (gpgsm_keylist_ext): Send with-validation
option. Fixed pattern construction.
(status_handler): Add debugging output.
2004-04-05 Werner Koch <wk@gnupg.org>
+ * gpgme.h: Add GPGME_STATUS_NEWSIG.
+
* verify.c (parse_error): Compare only the last part of the where
token.
+ (prepare_new_sig): New.
+ (parse_new_sig): Use prepare_new_sig when required.
+ (_gpgme_verify_status_handler): Handle STATUS_NEWSIG.
* engine-gpgsm.c (gpgsm_keylist_ext): Send with-validation
option. Fixed pattern construction.
+ (status_handler): Add debugging output.
2004-03-23 Marcus Brinkmann <marcus@g10code.de>
#include "assuan.h"
#include "status-table.h"
+#include "debug.h"
#include "engine-backend.h"
/* Try our best to terminate the connection friendly. */
/* assuan_write_line (gpgsm->assuan_ctx, "BYE"); */
err = map_assuan_error (assuan_err);
+ DEBUG3 ("fd %d: error from assuan (%d) getting status line : %s \n",
+ fd, assuan_err, gpg_strerror (err));
}
else if (linelen >= 3
&& line[0] == 'E' && line[1] == 'R' && line[2] == 'R'
err = map_assuan_error (atoi (&line[4]));
else
err = gpg_error (GPG_ERR_GENERAL);
+ DEBUG2 ("fd %d: ERR line - mapped to: %s\n",
+ fd, err? gpg_strerror (err):"ok");
}
else if (linelen >= 2
&& line[0] == 'O' && line[1] == 'K'
err = gpgsm->colon.fnc (gpgsm->colon.fnc_value, NULL);
}
_gpgme_io_close (gpgsm->status_cb.fd);
+ DEBUG2 ("fd %d: OK line - final status: %s\n",
+ fd, err? gpg_strerror (err):"ok");
return err;
}
else if (linelen > 2
dst++;
}
}
+ DEBUG2 ("fd %d: D line; final status: %s\n",
+ fd, err? gpg_strerror (err):"ok");
}
else if (linelen > 2
&& line[0] == 'S' && line[1] == ' ')
}
else
fprintf (stderr, "[UNKNOWN STATUS]%s %s", line + 2, rest);
+ DEBUG3 ("fd %d: S line (%s) - final status: %s\n",
+ fd, line+2, err? gpg_strerror (err):"ok");
}
}
while (!err && assuan_pending_line (gpgsm->assuan_ctx));
if (err)
return err;
- /* We must do a reset becuase we need to reset the list of signers. Note
- that RESET does not reset OPTION commands. */
+ /* We must send a reset because we need to reset the list of
+ signers. Note that RESET does not reset OPTION commands. */
err = gpgsm_assuan_simple_command (gpgsm->assuan_ctx, "RESET", NULL, NULL);
if (err)
return err;
#include <stdlib.h>
#include <string.h>
#include <errno.h>
+#include <assert.h>
#include "gpgme.h"
#include "util.h"
struct _gpgme_op_verify_result result;
gpgme_signature_t current_sig;
+ int did_prepare_new_sig;
} *op_data_t;
}
+static gpgme_error_t
+prepare_new_sig (op_data_t opd)
+{
+ gpgme_signature_t sig;
+
+ sig = calloc (1, sizeof (*sig));
+ if (!sig)
+ return gpg_error_from_errno (errno);
+ if (!opd->result.signatures)
+ opd->result.signatures = sig;
+ if (opd->current_sig)
+ opd->current_sig->next = sig;
+ opd->current_sig = sig;
+ opd->did_prepare_new_sig = 1;
+ return 0;
+}
+
static gpgme_error_t
parse_new_sig (op_data_t opd, gpgme_status_code_t code, char *args)
{
end++;
}
- sig = calloc (1, sizeof (*sig));
- if (!sig)
- return gpg_error_from_errno (errno);
- if (!opd->result.signatures)
- opd->result.signatures = sig;
- if (opd->current_sig)
- opd->current_sig->next = sig;
- opd->current_sig = sig;
+ if (!opd->did_prepare_new_sig)
+ {
+ gpg_error_t err;
+
+ err = prepare_new_sig (opd);
+ if (err)
+ return err;
+ }
+ assert (opd->did_prepare_new_sig);
+ opd->did_prepare_new_sig = 0;
+
+ assert (opd->current_sig);
+ sig = opd->current_sig;
/* FIXME: We should set the source of the state. */
switch (code)
switch (code)
{
+ case GPGME_STATUS_NEWSIG:
+ if (sig)
+ calc_sig_summary (sig);
+ break;
+
case GPGME_STATUS_GOODSIG:
case GPGME_STATUS_EXPSIG:
case GPGME_STATUS_EXPKEYSIG:
case GPGME_STATUS_BADSIG:
case GPGME_STATUS_ERRSIG:
- if (sig)
+ if (sig && !opd->did_prepare_new_sig)
calc_sig_summary (sig);
return parse_new_sig (opd, code, args);
return sig ? parse_error (sig, args) : gpg_error (GPG_ERR_INV_ENGINE);
case GPGME_STATUS_EOF:
- if (sig)
+ if (sig && !opd->did_prepare_new_sig)
calc_sig_summary (sig);
break;