summaryrefslogtreecommitdiff
path: root/src/gpgme.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/gpgme.c')
-rw-r--r--src/gpgme.c41
1 files changed, 33 insertions, 8 deletions
diff --git a/src/gpgme.c b/src/gpgme.c
index 51b68a5..628cdae 100644
--- a/src/gpgme.c
+++ b/src/gpgme.c
@@ -1,6 +1,7 @@
/* gpgme.c - GnuPG Made Easy.
Copyright (C) 2000 Werner Koch (dd9jn)
- Copyright (C) 2001, 2002, 2003, 2004, 2005, 2007, 2012 g10 Code GmbH
+ Copyright (C) 2001, 2002, 2003, 2004, 2005, 2007, 2012,
+ 2014 g10 Code GmbH
This file is part of GPGME.
@@ -15,9 +16,8 @@
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
- License along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
- 02111-1307, USA. */
+ License along with this program; if not, see <http://www.gnu.org/licenses/>.
+ */
#if HAVE_CONFIG_H
#include <config.h>
@@ -37,6 +37,7 @@
#include "wait.h"
#include "debug.h"
#include "priv-io.h"
+#include "sys-util.h"
/* The default locale. */
@@ -65,6 +66,15 @@ gpgme_set_global_flag (const char *name, const char *value)
return -1;
else if (!strcmp (name, "debug"))
return _gpgme_debug_set_debug_envvar (value);
+ else if (!strcmp (name, "disable-gpgconf"))
+ {
+ _gpgme_dirinfo_disable_gpgconf ();
+ return 0;
+ }
+ else if (!strcmp (name, "gpgconf-name"))
+ return _gpgme_set_default_gpgconf_name (value);
+ else if (!strcmp (name, "gpg-name"))
+ return _gpgme_set_default_gpg_name (value);
else
return -1;
}
@@ -76,6 +86,7 @@ gpgme_set_global_flag (const char *name, const char *value)
gpgme_error_t
gpgme_new (gpgme_ctx_t *r_ctx)
{
+ gpgme_error_t err;
gpgme_ctx_t ctx;
TRACE_BEG (DEBUG_CTX, "gpgme_new", r_ctx);
@@ -91,11 +102,13 @@ gpgme_new (gpgme_ctx_t *r_ctx)
INIT_LOCK (ctx->lock);
- _gpgme_engine_info_copy (&ctx->engine_info);
- if (!ctx->engine_info)
+ err = _gpgme_engine_info_copy (&ctx->engine_info);
+ if (!err && !ctx->engine_info)
+ err = gpg_error (GPG_ERR_NO_ENGINE);
+ if (err)
{
free (ctx);
- return TRACE_ERR (gpg_error_from_syserror ());
+ return TRACE_ERR (err);
}
ctx->keylist_mode = GPGME_KEYLIST_MODE_LOCAL;
@@ -220,6 +233,7 @@ gpgme_release (gpgme_ctx_t ctx)
return;
_gpgme_engine_release (ctx->engine);
+ ctx->engine = NULL;
_gpgme_fd_table_deinit (&ctx->fdt);
_gpgme_release_result (ctx);
_gpgme_signers_clear (ctx);
@@ -231,6 +245,7 @@ gpgme_release (gpgme_ctx_t ctx)
if (ctx->lc_messages)
free (ctx->lc_messages);
_gpgme_engine_info_release (ctx->engine_info);
+ ctx->engine_info = NULL;
DESTROY_LOCK (ctx->lock);
free (ctx);
}
@@ -308,7 +323,8 @@ gpgme_set_protocol (gpgme_ctx_t ctx, gpgme_protocol_t protocol)
&& protocol != GPGME_PROTOCOL_GPGCONF
&& protocol != GPGME_PROTOCOL_ASSUAN
&& protocol != GPGME_PROTOCOL_G13
- && protocol != GPGME_PROTOCOL_UISERVER)
+ && protocol != GPGME_PROTOCOL_UISERVER
+ && protocol != GPGME_PROTOCOL_SPAWN)
return TRACE_ERR (gpg_error (GPG_ERR_INV_VALUE));
if (!ctx)
@@ -392,6 +408,9 @@ gpgme_get_protocol_name (gpgme_protocol_t protocol)
case GPGME_PROTOCOL_UISERVER:
return "UIServer";
+ case GPGME_PROTOCOL_SPAWN:
+ return "Spawn";
+
case GPGME_PROTOCOL_DEFAULT:
return "default";
@@ -931,6 +950,9 @@ gpgme_pubkey_algo_name (gpgme_pubkey_algo_t algo)
case GPGME_PK_DSA:
return "DSA";
+ case GPGME_PK_ECC:
+ return "ECC";
+
case GPGME_PK_ELG:
return "ELG";
@@ -978,6 +1000,9 @@ gpgme_hash_algo_name (gpgme_hash_algo_t algo)
case GPGME_MD_SHA512:
return "SHA512";
+ case GPGME_MD_SHA224:
+ return "SHA224";
+
case GPGME_MD_MD4:
return "MD4";