<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugs.kde.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.6"
          urlbase="https://bugs.kde.org/"
          
          maintainer="sysadmin@kde.org"
>

    <bug>
          <bug_id>380491</bug_id>
          
          <creation_ts>2017-06-03 06:13:32 +0000</creation_ts>
          <short_desc>kscreenlocker_greet incorrect behaviour after pressing enter key with empty password</short_desc>
          <delta_ts>2017-06-06 07:53:58 +0000</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>10</classification_id>
          <classification>Unmaintained</classification>
          <product>kscreenlocker</product>
          <component>greeter</component>
          <version>unspecified</version>
          <rep_platform>Neon</rep_platform>
          <op_sys>Linux</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>NOR</priority>
          <bug_severity>critical</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Bhargavi H R">hrbhargavi</reporter>
          <assigned_to name="Plasma Bugs List">plasma-bugs-null</assigned_to>
          <cc>asturm</cc>
    
    <cc>bshah</cc>
    
    <cc>demm</cc>
    
    <cc>fabian</cc>
    
    <cc>hrbhargavi</cc>
    
    <cc>kde</cc>
    
    <cc>kirkjobsluder</cc>
    
    <cc>mgraesslin</cc>
    
    <cc>tobias.erthal</cc>
          
          <cf_commitlink>https://commits.kde.org/kscreenlocker/23fa33cedfa55cbac83bbdcc514b988d721552dc</cf_commitlink>
          <cf_versionfixedin></cf_versionfixedin>
          <cf_sentryurl></cf_sentryurl>
          <votes>0</votes>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>1679132</commentid>
    <comment_count>0</comment_count>
    <who name="Bhargavi H R">hrbhargavi</who>
    <bug_when>2017-06-03 06:13:32 +0000</bug_when>
    <thetext>Version: 5.10.0

In locked screen of KDE plasma 5.10, if you press enter/return key without entering any password, then after that even if you enter correct password it says &apos;Unlocking failed&apos;.

Please fix it soon.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1679163</commentid>
    <comment_count>1</comment_count>
    <who name="Kai Uwe Broulik">kde</who>
    <bug_when>2017-06-03 10:15:41 +0000</bug_when>
    <thetext>I noticed some odd behavior in screen locker indeed but I never figured out why that happens - thanks for the hint with submitting empty breaking it.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1679184</commentid>
    <comment_count>2</comment_count>
    <who name="Tobias Erthal">tobias.erthal</who>
    <bug_when>2017-06-03 16:08:05 +0000</bug_when>
    <thetext>I think I&apos;ve encountered the same issue.
Version: 5.10.0

I noticed that I am unable to unlock the lockscreen after the screen went off.

I can unlock the lockscreen with my password without any problem:
- If I lock the screen using ctrl+alt+L.
- If I put the computer in standby and wake it up again.

I cannot unlock the lockscreen (error: &quot;Unlocking failed&quot;):
- If I wait until the screen goes off and wake it up (sometimes using enter).

However, I can always use &quot;loginctl unlock-session&quot; to unlock from another tty.
Downgrading kscreenlocker to 5.9.5 fixes the issue.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1680507</commentid>
    <comment_count>3</comment_count>
    <who name="Kai Uwe Broulik">kde</who>
    <bug_when>2017-06-04 15:00:19 +0000</bug_when>
    <thetext>This can also be reproduced by running kscreenlocker_greet --testing and then typing in an empty password as first password. What happens:

It initializes KCheckPass, sends the password (which is empty) to it, gets a ConvPutAuthFailed and then a ConvGetHidden request. Whenever it gets a request it sets m_ready to false and only sets it back to true when it receives a ConvPutReadyForAuthentication.

