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
This commit is contained in:
Pawel Jakub Dawidek 2005-09-10 07:43:03 +00:00
parent 457c463d8a
commit df7eabb059
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=149928

View File

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