From cvs at cvs.gnupg.org Thu Oct 11 18:28:33 2012 From: cvs at cvs.gnupg.org (by Werner Koch) Date: Thu, 11 Oct 2012 18:28:33 +0200 Subject: [git] GPGME - branch, master, updated. gpgme-1.3.2-17-ge11e7fc Message-ID: This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "GnuPG Made Easy". The branch, master has been updated via e11e7fc5586613525035c3358e15ae24accb96ea (commit) via aa30b47aa010bf46876f2335e288f8bd8718e396 (commit) via 3f1329e1c9b99b1632cc4c4eec2e4399676fd93d (commit) via c28ebca9f2e21344d68e9fdcec60553f225c2e54 (commit) from 3d69b51f7f083193db28f364da4590c33b5e44e6 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit e11e7fc5586613525035c3358e15ae24accb96ea Author: Werner Koch Date: Thu Oct 11 17:02:50 2012 +0200 gpgme-tool: Use membuf functions to build up strings. * src/gpgme-tool.c (clear_membuf, init_membuf, put_membuf) (put_membuf_str, get_membuf, peek_membuf): Add membuf functions. Take from GnuPG master's common/membuf.[ch] and patch for our use. (result_xml_escape): Rewrite using new functions. -- First counting, then allocating, and finally copying data is prone to errors. We better use the membuf functions which make it much easier. diff --git a/src/gpgme-tool.c b/src/gpgme-tool.c index 057e428..eb1fbb8 100644 --- a/src/gpgme-tool.c +++ b/src/gpgme-tool.c @@ -475,6 +475,148 @@ argp_parse (const struct argp *argp, int argc, #endif +/* MEMBUF */ + +/* A simple implementation of a dynamic buffer. Use init_membuf() to + create a buffer, put_membuf to append bytes and get_membuf to + release and return the buffer. Allocation errors are detected but + only returned at the final get_membuf(), this helps not to clutter + the code with out-of-core checks. */ + +/* The definition of the structure is private, we only need it here, + so it can be allocated on the stack. */ +struct private_membuf_s +{ + size_t len; + size_t size; + char *buf; + int out_of_core; +}; + +typedef struct private_membuf_s membuf_t; + +/* Return the current length of the membuf. */ +#define get_membuf_len(a) ((a)->len) +#define is_membuf_ready(a) ((a)->buf || (a)->out_of_core) +#define MEMBUF_ZERO { 0, 0, NULL, 0} + + +static void +init_membuf (membuf_t *mb, int initiallen) +{ + mb->len = 0; + mb->size = initiallen; + mb->out_of_core = 0; + mb->buf = malloc (initiallen); + if (!mb->buf) + mb->out_of_core = errno; +} + + +/* Shift the the content of the membuf MB by AMOUNT bytes. The next + operation will then behave as if AMOUNT bytes had not been put into + the buffer. If AMOUNT is greater than the actual accumulated + bytes, the membuf is basically reset to its initial state. */ +#if 0 /* Not yet used. */ +static void +clear_membuf (membuf_t *mb, size_t amount) +{ + /* No need to clear if we are already out of core. */ + if (mb->out_of_core) + return; + if (amount >= mb->len) + mb->len = 0; + else + { + mb->len -= amount; + memmove (mb->buf, mb->buf+amount, mb->len); + } +} +#endif /* unused */ + +static void +put_membuf (membuf_t *mb, const void *buf, size_t len) +{ + if (mb->out_of_core || !len) + return; + + if (mb->len + len >= mb->size) + { + char *p; + + mb->size += len + 1024; + p = realloc (mb->buf, mb->size); + if (!p) + { + mb->out_of_core = errno ? errno : ENOMEM; + return; + } + mb->buf = p; + } + memcpy (mb->buf + mb->len, buf, len); + mb->len += len; +} + + +#if 0 /* Not yet used. */ +static void +put_membuf_str (membuf_t *mb, const char *string) +{ + put_membuf (mb, string, strlen (string)); +} +#endif /* unused */ + + +static void * +get_membuf (membuf_t *mb, size_t *len) +{ + char *p; + + if (mb->out_of_core) + { + if (mb->buf) + { + free (mb->buf); + mb->buf = NULL; + } + gpg_err_set_errno (mb->out_of_core); + return NULL; + } + + p = mb->buf; + if (len) + *len = mb->len; + mb->buf = NULL; + mb->out_of_core = ENOMEM; /* hack to make sure it won't get reused. */ + return p; +} + + +/* Peek at the membuf MB. On success a pointer to the buffer is + returned which is valid until the next operation on MB. If LEN is + not NULL the current LEN of the buffer is stored there. On error + NULL is returned and ERRNO is set. */ +#if 0 /* Not yet used. */ +static const void * +peek_membuf (membuf_t *mb, size_t *len) +{ + const char *p; + + if (mb->out_of_core) + { + gpg_err_set_errno (mb->out_of_core); + return NULL; + } + + p = mb->buf; + if (len) + *len = mb->len; + return p; +} +#endif /* unused */ + + + /* SUPPORT. */ FILE *log_stream; char *program_name = "gpgme-tool"; @@ -658,7 +800,8 @@ result_xml_tag_start (struct result_xml_state *state, char *name, ...) return 0; } -const char * +/* Return a constant string with an XML entity for C. */ +static const char * result_xml_escape_replacement(char c) { switch (c) @@ -674,48 +817,32 @@ result_xml_escape_replacement(char c) } } -gpg_error_t +/* Escape DATA by replacing certain characters with their XML + entities. The result is stored in a newly allocated buffer which + address will be stored at BUF. Returns 0 on success. */ +static gpg_error_t result_xml_escape (const char *data, char **buf) { - int data_len, i, j = 1; + int data_len, i; const char *r; - char *b; + membuf_t mb; + init_membuf (&mb, 128); data_len = strlen (data); for (i = 0; i < data_len; i++) { - r = result_xml_escape_replacement(data[i]); + r = result_xml_escape_replacement (data[i]); if (r) - j += strlen (r); + put_membuf (&mb, r, strlen (r)); else - j += 1; + put_membuf (&mb, data+i, 1); } - - b = (char *) malloc (j); - if (! b) - return gpg_error_from_syserror (); - - j = 0; - for (i = 0; i < data_len; i++) - { - r = result_xml_escape_replacement(data[i]); - if (r) - { - strcpy (b + j, r); - j += strlen (r); - } - else - { - b[j] = data[i]; - j += 1; - } - } - b[j] = 0; - *buf = b; - - return 0; + put_membuf (&mb, "", 1); + *buf = get_membuf (&mb, NULL); + return *buf? 0 : gpg_error_from_syserror (); } + gpg_error_t result_xml_tag_data (struct result_xml_state *state, const char *data) { @@ -734,7 +861,7 @@ result_xml_tag_data (struct result_xml_state *state, const char *data) (*cb) (hook, ">", 1); state->had_data[state->next_tag - 1] = 2; - err = result_xml_escape(data, &buf); + err = result_xml_escape (data, &buf); if (err) return err; commit aa30b47aa010bf46876f2335e288f8bd8718e396 Author: Werner Koch Date: Thu Oct 11 16:54:58 2012 +0200 gpgme-tool: Change license from LPGLv2+ to GPLv3+ * src/gpgme-tool.c: Change license notice. -- gpgme-tool.c is a standalone program, thus it makes no sense to keep it under the LGPL. We already had the manual under GPLv3+. diff --git a/AUTHORS b/AUTHORS index 707c106..53857b4 100644 --- a/AUTHORS +++ b/AUTHORS @@ -3,7 +3,7 @@ Maintainer: Werner Koch Bug reports: bug-gpgme at gnupg.org Security related bug reports: security at gnupg.org License (software): LGPLv2.1+ -License (manual): GPLv3+ +License (manual+tools): GPLv3+ FSF diff --git a/src/gpgme-tool.c b/src/gpgme-tool.c index b745294..057e428 100644 --- a/src/gpgme-tool.c +++ b/src/gpgme-tool.c @@ -1,12 +1,13 @@ /* gpgme-tool.c - Assuan server exposing GnuPG Made Easy operations. - Copyright (C) 2009, 2010 g10 Code GmbH + Copyright (C) 2009, 2010, 2012 g10 Code GmbH + Copyright (C) 2001, 2003, 2009, 2011 Free Software Foundation, Inc. This file is part of GPGME. GPGME is free software; you can redistribute it and/or modify it - under the terms of the GNU Lesser General Public License as - published by the Free Software Foundation; either version 2.1 of - the License, or (at your option) any later version. + under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. GPGME is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of commit 3f1329e1c9b99b1632cc4c4eec2e4399676fd93d Author: W. Trevor King Date: Sat Oct 6 11:30:21 2012 -0400 gpgme-tool: escape special characters in output XML data (<, >, and &). [[PGP Signed Part:Undecided]] src/gpgme-tool.c (result_xml_escape_replacement, result_xml_escape): New. (result_xml_tag_data): Use result_xml_escape() to escape data. (result_add_error): Use unescaped < and >. -- This is a general solution for generating valid XML, but the specific output that inspired the change was from the KEYLIST command: William Trevor King Now the uids are properly escaped: William Trevor King <wking at tremily.us> Signed-off-by: W. Trevor King diff --git a/src/gpgme-tool.c b/src/gpgme-tool.c index d37088c..b745294 100644 --- a/src/gpgme-tool.c +++ b/src/gpgme-tool.c @@ -657,12 +657,71 @@ result_xml_tag_start (struct result_xml_state *state, char *name, ...) return 0; } +const char * +result_xml_escape_replacement(char c) +{ + switch (c) + { + case '<': + return "<"; + case '>': + return ">"; + case '&': + return "&"; + default: + return NULL; + } +} + +gpg_error_t +result_xml_escape (const char *data, char **buf) +{ + int data_len, i, j = 1; + const char *r; + char *b; + + data_len = strlen (data); + for (i = 0; i < data_len; i++) + { + r = result_xml_escape_replacement(data[i]); + if (r) + j += strlen (r); + else + j += 1; + } + + b = (char *) malloc (j); + if (! b) + return gpg_error_from_syserror (); + + j = 0; + for (i = 0; i < data_len; i++) + { + r = result_xml_escape_replacement(data[i]); + if (r) + { + strcpy (b + j, r); + j += strlen (r); + } + else + { + b[j] = data[i]; + j += 1; + } + } + b[j] = 0; + *buf = b; + + return 0; +} gpg_error_t result_xml_tag_data (struct result_xml_state *state, const char *data) { + gpg_error_t err; result_xml_write_cb_t cb = state->cb; void *hook = state->hook; + char *buf = NULL; if (state->had_data[state->next_tag - 1]) { @@ -674,7 +733,13 @@ result_xml_tag_data (struct result_xml_state *state, const char *data) (*cb) (hook, ">", 1); state->had_data[state->next_tag - 1] = 2; - (*cb) (hook, data, strlen (data)); + err = result_xml_escape(data, &buf); + if (err) + return err; + + (*cb) (hook, buf, strlen (buf)); + + free (buf); return 0; } @@ -714,7 +779,7 @@ result_add_error (struct result_xml_state *state, char *name, gpg_error_t err) char code[20]; char msg[1024]; snprintf (code, sizeof (code) - 1, "0x%x", err); - snprintf (msg, sizeof (msg) - 1, "%s <%s>", + snprintf (msg, sizeof (msg) - 1, "%s <%s>", gpg_strerror (err), gpg_strsource (err)); result_xml_tag_start (state, name, "value", code, NULL); result_xml_tag_data (state, msg); commit c28ebca9f2e21344d68e9fdcec60553f225c2e54 Author: W. Trevor King Date: Sat Oct 6 09:33:30 2012 -0400 gpgme-tool: Fix chain_id -> chain-id in KEYLIST XML. [[PGP Signed Part:Undecided]] src/gpgme-tool.c (cmd_keylist): Use instead of . -- All the other tags map struct attribute underscores to hyphens, so fixing follows the priciple of least surprise. Signed-off-by: W. Trevor King diff --git a/src/gpgme-tool.c b/src/gpgme-tool.c index 23122e8..d37088c 100644 --- a/src/gpgme-tool.c +++ b/src/gpgme-tool.c @@ -2970,7 +2970,7 @@ cmd_keylist (assuan_context_t ctx, char *line) result_add_string (&state, "serial", key->issuer_serial); result_add_string (&state, "name", key->issuer_name); result_xml_tag_end (&state); /* issuer */ - result_add_string (&state, "chain_id", key->chain_id); + result_add_string (&state, "chain-id", key->chain_id); result_add_validity (&state, "owner-trust", key->owner_trust); result_xml_tag_start (&state, "subkeys", NULL); subkey = key->subkeys; ----------------------------------------------------------------------- Summary of changes: AUTHORS | 2 +- src/gpgme-tool.c | 207 ++++++++++++++++++++++++++++++++++++++++++++++++++++-- 2 files changed, 201 insertions(+), 8 deletions(-) hooks/post-receive -- GnuPG Made Easy http://git.gnupg.org From cvs at cvs.gnupg.org Fri Oct 19 12:49:52 2012 From: cvs at cvs.gnupg.org (by Werner Koch) Date: Fri, 19 Oct 2012 12:49:52 +0200 Subject: [git] GPGME - branch, master, updated. gpgme-1.3.2-19-gbd24fea Message-ID: This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "GnuPG Made Easy". The branch, master has been updated via bd24feaa86f8154e550107990392ac9ac05e60d4 (commit) via 14a8fd4eec126cad282a85c5aa336a6b55229b52 (commit) from e11e7fc5586613525035c3358e15ae24accb96ea (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit bd24feaa86f8154e550107990392ac9ac05e60d4 Author: Werner Koch Date: Fri Oct 19 11:23:39 2012 +0200 Trace the use of GPG_ERR_INV_ENGINE. * src/debug.h: Include "gpgme.h" (_gpgme_trace_gpgme_error): New. (trace_gpg_error): New macro. Use it in all files where we return GPG_ERR_INV_ENGINE; also "include debug.h" as needed. -- This is a pretty common error code but often it is hard to figure out the actual cause. With debug level 4 we now print the file name and line number where this error code is generated by gpgme. Along with the git revision printed in the first log lines, this should give us an easier way to track down the problems related to this error code. diff --git a/src/debug.h b/src/debug.h index ead92b2..c99b700 100644 --- a/src/debug.h +++ b/src/debug.h @@ -26,6 +26,9 @@ #include #endif +#include "gpgme.h" /* Required for gpgme_error stuff. */ + + /* Indirect stringification, requires __STDC__ to work. */ #define STRINGIFY(v) #v #define XSTRINGIFY(v) STRINGIFY(v) @@ -81,6 +84,13 @@ void _gpgme_debug_buffer (int lvl, const char *const fmt, void _gpgme_debug_frame_begin (void); void _gpgme_debug_frame_end (void); +static inline gpgme_error_t +_gpgme_trace_gpgme_error (gpgme_error_t err, const char *file, int line) +{ + _gpgme_debug (DEBUG_ENGINE, "%s:%d: returning error: %s\n", + _gpgme_debug_srcname (file), line, gpgme_strerror (err)); + return err; +} /* Trace support. */ @@ -262,4 +272,11 @@ void _gpgme_debug_frame_end (void); _gpgme_debug_end (&(hlp)) #define TRACE_ENABLED(hlp) (!!(hlp)) +/* And finally a simple macro to trace the location of an error code. + This macro is independent of the other trace macros and may be used + without any preconditions. */ +#define trace_gpg_error(e) \ + _gpgme_trace_gpgme_error (gpg_error (e), __FILE__, __LINE__) + + #endif /* DEBUG_H */ diff --git a/src/decrypt.c b/src/decrypt.c index f4f95dc..63787c7 100644 --- a/src/decrypt.c +++ b/src/decrypt.c @@ -146,7 +146,7 @@ parse_enc_to (char *args, gpgme_recipient_t *recp) if (*args != '\0' && *args != ' ') { free (rec); - return gpg_error (GPG_ERR_INV_ENGINE); + return trace_gpg_error (GPG_ERR_INV_ENGINE); } while (*args == ' ') @@ -160,7 +160,7 @@ parse_enc_to (char *args, gpgme_recipient_t *recp) { /* The crypto backend does not behave. */ free (rec); - return gpg_error (GPG_ERR_INV_ENGINE); + return trace_gpg_error (GPG_ERR_INV_ENGINE); } } @@ -283,7 +283,7 @@ _gpgme_decrypt_status_handler (void *priv, gpgme_status_code_t code, } /* FIXME: Is this ok? */ if (!rec) - return gpg_error (GPG_ERR_INV_ENGINE); + return trace_gpg_error (GPG_ERR_INV_ENGINE); } break; diff --git a/src/delete.c b/src/delete.c index 283b3e6..37e54f8 100644 --- a/src/delete.c +++ b/src/delete.c @@ -48,7 +48,7 @@ delete_status_handler (void *priv, gpgme_status_code_t code, char *args) gpg_err_set_errno (0); problem = strtol (args, &tail, 0); if (errno || (*tail && *tail != ' ')) - return gpg_error (GPG_ERR_INV_ENGINE); + return trace_gpg_error (GPG_ERR_INV_ENGINE); switch (problem) { diff --git a/src/engine-gpg.c b/src/engine-gpg.c index 7cf8894..4c7a8b2 100644 --- a/src/engine-gpg.c +++ b/src/engine-gpg.c @@ -1269,7 +1269,7 @@ start (engine_gpg_t gpg) return gpg_error (GPG_ERR_INV_VALUE); if (!gpg->file_name && !_gpgme_get_gpg_path ()) - return gpg_error (GPG_ERR_INV_ENGINE); + return trace_gpg_error (GPG_ERR_INV_ENGINE); if (gpg->lc_ctype) { diff --git a/src/engine-gpgconf.c b/src/engine-gpgconf.c index 8de847c..b50b635 100644 --- a/src/engine-gpgconf.c +++ b/src/engine-gpgconf.c @@ -300,7 +300,7 @@ gpgconf_config_load_cb (void *hook, char *line) /* We require at least the first 3 fields. */ if (fields < 2) - return gpg_error (GPG_ERR_INV_ENGINE); + return trace_gpg_error (GPG_ERR_INV_ENGINE); /* Find the pointer to the new component in the list. */ while (comp && comp->next) @@ -426,7 +426,7 @@ gpgconf_config_load_cb2 (void *hook, char *line) /* We require at least the first 10 fields. */ if (fields < 10) - return gpg_error (GPG_ERR_INV_ENGINE); + return trace_gpg_error (GPG_ERR_INV_ENGINE); opt = calloc (1, sizeof (*opt)); if (!opt) diff --git a/src/engine.c b/src/engine.c index 17d8d87..f72ce7f 100644 --- a/src/engine.c +++ b/src/engine.c @@ -30,6 +30,7 @@ #include "util.h" #include "sema.h" #include "ops.h" +#include "debug.h" #include "engine.h" #include "engine-backend.h" @@ -166,7 +167,7 @@ gpgme_engine_check_version (gpgme_protocol_t proto) info->req_version); UNLOCK (engine_info_lock); - return result ? 0 : gpg_error (GPG_ERR_INV_ENGINE); + return result ? 0 : trace_gpg_error (GPG_ERR_INV_ENGINE); } @@ -359,7 +360,7 @@ _gpgme_set_engine_info (gpgme_engine_info_t info, gpgme_protocol_t proto, info = info->next; if (!info) - return gpg_error (GPG_ERR_INV_ENGINE); + return trace_gpg_error (GPG_ERR_INV_ENGINE); /* Prepare new members. */ if (file_name) @@ -449,7 +450,7 @@ _gpgme_engine_new (gpgme_engine_info_t info, engine_t *r_engine) engine_t engine; if (!info->file_name || !info->version) - return gpg_error (GPG_ERR_INV_ENGINE); + return trace_gpg_error (GPG_ERR_INV_ENGINE); engine = calloc (1, sizeof *engine); if (!engine) diff --git a/src/gpgconf.c b/src/gpgconf.c index cbfd3dd..47ef47a 100644 --- a/src/gpgconf.c +++ b/src/gpgconf.c @@ -26,6 +26,7 @@ #include "ops.h" #include "engine.h" +#include "debug.h" #ifdef ENABLE_GPGCONF /* engine-gpgconf.c. */ diff --git a/src/import.c b/src/import.c index f599c23..d4edaba 100644 --- a/src/import.c +++ b/src/import.c @@ -131,7 +131,7 @@ parse_import (char *args, gpgme_import_status_t *import_status, int problem) { /* The crypto backend does not behave. */ free (import); - return gpg_error (GPG_ERR_INV_ENGINE); + return trace_gpg_error (GPG_ERR_INV_ENGINE); } args = tail; @@ -196,7 +196,7 @@ parse_import_res (char *args, gpgme_import_result_t result) (x) = strtol (args, &tail, 0); \ if (errno || args == tail || *tail != ' ') \ /* The crypto backend does not behave. */ \ - return gpg_error (GPG_ERR_INV_ENGINE); \ + return trace_gpg_error (GPG_ERR_INV_ENGINE); \ args = tail; PARSE_NEXT (result->considered); diff --git a/src/key.c b/src/key.c index c1d8ceb..1094f19 100644 --- a/src/key.c +++ b/src/key.c @@ -30,6 +30,7 @@ #include "util.h" #include "ops.h" #include "sema.h" +#include "debug.h" /* Protects all reference counters in keys. All other accesses to a diff --git a/src/op-support.c b/src/op-support.c index 808eac8..d42a247 100644 --- a/src/op-support.c +++ b/src/op-support.c @@ -31,6 +31,7 @@ #include "context.h" #include "ops.h" #include "util.h" +#include "debug.h" gpgme_error_t @@ -199,7 +200,7 @@ _gpgme_parse_inv_recp (char *args, gpgme_invalid_key_t *key) { /* The crypto backend does not behave. */ free (inv_key); - return gpg_error (GPG_ERR_INV_ENGINE); + return trace_gpg_error (GPG_ERR_INV_ENGINE); } switch (reason) diff --git a/src/passphrase.c b/src/passphrase.c index 17f1443..7e5508e 100644 --- a/src/passphrase.c +++ b/src/passphrase.c @@ -32,6 +32,7 @@ #include "context.h" #include "ops.h" #include "util.h" +#include "debug.h" typedef struct diff --git a/src/passwd.c b/src/passwd.c index 0ed54ba..e832026 100644 --- a/src/passwd.c +++ b/src/passwd.c @@ -56,7 +56,7 @@ parse_error (char *args) where = args; } else - return gpg_error (GPG_ERR_INV_ENGINE); + return trace_gpg_error (GPG_ERR_INV_ENGINE); err = atoi (which); diff --git a/src/progress.c b/src/progress.c index 76ec47f..a4e48f1 100644 --- a/src/progress.c +++ b/src/progress.c @@ -28,6 +28,7 @@ #include "util.h" #include "context.h" +#include "debug.h" gpgme_error_t diff --git a/src/sig-notation.c b/src/sig-notation.c index 8386378..46efac6 100644 --- a/src/sig-notation.c +++ b/src/sig-notation.c @@ -30,6 +30,7 @@ #include "util.h" #include "context.h" #include "ops.h" +#include "debug.h" /* Free the signature notation object and all associated resources. @@ -159,13 +160,13 @@ _gpgme_parse_notation (gpgme_sig_notation_t *notationp, /* A few simple sanity checks. */ if (len > strlen (data)) - return gpg_error (GPG_ERR_INV_ENGINE); + return trace_gpg_error (GPG_ERR_INV_ENGINE); /* See below for the format of a notation subpacket. It has at least four octets of flags and two times two octets of length information. */ if (type == 20 && len < 4 + 2 + 2) - return gpg_error (GPG_ERR_INV_ENGINE); + return trace_gpg_error (GPG_ERR_INV_ENGINE); err = _gpgme_decode_percent_string (data, &decoded_data, 0, 1); if (err) @@ -234,7 +235,7 @@ _gpgme_parse_notation (gpgme_sig_notation_t *notationp, if (4 + 2 + 2 + name_len + value_len > len) { free (decoded_data); - return gpg_error (GPG_ERR_INV_ENGINE); + return trace_gpg_error (GPG_ERR_INV_ENGINE); } name = (char *) bdata; diff --git a/src/sign.c b/src/sign.c index 1509204..67280e9 100644 --- a/src/sign.c +++ b/src/sign.c @@ -169,14 +169,14 @@ parse_sig_created (char *args, gpgme_new_signature_t *sigp) default: /* The backend engine is not behaving. */ free (sig); - return gpg_error (GPG_ERR_INV_ENGINE); + return trace_gpg_error (GPG_ERR_INV_ENGINE); } args++; if (*args != ' ') { free (sig); - return gpg_error (GPG_ERR_INV_ENGINE); + return trace_gpg_error (GPG_ERR_INV_ENGINE); } gpg_err_set_errno (0); @@ -185,7 +185,7 @@ parse_sig_created (char *args, gpgme_new_signature_t *sigp) { /* The crypto backend does not behave. */ free (sig); - return gpg_error (GPG_ERR_INV_ENGINE); + return trace_gpg_error (GPG_ERR_INV_ENGINE); } args = tail; @@ -194,7 +194,7 @@ parse_sig_created (char *args, gpgme_new_signature_t *sigp) { /* The crypto backend does not behave. */ free (sig); - return gpg_error (GPG_ERR_INV_ENGINE); + return trace_gpg_error (GPG_ERR_INV_ENGINE); } args = tail; @@ -205,7 +205,7 @@ parse_sig_created (char *args, gpgme_new_signature_t *sigp) { /* The crypto backend does not behave. */ free (sig); - return gpg_error (GPG_ERR_INV_ENGINE); + return trace_gpg_error (GPG_ERR_INV_ENGINE); } args = tail; @@ -214,7 +214,7 @@ parse_sig_created (char *args, gpgme_new_signature_t *sigp) { /* The crypto backend does not behave. */ free (sig); - return gpg_error (GPG_ERR_INV_ENGINE); + return trace_gpg_error (GPG_ERR_INV_ENGINE); } args = tail; while (*args == ' ') @@ -224,7 +224,7 @@ parse_sig_created (char *args, gpgme_new_signature_t *sigp) { /* The crypto backend does not behave. */ free (sig); - return gpg_error (GPG_ERR_INV_ENGINE); + return trace_gpg_error (GPG_ERR_INV_ENGINE); } tail = strchr (args, ' '); diff --git a/src/trust-item.c b/src/trust-item.c index 226298b..5a0b544 100644 --- a/src/trust-item.c +++ b/src/trust-item.c @@ -30,6 +30,7 @@ #include "util.h" #include "ops.h" #include "sema.h" +#include "debug.h" /* Protects all reference counters in trust items. All other accesses diff --git a/src/verify.c b/src/verify.c index a61cc95..c32241a 100644 --- a/src/verify.c +++ b/src/verify.c @@ -346,7 +346,7 @@ parse_new_sig (op_data_t opd, gpgme_status_code_t code, char *args) /* Parse the timestamp. */ sig->timestamp = _gpgme_parse_timestamp (end, &tail); if (sig->timestamp == -1 || end == tail || (*tail && *tail != ' ')) - return gpg_error (GPG_ERR_INV_ENGINE); + return trace_gpg_error (GPG_ERR_INV_ENGINE); end = tail; while (*end == ' ') end++; @@ -420,12 +420,12 @@ parse_valid_sig (gpgme_signature_t sig, char *args) sig->timestamp = _gpgme_parse_timestamp (end, &tail); if (sig->timestamp == -1 || end == tail || (*tail && *tail != ' ')) - return gpg_error (GPG_ERR_INV_ENGINE); + return trace_gpg_error (GPG_ERR_INV_ENGINE); end = tail; sig->exp_timestamp = _gpgme_parse_timestamp (end, &tail); if (sig->exp_timestamp == -1 || end == tail || (*tail && *tail != ' ')) - return gpg_error (GPG_ERR_INV_ENGINE); + return trace_gpg_error (GPG_ERR_INV_ENGINE); end = tail; while (*end == ' ') @@ -445,7 +445,7 @@ parse_valid_sig (gpgme_signature_t sig, char *args) gpg_err_set_errno (0); sig->pubkey_algo = strtol (end, &tail, 0); if (errno || end == tail || *tail != ' ') - return gpg_error (GPG_ERR_INV_ENGINE); + return trace_gpg_error (GPG_ERR_INV_ENGINE); end = tail; while (*end == ' ') @@ -458,7 +458,7 @@ parse_valid_sig (gpgme_signature_t sig, char *args) gpg_err_set_errno (0); sig->hash_algo = strtol (end, &tail, 0); if (errno || end == tail || *tail != ' ') - return gpg_error (GPG_ERR_INV_ENGINE); + return trace_gpg_error (GPG_ERR_INV_ENGINE); end = tail; } } @@ -491,7 +491,7 @@ parse_notation (gpgme_signature_t sig, gpgme_status_code_t code, char *args) if (notation) /* There is another notation name without data for the previous one. The crypto backend misbehaves. */ - return gpg_error (GPG_ERR_INV_ENGINE); + return trace_gpg_error (GPG_ERR_INV_ENGINE); err = _gpgme_sig_notation_create (¬ation, NULL, 0, NULL, 0, 0); if (err) @@ -544,7 +544,7 @@ parse_notation (gpgme_signature_t sig, gpgme_status_code_t code, char *args) if (!notation || !notation->name) /* There is notation data without a previous notation name. The crypto backend misbehaves. */ - return gpg_error (GPG_ERR_INV_ENGINE); + return trace_gpg_error (GPG_ERR_INV_ENGINE); if (!notation->value) { @@ -569,7 +569,7 @@ parse_notation (gpgme_signature_t sig, gpgme_status_code_t code, char *args) notation->value_len += strlen (dest); } else - return gpg_error (GPG_ERR_INV_ENGINE); + return trace_gpg_error (GPG_ERR_INV_ENGINE); return 0; } @@ -645,7 +645,7 @@ parse_error (gpgme_signature_t sig, char *args, int set_status) where = args; } else - return gpg_error (GPG_ERR_INV_ENGINE); + return trace_gpg_error (GPG_ERR_INV_ENGINE); err = atoi (which); @@ -708,7 +708,7 @@ _gpgme_verify_status_handler (void *priv, gpgme_status_code_t code, char *args) case GPGME_STATUS_VALIDSIG: opd->only_newsig_seen = 0; return sig ? parse_valid_sig (sig, args) - : gpg_error (GPG_ERR_INV_ENGINE); + : trace_gpg_error (GPG_ERR_INV_ENGINE); case GPGME_STATUS_NODATA: opd->only_newsig_seen = 0; @@ -729,7 +729,7 @@ _gpgme_verify_status_handler (void *priv, gpgme_status_code_t code, char *args) case GPGME_STATUS_POLICY_URL: opd->only_newsig_seen = 0; return sig ? parse_notation (sig, code, args) - : gpg_error (GPG_ERR_INV_ENGINE); + : trace_gpg_error (GPG_ERR_INV_ENGINE); case GPGME_STATUS_TRUST_UNDEFINED: case GPGME_STATUS_TRUST_NEVER: @@ -738,7 +738,7 @@ _gpgme_verify_status_handler (void *priv, gpgme_status_code_t code, char *args) case GPGME_STATUS_TRUST_ULTIMATE: opd->only_newsig_seen = 0; return sig ? parse_trust (sig, code, args) - : gpg_error (GPG_ERR_INV_ENGINE); + : trace_gpg_error (GPG_ERR_INV_ENGINE); case GPGME_STATUS_PKA_TRUST_BAD: case GPGME_STATUS_PKA_TRUST_GOOD: @@ -746,7 +746,7 @@ _gpgme_verify_status_handler (void *priv, gpgme_status_code_t code, char *args) /* Check that we only get one of these status codes per signature; if not the crypto backend misbehaves. */ if (!sig || sig->pka_trust || sig->pka_address) - return gpg_error (GPG_ERR_INV_ENGINE); + return trace_gpg_error (GPG_ERR_INV_ENGINE); sig->pka_trust = code == GPGME_STATUS_PKA_TRUST_GOOD? 2 : 1; end = strchr (args, ' '); if (end) diff --git a/src/wait-global.c b/src/wait-global.c index f3aa399..9a194b0 100644 --- a/src/wait-global.c +++ b/src/wait-global.c @@ -34,6 +34,7 @@ #include "wait.h" #include "priv-io.h" #include "ops.h" +#include "debug.h" /* The global event loop is used for all asynchronous operations (except key listing) for which no user I/O callbacks are specified. diff --git a/src/wait-private.c b/src/wait-private.c index d0552ce..aab8fb7 100644 --- a/src/wait-private.c +++ b/src/wait-private.c @@ -31,6 +31,7 @@ #include "ops.h" #include "priv-io.h" #include "util.h" +#include "debug.h" /* The private event loops are used for all blocking operations, and diff --git a/src/wait-user.c b/src/wait-user.c index 42bb3a5..ba28761 100644 --- a/src/wait-user.c +++ b/src/wait-user.c @@ -29,6 +29,7 @@ #include "priv-io.h" #include "wait.h" #include "ops.h" +#include "debug.h" /* The user event loops are used for all asynchronous operations for commit 14a8fd4eec126cad282a85c5aa336a6b55229b52 Author: Werner Koch Date: Fri Oct 19 11:18:08 2012 +0200 Avoid warning about initialized but not used variable * src/engine-gpgsm.c (gpgsm_set_fd): Do not set DIR if not needed. diff --git a/src/engine-gpgsm.c b/src/engine-gpgsm.c index 42bf879..52873ac 100644 --- a/src/engine-gpgsm.c +++ b/src/engine-gpgsm.c @@ -645,7 +645,9 @@ gpgsm_set_fd (engine_gpgsm_t gpgsm, fd_type_t fd_type, const char *opt) char line[COMMANDLINELEN]; char *which; iocb_data_t *iocb_data; +#if USE_DESCRIPTOR_PASSING int dir; +#endif switch (fd_type) { @@ -668,9 +670,8 @@ gpgsm_set_fd (engine_gpgsm_t gpgsm, fd_type_t fd_type, const char *opt) return gpg_error (GPG_ERR_INV_VALUE); } - dir = iocb_data->dir; - #if USE_DESCRIPTOR_PASSING + dir = iocb_data->dir; /* We try to short-cut the communication by giving GPGSM direct access to the file descriptor, rather than using a pipe. */ iocb_data->server_fd = _gpgme_data_get_fd (iocb_data->data); ----------------------------------------------------------------------- Summary of changes: src/debug.h | 17 +++++++++++++++++ src/decrypt.c | 6 +++--- src/delete.c | 2 +- src/engine-gpg.c | 2 +- src/engine-gpgconf.c | 4 ++-- src/engine-gpgsm.c | 5 +++-- src/engine.c | 7 ++++--- src/gpgconf.c | 1 + src/import.c | 4 ++-- src/key.c | 1 + src/op-support.c | 3 ++- src/passphrase.c | 1 + src/passwd.c | 2 +- src/progress.c | 1 + src/sig-notation.c | 7 ++++--- src/sign.c | 14 +++++++------- src/trust-item.c | 1 + src/verify.c | 26 +++++++++++++------------- src/wait-global.c | 1 + src/wait-private.c | 1 + src/wait-user.c | 1 + 21 files changed, 68 insertions(+), 39 deletions(-) hooks/post-receive -- GnuPG Made Easy http://git.gnupg.org From cvs at cvs.gnupg.org Wed Oct 24 18:18:43 2012 From: cvs at cvs.gnupg.org (by Werner Koch) Date: Wed, 24 Oct 2012 18:18:43 +0200 Subject: [git] GPGME - branch, master, updated. gpgme-1.3.2-22-gc97d067 Message-ID: This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "GnuPG Made Easy". The branch, master has been updated via c97d067f27899d890a99036fcbed9263f4f68875 (commit) via 12a0c93433a0b1d7e8019fc35a63476db39327fa (commit) via cc59b75b21516198b39a56950afbcec140d8ba48 (commit) from bd24feaa86f8154e550107990392ac9ac05e60d4 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit c97d067f27899d890a99036fcbed9263f4f68875 Author: Werner Koch Date: Wed Oct 24 16:51:47 2012 +0200 Make local variables configure hack more robust * configure.ac (emacs_local_vars_begin): Use extra m4 quoting so that newer Emscasen won't take it up as Local Variables for this file. diff --git a/configure.ac b/configure.ac index 8f6505e..c5300e3 100644 --- a/configure.ac +++ b/configure.ac @@ -925,7 +925,7 @@ AC_CHECK_TYPES([error_t], [], # A substitution to set generated files in a Emacs buffer to read-only. -AC_SUBST(emacs_local_vars_begin, ['Local Variables:']) +AC_SUBST(emacs_local_vars_begin, [['Local][ ][Variables:']]) AC_SUBST(emacs_local_vars_read_only, ['buffer-read-only: t']) AC_SUBST(emacs_local_vars_end, ['End:']) commit 12a0c93433a0b1d7e8019fc35a63476db39327fa Author: Werner Koch Date: Wed Oct 24 16:44:34 2012 +0200 Fix ttyname problem on Android. * configure.ac: Define macro and conditional HAVE_ANDROID_SYSTEM. * m4/gnupg-ttyname.m4: Force use of replacement on Android. * src/ttyname_r.c: Ditto. -- Android's bionic lib has no working ttyname_r() nor ttyname(). Using them anyway will print FIX ME! implement ttyname_r() bionic/libc/bionic/stubs.c:466 Thus we force the use of our replacement code which simply return "/dev/tty". diff --git a/configure.ac b/configure.ac index 3cac826..8f6505e 100644 --- a/configure.ac +++ b/configure.ac @@ -131,6 +131,7 @@ GPGCONF_DEFAULT=no G13_DEFAULT=no component_system=None have_dosish_system=no +have_android_system=no have_w32_system=no have_w64_system=no build_w32_glib=no @@ -142,6 +143,9 @@ case "${host}" in *-mingw32ce*) have_w32ce_system=yes ;; + *-linux-androideabi) + have_android_system=yes + ;; esac case "${host}" in *-mingw32ce*|*-mingw32*) @@ -210,6 +214,11 @@ if test "$have_w32ce_system" = yes; then fi AM_CONDITIONAL(HAVE_W32CE_SYSTEM, test "$have_w32ce_system" = yes) +if test "$have_android_system" = yes; then + AC_DEFINE(HAVE_ANDROID_SYSTEM,1, [Defined if we build for an Android system]) +fi +AM_CONDITIONAL(HAVE_ANDROID_SYSTEM, test "$have_android_system" = yes) + AM_CONDITIONAL(BUILD_W32_GLIB, test "$build_w32_glib" = yes) AM_CONDITIONAL(BUILD_W32_QT, test "$build_w32_qt" = yes) diff --git a/m4/gnupg-ttyname.m4 b/m4/gnupg-ttyname.m4 index d9a0e2e..c76115a 100644 --- a/m4/gnupg-ttyname.m4 +++ b/m4/gnupg-ttyname.m4 @@ -27,6 +27,9 @@ # The macro REPLACE_TTYNAME_R is defined if ttyname_r is a replacement # function. This macro is useful for the definition of the prototype. # +# If the macro "have_android_system" has a value of "yes", ttyname_r +# will also be replaced by our own function. +# AC_DEFUN([gnupg_REPLACE_TTYNAME_R], [ AC_CHECK_HEADERS([unistd.h]) @@ -60,6 +63,12 @@ AC_DEFUN([gnupg_REPLACE_TTYNAME_R], if test $gnupg_cv_func_ttyname_r_posix = no; then AC_LIBOBJ([ttyname_r]) AC_DEFINE([REPLACE_TTYNAME_R],[1]) + elif test "$have_android_system" = yes; then + # Android has ttyname and ttyname_r but they are only stubs and + # print an annoying warning message. Thus we need to replace + # ttyname_r with our own dummy function. + AC_LIBOBJ([ttyname_r]) + AC_DEFINE([REPLACE_TTYNAME_R],[1]) else AC_DEFINE([HAVE_POSIXDECL_TTYNAME_R], [1], [Define if the ttyname_r function has a POSIX compliant declaration.]) diff --git a/src/ttyname_r.c b/src/ttyname_r.c index 105e0af..eed28bd 100644 --- a/src/ttyname_r.c +++ b/src/ttyname_r.c @@ -32,6 +32,12 @@ # warning ttyname is not thread-safe, and ttyname_r is missing #endif +/* For Android we force the use of our replacement code. */ +#if HAVE_ANDROID_SYSTEM +# undef HAVE_TTYNAME_R +#endif + + int _gpgme_ttyname_r (int fd, char *buf, size_t buflen) { @@ -110,12 +116,11 @@ _gpgme_ttyname_r (int fd, char *buf, size_t buflen) #else /*!HAVE_TTYNAME_R*/ char *tty; -# if HAVE_W32_SYSTEM +# if HAVE_W32_SYSTEM || HAVE_ANDROID_SYSTEM /* We use this default one for now. AFAICS we only need it to be passed to gpg and in turn to pinentry. Providing a replacement - is needed because elsewhere we bail out on error. If we - eventually implement a pinentry for Windows it is inlikely that - we need a real tty at all. */ + is needed because elsewhere we bail out on error or Android + provided ttyname_r prints an error message if used. */ tty = "/dev/tty"; # else tty = ttyname (fd); commit cc59b75b21516198b39a56950afbcec140d8ba48 Author: Werner Koch Date: Wed Oct 24 16:07:31 2012 +0200 tests: Adhere to the docs and call gpgme_check_version. * tests/t-engine-info.c: Call gpgme_check_version. diff --git a/tests/t-engine-info.c b/tests/t-engine-info.c index beb4992..ec2e1e8 100644 --- a/tests/t-engine-info.c +++ b/tests/t-engine-info.c @@ -73,6 +73,7 @@ main (int argc, char **argv ) gpgme_engine_info_t info; gpgme_error_t err; + gpgme_check_version (NULL); err = gpgme_get_engine_info (&info); fail_if_err (err); ----------------------------------------------------------------------- Summary of changes: configure.ac | 11 ++++++++++- m4/gnupg-ttyname.m4 | 9 +++++++++ src/ttyname_r.c | 13 +++++++++---- tests/t-engine-info.c | 1 + 4 files changed, 29 insertions(+), 5 deletions(-) hooks/post-receive -- GnuPG Made Easy http://git.gnupg.org From cvs at cvs.gnupg.org Thu Oct 25 12:23:04 2012 From: cvs at cvs.gnupg.org (by Andreas Rönnquist) Date: Thu, 25 Oct 2012 12:23:04 +0200 Subject: [git] GPA - branch, master, updated. gpa-0.9.3-2-g29fc35b Message-ID: This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "The GNU Privacy Assistant". The branch, master has been updated via 29fc35bedb2aff64453e817903f8951ac8663a65 (commit) from 1d898c4c941afb4355416c61a26e81baedf1df17 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 29fc35bedb2aff64453e817903f8951ac8663a65 Author: Andreas R?nnquist Date: Wed Oct 24 17:18:54 2012 +0200 Make siglist search both key and name * siglist.c (search_siglist_function): New. (gpa_siglist_new): Enable searching via the new function. diff --git a/src/siglist.c b/src/siglist.c index 1a66387..5e6cf9b 100644 --- a/src/siglist.c +++ b/src/siglist.c @@ -41,6 +41,32 @@ typedef enum SIG_N_COLUMNS } SignatureListColumn; +gboolean +search_siglist_function (GtkTreeModel *model, int column, + const gchar *key_to_search_for, GtkTreeIter *iter, + gpointer search_data) +{ + gboolean result=TRUE; + gchar *key_id, *user_id; + gint search_len; + + gtk_tree_model_get (model, iter, + SIG_KEYID_COLUMN, &key_id, + SIG_USERID_COLUMN, &user_id, -1); + + search_len = strlen (key_to_search_for); + + if (!g_ascii_strncasecmp (key_id, key_to_search_for, search_len)) + result=FALSE; + if (!g_ascii_strncasecmp (user_id, key_to_search_for, search_len)) + result=FALSE; + + g_free (key_id); + g_free (user_id); + + return result; +} + static void gpa_siglist_ui_mode_changed_cb (GpaOptions *options, GtkWidget *list); @@ -61,6 +87,10 @@ gpa_siglist_new (void) gtk_tree_sortable_set_sort_column_id (GTK_TREE_SORTABLE (store), SIG_USERID_COLUMN, GTK_SORT_ASCENDING); + gtk_tree_view_set_enable_search (GTK_TREE_VIEW (list), TRUE); + gtk_tree_view_set_search_equal_func (GTK_TREE_VIEW (list), + search_siglist_function, NULL, NULL); + g_signal_connect (G_OBJECT (gpa_options_get_instance ()), "changed_ui_mode", G_CALLBACK (gpa_siglist_ui_mode_changed_cb), list); ----------------------------------------------------------------------- Summary of changes: src/siglist.c | 30 ++++++++++++++++++++++++++++++ 1 files changed, 30 insertions(+), 0 deletions(-) hooks/post-receive -- The GNU Privacy Assistant http://git.gnupg.org From cvs at cvs.gnupg.org Tue Oct 30 11:38:03 2012 From: cvs at cvs.gnupg.org (by Milan Broz) Date: Tue, 30 Oct 2012 11:38:03 +0100 Subject: [git] GCRYPT - branch, master, updated. libgcrypt-1.5.0-36-g8528f1b Message-ID: This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "The GNU crypto library". The branch, master has been updated via 8528f1ba40e587dc17e02822e529fbd7ac69a189 (commit) from 2c54c4da19d3a79e9f749740828026dd41f0521a (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 8528f1ba40e587dc17e02822e529fbd7ac69a189 Author: Milan Broz Date: Mon Oct 29 17:18:09 2012 +0100 PBKDF2: Allow empty passphrase. * cipher/kdf.c (gcry_kdf_derive): Allow empty passphrase for PBKDF2. * tests/t-kdf.c (check_pbkdf2): Add test case for above. -- While it is insecure, the PBKDF2 implementations usually allows to derive key only from salt. This particular case is used e.g. in cryptsetup when you use empty file as keyfile for LUKS keyslot. Test vector is compared with two independent implementations. Signed-off-by: Milan Broz diff --git a/cipher/kdf.c b/cipher/kdf.c index d981022..46e8550 100644 --- a/cipher/kdf.c +++ b/cipher/kdf.c @@ -238,7 +238,7 @@ gcry_kdf_derive (const void *passphrase, size_t passphraselen, { gpg_err_code_t ec; - if (!passphrase || !passphraselen) + if (!passphrase || (!passphraselen && algo != GCRY_KDF_PBKDF2)) { ec = GPG_ERR_INV_DATA; goto leave; diff --git a/tests/t-kdf.c b/tests/t-kdf.c index 7209525..06c0026 100644 --- a/tests/t-kdf.c +++ b/tests/t-kdf.c @@ -917,7 +917,15 @@ check_pbkdf2 (void) 16, "\x56\xfa\x6a\xa7\x55\x48\x09\x9d\xcc\x37" "\xd7\xf0\x34\x25\xe0\xc3" - } + }, + { /* empty password test, not in RFC-6070 */ + "", 0, + "salt", 4, + 2, + 20, + "\x13\x3a\x4c\xe8\x37\xb4\xd2\x52\x1e\xe2" + "\xbf\x03\xe1\x1c\x71\xca\x79\x4e\x07\x97" + }, }; int tvidx; gpg_error_t err; ----------------------------------------------------------------------- Summary of changes: cipher/kdf.c | 2 +- tests/t-kdf.c | 10 +++++++++- 2 files changed, 10 insertions(+), 2 deletions(-) hooks/post-receive -- The GNU crypto library http://git.gnupg.org From cvs at cvs.gnupg.org Wed Oct 31 04:28:55 2012 From: cvs at cvs.gnupg.org (by NIIBE Yutaka) Date: Wed, 31 Oct 2012 04:28:55 +0100 Subject: [git] GnuPG - branch, STABLE-BRANCH-2-0, updated. gnupg-2.0.19-36-g80a34c0 Message-ID: This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "The GNU Privacy Guard". The branch, STABLE-BRANCH-2-0 has been updated via 80a34c0b5008c59979561dcee40536d7e25246f6 (commit) from 51a4df9d4a16c9e3a7b9dedffda6f9628edc8b27 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 80a34c0b5008c59979561dcee40536d7e25246f6 Author: NIIBE Yutaka Date: Wed Oct 31 11:02:58 2012 +0900 SCD: Upon error, open_pcsc_reader_wrapped does same as _direct. * scd/apdu.c (PCSC_E_NO_SERVICE): New. (open_pcsc_reader_direct): Use PCSC_E_NO_SERVICE. (open_pcsc_reader_wrapped): Set pcsc_no_service. diff --git a/scd/apdu.c b/scd/apdu.c index 0ce1c51..b369a26 100644 --- a/scd/apdu.c +++ b/scd/apdu.c @@ -221,6 +221,7 @@ static char (* DLSTDCALL CT_close) (unsigned short ctn); #define PCSC_E_SYSTEM_CANCELLED 0x80100012 #define PCSC_E_NOT_TRANSACTED 0x80100016 #define PCSC_E_READER_UNAVAILABLE 0x80100017 +#define PCSC_E_NO_SERVICE 0x8010001D #define PCSC_W_REMOVED_CARD 0x80100069 #define CM_IOCTL_GET_FEATURE_REQUEST (0x42000000 + 3400) @@ -1711,7 +1712,7 @@ open_pcsc_reader_direct (const char *portstr) pcsc_error_string (err), err); reader_table[slot].used = 0; unlock_slot (slot); - if (err == 0x8010001d) + if (err == PCSC_E_NO_SERVICE) pcsc_no_service = 1; return -1; } @@ -1819,6 +1820,7 @@ open_pcsc_reader_wrapped (const char *portstr) { log_error ("can't run PC/SC access module `%s': %s\n", wrapperpgm, strerror (errno)); + pcsc_no_service = 1; return -1; } @@ -1918,6 +1920,8 @@ open_pcsc_reader_wrapped (const char *portstr) ; #undef WAIT + pcsc_no_service = 1; + /* Now send the open request. */ msgbuf[0] = 0x01; /* OPEN command. */ len = portstr? strlen (portstr):0; @@ -1950,10 +1954,15 @@ open_pcsc_reader_wrapped (const char *portstr) { log_error ("PC/SC returned a too large ATR (len=%lx)\n", (unsigned long)len); + pcsc_no_service = 0; goto command_failed; } err = PCSC_ERR_MASK ((msgbuf[5] << 24) | (msgbuf[6] << 16) | (msgbuf[7] << 8 ) | msgbuf[8]); + + if (err != PCSC_E_NO_SERVICE) + pcsc_no_service = 0; + if (err) { log_error ("PC/SC OPEN failed: %s (0x%08x)\n", ----------------------------------------------------------------------- Summary of changes: scd/apdu.c | 11 ++++++++++- 1 files changed, 10 insertions(+), 1 deletions(-) hooks/post-receive -- The GNU Privacy Guard http://git.gnupg.org From cvs at cvs.gnupg.org Wed Oct 31 04:31:57 2012 From: cvs at cvs.gnupg.org (by NIIBE Yutaka) Date: Wed, 31 Oct 2012 04:31:57 +0100 Subject: [git] GnuPG - branch, master, updated. gnupg-2.1.0beta3-91-g8df89f3 Message-ID: This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "The GNU Privacy Guard". The branch, master has been updated via 8df89f3e9cf0255f11011c2f1df0d419a5c23a8c (commit) from 76055d49d1c8b8e4f6245e6729cae81b1eaecbf6 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 8df89f3e9cf0255f11011c2f1df0d419a5c23a8c Author: NIIBE Yutaka Date: Wed Oct 31 11:05:55 2012 +0900 SCD: Upon error, open_pcsc_reader_wrapped does same as _direct. * scd/apdu.c (PCSC_E_NO_SERVICE): New. (open_pcsc_reader_direct): Use PCSC_E_NO_SERVICE. (open_pcsc_reader_wrapped): Set pcsc_no_service. diff --git a/scd/apdu.c b/scd/apdu.c index bdc37ca..43c807e 100644 --- a/scd/apdu.c +++ b/scd/apdu.c @@ -239,6 +239,7 @@ static char (* DLSTDCALL CT_close) (unsigned short ctn); #define PCSC_E_SYSTEM_CANCELLED 0x80100012 #define PCSC_E_NOT_TRANSACTED 0x80100016 #define PCSC_E_READER_UNAVAILABLE 0x80100017 +#define PCSC_E_NO_SERVICE 0x8010001D #define PCSC_W_REMOVED_CARD 0x80100069 #define CM_IOCTL_GET_FEATURE_REQUEST (0x42000000 + 3400) @@ -1692,7 +1693,7 @@ open_pcsc_reader_direct (const char *portstr) log_error ("pcsc_establish_context failed: %s (0x%lx)\n", pcsc_error_string (err), err); reader_table[slot].used = 0; - if (err == 0x8010001d) + if (err == PCSC_E_NO_SERVICE) pcsc_no_service = 1; return -1; } @@ -1795,6 +1796,7 @@ open_pcsc_reader_wrapped (const char *portstr) { log_error ("can't run PC/SC access module '%s': %s\n", wrapperpgm, strerror (errno)); + pcsc_no_service = 1; return -1; } @@ -1891,6 +1893,8 @@ open_pcsc_reader_wrapped (const char *portstr) ; #undef WAIT + pcsc_no_service = 1; + /* Now send the open request. */ msgbuf[0] = 0x01; /* OPEN command. */ len = portstr? strlen (portstr):0; @@ -1923,10 +1927,15 @@ open_pcsc_reader_wrapped (const char *portstr) { log_error ("PC/SC returned a too large ATR (len=%lx)\n", (unsigned long)len); + pcsc_no_service = 0; goto command_failed; } err = PCSC_ERR_MASK ((msgbuf[5] << 24) | (msgbuf[6] << 16) | (msgbuf[7] << 8 ) | msgbuf[8]); + + if (err != PCSC_E_NO_SERVICE) + pcsc_no_service = 0; + if (err) { log_error ("PC/SC OPEN failed: %s\n", pcsc_error_string (err)); ----------------------------------------------------------------------- Summary of changes: scd/apdu.c | 11 ++++++++++- 1 files changed, 10 insertions(+), 1 deletions(-) hooks/post-receive -- The GNU Privacy Guard http://git.gnupg.org