Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
ghost opened this issue Apr 23, 2013 · 2 comments

Comments

@ghost
Copy link

ghost commented Apr 23, 2013

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

@da2ce7
Copy link
Contributor

da2ce7 commented Apr 25, 2013

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
Copy link
Contributor

da2ce7 commented Apr 25, 2013

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant