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

Minor fixes.

This commit is contained in:
Werner Koch 2008-12-09 08:58:02 +00:00
parent 78ff45c49e
commit 382d2f8efb
23 changed files with 106 additions and 54 deletions

3
NEWS
View File

@ -41,7 +41,8 @@ Noteworthy changes in version 2.0.10 (unreleased)
* [w32] Fixed a race condition bteween gpg and gpgsm in the use of
temporary file names.
* The gpg-preset-passphrase mechanism works again.
* The gpg-preset-passphrase mechanism works again. An arbitrary
string may now be used for a custom cache ID.
* Admin PINs are cached again (bug in 2.0.9).

View File

@ -1,3 +1,12 @@
2008-12-09 Werner Koch <wk@g10code.com>
* gpg-agent.c (main): Call i18n_init before init_common_subsystems.
* preset-passphrase.c (main): Ditto.
* protect-tool.c (main): Ditto.
* command.c (cmd_preset_passphrase): Allow an arbitrary string for
the cache id.
2008-12-08 Werner Koch <wk@g10code.com>
* gpg-agent.c (handle_connections): Sync the ticker to the next

View File

@ -1093,7 +1093,7 @@ cmd_passwd (assuan_context_t ctx, char *line)
return rc;
}
/* PRESET_PASSPHRASE <hexstring_with_keygrip> <timeout> <hexstring>
/* PRESET_PASSPHRASE <string_or_keygrip> <timeout> <hexstring>
Set the cached passphrase/PIN for the key identified by the keygrip
to passwd for the given time, where -1 means infinite and 0 means
@ -1104,7 +1104,6 @@ static int
cmd_preset_passphrase (assuan_context_t ctx, char *line)
{
int rc;
unsigned char grip[20];
char *grip_clear = NULL;
char *passphrase = NULL;
int ttl;
@ -1113,11 +1112,6 @@ cmd_preset_passphrase (assuan_context_t ctx, char *line)
if (!opt.allow_preset_passphrase)
return set_error (GPG_ERR_NOT_SUPPORTED, "no --allow-preset-passphrase");
rc = parse_keygrip (ctx, line, grip);
if (rc)
return rc;
/* FIXME: parse_keygrip should return a tail pointer. */
grip_clear = line;
while (*line && (*line != ' ' && *line != '\t'))
line++;

View File

@ -535,9 +535,9 @@ main (int argc, char **argv )
log_set_prefix ("gpg-agent", JNLIB_LOG_WITH_PREFIX|JNLIB_LOG_WITH_PID);
/* Make sure that our subsystems are ready. */
i18n_init ();
init_common_subsystems ();
i18n_init ();
/* Libgcrypt requires us to register the threading model first.
Note that this will also do the pth_init. */

View File

@ -209,9 +209,8 @@ main (int argc, char **argv)
log_set_prefix ("gpg-preset-passphrase", 1);
/* Make sure that our subsystems are ready. */
init_common_subsystems ();
i18n_init ();
init_common_subsystems ();
opt_homedir = default_homedir ();

View File

