otapij icon indicating copy to clipboard operation
otapij copied to clipboard

OTServer crashes if an invalid cached key is used during newserver creation.

Open ghost opened this issue 11 years ago • 2 comments

I found the crash caused by entering the wrong key for the cached key. Here is an excerpt from gdb at the end of the otserver creation process:

BuildFolderPath: Made New Folder: /home/barry/.ot/server_data/contracts/ OTSymmetricKey::SerializeFrom: Error: host_is_generated, Bad value: 288. (Expected 0 or 1.) Passphrase request for: "We do not have a check hash yet for this password, please enter your password" (OT) passphrase: (Verifying) passphrase again:

[New Thread 0x7ffff3bdc700 (LWP 7227)] [Thread 0x7ffff3bdc700 (LWP 7227) exited]

Program received signal SIGSEGV, Segmentation fault. OTPassword::getPasswordSize (this=0x0) at OTPassword.cpp:766 (gdb)

The function that fails is:

uint32_t OTPassword::getPasswordSize() const { OT_ASSERT(m_bIsText); return m_nPasswordSize; }

The program is trying to access m_bIsText inside the OT_ASSERT macro, but the this pointer is NULL.

The call stack is: #0 OTPassword::getPasswordSize (this=0x0) at OTPassword.cpp:766 #1 0x00007ffff78360f5 in OTAsymmetricKey_OpenSSL::LoadPrivateKeyFromCertString (this=, strCert=..., bEscaped=, pstrReason=0x7fffffffc4c0, pImportPassword=0x0) at OTAsymmetricKey.cpp:659 #2 0x00007ffff785955e in OTKeyCredential::SetPrivateContents (this=0x671bf0, mapPrivate=..., pImportPassword=0x0) at OTCredential.cpp:2157 #3 0x00007ffff7858dd0 in OTSubcredential::ProcessXMLNode (this=0x671bf0, xml=@0x7fffffffca18: 0x675140) at OTCredential.cpp:1074 #4 0x00007ffff78590fe in OTMasterkey::ProcessXMLNode (this=0x671bf0, xml=@0x7fffffffca18: 0x675140) at OTCredential.cpp:1203 #5 0x00007ffff784ba96 in OTContract::LoadContractXML (this=0x671bf0) at OTContract.cpp:2280

ghost avatar Apr 23 '13 23:04 ghost

If you are using the test server data. Then you must enter 'test' . Unfortunately the test server data was generated before we had the password checking code. If you enter the correct key the first time it will not let you make a mistake in the future.

da2ce7 avatar Apr 25 '13 09:04 da2ce7

When we update the sample / test data. This issue will go away. It is only an issue when migrating old data.

da2ce7 avatar Apr 25 '13 09:04 da2ce7