Skip to content

Commit

Permalink
add: more logging for KeePass
Browse files Browse the repository at this point in the history
  • Loading branch information
MircoBabin committed Apr 6, 2023
1 parent 73aec93 commit 82cd68f
Showing 1 changed file with 34 additions and 3 deletions.
37 changes: 34 additions & 3 deletions src/BuildStamp/CommandSignExecutable.cs
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,39 @@ public ProgramExitCode Run(ProgramOutput output, ProgramArguments args)
fieldnames,
new string[] { args.KeePassCertificateAttachment });

if (entry != null && entry.Title != args.KeePassCertificateTitle)
entry = null;
if (entry != null)
{
if (entry.CommunicationVia != null && entry.CommunicationVia.Count > 0)
{
var via = entry.CommunicationVia[0];
Console.WriteLine();
Console.WriteLine("Communicated with KeePass via " + via.SendVia.ToString() + ".");

if (via.XmlConfigFilename != null)
{
string config = Path.GetFullPath(via.XmlConfigFilename);
Console.WriteLine("Used configuration: " + config);
}

if (via.SendVia == KeePassCommand.CommunicationType.FileSystem)
{
Console.WriteLine("Used filesystem: " + via.FileSystemDirectory);
}

Console.WriteLine();
}

if (entry.Title != args.KeePassCertificateTitle)
{
Console.WriteLine("Could not retrieve KeePass entry.");
Console.WriteLine("When using filesystem communication, has KeePass entry \"KeePassCommander.FileSystem ...\"");
Console.WriteLine("the following line in the notes section:");
Console.WriteLine("KeePassCommanderListAddItem=" + args.KeePassCertificateTitle);
Console.WriteLine();

entry = null;
}
}
}
catch (Exception ex)
{
Expand All @@ -85,7 +116,7 @@ public ProgramExitCode Run(ProgramOutput output, ProgramArguments args)
{
output.WriteOutputLine("Error retrieving certificate from KeePass.");
output.WriteOutputLine("1) KeePass is closed or locked.");
output.WriteOutputLine("2) --keepass-certificate-title does not exist");
output.WriteOutputLine("2) --keepass-certificate-title \"" + args.KeePassCertificateTitle + "\" does not exist or is not allowed to be queried.");
return ProgramExitCode.CertificateError;
}

Expand Down

0 comments on commit 82cd68f

Please sign in to comment.