mirror of
git://git.gnupg.org/gnupg.git
synced 2025-07-03 22:56:33 +02:00
(agent_marktrusted): Check whether the trustlist is
writable.
This commit is contained in:
parent
4453659c9a
commit
fa5d1513a2
4 changed files with 23 additions and 1 deletions
|
@ -236,6 +236,22 @@ agent_marktrusted (CTRL ctrl, const char *name, const char *fpr, int flag)
|
|||
static char key[41];
|
||||
int keyflag;
|
||||
char *desc;
|
||||
char *fname;
|
||||
|
||||
/* Check whether we are at all allowed to modify the trustlist.
|
||||
This is useful so that the trustlist may be a symlink to a global
|
||||
trustlist with only admin priviliges to modify it. Of course
|
||||
this is not a secure way of denying access, but it avoids the
|
||||
usual clicking on an Okay buttun thing most users are used to. */
|
||||
fname = make_filename (opt.homedir, "trustlist.txt", NULL);
|
||||
rc = access (fname, W_OK);
|
||||
if (rc && errno != ENOENT)
|
||||
{
|
||||
xfree (fname);
|
||||
return gpg_error (GPG_ERR_EPERM);
|
||||
}
|
||||
xfree (fname);
|
||||
|
||||
|
||||
if (trustfp)
|
||||
rewind (trustfp);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue