diff options
author | pjd <pjd@FreeBSD.org> | 2005-09-10 07:43:03 +0000 |
---|---|---|
committer | pjd <pjd@FreeBSD.org> | 2005-09-10 07:43:03 +0000 |
commit | e74d0361d3a1e489a136b899dd637e3c004c6ab6 (patch) | |
tree | dc2c9302689a90727048a0c84ab04d5775a28a00 | |
parent | ea5e582b96e1d9ae20a4dfb62eb1f7235c71694d (diff) | |
download | FreeBSD-src-e74d0361d3a1e489a136b899dd637e3c004c6ab6.zip FreeBSD-src-e74d0361d3a1e489a136b899dd637e3c004c6ab6.tar.gz |
Even if there are no valid keys in metadata, but provider is attached
we can still use setkey subcommand.
MFC after: 3 days
Found by: regression tests
-rw-r--r-- | sbin/geom/class/eli/geom_eli.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/sbin/geom/class/eli/geom_eli.c b/sbin/geom/class/eli/geom_eli.c index 987392f..a5f7964 100644 --- a/sbin/geom/class/eli/geom_eli.c +++ b/sbin/geom/class/eli/geom_eli.c @@ -727,6 +727,11 @@ eli_setkey_detached(struct gctl_req *req, const char *prov, unsigned nkey; int error; + if (md->md_keys == 0) { + gctl_error(req, "No valid keys on %s.", prov); + return; + } + /* Generate key for Master Key decryption. */ if (eli_genkey(req, md, key, 0) == NULL) { bzero(key, sizeof(key)); @@ -838,11 +843,6 @@ eli_setkey(struct gctl_req *req) if (eli_metadata_read(req, prov, &md) == -1) return; - if (md.md_keys == 0) { - gctl_error(req, "No valid keys on %s.", prov); - return; - } - if (eli_is_attached(prov)) eli_setkey_attached(req, prov, &md); else |