diff options
author | pjd <pjd@FreeBSD.org> | 2006-02-01 15:01:55 +0000 |
---|---|---|
committer | pjd <pjd@FreeBSD.org> | 2006-02-01 15:01:55 +0000 |
commit | 85ddd3fd4b73db4a1426cf41a08394afc841d542 (patch) | |
tree | 196f97a1dae4e867971a01f3790ecec07862ff32 /sbin | |
parent | 07c68a91e26ee2f1014495097ebfc66a5ac43b50 (diff) | |
download | FreeBSD-src-85ddd3fd4b73db4a1426cf41a08394afc841d542.zip FreeBSD-src-85ddd3fd4b73db4a1426cf41a08394afc841d542.tar.gz |
Deny init/attach/setkey subcommands when no key components are given.
MFC after: 3 days
Tested with: prove /usr/src/tools/regression/geom_eli
Diffstat (limited to 'sbin')
-rw-r--r-- | sbin/geom/class/eli/geom_eli.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/sbin/geom/class/eli/geom_eli.c b/sbin/geom/class/eli/geom_eli.c index 13bdb90f..76655a3 100644 --- a/sbin/geom/class/eli/geom_eli.c +++ b/sbin/geom/class/eli/geom_eli.c @@ -303,7 +303,10 @@ eli_genkey(struct gctl_req *req, struct g_eli_metadata *md, unsigned char *key, g_eli_crypto_hmac_init(&ctx, NULL, 0); str = gctl_get_ascii(req, new ? "newkeyfile" : "keyfile"); - if (str[0] != '\0') { + if (str[0] == '\0' && nopassphrase) { + gctl_error(req, "No key components given."); + return (NULL); + } else if (str[0] != '\0') { char buf[MAXPHYS]; ssize_t done; int fd; |