mirror of
git://git.gnupg.org/gnupg.git
synced 2025-01-17 14:07:03 +01:00
(agent_marktrusted): Check whether the trustlist is
writable.
This commit is contained in:
parent
4453659c9a
commit
fa5d1513a2
@ -1,3 +1,8 @@
|
||||
2004-01-28 Werner Koch <wk@gnupg.org>
|
||||
|
||||
* trustlist.c (agent_marktrusted): Check whether the trustlist is
|
||||
writable.
|
||||
|
||||
2004-01-27 Werner Koch <wk@gnupg.org>
|
||||
|
||||
* sexp-parse.h: Moved to ../common.
|
||||
|
@ -134,7 +134,7 @@ ask_for_card (CTRL ctrl, const unsigned char *shadow_info, char **r_kid)
|
||||
}
|
||||
|
||||
|
||||
/* Put the DIGEST into an DER encoded comtainer and return it in R_VAL. */
|
||||
/* Put the DIGEST into an DER encoded container and return it in R_VAL. */
|
||||
static int
|
||||
encode_md_for_card (const unsigned char *digest, size_t digestlen, int algo,
|
||||
unsigned char **r_val, size_t *r_len)
|
||||
|
@ -303,6 +303,7 @@ agent_handle_learn (void *assuan_context)
|
||||
101, /* trusted */
|
||||
102, /* useful */
|
||||
100, /* regular */
|
||||
/* We don't include 110 here because gpgsm can't handle it. */
|
||||
-1 /* end of list */
|
||||
};
|
||||
|
||||
|
@ -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…
x
Reference in New Issue
Block a user