diff options
author | Stefan Gschiel <stefan.gschiel.sg@gmail.com> | 2017-01-17 12:05:39 +0100 |
---|---|---|
committer | Stefan Gschiel <stefan.gschiel.sg@gmail.com> | 2017-01-17 12:05:39 +0100 |
commit | ce297c1b5e5a8fdf6d4f61103d461b1a2737dbcc (patch) | |
tree | 6fd843ebf0d7a3b00418cd8972c4ec8c2e71b040 /nss-tool | |
parent | e2c9b1926e0fad22f4e3e712e091a2a7d0e67ce9 (diff) | |
download | nss-hg-ce297c1b5e5a8fdf6d4f61103d461b1a2737dbcc.tar.gz |
Bug 1331594 - nss-tool needs to check whether given DB path exists r=ttaubert
Differential Revision: https://nss-review.dev.mozaws.net/D151
Diffstat (limited to 'nss-tool')
-rw-r--r-- | nss-tool/db/dbtool.cc | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/nss-tool/db/dbtool.cc b/nss-tool/db/dbtool.cc index 413a83d91..ca11fe722 100644 --- a/nss-tool/db/dbtool.cc +++ b/nss-tool/db/dbtool.cc @@ -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; @@ -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")) { |