(agent_marktrusted): Check whether the trustlist is

writable.
This commit is contained in:
Werner Koch 2004-01-28 16:19:46 +00:00
parent 4453659c9a
commit fa5d1513a2
4 changed files with 23 additions and 1 deletions

View File

@ -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.

View File

@ -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)

View File

@ -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 */
};

View File

@ -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);