device revokation: password check failure and crash
Affects: latest daemon master with opendht from the contribs
How to reproduce:
You will need an account A with non-empty password (let's say "123456789")
- open GNOME client
- go to account A's settings
- try to revoke device, password is asked
- enter empty password
Expected: daemon detects bad password and GNOME client displays bad password dialog.
What happens: daemon fails to catch bad password & dht crashes.
gdb stacktrace:
[1533936396.816|15896|ringaccount.cpp :2119 ] Query for local certificate store: 4e9fcf8b3abab01b5bf17a974090a0c91f7c3f87: 1 found.
[Thread 0x7fffeaddf700 (LWP 15901) exited]
[Thread 0x7fffe8ddb700 (LWP 15905) exited]
[1533936402.917|15896|ringaccount.cpp :3292 ] [Account 9fba7138a1fc3f51] found 1 devices for c2383a4923f3f3ead1b9f725456e8ff9d69581a3
[1533936413.395|15913|ringaccount.cpp :926 ] [Account 9fba7138a1fc3f51] reading account archive
[1533936413.395|15913|fileutils.cpp :424 ] Reading archive from /home/hlefeuvre/.local/share/ring/9fba7138a1fc3f51/export.gz
[1533936414.505|15913|fileutils.cpp :441 ] Error decrypting archive: Can't decrypt data
[1533936414.505|15913|thread_pool.cpp :79 ] Exception running task: Can't decrypt data
Dropping packet with high delay: 0.826318
[1533936418.547|15913|ringaccount.cpp :926 ] [Account 9fba7138a1fc3f51] reading account archive
[1533936418.547|15913|fileutils.cpp :424 ] Reading archive from /home/hlefeuvre/.local/share/ring/9fba7138a1fc3f51/export.gz
[1533936418.547|15913|accountarchive.cpp:31 ] Loading account archive (10664 bytes)
[New Thread 0x7fffe8ddb700 (LWP 15932)]
[Thread 0x7fffe8ddb700 (LWP 15932) exited]
Thread 1 "dring" received signal SIGSEGV, Segmentation fault.
0x0000000000b08f94 in dht::crypto::Certificate::getExpiration() const ()
(gdb) bt
#0 0x0000000000b08f94 in dht::crypto::Certificate::getExpiration() const ()
#1 0x0000000000b0c6a2 in dht::crypto::RevocationList::sign(dht::crypto::PrivateKey const&, dht::crypto::Certificate const&, std::chrono::duration<long, std::ratio<1l, 1000000000l> >) ()
#2 0x00000000006569a7 in dht::crypto::RevocationList::sign (this=0x6030003516b0, id=...) at /home/hlefeuvre/Development/ring-daemon/contrib/x86_64-linux-gnu/include/opendht/crypto.h:212
#3 0x000000000060eeba in ring::RingAccount::<lambda(const std::shared_ptr<dht::crypto::Certificate>&)>::operator()(const std::shared_ptr<dht::crypto::Certificate> &) (__closure=0x6080000958a0,
crt=std::shared_ptr (count 4, weak 0) 0x60800000fe30) at ringaccount.cpp:1123
#4 0x000000000063eda3 in std::_Function_handler<void(const std::shared_ptr<dht::crypto::Certificate>&), ring::RingAccount::revokeDevice(const string&, const string&)::<lambda(const std::shared_ptr<dht::crypto::Certificate>&)> >::_M_invoke(const std::_Any_data &, const std::shared_ptr<dht::crypto::Certificate> &) (__functor=..., __args#0=std::shared_ptr (count 4, weak 0) 0x60800000fe30)
at /usr/include/c++/5/functional:1871
#5 0x0000000000678909 in std::function<void (std::shared_ptr<dht::crypto::Certificate> const&)>::operator()(std::shared_ptr<dht::crypto::Certificate> const&) const (this=0x7fffffffcb80,
__args#0=std::shared_ptr (count 4, weak 0) 0x60800000fe30) at /usr/include/c++/5/functional:2267
#6 0x000000000062720f in ring::RingAccount::findCertificate(dht::Hash<20ul> const&, std::function<void (std::shared_ptr<dht::crypto::Certificate> const&)>&&) (this=0x623000007110, h=...,
cb=<unknown type in /home/hlefeuvre/Development/ring-daemon/bin/dring, CU 0x4b98e6, DIE 0x5f4616>) at ringaccount.cpp:2580
#7 0x000000000060f774 in ring::RingAccount::revokeDevice (this=0x623000007110, password="", device="25a30306bd68013858d55f9edad096c65f523048") at ringaccount.cpp:1133
#8 0x0000000000527061 in DRing::revokeDevice (accountID="9fba7138a1fc3f51", password="", deviceID="25a30306bd68013858d55f9edad096c65f523048") at configurationmanager.cpp:308
#9 0x00000000004d163b in DBusConfigurationManager::revokeDevice (this=0x61500001f980, accountID="9fba7138a1fc3f51", password="", device="25a30306bd68013858d55f9edad096c65f523048")
at dbusconfigurationmanager.cpp:93
#10 0x00000000004dcf7b in cx::ring::Ring::ConfigurationManager_adaptor::_revokeDevice_stub (this=0x61500001f980, call=...) at dbusconfigurationmanager.adaptor.h:1495
#11 0x00000000004fa932 in DBus::Callback<cx::ring::Ring::ConfigurationManager_adaptor, DBus::Message, DBus::CallMessage const&>::call (this=0x6030000249a0, param=...)
at /home/hlefeuvre/Development/ring-daemon/contrib/x86_64-linux-gnu/include/dbus-c++-1/dbus-c++/util.h:283
#12 0x0000000000505cff in DBus::Slot<DBus::Message, DBus::CallMessage const&>::call(DBus::CallMessage const&) const () at /usr/include/c++/5/ext/new_allocator.h:120
#13 0x0000000000504df2 in DBus::InterfaceAdaptor::dispatch_method(DBus::CallMessage const&) () at /usr/include/c++/5/ext/new_allocator.h:120
#14 0x000000000050d777 in DBus::ObjectAdaptor::handle_message(DBus::Message const&) () at /usr/include/c++/5/ext/new_allocator.h:120
#15 0x000000000050ccee in DBus::ObjectAdaptor::Private::message_function_stub(DBusConnection*, DBusMessage*, void*) () at /usr/include/c++/5/ext/new_allocator.h:120
#16 0x00007ffff6c3f813 in ?? () from /lib/x86_64-linux-gnu/libdbus-1.so.3
#17 0x00007ffff6c30d94 in dbus_connection_dispatch () from /lib/x86_64-linux-gnu/libdbus-1.so.3
#18 0x00000000004fc812 in DBus::Connection::Private::do_dispatch() () at /usr/include/c++/5/ext/new_allocator.h:120
#19 0x00000000004ff779 in DBus::Dispatcher::dispatch_pending(std::__cxx11::list<DBus::Connection::Private*, std::allocator<DBus::Connection::Private*> >&) ()
at /usr/include/c++/5/ext/new_allocator.h:120
#20 0x00000000004ff577 in DBus::Dispatcher::dispatch_pending() () at /usr/include/c++/5/ext/new_allocator.h:120
#21 0x00000000005032ca in DBus::BusDispatcher::do_iteration() () at /usr/include/c++/5/ext/new_allocator.h:120
#22 0x0000000000502f78 in DBus::BusDispatcher::enter() () at /usr/include/c++/5/ext/new_allocator.h:120
#23 0x0000000000459fcf in DBusClient::event_loop (this=0x60600000a340) at dbusclient.cpp:250
#24 0x00000000004541d1 in main (argc=2, argv=0x7fffffffdc88) at main.cpp:236