1
0
Fork 0
mirror of git://git.gnupg.org/gnupg.git synced 2025-07-02 22:46:30 +02:00

gpg: Create exported secret files and revocs with mode 700.

* common/iobuf.c (direct_open): Add arg MODE700.
(iobuf_create): Ditto.
* g10/openfile.c (open_outfile): Add arg RESTRICTEDPERM.  Change call
callers to pass 0 for it.
* g10/revoke.c (gen_desig_revoke, gen_revoke): Here pass true for new
arg.
* g10/export.c (do_export): Pass true for new arg if SECRET is true.
--

GnuPG-bug-id: 1653.

Note that this works only if --output has been used.
This commit is contained in:
Werner Koch 2014-06-25 20:25:28 +02:00
parent 35fdfaa0b9
commit c434de4d83
12 changed files with 43 additions and 31 deletions

View file

@ -3814,7 +3814,7 @@ do_generate_keypair (struct para_data_s *para,
gpg_err_set_errno (EPERM);
}
else
outctrl->pub.stream = iobuf_create( outctrl->pub.fname );
outctrl->pub.stream = iobuf_create (outctrl->pub.fname, 0);
if (!outctrl->pub.stream)
{
log_error(_("can't create '%s': %s\n"), outctrl->pub.newfname,
@ -4442,6 +4442,9 @@ gen_card_key_with_backup (int algo, int keyno, int is_primary,
(ulong)sk->keyid[0], (ulong)sk->keyid[1]);
fname = make_filename (backup_dir, name_buffer, NULL);
/* Note that the umask call is not anymore needed because
iobuf_create now takes care of it. However, it does not harm
and thus we keep it. */
oldmask = umask (077);
if (is_secured_filename (fname))
{
@ -4449,7 +4452,7 @@ gen_card_key_with_backup (int algo, int keyno, int is_primary,
gpg_err_set_errno (EPERM);
}
else
fp = iobuf_create (fname);
fp = iobuf_create (fname, 1);
umask (oldmask);
if (!fp)
{