mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-06-26 10:54:26 +02:00
CmdDiagnostics: Made sure file existence is checked before readability
This commit is contained in:
parent
5a5195fbb2
commit
68dac1b6c6
1 changed files with 47 additions and 22 deletions
|
@ -234,13 +234,53 @@ int CmdDiagnostics::execute (std::string& output)
|
||||||
<< context.config.get ("taskd.server")
|
<< context.config.get ("taskd.server")
|
||||||
<< '\n';
|
<< '\n';
|
||||||
|
|
||||||
if (context.config.get ("taskd.ca") != "")
|
std::string ca_pem = context.config.get ("taskd.ca");
|
||||||
out << " CA: "
|
out << " CA: ";
|
||||||
<< context.config.get ("taskd.ca")
|
if (ca_pem != "")
|
||||||
<< (File (context.config.get ("taskd.ca")).readable ()
|
{
|
||||||
? ", readable, " : ", not readable, ")
|
File file_ca (ca_pem);
|
||||||
<< File (context.config.get ("taskd.ca")).size ()
|
if (file_ca.exists ())
|
||||||
<< " bytes\n";
|
out << ca_pem
|
||||||
|
<< (file_ca.readable () ? ", readable, " : ", not readable, ")
|
||||||
|
<< file_ca.size ()
|
||||||
|
<< " bytes\n";
|
||||||
|
else
|
||||||
|
out << "not found\n";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
out << "-\n";
|
||||||
|
|
||||||
|
std::string cert_pem = context.config.get ("taskd.certificate");
|
||||||
|
out << "Certificate: ";
|
||||||
|
if (cert_pem != "")
|
||||||
|
{
|
||||||
|
File file_cert (cert_pem);
|
||||||
|
if (file_cert.exists ())
|
||||||
|
out << cert_pem
|
||||||
|
<< (file_cert.readable () ? ", readable, " : ", not readable, ")
|
||||||
|
<< file_cert.size ()
|
||||||
|
<< " bytes\n";
|
||||||
|
else
|
||||||
|
out << "not found\n";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
out << "-\n";
|
||||||
|
|
||||||
|
std::string key_pem = context.config.get ("taskd.key");
|
||||||
|
out << " Key: ";
|
||||||
|
if (key_pem != "")
|
||||||
|
{
|
||||||
|
File file_key (key_pem);
|
||||||
|
if (file_key.exists ())
|
||||||
|
out << key_pem
|
||||||
|
<< (file_key.readable () ? ", readable, " : ", not readable, ")
|
||||||
|
<< file_key.size ()
|
||||||
|
<< " bytes\n";
|
||||||
|
else
|
||||||
|
out << "not found\n";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
out << "-\n";
|
||||||
|
|
||||||
std::string trust_value = context.config.get ("taskd.trust");
|
std::string trust_value = context.config.get ("taskd.trust");
|
||||||
if (trust_value == "strict" ||
|
if (trust_value == "strict" ||
|
||||||
|
@ -250,20 +290,6 @@ int CmdDiagnostics::execute (std::string& output)
|
||||||
else
|
else
|
||||||
out << " Trust: Bad value - see 'man taskrc'\n";
|
out << " Trust: Bad value - see 'man taskrc'\n";
|
||||||
|
|
||||||
out << "Certificate: "
|
|
||||||
<< context.config.get ("taskd.certificate")
|
|
||||||
<< (File (context.config.get ("taskd.certificate")).readable ()
|
|
||||||
? ", readable, " : ", not readable, ")
|
|
||||||
<< File (context.config.get ("taskd.certificate")).size ()
|
|
||||||
<< " bytes\n";
|
|
||||||
|
|
||||||
out << " Key: "
|
|
||||||
<< context.config.get ("taskd.key")
|
|
||||||
<< (File (context.config.get ("taskd.key")).readable ()
|
|
||||||
? ", readable, " : ", not readable, ")
|
|
||||||
<< File (context.config.get ("taskd.key")).size ()
|
|
||||||
<< " bytes\n";
|
|
||||||
|
|
||||||
out << " Ciphers: "
|
out << " Ciphers: "
|
||||||
<< context.config.get ("taskd.ciphers")
|
<< context.config.get ("taskd.ciphers")
|
||||||
<< '\n';
|
<< '\n';
|
||||||
|
@ -412,7 +438,6 @@ int CmdDiagnostics::execute (std::string& output)
|
||||||
<< '\n';
|
<< '\n';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Check all the UUID references
|
// Check all the UUID references
|
||||||
|
|
||||||
bool noBrokenRefs = true;
|
bool noBrokenRefs = true;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue