From 375babc34dc1d82694572317a8a42d8c3c336ecd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hans-Ulrich=20J=C3=BCttner?= Date: Tue, 28 Nov 2017 10:22:56 +0100 Subject: [PATCH] Bugfix for missing option -nssdir and help message for that option --- utils/pdfsig.cc | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/utils/pdfsig.cc b/utils/pdfsig.cc index c69c2ab..b6a2c5f 100644 --- a/utils/pdfsig.cc +++ b/utils/pdfsig.cc @@ -99,7 +99,7 @@ static char reason[256] = ""; static const ArgDesc argDesc[] = { {"-nssdir", argGooString, &nssDir, 0, - "don't perform certificate validation"}, + "path to directory of libnss3 database"}, {"-nocert", argFlag, &dontVerifyCert, 0, "don't perform certificate validation"}, {"-sign", argInt, &signatureNumber, 0, @@ -197,7 +197,7 @@ int main(int argc, char *argv[]) fws->setSignatureType(ETSI_CAdES_detached); const char* pw = (strlen(password) == 0) ? nullptr : password; const char* rs = (strlen(reason) == 0) ? nullptr : reason; - if (fws->signDocument(nssDir.getCString(), argv[2], certNickname, digestName, pw, rs)) { + if (fws->signDocument(nssDir.getLength() ? nssDir.getCString() : nullptr, argv[2], certNickname, digestName, pw, rs)) { exitCode = 0; goto end; } else { @@ -215,7 +215,7 @@ int main(int argc, char *argv[]) } for (unsigned int i = 0; i < sigCount; i++) { - sig_info = sig_widgets.at(i)->validateSignature(nssDir.getCString(), !dontVerifyCert, false, -1 /* now */); + sig_info = sig_widgets.at(i)->validateSignature(nssDir.getLength() ? nssDir.getCString() : nullptr, !dontVerifyCert, false, -1 /* now */); printf("Signature #%u:\n", i+1); printf(" - Signer Certificate Common Name: %s\n", sig_info->getSignerName()); printf(" - Signer full Distinguished Name: %s\n", sig_info->getSubjectDN()); -- 1.9.1