Module Name:    src
Committed By:   elric
Date:           Thu Dec  2 04:54:32 UTC 2010

Modified Files:
        src/sbin/cgdconfig: cgdconfig.c

Log Message:
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+net...@mumble.net>.


To generate a diff of this commit:
cvs rdiff -u -r1.29 -r1.30 src/sbin/cgdconfig/cgdconfig.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sbin/cgdconfig/cgdconfig.c
diff -u src/sbin/cgdconfig/cgdconfig.c:1.29 src/sbin/cgdconfig/cgdconfig.c:1.30
--- src/sbin/cgdconfig/cgdconfig.c:1.29	Sat Nov 27 17:08:36 2010
+++ src/sbin/cgdconfig/cgdconfig.c	Thu Dec  2 04:54:32 2010
@@ -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 @@
 
 	/* 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);

Reply via email to