From 4739c68a6cb81cae53cd7df694ecd6176d6f11f8 Mon Sep 17 00:00:00 2001 From: mdw Date: Wed, 21 Apr 2004 00:38:34 +0000 Subject: [PATCH] Copy attributes from parameter keys. --- key.1 | 3 ++- keyutil.c | 12 +++++++++++- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/key.1 b/key.1 index 1b6c7e5..5c7bee6 100644 --- a/key.1 +++ b/key.1 @@ -267,7 +267,8 @@ key-generation algorithms have a subsidiary key size. .TP .BI "\-p, \-\-parameters " tag Selects a key containing parameter values to copy. Not all -key-generation algorithms allow the use of shared parameters. +key-generation algorithms allow the use of shared parameters. A new key +also inherits attributes from its parameter key. .TP .BI "\-e, \-\-expire " expire The expiry date for the generated key. This may be the string diff --git a/keyutil.c b/keyutil.c index 0251b43..13b8784 100644 --- a/keyutil.c +++ b/keyutil.c @@ -1,6 +1,6 @@ /* -*-c-*- * - * $Id: keyutil.c,v 1.24 2004/04/08 01:36:15 mdw Exp $ + * $Id: keyutil.c,v 1.25 2004/04/21 00:38:22 mdw Exp $ * * Simple key manager program * @@ -248,6 +248,8 @@ static void mpkey(key_data *kd, const char *tag, mp *m, unsigned f) static int copyparam(keyopts *k, const char **pp) { key_filter kf; + key_attriter i; + const char *n, *v; /* --- Quick check if no parameters supplied --- */ @@ -271,6 +273,14 @@ static int copyparam(keyopts *k, const char **pp) kf.m = KF_CATMASK; if (!key_copy(&k->k->k, &k->p->k, &kf)) die(EXIT_FAILURE, "unexpected failure while copying parameters"); + + /* --- Copy over attributes --- */ + + for (key_mkattriter(&i, k->p); key_nextattr(&i, &n, &v); ) + key_putattr(k->kf, k->k, n, v); + + /* --- Done --- */ + return (1); } -- 2.11.0