[libcalamares] Redacted -> RedactedCommand
- For logging (shell) commands where a password might become visible, use RedactedCommand. Rename it to allow for other kinds of redaction, too.
This commit is contained in:
parent
7cc84b89be
commit
7b3c4db8f0
@ -229,7 +229,7 @@ toString( const QVariant& v )
|
|||||||
}
|
}
|
||||||
|
|
||||||
QDebug&
|
QDebug&
|
||||||
operator<<( QDebug& s, const Redacted& l )
|
operator<<( QDebug& s, const RedactedCommand& l )
|
||||||
{
|
{
|
||||||
// Special case logging: don't log the (encrypted) password.
|
// Special case logging: don't log the (encrypted) password.
|
||||||
if ( l.list.contains( "usermod" ) )
|
if ( l.list.contains( "usermod" ) )
|
||||||
|
@ -214,9 +214,9 @@ public:
|
|||||||
* since the log may get posted to bug reports, or stored in
|
* since the log may get posted to bug reports, or stored in
|
||||||
* the target system.
|
* the target system.
|
||||||
*/
|
*/
|
||||||
struct Redacted
|
struct RedactedCommand
|
||||||
{
|
{
|
||||||
Redacted( const QStringList& l )
|
RedactedCommand( const QStringList& l )
|
||||||
: list( l )
|
: list( l )
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
@ -224,7 +224,7 @@ struct Redacted
|
|||||||
const QStringList& list;
|
const QStringList& list;
|
||||||
};
|
};
|
||||||
|
|
||||||
QDebug& operator<<( QDebug& s, const Redacted& l );
|
QDebug& operator<<( QDebug& s, const RedactedCommand& l );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Formatted logging of a pointer
|
* @brief Formatted logging of a pointer
|
||||||
|
@ -163,7 +163,7 @@ Calamares::Utils::Runner::run()
|
|||||||
} );
|
} );
|
||||||
}
|
}
|
||||||
|
|
||||||
cDebug() << Logger::SubEntry << "Running" << Logger::Redacted( m_command );
|
cDebug() << Logger::SubEntry << "Running" << Logger::RedactedCommand( m_command );
|
||||||
process.start();
|
process.start();
|
||||||
if ( !process.waitForStarted() )
|
if ( !process.waitForStarted() )
|
||||||
{
|
{
|
||||||
@ -225,13 +225,13 @@ Calamares::Utils::Runner::run()
|
|||||||
{
|
{
|
||||||
if ( !output.isEmpty() )
|
if ( !output.isEmpty() )
|
||||||
{
|
{
|
||||||
cDebug() << Logger::SubEntry << "Target cmd:" << Logger::Redacted( m_command ) << "Exit code:" << r
|
cDebug() << Logger::SubEntry << "Target cmd:" << Logger::RedactedCommand( m_command ) << "Exit code:" << r
|
||||||
<< "output:\n"
|
<< "output:\n"
|
||||||
<< Logger::NoQuote << output;
|
<< Logger::NoQuote << output;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
cDebug() << Logger::SubEntry << "Target cmd:" << Logger::Redacted( m_command ) << "Exit code:" << r
|
cDebug() << Logger::SubEntry << "Target cmd:" << Logger::RedactedCommand( m_command ) << "Exit code:" << r
|
||||||
<< "(no output)";
|
<< "(no output)";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user