In -G, refuse to operate if KEYGEN_URANDOM is specified as we already do

for KEYGEN_RANDOMKEY.

Print a warning if such a refusal is made---this will help the user understand
why there is an error.

Patch provided by:  Taylor R Campbell <campbell+netbsd@mumble.net>.
This commit is contained in:
elric 2010-12-02 04:54:32 +00:00
parent 574c2fc5a2
commit 7de6a71be4
1 changed files with 12 additions and 4 deletions

View File

@ -1,4 +1,6 @@
/* $NetBSD: cgdconfig.c,v 1.29 2010/11/27 17:08:36 elric Exp $ */
#define opendisk1(x,y,z,t,u,v) opendisk(x,y,z,t,u)
/* $NetBSD: cgdconfig.c,v 1.30 2010/12/02 04:54:32 elric Exp $ */
/*-
* Copyright (c) 2002, 2003 The NetBSD Foundation, Inc.
@ -33,7 +35,7 @@
#ifndef lint
__COPYRIGHT("@(#) Copyright (c) 2002, 2003\
The NetBSD Foundation, Inc. All rights reserved.");
__RCSID("$NetBSD: cgdconfig.c,v 1.29 2010/11/27 17:08:36 elric Exp $");
__RCSID("$NetBSD: cgdconfig.c,v 1.30 2010/12/02 04:54:32 elric Exp $");
#endif
#include <err.h>
@ -872,11 +874,17 @@ generate_convert(struct params *p, int argc, char **argv, const char *outfile)
/* for sanity, we ensure that none of the keygens are randomkey */
for (kg=p->keygen; kg; kg=kg->next)
if (kg->kg_method == KEYGEN_RANDOMKEY)
if ((kg->kg_method == KEYGEN_RANDOMKEY) ||
(kg->kg_method == KEYGEN_URANDOMKEY)) {
warnx("can't preserve randomly generated key");
goto bail;
}
for (kg=oldp->keygen; kg; kg=kg->next)
if (kg->kg_method == KEYGEN_RANDOMKEY)
if ((kg->kg_method == KEYGEN_RANDOMKEY) ||
(kg->kg_method == KEYGEN_URANDOMKEY)) {
warnx("can't preserve randomly generated key");
goto bail;
}
if (!params_verify(oldp)) {
warnx("invalid old parameters file \"%s\"", *argv);