From 08eaf1cea1da709b746f7b3f1b61415143188b05 Mon Sep 17 00:00:00 2001 From: Werner Koch Date: Thu, 16 Nov 2000 17:26:53 +0000 Subject: [PATCH] Released 0.0.0 --- README | 20 ++++++++++++++++++-- configure.in | 2 +- gpgme/rungpg.c | 15 ++++++++++++++- tests/Makefile.am | 28 +++++++++++++++++++++++++++- tests/t-decrypt.c | 19 ++++++++++++++++++- 5 files changed, 78 insertions(+), 6 deletions(-) diff --git a/README b/README index 9ff55645..03cb7184 100644 --- a/README +++ b/README @@ -1,7 +1,23 @@ GPGME - GnuPG Made Easy --------------------------- -THIS IS WORK IN PROGRESS !!! + !!!! THIS IS WORK IN PROGRESS !!! + +If you want to hack on it, start with one of the tests/t-foo programs. +You need the latest CVS version of GnuPG 1.0, see +http://www.gnupg.org/cvs-access.html . If you use passphrases for +your keys, you should get the gpg-agent which comes with the GnuPG +unstable version (either CVS HEAD or +ftp.gnupg.org/pub/gcrypt/alpha/gnupg/gnupg-1.1.2.tar.gz) and install +the agent from the agent subdirectory. + +Please subscribe to the gnupg-devel@gnupg.org mailing list if you want +to do serious work. + + + + + + -Contact wk@gnupg.org for questions. diff --git a/configure.in b/configure.in index 9adf05b2..10aab74c 100644 --- a/configure.in +++ b/configure.in @@ -13,7 +13,7 @@ AM_MAINTAINER_MODE # AGE, set REVISION to 0. # 3. Interfaces removed (BAD, breaks upward compatibility): Increment # CURRENT, set AGE and REVISION to 0. -AM_INIT_AUTOMAKE(gpgme,0.0) +AM_INIT_AUTOMAKE(gpgme,0.0.0) LIBGPGME_LT_CURRENT=0 LIBGPGME_LT_AGE=0 LIBGPGME_LT_REVISION=0 diff --git a/gpgme/rungpg.c b/gpgme/rungpg.c index e437ba88..a370f5e9 100644 --- a/gpgme/rungpg.c +++ b/gpgme/rungpg.c @@ -312,6 +312,8 @@ build_argv ( GpgObject gpg ) size_t datac=0, argc=0; char **argv; int need_special = 0; + int use_agent = !!getenv ("GPG_AGENT_INFO"); + if ( gpg->argv ) { free_argv ( gpg->argv ); @@ -337,6 +339,8 @@ build_argv ( GpgObject gpg ) } if ( need_special ) argc++; + if (use_agent) + argc++; argv = xtrycalloc ( argc+1, sizeof *argv ); if (!argv) @@ -364,6 +368,15 @@ build_argv ( GpgObject gpg ) } argc++; } + if ( use_agent ) { + argv[argc] = xtrystrdup ( "--use-agent" ); + if (!argv[argc]) { + xfree (fd_data_map); + free_argv (argv); + return mk_error (Out_Of_Core); + } + argc++; + } for ( a=gpg->arglist; a; a = a->next ) { if ( a->data ) { switch ( _gpgme_data_get_mode (a->data) ) { @@ -535,7 +548,7 @@ _gpgme_gpg_spawn( GpgObject gpg, void *opaque ) close (fd); } - execv ("./gpg", gpg->argv ); + execv ("/usr/local/bin/gpg", gpg->argv ); fprintf (stderr,"exec of gpg failed\n"); _exit (8); } diff --git a/tests/Makefile.am b/tests/Makefile.am index 7b599581..5e03d459 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -1,8 +1,10 @@ ## Process this file with automake to create Makefile.in +TESTS_ENVIRONMENT = GNUPGHOME=. + TESTS = t-encrypt t-sign t-decrypt t-verify t-keylist -EXTRA_DIST = cipher-1.asc geheim.txt +EXTRA_DIST = mkdemodirs pubdemo.asc secdemo.asc cipher-1.asc geheim.txt INCLUDES = -I$(top_srcdir)/include -I$(top_srcdir)/intl @@ -11,4 +13,28 @@ LDADD = ../gpgme/libgpgme.la noinst_PROGRAMS = $(TESTS) +distclean-local: + $(srcdir)/mkdemodirs --clean + +all-local: ./pubring.gpg ./secring.gpg + +./pubring.gpg: $(srcdir)/pubdemo.asc + -gpg --homedir . --import $(srcdir)/pubdemo.asc + +./secring.gpg: ./Alpha/Secret.gpg + -gpg --homedir . --import Alpha/Secret.gpg Zulu/Secret.gpg + +./Alpha/Secret.gpg: secdemo.asc + srcdir=$(srcdir) $(srcdir)/mkdemodirs + + + + + + + + + + + diff --git a/tests/t-decrypt.c b/tests/t-decrypt.c index 0b066f5e..bf96112d 100644 --- a/tests/t-decrypt.c +++ b/tests/t-decrypt.c @@ -51,6 +51,22 @@ print_data ( GpgmeData dh ) } +static char * +mk_fname ( const char *fname ) +{ + const char *srcdir = getenv ("srcdir"); + char *buf; + + if (!srcdir) + srcdir = "."; + buf = malloc (strlen(srcdir) + strlen(fname) + 2 ); + if (!buf ) + exit (8); + strcpy (buf, srcdir); + strcat (buf, "/"); + strcat (buf, fname ); + return buf; +} int main (int argc, char **argv ) @@ -58,12 +74,13 @@ main (int argc, char **argv ) GpgmeCtx ctx; GpgmeError err; GpgmeData in, out; + const char *cipher_1_asc = mk_fname ("cipher-1.asc"); do { err = gpgme_new (&ctx); fail_if_err (err); - err = gpgme_data_new_from_file ( &in, "cipher-1.asc", 1 ); + err = gpgme_data_new_from_file ( &in, cipher_1_asc, 1 ); fail_if_err (err); err = gpgme_data_new ( &out );