1
0
mirror of git://git.gnupg.org/gnupg.git synced 2024-12-22 10:19:57 +01:00

Allow to enter an alternate filename

This commit is contained in:
Werner Koch 2001-03-29 09:18:11 +00:00
parent ec742b7f58
commit 424f5d6d93
8 changed files with 55 additions and 29 deletions

1
THANKS
View File

@ -138,6 +138,7 @@ Sam Roberts sam@cogent.ca
Sean MacLennan seanm@netwinder.org
Serge Munhoven munhoven@mema.ucl.ac.be
SL Baur steve@xemacs.org
Stefan Bellon sbellon@sbellon.de
Stefan Karrmann S.Karrmann@gmx.net
Stefan Keller dres@cs.tu-berlin.de
Steffen Ullrich ccrlphr@xensei.com

16
TODO
View File

@ -7,8 +7,6 @@
* check whether we can remove all the expire stuff in trustdb because this
is now done in getkey.
* ask for alternate filename?
* Can we output things like the preferences?
* We need another special packet at the end of a clearsign message to mark
@ -49,10 +47,6 @@
Scheduled for 1.1
-----------------
* David C Niemi pointed out that the code for --no-default-keyring does not
work as expected, because in g10/g10.c sec_nring will be set in the option
switch but later checked to see whether there are any keyrings.
* export by user-IDs does only export the first matching name which leads
to a problem in cases where there are 2 keys with identically user-IDs.
@ -61,8 +55,6 @@ Scheduled for 1.1
* Speed up calculation of key validation.
* print a warning when a revoked/expired _secret_ key is used.
* --disable-asm should still assemble _udiv_qrnnd when needed
* Skip RO keyrings when importing a key.
@ -88,9 +80,6 @@ Nice to have
test program. Use it with the test suite?
* add test cases for invalid data (scrambled armor or other random data)
* add checking of armor trailers
* Burn the buffers used by fopen(), or use read(2). Does this
really make sense? And while we are at it: implement a secure deletion
stuff?
* the pubkey encrypt functions should do some sanity checks.
* dynload: implement the hint stuff.
* "gpg filename.tar.gz.asc" should work like --verify (-sab).
@ -98,8 +87,7 @@ Nice to have
verification status of the message to the output (i.e. write something to
the --output file and not only to stderr.
* configure option where to find zlib
* Display more validity information about the user IDs at certain places.
We need a more general function to extract such kind of info from the
trustdb.
* Evaluate whether it make sense to replace the namehashs either by
using the user ID directly or by using pointers into the trustdb.

View File

@ -1,3 +1,10 @@
2001-03-29 Werner Koch <wk@gnupg.org>
* openfile.c (ask_outfile_name): Trim spaces.
(open_outfile): Allow to enter an alternate filename. Thanks to
Stefan Bellon.
* plaintext.c (handle_plaintext): Ditto.
2001-03-28 Werner Koch <wk@gnupg.org>
* mainproc.c (do_check_sig): Allow direct key and subkey

View File

@ -155,6 +155,8 @@ ask_outfile_name( const char *name, size_t namelen )
fname = defname; defname = NULL;
}
m_free(defname);
if (fname)
trim_spaces (fname);
return fname;
}
@ -221,7 +223,19 @@ open_outfile( const char *iname, int mode, IOBUF *a )
name = buf;
}
if( overwrite_filep( name ) ) {
rc = 0;
while( !overwrite_filep (name) ) {
char *tmp = ask_outfile_name (NULL, 0);
if ( !tmp || !*tmp ) {
m_free (tmp);
rc = G10ERR_FILE_EXISTS;
break;
}
m_free (buf);
name = buf = tmp;
}
if( !rc ) {
if( !(*a = iobuf_create( name )) ) {
log_error(_("%s: can't create: %s\n"), name, strerror(errno) );
rc = G10ERR_CREATE_FILE;
@ -229,8 +243,6 @@ open_outfile( const char *iname, int mode, IOBUF *a )
else if( opt.verbose )
log_info(_("writing to `%s'\n"), name );
}
else
rc = G10ERR_FILE_EXISTS;
m_free(buf);
}
return rc;

View File

@ -89,9 +89,17 @@ handle_plaintext( PKT_plaintext *pt, md_filter_context_t *mfx,
setmode ( fileno(fp) , O_BINARY );
#endif
}
else if( !overwrite_filep( fname ) ) {
rc = G10ERR_CREATE_FILE;
goto leave;
else {
while( !overwrite_filep (fname) ) {
char *tmp = ask_outfile_name (NULL, 0);
if ( !tmp || !*tmp ) {
m_free (tmp);
rc = G10ERR_CREATE_FILE;
goto leave;
}
m_free (fname);
fname = tmp;
}
}
if( fp || nooutput )

View File

@ -1,3 +1,10 @@
2001-03-29 Werner Koch <wk@gnupg.org>
* miscutil.c (answer_is_yes): An empty string does now return no.
(answer_is_yes_no_quit): Likewise.
* iobuf.c (iobuf_close): Burn the buffers.
2001-03-26 Werner Koch <wk@gnupg.org>
* ttyio.c: Define TERMDEVICE depending on OS.

View File

@ -905,7 +905,10 @@ iobuf_close ( IOBUF a )
a->chain, NULL, &dummy_len)) )
log_error("IOBUFCTRL_FREE failed on close: %s\n", g10_errstr(rc) );
m_free(a->real_fname);
m_free(a->d.buf);
if (a->d.buf) {
memset (a->d.buf, 0, a->d.size); /* erase the buffer */
m_free(a->d.buf);
}
m_free(a);
}
return rc;

View File

@ -281,17 +281,17 @@ answer_is_yes( const char *s )
if( !stricmp(s, long_yes ) )
return 1;
if( strchr( short_yes, *s ) && !s[1] )
if( *s && strchr( short_yes, *s ) && !s[1] )
return 1;
/* test for no strings to catch ambiguities for the next test */
if( !stricmp(s, long_no ) )
return 0;
if( strchr( short_no, *s ) && !s[1] )
if( *s && strchr( short_no, *s ) && !s[1] )
return 0;
/* test for the english version (for those who are used to type yes) */
if( !stricmp(s, "yes" ) )
return 1;
if( strchr( "yY", *s ) && !s[1] )
if( *s && strchr( "yY", *s ) && !s[1] )
return 1;
return 0;
}
@ -316,19 +316,19 @@ answer_is_yes_no_quit( const char *s )
return 1;
if( !stricmp(s, long_quit ) )
return -1;
if( strchr( short_no, *s ) && !s[1] )
if( *s && strchr( short_no, *s ) && !s[1] )
return 0;
if( strchr( short_yes, *s ) && !s[1] )
if( *s && strchr( short_yes, *s ) && !s[1] )
return 1;
if( strchr( short_quit, *s ) && !s[1] )
if( *s && strchr( short_quit, *s ) && !s[1] )
return -1;
if( !stricmp(s, "yes" ) )
return 1;
if( !stricmp(s, "quit" ) )
return -1;
if( strchr( "yY", *s ) && !s[1] )
if( *s && strchr( "yY", *s ) && !s[1] )
return 1;
if( strchr( "qQ", *s ) && !s[1] )
if( *s && strchr( "qQ", *s ) && !s[1] )
return -1;
return 0;
}