diff options
author | Werner Koch <[email protected]> | 2004-05-11 07:43:19 +0000 |
---|---|---|
committer | Werner Koch <[email protected]> | 2004-05-11 07:43:19 +0000 |
commit | 536841ecae596e6f7f0448c59722c8e997963cb4 (patch) | |
tree | 696933cb8829111e71f8f1e49ac069f128e12b33 | |
parent | * options.h, mainproc.c (symkey_decrypt_seskey), keyserver.c (struct (diff) | |
download | gnupg-536841ecae596e6f7f0448c59722c8e997963cb4.tar.gz gnupg-536841ecae596e6f7f0448c59722c8e997963cb4.zip |
* keylist.c (show_policy_url, show_keyserver_url, show_notation)
(list_one): Use const char* for i18n string helpers.
* keygen.c (do_generate_keypair, read_parameter_file): Really
close the files.
(do_generate_keypair): Create the secret key file using safe
permissions. Noted by Atom Smasher.
Diffstat (limited to '')
-rw-r--r-- | g10/ChangeLog | 10 | ||||
-rw-r--r-- | g10/ccid-driver.c | 3 | ||||
-rw-r--r-- | g10/keygen.c | 18 | ||||
-rw-r--r-- | g10/keylist.c | 8 |
4 files changed, 35 insertions, 4 deletions
diff --git a/g10/ChangeLog b/g10/ChangeLog index 40b5aab9c..c6cbd8b63 100644 --- a/g10/ChangeLog +++ b/g10/ChangeLog @@ -1,3 +1,13 @@ +2004-05-11 Werner Koch <[email protected]> + + * keylist.c (show_policy_url, show_keyserver_url, show_notation) + (list_one): Use const char* for i18n string helpers. + + * keygen.c (do_generate_keypair, read_parameter_file): Really + close the files. + (do_generate_keypair): Create the secret key file using safe + permissions. Noted by Atom Smasher. + 2004-05-10 David Shaw <[email protected]> * options.h, mainproc.c (symkey_decrypt_seskey), keyserver.c diff --git a/g10/ccid-driver.c b/g10/ccid-driver.c index cd0bee6ef..3a142cacb 100644 --- a/g10/ccid-driver.c +++ b/g10/ccid-driver.c @@ -513,6 +513,9 @@ ccid_open_reader (ccid_driver_t *handle, int readerno) if (rc) { DEBUGOUT_1 ("usb_claim_interface failed: %d\n", rc); + + XXXXX; + free (*handle); *handle = NULL; goto leave; diff --git a/g10/keygen.c b/g10/keygen.c index a5c749f3e..24a81f128 100644 --- a/g10/keygen.c +++ b/g10/keygen.c @@ -26,6 +26,9 @@ #include <ctype.h> #include <errno.h> #include <assert.h> +#include <sys/types.h> +#include <sys/stat.h> +#include <unistd.h> #include "util.h" #include "main.h" #include "packet.h" @@ -2152,6 +2155,13 @@ read_parameter_file( const char *fname ) if( outctrl.use_files ) { /* close open streams */ iobuf_close( outctrl.pub.stream ); iobuf_close( outctrl.sec.stream ); + + /* Must invalidate that ugly cache to actually close it. */ + if (outctrl.pub.fname) + iobuf_ioctl (NULL, 2, 0, (char*)outctrl.pub.fname); + if (outctrl.sec.fname) + iobuf_ioctl (NULL, 2, 0, (char*)outctrl.sec.fname); + m_free( outctrl.pub.fname ); m_free( outctrl.pub.newfname ); m_free( outctrl.sec.fname ); @@ -2388,6 +2398,8 @@ do_generate_keypair( struct para_data_s *para, if( outctrl->pub.newfname ) { iobuf_close(outctrl->pub.stream); outctrl->pub.stream = NULL; + if (outctrl->pub.fname) + iobuf_ioctl (NULL, 2, 0, (char*)outctrl->pub.fname); m_free( outctrl->pub.fname ); outctrl->pub.fname = outctrl->pub.newfname; outctrl->pub.newfname = NULL; @@ -2405,13 +2417,19 @@ do_generate_keypair( struct para_data_s *para, } } if( outctrl->sec.newfname ) { + mode_t oldmask; + iobuf_close(outctrl->sec.stream); outctrl->sec.stream = NULL; + if (outctrl->sec.fname) + iobuf_ioctl (NULL, 2, 0, (char*)outctrl->sec.fname); m_free( outctrl->sec.fname ); outctrl->sec.fname = outctrl->sec.newfname; outctrl->sec.newfname = NULL; + oldmask = umask (077); outctrl->sec.stream = iobuf_create( outctrl->sec.fname ); + umask (oldmask); if( !outctrl->sec.stream ) { log_error("can't create `%s': %s\n", outctrl->sec.newfname, strerror(errno) ); diff --git a/g10/keylist.c b/g10/keylist.c index 421d2c1e9..091e1dc46 100644 --- a/g10/keylist.c +++ b/g10/keylist.c @@ -170,7 +170,7 @@ show_policy_url(PKT_signature *sig,int indent,int mode) if(mode!=2) { int i; - char *str; + const char *str; for(i=0;i<indent;i++) putchar(' '); @@ -211,7 +211,7 @@ show_keyserver_url(PKT_signature *sig,int indent,int mode) if(mode!=2) { int i; - char *str; + const char *str; for(i=0;i<indent;i++) putchar(' '); @@ -276,7 +276,7 @@ show_notation(PKT_signature *sig,int indent,int mode,int which) if((which&1 && !has_at) || (which&2 && has_at)) { int i; - char *str; + const char *str; for(i=0;i<indent;i++) putchar(' '); @@ -397,7 +397,7 @@ list_one( STRLIST names, int secret ) KBNODE keyblock = NULL; GETKEY_CTX ctx; const char *resname; - char *keyring_str = _("Keyring"); + const char *keyring_str = _("Keyring"); int i; struct sig_stats stats; |