Bug #4157
openndnsec-export: confusing error message when getpass is unavailable
0%
Description
Environment: Ubuntu 14.04
Steps to reproduce:
vagrant@m0212:~$ rm -rf .ndn
vagrant@m0212:~$ ndnsec-keygen /identity | ndnsec-cert-install -
OK: certificate with name [/identity/KEY/%8E%B9%B5%98%0C%40%AC%CB/self/%FD%00%00%01%5C%F3%A1%40%CC] has been successfully installed
vagrant@m0212:~$ ndnsec-export -o mykey.ndnkey /identity
ERROR: invalid password
Updated by Junxiao Shi over 7 years ago
- Assignee set to Zhiyi Zhang
- Estimated time changed from 1.00 h to 2.00 h
There are two problems.
First, getpass
is not properly detected, as seen in ndn-cxx/build/config.log
:
----------------------------------------------------
Checking for function getpass
==>
#include <unistd.h>
int main(int argc, char **argv) {
void *p;
(void)argc; (void)argv;
p=(void*)(getpass);
((void)(p));
return 0;
}
<==
[1/2] Compiling ESC[32mbuild/.conf_check_bef817a4e1e3fc7a929916a51bee77c1/test.cppESC[0m
['/usr/bin/g++', '-O0', '-Og', '-g3', '-pedantic', '-Wall', '-Wextra', '-Werror', '-Wnon-virtual-dtor', '-Wno-unused-parameter', '-Wno-error=maybe-uninitialized', '-Wno-error=deprecated-declarations', '-Wno-missing-field-initializers', '-std=c++11', '-D_DEBUG', '-DHAVE_STD_TO_STRING=1', '-DHAVE_IS_DEFAULT_CONSTRUCTIBLE=1', '-DHAVE_IS_NOTHROW_MOVE_CONSTRUCTIBLE=1', '-DHAVE_IS_NOTHROW_MOVE_ASSIGNABLE=1', '-DHAVE_PTHREAD=1', '-DHAVE_RT=1', '../test.cpp', '-c', '-o', '/home/vagrant/ndn-cxx/build/.conf_check_bef817a4e1e3fc7a929916a51bee77c1/testbuild/test.cpp.1.o']
err: ../test.cpp: In function ‘int main(int, char**)’:
../test.cpp:6:19: error: ISO C++ forbids casting between pointer-to-function and pointer-to-object [-Werror=pedantic]
p=(void*)(getpass);
^
cc1plus: all warnings being treated as errors
from /home/vagrant/ndn-cxx: Test does not build: Traceback (most recent call last):
File "/home/vagrant/ndn-cxx/.waf-1.8.9-849024857bd41c3cf8e87dc01ecf79b0/waflib/Configure.py", line 343, in run_build
bld.compile()
File "/home/vagrant/ndn-cxx/.waf-1.8.9-849024857bd41c3cf8e87dc01ecf79b0/waflib/Build.py", line 184, in compile
raise Errors.BuildError(self.producer.error)
BuildError: Build failed
-> task in 'testprog' failed (exit status 1):
{task 139639119270416: cxx test.cpp -> test.cpp.1.o}
['/usr/bin/g++', '-O0', '-Og', '-g3', '-pedantic', '-Wall', '-Wextra', '-Werror', '-Wnon-virtual-dtor', '-Wno-unused-parameter', '-Wno-error=maybe-uninitialized', '-Wno-error=deprecated-declarations', '-Wno-missing-field-initializers', '-std=c++11', '-D_DEBUG', '-DHAVE_STD_TO_STRING=1', '-DHAVE_IS_DEFAULT_CONSTRUCTIBLE=1', '-DHAVE_IS_NOTHROW_MOVE_CONSTRUCTIBLE=1', '-DHAVE_IS_NOTHROW_MOVE_ASSIGNABLE=1', '-DHAVE_PTHREAD=1', '-DHAVE_RT=1', '../test.cpp', '-c', '-o', '/home/vagrant/ndn-cxx/build/.conf_check_bef817a4e1e3fc7a929916a51bee77c1/testbuild/test.cpp.1.o']
not found
from /home/vagrant/ndn-cxx: The configuration failed
----------------------------------------------------
Second, error message is confusing when getpass
is unavailable.
ndn::ndnsec::getPassword
should print a warning indicating that getpass
is unavailable so the relevant function cannot be used.
Addressing the first problem would mask the second problem, so the second problem should be fixed before the first one.
Updated by Junxiao Shi over 7 years ago
- Subject changed from ndnsec-export: http://named-data.net/doc/ndn-cxx/current/ to ndnsec-export: ERROR: invalid password
Updated by Davide Pesavento over 7 years ago
First, getpass is not properly detected
We had fixed this problem before (#2419), but then I broke it again in commit 2bf35a6a37a4fb9943bc918910657d56c04dfb53
. Better to add a comment this time.
Updated by Davide Pesavento over 7 years ago
- Related to Bug #2419: wscript misdetects availability of functions for conditional compilation (getpass, setegid, ...) added
Updated by Davide Pesavento about 7 years ago
- Related to Bug #4296: Xcode >= 9.0 triggers -Wundefined-func-template warnings/errors in boost headers added
Updated by Zhiyi Zhang about 7 years ago
We cannot reproduce the error with the newest version of ndn-cxx.
Updated by Davide Pesavento about 7 years ago
Zhiyi Zhang wrote:
We cannot reproduce the error with the newest version of ndn-cxx.
I think the configure-time detection was fixed in #4296, so on a normal build you cannot experience the confusing error message related to getpass
. You need to forcefully disable getpass
to properly reproduce the issue.
Updated by Junxiao Shi about 7 years ago
- Blocks deleted (Task #4275: Release 0.6.0)
Updated by Junxiao Shi about 7 years ago
- Target version changed from v0.6 to v0.7
I think the configure-time detection was fixed in #4296, so on a normal build you cannot experience the confusing error message related to
getpass
.
This issue is no longer blocking the release, but the error message still should be fixed.
Updated by Davide Pesavento about 7 years ago
- Subject changed from ndnsec-export: ERROR: invalid password to ndnsec-export: confusing error message when getpass is unavailable
- Priority changed from Normal to Low
- Start date deleted (
06/29/2017)
Updated by Junxiao Shi over 6 years ago
- Related to Bug #4579: getpass is obsolete added
Updated by Junxiao Shi over 6 years ago
- Category changed from Security to Tools
Updated by Davide Pesavento almost 6 years ago
- Related to deleted (Bug #4296: Xcode >= 9.0 triggers -Wundefined-func-template warnings/errors in boost headers)
Updated by Davide Pesavento over 3 years ago
What should be the behavior of ndnsec export
when getpass
is not available? Should the tool refuse to run? Or ask the user to supply the passphrase via the -P
option, even if it's insecure? Or something else?