src: Disable use of getpass() when it is not available
For example, getpass is not available on Android platform.
Change-Id: I4c3039a3fcf188fd9343d625a551d268a4a20a93
diff --git a/tools/ndnsec/unlock-tpm.hpp b/tools/ndnsec/unlock-tpm.hpp
index 23cfc83..607efb1 100644
--- a/tools/ndnsec/unlock-tpm.hpp
+++ b/tools/ndnsec/unlock-tpm.hpp
@@ -29,6 +29,7 @@
int
ndnsec_unlock_tpm(int argc, char** argv)
{
+#ifndef NDN_CXX_HAVE_GETPASS
using namespace ndn;
namespace po = boost::program_options;
@@ -78,6 +79,10 @@
std::cerr << "ERROR: TPM is still locked" << std::endl;
return 1;
}
+#else
+ std::cerr << "ERROR: Command not supported on this platform" << std::endl;
+ return 1;
+#endif // NDN_CXX_HAVE_GETPASS
}
#endif // NDN_TOOLS_NDNSEC_UNLOCK_TPM_HPP
diff --git a/tools/ndnsec/util.hpp b/tools/ndnsec/util.hpp
index 6f55478..2de9ff1 100644
--- a/tools/ndnsec/util.hpp
+++ b/tools/ndnsec/util.hpp
@@ -46,6 +46,7 @@
bool
getPassword(std::string& password, const std::string& prompt)
{
+#ifndef NDN_CXX_HAVE_GETPASS
bool isReady = false;
char* pw0 = 0;
@@ -78,6 +79,9 @@
return false;
return isReady;
+#else
+ return false;
+#endif // NDN_CXX_HAVE_GETPASS
}
ndn::shared_ptr<ndn::IdentityCertificate>