Deny init/attach/setkey subcommands when no key components are given.

MFC after:	3 days
Tested with:	prove /usr/src/tools/regression/geom_eli
This commit is contained in:
Pawel Jakub Dawidek 2006-02-01 15:01:55 +00:00
parent 366454f2fd
commit f1650f412f
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=155183

View File

@ -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;