@ -1059,9 +1059,8 @@ main (int argc, char **argv )
log_set_prefix ("gpg-protect-tool", 1);
/* Make sure that our subsystems are ready. */
init_common_subsystems ();
i18n_init ();
init_common_subsystems ();
if (!gcry_check_version (NEED_LIBGCRYPT_VERSION) )
{

View File

@ -979,7 +979,7 @@ which will be printed to stdout.
.B gpg-preset-passphrase
.RI [ options ]
.RI [ command ]
.I keygrip
.I cache-id
@end ifset
@mansect description
@ -1009,14 +1009,19 @@ starting @command{gpg-agent} with the
@command{gpg-preset-passphrase} is invoked this way:
@example
gpg-preset-passphrase [options] [command] @var{keygrip}
gpg-preset-passphrase [options] [command] @var{cacheid}
@end example
@var{keygrip} is a 40 character string of hexadecimal characters
identifying the key for which the passphrase should be set or cleared.
This keygrip is listed along with the key when running the command:
@code{gpgsm --dump-secret-keys}. One of the following command options
must be given:
@var{cacheid} is either a 40 character keygrip of hexadecimal
characters identifying the key for which the passphrase should be set
or cleared. The keygrip is listed along with the key when running the
command: @code{gpgsm --dump-secret-keys}. Alternatively an arbitrary
string may be used to identify a passphrase; it is suggested that such
a string is prefixed with the name of the application (e.g
@code{foo:12346}).
@noindent
One of the following command options must be given:
@table @gnupgtabopt
@item --preset
@ -1027,7 +1032,7 @@ use. @command{gpg-preset-passphrase} will then read the passphrase from
@item --forget
@opindex forget
Flush the passphrase for the given keygrip from the cache.
Flush the passphrase for the given cache ID from the cache.
@end table

View File

@ -1,3 +1,15 @@
2008-12-09 Werner Koch <wk@g10code.com>
* gpg.c (open_info_file): Add arg BINARY and adjust callers.
* gpg.c (main): Call i18n_init before init_common_subsystems.
* gpgv.c (main): Ditto.
* keylist.c (set_attrib_fd): Do not close ATTRIB_FP if it is the
log stream.
(set_attrib_fd) [W32]: Set to binary mode.
(dump_attribs): Flush the stream after writing.
2008-12-05 Werner Koch <wk@g10code.com>
* call-agent.c (percent_plus_escape): Rename to

View File

@ -229,7 +229,7 @@ write_status_buffer ( int no, const char *buffer, size_t len, int wrap )
/* Print the BEGIN_SIGNING status message. If MD is not NULL it is
used retrieve the hash algorithms used for the message. */
used to retrieve the hash algorithms used for the message. */
void
write_status_begin_signing (gcry_md_hd_t md)
{

View File

@ -1038,7 +1038,7 @@ set_screen_dimensions(void)
might like it too. Prints an error message and returns -1 on
error. On success the file descriptor is returned. */
static int
open_info_file (const char *fname, int for_write)
open_info_file (const char *fname, int for_write, int binary)
{
#ifdef __riscos__
return riscos_fdopenfile (fname, for_write);
@ -1048,10 +1048,16 @@ open_info_file (const char *fname, int for_write)
similar to the option file but in that case it is unlikely that
sensitive information may be retrieved by means of error
messages. */
(void)fname;
(void)for_write;
(void)binary;
return -1;
#else
int fd;
if (binary)
binary = MY_O_BINARY;
/* if (is_secured_filename (fname)) */
/* { */
/* fd = -1; */
@ -1062,10 +1068,10 @@ open_info_file (const char *fname, int for_write)
do
{
if (for_write)
fd = open (fname, O_CREAT | O_TRUNC | O_WRONLY,
fd = open (fname, O_CREAT | O_TRUNC | O_WRONLY | binary,
S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP);
else
fd = open (fname, O_RDONLY | MY_O_BINARY);
fd = open (fname, O_RDONLY | binary);
}
while (fd == -1 && errno == EINTR);
/* } */
@ -1910,6 +1916,7 @@ main (int argc, char **argv)
log_set_prefix ("gpg", 1);
/* Make sure that our subsystems are ready. */
i18n_init();
init_common_subsystems ();
/* Check that the libraries are suitable. Do it right here because the
@ -1929,7 +1936,6 @@ main (int argc, char **argv)
create_dotlock(NULL); /* Register locking cleanup. */
i18n_init();
opt.command_fd = -1; /* no command fd */
opt.compress_level = -1; /* defaults to standard compress level */
@ -2216,16 +2222,16 @@ main (int argc, char **argv)
case oDebugLevel: debug_level = pargs.r.ret_str; break;
case oStatusFD:
set_status_fd( translate_sys2libc_fd_int (pargs.r.ret_int, 1) );
set_status_fd ( translate_sys2libc_fd_int (pargs.r.ret_int, 1) );
break;
case oStatusFile:
set_status_fd ( open_info_file (pargs.r.ret_str, 1) );
set_status_fd ( open_info_file (pargs.r.ret_str, 1, 0) );
break;
case oAttributeFD:
set_attrib_fd(translate_sys2libc_fd_int (pargs.r.ret_int, 1));
set_attrib_fd ( translate_sys2libc_fd_int (pargs.r.ret_int, 1) );
break;
case oAttributeFile:
set_attrib_fd ( open_info_file (pargs.r.ret_str, 1) );
set_attrib_fd ( open_info_file (pargs.r.ret_str, 1, 1) );
break;
case oLoggerFD:
log_set_fd (translate_sys2libc_fd_int (pargs.r.ret_int, 1));
@ -2522,14 +2528,14 @@ main (int argc, char **argv)
pwfd = translate_sys2libc_fd_int (pargs.r.ret_int, 0);
break;
case oPasswdFile:
pwfd = open_info_file (pargs.r.ret_str, 0);
pwfd = open_info_file (pargs.r.ret_str, 0, 1);
break;
case oPasswdRepeat: opt.passwd_repeat=pargs.r.ret_int; break;
case oCommandFD:
opt.command_fd = translate_sys2libc_fd_int (pargs.r.ret_int, 0);
break;
case oCommandFile:
opt.command_fd = open_info_file (pargs.r.ret_str, 0);
opt.command_fd = open_info_file (pargs.r.ret_str, 0, 1);
break;
case oCipherAlgo:
def_cipher_string = xstrdup(pargs.r.ret_str);

View File

@ -147,10 +147,10 @@ main( int argc, char **argv )
log_set_prefix ("gpgv", 1);
/* Make sure that our subsystems are ready. */
i18n_init();
init_common_subsystems ();
gnupg_init_signals (0, NULL);
i18n_init();
opt.command_fd = -1; /* no command fd */
opt.pgp2_workarounds = 1;

View File

@ -24,6 +24,9 @@
#include <string.h>
#include <errno.h>
#include <assert.h>
#ifdef HAVE_DOSISH_SYSTEM
#include <fcntl.h> /* for setmode() */
#endif
#include "gpg.h"
#include "options.h"
@ -50,7 +53,8 @@ struct sig_stats
int oth_err;
};
static FILE *attrib_fp=NULL;
/* The stream used to write attribute packets to. */
static FILE *attrib_fp = NULL;
/****************
* List the keys
@ -745,6 +749,7 @@ dump_attribs(const PKT_user_id *uid,PKT_public_key *pk,PKT_secret_key *sk)
}
fwrite(uid->attribs[i].data,uid->attribs[i].len,1,attrib_fp);
fflush (attrib_fp);
}
}
@ -1609,26 +1614,32 @@ print_card_serialno (PKT_secret_key *sk)
void set_attrib_fd(int fd)
void
set_attrib_fd (int fd)
{
static int last_fd=-1;
if ( fd != -1 && last_fd == fd )
return;
if ( attrib_fp && attrib_fp != stdout && attrib_fp != stderr )
if ( attrib_fp && attrib_fp != stdout && attrib_fp != stderr
&& attrib_fp != log_get_stream () )
fclose (attrib_fp);
attrib_fp = NULL;
if ( fd == -1 )
return;
#ifdef HAVE_DOSISH_SYSTEM
setmode ( fileno(fp) , O_BINARY );
#endif
if( fd == 1 )
attrib_fp = stdout;
else if( fd == 2 )
attrib_fp = stderr;
else
attrib_fp = fdopen( fd, "wb" );
if( !attrib_fp ) {
attrib_fp = fdopen (fd, "wb");
if (!attrib_fp)
{
log_fatal("can't open fd %d for attribute output: %s\n",
fd, strerror(errno));
}

View File

@ -1,3 +1,7 @@
2008-12-09 Werner Koch <wk@g10code.com>
* kbxutil.c (main): Call i18n_init before init_common_subsystems.
2008-11-20 Werner Koch <wk@g10code.com>
* keybox-update.c (create_tmp_file) [USE_ONLY_8DOT3]: Use other

View File

@ -419,9 +419,8 @@ main( int argc, char **argv )
log_set_prefix ("kbxutil", 1);
/* Make sure that our subsystems are ready. */
init_common_subsystems ();
i18n_init ();
init_common_subsystems ();
/* Check that the libraries are suitable. Do it here because
the option parsing may need services of the library. */

View File

@ -1,3 +1,7 @@
2008-12-09 Werner Koch <wk@g10code.com>
* scdaemon.c (main): Call i18n_init before init_common_subsystems.
2008-12-08 Werner Koch <wk@g10code.com>
* scdaemon.c (handle_connections): Sync ticker to the next full

View File

@ -364,9 +364,9 @@ main (int argc, char **argv )
log_set_prefix ("scdaemon", 1|4);
/* Make sure that our subsystems are ready. */
i18n_init ();
init_common_subsystems ();
i18n_init ();
/* Libgcrypt requires us to register the threading model first.
Note that this will also do the pth_init. */

View File

@ -1,3 +1,7 @@
2008-12-09 Werner Koch <wk@g10code.com>
* gpgsm.c (main): Call i18n_init before init_common_subsystems.
2008-12-05 Werner Koch <wk@g10code.com>
* certreqgen.c (create_request): Provide a custom prompt for the

View File

@ -869,6 +869,7 @@ main ( int argc, char **argv)
log_set_prefix ("gpgsm", 1);
/* Make sure that our subsystems are ready. */
i18n_init();
init_common_subsystems ();
/* Check that the libraries are suitable. Do it here because the
@ -888,7 +889,6 @@ main ( int argc, char **argv)
gnupg_init_signals (0, emergency_cleanup);
create_dotlock (NULL); /* register locking cleanup */
i18n_init();
opt.def_cipher_algoid = "AES"; /*des-EDE3-CBC*/

View File

@ -1,3 +1,11 @@
2008-12-09 Werner Koch <wk@g10code.com>
* gpg-check-pattern.c (main): Call i18n_init before
init_common_subsystems.
* gpg-connect-agent.c (main): Ditto.
* gpgconf.c (main): Ditto.
* symcryptrun.c (main): Ditto.
2008-12-08 Werner Koch <wk@g10code.com>
* gpgkey2ssh.c (main): Change order of output for RSA. Change name

View File

@ -168,9 +168,8 @@ main (int argc, char **argv )
log_set_prefix ("gpg-check-pattern", 1);
/* Make sure that our subsystems are ready. */
init_common_subsystems ();
i18n_init ();
init_common_subsystems ();
/* We need Libgcrypt for hashing. */
if (!gcry_check_version (NEED_LIBGCRYPT_VERSION) )

View File

@ -1152,11 +1152,11 @@ main (int argc, char **argv)
log_set_prefix ("gpg-connect-agent", 1);
/* Make sure that our subsystems are ready. */
i18n_init();
init_common_subsystems ();
assuan_set_assuan_err_source (0);
i18n_init();
opt.homedir = default_homedir ();
opt.connect_flags = 1; /* Use extended connect mode. */

View File

@ -147,9 +147,8 @@ main (int argc, char **argv)
log_set_prefix ("gpgconf", 1);
/* Make sure that our subsystems are ready. */
init_common_subsystems ();
i18n_init();
init_common_subsystems ();
/* Parse the command line. */
pargs.argc = &argc;

View File

@ -884,9 +884,8 @@ main (int argc, char **argv)
log_set_prefix ("symcryptrun", 1);
/* Make sure that our subsystems are ready. */
init_common_subsystems ();
i18n_init();
init_common_subsystems ();
opt.homedir = default_homedir ();