When we end up in ConvGetHidden it only sends back a 1 to kcheckpass if (!m_password.isEmpty()) and then it is never put back to ready and any subsequent request fails. If I remove the isEmpty check, it works, but I have no idea of the codebase and I also don&apos;t know what ConvGetHidden means and what &quot;IsSecret&quot; means, so I don&apos;t want to randomly change things here to make it somehow work... :(</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1680539</commentid>
    <comment_count>4</comment_count>
    <who name="Fabian Vogt">fabian</who>
    <bug_when>2017-06-04 18:31:50 +0000</bug_when>
    <thetext>I believe I figured out the issue, it&apos;s a simple protocol mismatch between sender and receiver.

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

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

GRecvStr returns a nullptr if the received string has a length of 0 or malloc fails.

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

            GSendStr(m_password.toUtf8().constData());
            if (!m_password.isEmpty()) {
                // IsSecret
                GSendInt(1);
            }

Obviously that does not match, as an empty string still has a length of 1, so kcheckpass will not receive the int it expects.

I&apos;ll test that and make a patch that cleans it up a bit. Although I&apos;m not quite sure what &quot;IsSecret&quot; (which should&apos;ve been &quot;IsPassword&quot; instead, which even has a different value now!) was originally supposed to mean, I&apos;ll leave it as-is.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1680545</commentid>
    <comment_count>5</comment_count>
    <who name="Fabian Vogt">fabian</who>
    <bug_when>2017-06-04 18:50:48 +0000</bug_when>
    <thetext>(In reply to Fabian Vogt from comment #4)
&gt; I&apos;ll test that and make a patch that cleans it up a bit. Although I&apos;m not
&gt; quite sure what &quot;IsSecret&quot; (which should&apos;ve been &quot;IsPassword&quot; instead, which
&gt; even has a different value now!) was originally supposed to mean, I&apos;ll leave
&gt; it as-is.

Please test and review: https://phabricator.kde.org/D6091</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1680557</commentid>
    <comment_count>6</comment_count>
    <who name="">demm</who>
    <bug_when>2017-06-04 19:44:27 +0000</bug_when>
    <thetext>Patch tested, fixes the issue for KaOS, kscreenlocker 5.10.0, Qt 5.9.0.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1680569</commentid>
    <comment_count>7</comment_count>
    <who name="Fabian Vogt">fabian</who>
    <bug_when>2017-06-04 20:32:29 +0000</bug_when>
    <thetext>Git commit 23fa33cedfa55cbac83bbdcc514b988d721552dc by Fabian Vogt.
Committed on 04/06/2017 at 18:57.
Pushed by fvogt into branch &apos;Plasma/5.10&apos;.

Fixup protocol mismatch between greeter and kcheckpass

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

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

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

	GSendStr(m_password.toUtf8().constData());
	if (!m_password.isEmpty()) {
		// IsSecret
		GSendInt(1);
	}

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.

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

Reviewers: #plasma

Subscribers: plasma-devel

Tags: #plasma

Differential Revision: https://phabricator.kde.org/D6091

M  +7    -15   greeter/authenticator.cpp

https://commits.kde.org/kscreenlocker/23fa33cedfa55cbac83bbdcc514b988d721552dc</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1680778</commentid>
    <comment_count>8</comment_count>
    <who name="Kai Uwe Broulik">kde</who>
    <bug_when>2017-06-06 04:10:00 +0000</bug_when>
    <thetext>*** Bug 380509 has been marked as a duplicate of this bug. ***</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1680803</commentid>
    <comment_count>9</comment_count>
    <who name="Tobias Erthal">tobias.erthal</who>
    <bug_when>2017-06-06 07:53:58 +0000</bug_when>
    <thetext>(In reply to Fabian Vogt from comment #5)
&gt; (In reply to Fabian Vogt from comment #4)
&gt; &gt; I&apos;ll test that and make a patch that cleans it up a bit. Although I&apos;m not
&gt; &gt; quite sure what &quot;IsSecret&quot; (which should&apos;ve been &quot;IsPassword&quot; instead, which
&gt; &gt; even has a different value now!) was originally supposed to mean, I&apos;ll leave
&gt; &gt; it as-is.
&gt; 
&gt; Please test and review: https://phabricator.kde.org/D6091

Patch fixes the issue on ArchLinux x86_64 as well.</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>