Skip to content

Commit

Permalink
fix handling of encrypted LVM based proposal on partitioned Dm, Md an…
Browse files Browse the repository at this point in the history
…d Dasd devices (bnc#805169)
  • Loading branch information
Thomas Fehr committed Mar 5, 2013
1 parent d2e2761 commit 2224cb9
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 3 deletions.
9 changes: 9 additions & 0 deletions libstorage/src/Dasd.cc
Expand Up @@ -275,6 +275,15 @@ int Dasd::createPartition( PartitionType type, unsigned long start,
cylinderToKb(len), Region(start, len), type);
p->setCreated();
device = p->device();
PartPair pp = partPair();
for( PartIter i = pp.begin(); i != pp.end(); ++i)
{
if (i->deleted() && i->nr()==p->nr() && !i->getCryptPwd().empty())
{
y2mil("harvesting old password");
p->setCryptPwd(i->getCryptPwd());
}
}
addToList( p );
}
y2mil("ret:" << ret);
Expand Down
9 changes: 9 additions & 0 deletions libstorage/src/DmPartCo.cc
Expand Up @@ -95,6 +95,15 @@ DmPartCo::addNewDev(string& device)
dm->getFsInfo( p );
dm->setCreated();
dm->addUdevData();
ConstDmPartPair pp = dmpartPair();
for( ConstDmPartIter i=pp.begin(); i!=pp.end(); ++i )
{
if( i->deleted() && i->nr()==p->nr() && !i->getCryptPwd().empty())
{
y2mil("harvesting old password");
dm->setCryptPwd(i->getCryptPwd());
}
}
addToList( dm );
}
handleWholeDevice();
Expand Down
9 changes: 9 additions & 0 deletions libstorage/src/MdPartCo.cc
Expand Up @@ -166,6 +166,15 @@ MdPartCo::addNewDev(string& device)
md->getFsInfo( p );
md->setCreated();
md->addUdevData();
ConstMdPartPair pp = mdpartPair();
for( ConstMdPartIter i=pp.begin(); i!=pp.end(); ++i )
{
if( i->deleted() && i->nr()==p->nr() && !i->getCryptPwd().empty())
{
y2mil("harvesting old password");
md->setCryptPwd(i->getCryptPwd());
}
}
addToList( md );
y2mil("device:" << device << " was added to MdPartCo : " << dev);

Expand Down
7 changes: 4 additions & 3 deletions libstorage/src/Volume.cc
Expand Up @@ -3324,12 +3324,13 @@ std::ostream& operator<< (std::ostream& s, const Volume &v )
if( v.encryption != v.orig_encryption &&
v.orig_encryption!=storage::ENC_NONE )
s << " orig_encr:" << toString(v.orig_encryption);
}
#ifdef DEBUG_CRYPT_PASSWORD
if( !v.crypt_pwd.empty() )
s << " pwd:" << v.crypt_pwd;
if( v.orig_crypt_pwd.empty() && v.crypt_pwd!=v.orig_crypt_pwd )
s << " orig_pwd:" << v.orig_crypt_pwd;
if( !v.orig_crypt_pwd.empty() && v.crypt_pwd!=v.orig_crypt_pwd )
s << " orig_pwd:" << v.orig_crypt_pwd;
#endif
}
if( !v.dmcrypt_dev.empty() )
s << " dmcrypt:" << v.dmcrypt_dev;
if( v.dmcrypt_active )
Expand Down

0 comments on commit 2224cb9

Please sign in to comment.