{
CamelCipherContext *cipher = (CamelCipherContext *) context;
- context->path = NULL;
context->always_trust = FALSE;
cipher->sign_protocol = "application/pgp-signature";
static void
camel_gpg_context_finalise (CamelObject *object)
{
- CamelGpgContext *ctx = (CamelGpgContext *) object;
-
- g_free (ctx->path);
+ ;
}
/**
* camel_gpg_context_new:
* @session: session
- * @path: path to gpg binary
*
* Creates a new gpg cipher context object.
*
* Returns a new gpg cipher context object.
**/
CamelCipherContext *
-camel_gpg_context_new (CamelSession *session, const char *path)
+camel_gpg_context_new (CamelSession *session)
{
CamelCipherContext *cipher;
CamelGpgContext *ctx;
g_return_val_if_fail (CAMEL_IS_SESSION (session), NULL);
- g_return_val_if_fail (path != NULL, NULL);
ctx = (CamelGpgContext *) camel_object_new (camel_gpg_context_get_type ());
- ctx->path = g_strdup (path);
cipher = (CamelCipherContext *) ctx;
cipher->session = session;
GHashTable *userid_hint;
pid_t pid;
- char *path;
char *userid;
char *sigfile;
GPtrArray *recipients;
};
static struct _GpgCtx *
-gpg_ctx_new (CamelSession *session, const char *path)
+gpg_ctx_new (CamelSession *session)
{
struct _GpgCtx *gpg;
gpg->exit_status = 0;
gpg->exited = FALSE;
- gpg->path = g_strdup (path);
gpg->userid = NULL;
gpg->sigfile = NULL;
gpg->recipients = NULL;
g_hash_table_foreach (gpg->userid_hint, userid_hint_free, NULL);
g_hash_table_destroy (gpg->userid_hint);
- g_free (gpg->path);
-
g_free (gpg->userid);
g_free (gpg->sigfile);
break;
}
- for (i = 0; i < argv->len; i++)
- printf ("%s ", argv->pdata[i]);
- printf ("\n");
-
g_ptr_array_add (argv, NULL);
return argv;
char *status_fd = NULL, *passwd_fd = NULL;
int i, maxfd, errnosave, fds[10];
GPtrArray *argv;
- struct stat st;
for (i = 0; i < 10; i++)
fds[i] = -1;
- if (stat (gpg->path, &st) == -1)
- goto exception;
-
maxfd = gpg->need_passwd ? 10 : 8;
for (i = 0; i < maxfd; i += 2) {
if (pipe (fds + i) == -1)
}
/* run gpg */
- execvp (gpg->path, (char **) argv->pdata);
+ execvp ("gpg", (char **) argv->pdata);
_exit (255);
} else if (gpg->pid < 0) {
g_ptr_array_free (argv, TRUE);
gpg_sign (CamelCipherContext *context, const char *userid, CamelCipherHash hash,
CamelStream *istream, CamelStream *ostream, CamelException *ex)
{
- CamelGpgContext *ctx = (CamelGpgContext *) context;
struct _GpgCtx *gpg;
- gpg = gpg_ctx_new (context->session, ctx->path);
+ gpg = gpg_ctx_new (context->session);
gpg_ctx_set_mode (gpg, GPG_CTX_MODE_SIGN);
gpg_ctx_set_hash (gpg, hash);
gpg_ctx_set_armor (gpg, TRUE);
CamelStream *istream, CamelStream *sigstream,
CamelException *ex)
{
- CamelGpgContext *ctx = (CamelGpgContext *) context;
CamelCipherValidity *validity;
char *diagnostics = NULL;
struct _GpgCtx *gpg;
}
}
- gpg = gpg_ctx_new (context->session, ctx->path);
+ gpg = gpg_ctx_new (context->session);
gpg_ctx_set_mode (gpg, GPG_CTX_MODE_VERIFY);
gpg_ctx_set_hash (gpg, hash);
gpg_ctx_set_sigfile (gpg, sigfile);
struct _GpgCtx *gpg;
int i;
- gpg = gpg_ctx_new (context->session, ctx->path);
+ gpg = gpg_ctx_new (context->session);
gpg_ctx_set_mode (gpg, GPG_CTX_MODE_ENCRYPT);
gpg_ctx_set_armor (gpg, TRUE);
gpg_ctx_set_userid (gpg, userid);
gpg_decrypt (CamelCipherContext *context, CamelStream *istream,
CamelStream *ostream, CamelException *ex)
{
- CamelGpgContext *ctx = (CamelGpgContext *) context;
struct _GpgCtx *gpg;
- gpg = gpg_ctx_new (context->session, ctx->path);
+ gpg = gpg_ctx_new (context->session);
gpg_ctx_set_mode (gpg, GPG_CTX_MODE_DECRYPT);
gpg_ctx_set_istream (gpg, istream);
gpg_ctx_set_ostream (gpg, ostream);