Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 12 additions & 14 deletions zypp/target/rpm/RpmDb.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1170,6 +1170,7 @@ namespace
rpmts ts = ::rpmtsCreate();
::rpmtsSetRootDir( ts, root_r.c_str() );
::rpmtsSetVSFlags( ts, RPMVSF_DEFAULT );
::rpmtsSetVfyLevel( ts, requireGPGSig_r ? RPMSIG_SIGNATURE_TYPE : 0 );

rpmQVKArguments_s qva;
memset( &qva, 0, sizeof(rpmQVKArguments_s) );
Expand Down Expand Up @@ -1204,11 +1205,7 @@ namespace
std::string & line( lines[i] );
RpmDb::CheckPackageResult lineres = RpmDb::CHK_ERROR;
if ( line.find( ": OK" ) != std::string::npos )
{
lineres = RpmDb::CHK_OK;
if ( line.find( "Signature, key ID" ) == std::string::npos )
++count[RpmDb::CHK_NOSIG]; // Valid but no gpg signature -> CHK_NOSIG
}
{ lineres = RpmDb::CHK_OK; }
else if ( line.find( ": NOKEY" ) != std::string::npos )
{ lineres = RpmDb::CHK_NOKEY; }
else if ( line.find( ": BAD" ) != std::string::npos )
Expand All @@ -1218,15 +1215,20 @@ namespace
else if ( line.find( ": NOTRUSTED" ) != std::string::npos )
{ lineres = RpmDb::CHK_NOTTRUSTED; }
else if ( line.find( ": NOTFOUND" ) != std::string::npos )
{ continue; } // just collect details for signatures found (#229)
{ lineres = RpmDb::CHK_NOSIG; }
else
{ ret = RpmDb::CHK_ERROR; } // unparsable line

++count[lineres];
detail_r.push_back( RpmDb::CheckPackageDetail::value_type( lineres, std::move(line) ) );
}

RpmDb::CheckPackageResult ret = ( res ? RpmDb::CHK_ERROR : RpmDb::CHK_OK );

if ( count[RpmDb::CHK_FAIL] )
if ( count[RpmDb::CHK_ERROR] }
ret = RpmDb::CHK_ERROR;

else if ( count[RpmDb::CHK_FAIL] )
ret = RpmDb::CHK_FAIL;

else if ( count[RpmDb::CHK_NOTFOUND] )
Expand All @@ -1238,14 +1240,10 @@ namespace
else if ( count[RpmDb::CHK_NOTTRUSTED] )
ret = RpmDb::CHK_NOTTRUSTED;

else if ( ret == RpmDb::CHK_OK )
else if ( count[RpmDb::CHK_NOSIG] )
{
if ( count[RpmDb::CHK_OK] == count[RpmDb::CHK_NOSIG] )
{
detail_r.push_back( RpmDb::CheckPackageDetail::value_type( RpmDb::CHK_NOSIG, std::string(" ")+_("Package is not signed!") ) );
if ( requireGPGSig_r )
ret = RpmDb::CHK_NOSIG;
}
detail_r.push_back( RpmDb::CheckPackageDetail::value_type( RpmDb::CHK_NOSIG, std::string(" ")+_("Package is not signed!") ) );
ret = RpmDb::CHK_NOSIG;
}

if ( ret != RpmDb::CHK_OK )
Expand Down