mirror of
git://git.gnupg.org/gnupg.git
synced 2025-07-02 22:46:30 +02:00
agent: Keep some permissions of private-keys-v1.d.
* common/sysutils.c (modestr_to_mode): Re-implement. (gnupg_chmod): Support keeping of permissions. -- GnuPG-bug-id: 2312 Signed-off-by: Werner Koch <wk@gnupg.org>
This commit is contained in:
parent
5b6cfef620
commit
7de9ed521e
2 changed files with 55 additions and 27 deletions
|
@ -2314,10 +2314,20 @@ create_private_keys_directory (const char *home)
|
|||
fname, strerror (errno) );
|
||||
else if (!opt.quiet)
|
||||
log_info (_("directory '%s' created\n"), fname);
|
||||
|
||||
if (gnupg_chmod (fname, "-rwx"))
|
||||
log_error (_("can't set permissions of '%s': %s\n"),
|
||||
fname, strerror (errno));
|
||||
}
|
||||
else
|
||||
{
|
||||
/* The file exists or another error. Make sure we have sensible
|
||||
* permissions. We enforce rwx for user but keep existing group
|
||||
* permissions. Permissions for other are always cleared. */
|
||||
if (gnupg_chmod (fname, "-rwx...---"))
|
||||
log_error (_("can't set permissions of '%s': %s\n"),
|
||||
fname, strerror (errno));
|
||||
}
|
||||
if (gnupg_chmod (fname, "-rwx"))
|
||||
log_error (_("can't set permissions of '%s': %s\n"),
|
||||
fname, strerror (errno));
|
||||
xfree (fname);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue