Skip to content

Commit

Permalink
Bug 1331594 - nss-tool needs to check whether given DB path exists r=…
Browse files Browse the repository at this point in the history
…ttaubert

Differential Revision: https://nss-review.dev.mozaws.net/D151

--HG--
extra : amend_source : e7fa0a2289448575e58bc4c01ace453b1b795915
  • Loading branch information
sg-dev1 committed Jan 17, 2017
1 parent df12a25 commit 29082bf
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions nss-tool/db/dbtool.cc
Expand Up @@ -14,6 +14,7 @@
#include <cert.h>
#include <certdb.h>
#include <nss.h>
#include <prio.h>

static std::string PrintFlags(unsigned int flags) {
std::stringstream ss;
Expand Down Expand Up @@ -58,6 +59,12 @@ bool DBTool::Run(const std::vector<std::string> &arguments) {
std::string initDir(".");
if (parser.Has("--path")) {
initDir = parser.Get("--path");
if (PR_Access(initDir.c_str(), PR_ACCESS_READ_OK) != PR_SUCCESS) {
std::cerr << "Directory '" << initDir
<< "' does not exists or you don't have permissions!"
<< std::endl;
return false;
}
}

if (!parser.Has("--list-certs")) {
Expand Down

0 comments on commit 29082bf

Please sign in to comment.