summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--doc/gpgv.texi3
-rw-r--r--g10/Makefile.am3
-rw-r--r--g10/dearmor.c7
-rw-r--r--g10/gpg.c2
-rw-r--r--g10/gpgv.c130
-rw-r--r--g10/main.h2
6 files changed, 10 insertions, 137 deletions
diff --git a/doc/gpgv.texi b/doc/gpgv.texi
index 214fb99fa..1d9a81e3a 100644
--- a/doc/gpgv.texi
+++ b/doc/gpgv.texi
@@ -92,9 +92,6 @@ are replaced by the HOME directory. If the filename
does not contain a slash, it is assumed to be in the
home-directory ("~/.gnupg" if --homedir is not used).
-If @var{file} ends in @code{.asc} then it is assumed to be an armored
-keyring produced e.g. by @code{gpg --export}.
-
@item --status-fd @var{n}
@opindex status-fd
Write special status strings to the file descriptor @var{n}. See the
diff --git a/g10/Makefile.am b/g10/Makefile.am
index c901198e2..cd1d15701 100644
--- a/g10/Makefile.am
+++ b/g10/Makefile.am
@@ -156,8 +156,7 @@ gpg_SOURCES = gpg.c \
gpgcompose_SOURCES = gpgcompose.c $(gpg_sources)
gpgv_SOURCES = gpgv.c \
$(common_source) \
- verify.c \
- dearmor.c
+ verify.c
#gpgd_SOURCES = gpgd.c \
# ks-proto.h \
diff --git a/g10/dearmor.c b/g10/dearmor.c
index 3f1976f96..3fdd57dae 100644
--- a/g10/dearmor.c
+++ b/g10/dearmor.c
@@ -35,11 +35,10 @@
#include "i18n.h"
/****************
- * Take an armor file and write it out without armor. If outfd is not
- * -1, the output will be written to the given file descriptor.
+ * Take an armor file and write it out without armor
*/
int
-dearmor_file( const char *fname, int outfd )
+dearmor_file( const char *fname )
{
armor_filter_context_t *afx;
IOBUF inp = NULL, out = NULL;
@@ -65,7 +64,7 @@ dearmor_file( const char *fname, int outfd )
push_armor_filter ( afx, inp );
- if( (rc = open_outfile (outfd, fname, 0, 0, &out)) )
+ if( (rc = open_outfile (-1, fname, 0, 0, &out)) )
goto leave;
while( (c = iobuf_get(inp)) != -1 )
diff --git a/g10/gpg.c b/g10/gpg.c
index bb5e8472d..b9d69a7cb 100644
--- a/g10/gpg.c
+++ b/g10/gpg.c
@@ -4285,7 +4285,7 @@ main (int argc, char **argv)
case aDeArmor:
if( argc > 1 )
wrong_args("--dearmor [file]");
- rc = dearmor_file( argc? *argv: NULL, -1 );
+ rc = dearmor_file( argc? *argv: NULL );
if( rc )
{
write_status_failure ("dearmor", rc);
diff --git a/g10/gpgv.c b/g10/gpgv.c
index de6529b04..19a2ff6c7 100644
--- a/g10/gpgv.c
+++ b/g10/gpgv.c
@@ -25,7 +25,9 @@
#include <string.h>
#include <ctype.h>
#include <unistd.h>
-#include <fcntl.h>
+#ifdef HAVE_DOSISH_SYSTEM
+#include <fcntl.h> /* for setmode() */
+#endif
#ifdef HAVE_LIBREADLINE
#define GNUPG_LIBREADLINE_H_INCLUDED
#include <readline/readline.h>
@@ -133,66 +135,6 @@ my_strusage( int level )
}
-static char *
-make_temp_dir (void)
-{
- char *result;
- char *tmp;
-#if defined (_WIN32)
- int err;
-
- tmp = xmalloc (MAX_PATH+2);
- err = GetTempPath (MAX_PATH + 1, tmp);
- if (err == 0 || err > MAX_PATH + 1)
- strcpy (tmp, "c:\\windows\\temp");
- else
- {
- int len = strlen (tmp);
-
- /* GetTempPath may return with \ on the end */
- while (len > 0 && tmp[len-1] == '\\')
- {
- tmp[len-1] = '\0';
- len--;
- }
- }
-#else /* More unixish systems */
- tmp = getenv ("TMPDIR");
- if (tmp == NULL)
- {
- tmp = getenv ("TMP");
- if (tmp == NULL)
- {
-#ifdef __riscos__
- tmp = "<Wimp$ScrapDir>.GnuPG";
- mkdir (tmp, 0700); /* Error checks occur later on */
-#else
- tmp = "/tmp";
-#endif
- }
- }
-#endif
-
- result = xasprintf ("%s" DIRSEP_S "gpg-XXXXXX", tmp);
-
-#if defined (_WIN32)
- xfree(tmp);
-#endif
-
- if (result == NULL)
- return NULL;
-
- if (! gnupg_mkdtemp (result))
- {
- log_error (_("can't create directory '%s': %s\n"),
- result, strerror (errno));
- xfree (result);
- return NULL;
- }
-
- return result;
-}
-
int
main( int argc, char **argv )
@@ -201,7 +143,6 @@ main( int argc, char **argv )
int rc=0;
strlist_t sl;
strlist_t nrings = NULL;
- strlist_t tmprings = NULL;
unsigned configlineno;
ctrl_t ctrl;
@@ -275,63 +216,8 @@ main( int argc, char **argv )
(KEYDB_RESOURCE_FLAG_READONLY
|KEYDB_RESOURCE_FLAG_GPGVDEF));
for (sl = nrings; sl; sl = sl->next)
- {
- char *name = sl->d;
- if (strlen (name) >= 4
- && strcmp (&name[strlen (name) - 4], ".asc") == 0)
- {
- /* The file is an armored keyring. Dearmor it. */
- char *tmpdir = NULL, *tmpname = NULL;
- int fd = -1, success;
+ keydb_add_resource (sl->d, KEYDB_RESOURCE_FLAG_READONLY);
- tmpdir = make_temp_dir ();
- if (tmpdir == NULL)
- goto cleanup;
-
- tmpname = xasprintf ("%s" DIRSEP_S "key", tmpdir);
- if (tmpname == NULL)
- goto cleanup;
-
- if (! add_to_strlist_try (&tmprings, tmpname))
- goto cleanup;
-
-#ifndef O_BINARY
-#define O_BINARY 0
-#endif
- fd = open (tmpname, O_WRONLY|O_CREAT|O_BINARY, S_IRUSR);
- if (fd == -1)
- goto cleanup;
-
- rc = dearmor_file (name, fd);
- close (fd);
- fd = -2;
- if (rc)
- goto cleanup;
-
- keydb_add_resource (tmpname, KEYDB_RESOURCE_FLAG_READONLY);
-
- cleanup:
- success = tmpdir && tmpname && fd != -1;
- if (fd >= 0)
- close (fd);
- if (tmpname)
- {
- if (! success)
- unlink (tmpname);
- xfree (tmpname);
- }
- if (tmpdir)
- {
- if (! success)
- rmdir (tmpdir);
- xfree (tmpdir);
- }
- if (! success)
- g10_exit (1);
- }
- else
- keydb_add_resource (name, KEYDB_RESOURCE_FLAG_READONLY);
- }
FREE_STRLIST (nrings);
ctrl = xcalloc (1, sizeof *ctrl);
@@ -341,14 +227,6 @@ main( int argc, char **argv )
xfree (ctrl);
- for (sl = tmprings; sl; sl = sl->next)
- {
- unlink (sl->d);
- sl->d[strlen (sl->d) - 4] = 0;
- rmdir (sl->d);
- }
- FREE_STRLIST (tmprings);
-
/* cleanup */
g10_exit (0);
return 8; /*NOTREACHED*/
diff --git a/g10/main.h b/g10/main.h
index 766c53fd9..5b5947e48 100644
--- a/g10/main.h
+++ b/g10/main.h
@@ -389,7 +389,7 @@ gpg_error_t receive_seckey_from_agent (ctrl_t ctrl, gcry_cipher_hd_t cipherhd,
gpg_error_t export_ssh_key (ctrl_t ctrl, const char *userid);
/*-- dearmor.c --*/
-int dearmor_file( const char *fname, int outfd );
+int dearmor_file( const char *fname );
int enarmor_file( const char *fname );
/*-- revoke.c --*/