Fixup protocol mismatch between greeter and kcheckpass

Authored by fvogt on Jun 4 2017, 6:48 PM.



The receiver (kcheckpass) reads a string and if it is !nullptr, reads an int:

msg = GRecvStr ();
if (msg && (GRecvInt() & IsPassword) && !*msg)

The sender (kscreenlocker_greet) sends a string and if it is not empty,
sends an int:

if (!m_password.isEmpty()) {

		// IsSecret


This does not work out for empty strings, as those still have a length of 1,
resulting in kcheckpass waiting indefinitely for an int that does not get sent.
Testing for a nullptr on the sender side instead of the string length fixes this.

Also clean up the code duplication and IsSecret (1)/IsPassword (2) mismatch.

BUG: 380491

Test Plan

Reproduced the bug without this patch, with this patch it does not
happen anymore. Authentication still works and fails as expected.

Diff Detail

R133 KScreenLocker
Automatic diff as part of commit; lint not applicable.
Automatic diff as part of commit; unit tests not applicable.
fvogt created this revision.Jun 4 2017, 6:48 PM
Restricted Application added a project: Plasma. · View Herald TranscriptJun 4 2017, 6:48 PM
fvogt added a comment.Jun 4 2017, 6:59 PM

The target branch should obviously be Plasma/5.10, but as I'm not sure how to adjust that with arc I can just commit it there instead.

davidedmundson accepted this revision.Jun 4 2017, 8:24 PM
davidedmundson added a subscriber: davidedmundson.

Good analysis. If we had a badge for hero of the week, it would go to you.

Btw there's a qbytearray.isNull() you can use.

This revision is now accepted and ready to land.Jun 4 2017, 8:24 PM
This revision was automatically updated to reflect the committed changes.