aboutsummaryrefslogtreecommitdiffstats
path: root/camel
diff options
context:
space:
mode:
authorJeffrey Stedfast <fejj@ximian.com>2002-10-17 11:01:36 +0800
committerJeffrey Stedfast <fejj@src.gnome.org>2002-10-17 11:01:36 +0800
commit0372b96a72e19185a1e2d370d92610b3bc3e9090 (patch)
tree076d656e3633ca1545064d7e2e389d698404b46e /camel
parented4784f031bae4c963660ea5de1cc8161092f336 (diff)
downloadgsoc2013-evolution-0372b96a72e19185a1e2d370d92610b3bc3e9090.tar.gz
gsoc2013-evolution-0372b96a72e19185a1e2d370d92610b3bc3e9090.tar.zst
gsoc2013-evolution-0372b96a72e19185a1e2d370d92610b3bc3e9090.zip
No longer takes a path argument. (camel_gpg_context_fianlise): No need to
2002-10-16 Jeffrey Stedfast <fejj@ximian.com> * camel-gpg-context.c (camel_gpg_context_new): No longer takes a path argument. (camel_gpg_context_fianlise): No need to free ctx->path. (gpg_ctx_new): No longer takes a path argument either. (gpg_ctx_free): No need to free ctx->path, it's no longer used. (gpg_ctx_op_start): Don't stat the path anymore and change the first arg to execvp to "gpg" so that we use the shell's environment to find gpg. (gpg_sign): Updated. (gpg_verify): Updated. (gpg_encrypt): Updated. (gpg_decrypt): Updated. (gpg_ctx_get_argv): Removed some debug printfs. svn path=/trunk/; revision=18383
Diffstat (limited to 'camel')
-rw-r--r--camel/ChangeLog16
-rw-r--r--camel/camel-gpg-context.c37
-rw-r--r--camel/camel-gpg-context.h4
3 files changed, 25 insertions, 32 deletions
diff --git a/camel/ChangeLog b/camel/ChangeLog
index 4b88d89361..2805e19cb1 100644
--- a/camel/ChangeLog
+++ b/camel/ChangeLog
@@ -1,3 +1,19 @@
+2002-10-16 Jeffrey Stedfast <fejj@ximian.com>
+
+ * camel-gpg-context.c (camel_gpg_context_new): No longer takes a
+ path argument.
+ (camel_gpg_context_fianlise): No need to free ctx->path.
+ (gpg_ctx_new): No longer takes a path argument either.
+ (gpg_ctx_free): No need to free ctx->path, it's no longer used.
+ (gpg_ctx_op_start): Don't stat the path anymore and change the
+ first arg to execvp to "gpg" so that we use the shell's
+ environment to find gpg.
+ (gpg_sign): Updated.
+ (gpg_verify): Updated.
+ (gpg_encrypt): Updated.
+ (gpg_decrypt): Updated.
+ (gpg_ctx_get_argv): Removed some debug printfs.
+
2002-10-15 Jeffrey Stedfast <fejj@ximian.com>
* camel-gpg-context.c (gpg_id_to_hash): If the hash id is NULL,
diff --git a/camel/camel-gpg-context.c b/camel/camel-gpg-context.c
index e994c1054c..26ad0f81b6 100644
--- a/camel/camel-gpg-context.c
+++ b/camel/camel-gpg-context.c
@@ -108,7 +108,6 @@ camel_gpg_context_init (CamelGpgContext *context)
{
CamelCipherContext *cipher = (CamelCipherContext *) context;
- context->path = NULL;
context->always_trust = FALSE;
cipher->sign_protocol = "application/pgp-signature";
@@ -118,32 +117,27 @@ camel_gpg_context_init (CamelGpgContext *context)
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;
@@ -227,7 +221,6 @@ struct _GpgCtx {
GHashTable *userid_hint;
pid_t pid;
- char *path;
char *userid;
char *sigfile;
GPtrArray *recipients;
@@ -271,7 +264,7 @@ struct _GpgCtx {
};
static struct _GpgCtx *
-gpg_ctx_new (CamelSession *session, const char *path)
+gpg_ctx_new (CamelSession *session)
{
struct _GpgCtx *gpg;
@@ -287,7 +280,6 @@ gpg_ctx_new (CamelSession *session, const char *path)
gpg->exit_status = 0;
gpg->exited = FALSE;
- gpg->path = g_strdup (path);
gpg->userid = NULL;
gpg->sigfile = NULL;
gpg->recipients = NULL;
@@ -414,8 +406,6 @@ gpg_ctx_free (struct _GpgCtx *gpg)
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);
@@ -555,10 +545,6 @@ gpg_ctx_get_argv (struct _GpgCtx *gpg, int status_fd, char **sfd, int passwd_fd,
break;
}
- for (i = 0; i < argv->len; i++)
- printf ("%s ", argv->pdata[i]);
- printf ("\n");
-
g_ptr_array_add (argv, NULL);
return argv;
@@ -570,14 +556,10 @@ gpg_ctx_op_start (struct _GpgCtx *gpg)
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)
@@ -614,7 +596,7 @@ gpg_ctx_op_start (struct _GpgCtx *gpg)
}
/* 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);
@@ -1205,10 +1187,9 @@ static int
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);
@@ -1299,7 +1280,6 @@ gpg_verify (CamelCipherContext *context, CamelCipherHash hash,
CamelStream *istream, CamelStream *sigstream,
CamelException *ex)
{
- CamelGpgContext *ctx = (CamelGpgContext *) context;
CamelCipherValidity *validity;
char *diagnostics = NULL;
struct _GpgCtx *gpg;
@@ -1319,7 +1299,7 @@ gpg_verify (CamelCipherContext *context, CamelCipherHash hash,
}
}
- 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);
@@ -1387,7 +1367,7 @@ gpg_encrypt (CamelCipherContext *context, gboolean sign, const char *userid,
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);
@@ -1449,10 +1429,9 @@ static int
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);
diff --git a/camel/camel-gpg-context.h b/camel/camel-gpg-context.h
index 80417fdbcf..6a2f56f304 100644
--- a/camel/camel-gpg-context.h
+++ b/camel/camel-gpg-context.h
@@ -42,8 +42,6 @@ typedef struct _CamelGpgContextClass CamelGpgContextClass;
struct _CamelGpgContext {
CamelCipherContext parent_object;
- char *path;
-
gboolean always_trust;
};
@@ -55,7 +53,7 @@ struct _CamelGpgContextClass {
CamelType camel_gpg_context_get_type (void);
-CamelCipherContext *camel_gpg_context_new (CamelSession *session, const char *path);
+CamelCipherContext *camel_gpg_context_new (CamelSession *session);
void camel_gpg_context_set_always_trust (CamelGpgContext *ctx, gboolean trust);