From a3249c62acbbf240c238c1f5237e1e50aa465882 Mon Sep 17 00:00:00 2001 From: Alexander von Gernler Date: Thu, 8 Feb 2007 16:21:10 +0000 Subject: prevent vnconfig from asking for a key when unconfiguring or listing devices. even clarify this further by supplying NULL and 0 to action() for -u case ok pedro@, no objections bluhm@ --- usr.sbin/vnconfig/vnconfig.c | 27 +++++++++++++-------------- 1 file changed, 13 insertions(+), 14 deletions(-) (limited to 'usr.sbin') diff --git a/usr.sbin/vnconfig/vnconfig.c b/usr.sbin/vnconfig/vnconfig.c index 4b4672d748a..63dc7e54165 100644 --- a/usr.sbin/vnconfig/vnconfig.c +++ b/usr.sbin/vnconfig/vnconfig.c @@ -1,4 +1,4 @@ -/* $OpenBSD: vnconfig.c,v 1.22 2007/02/02 08:54:43 grunk Exp $ */ +/* $OpenBSD: vnconfig.c,v 1.23 2007/02/08 16:21:09 grunk Exp $ */ /* * Copyright (c) 1993 University of Utah. * Copyright (c) 1990, 1993 @@ -126,20 +126,19 @@ main(int argc, char **argv) if (saltopt && (!opt_K)) errx(1, "-S only makes sense when used with -K"); - if (opt_k) { - if (opt_K) - errx(1, "-k and -K are mutually exclusive options"); - key = getpass("Encryption key: "); - keylen = strlen(key); - } else if (opt_K) { - key = get_pkcs_key(rounds, saltopt); - keylen = 128; - } - - if (action == VND_CONFIG && argc == 2) + if (action == VND_CONFIG && argc == 2) { + if (opt_k) { + if (opt_K) + errx(1, "-k and -K are mutually exclusive"); + key = getpass("Encryption key: "); + keylen = strlen(key); + } else if (opt_K) { + key = get_pkcs_key(rounds, saltopt); + keylen = 128; + } rv = config(argv[0], argv[1], action, key, keylen); - else if (action == VND_UNCONFIG && argc == 1) - rv = config(argv[0], NULL, action, key, keylen); + } else if (action == VND_UNCONFIG && argc == 1) + rv = config(argv[0], NULL, action, NULL, 0); else if (action == VND_GET) rv = getinfo(argc ? argv[0] : NULL); else -- cgit v1.2.3