Fix setting of initial passwords for new users
AbandonedPublic

Authored by davidedmundson on Jan 29 2020, 12:07 AM.

Details

Reviewers
meven
Group Reviewers
Plasma
Summary

This is somewhat a simple fix for 5.18.0, but this really needs
revisiting.

The probelm is that newUserSetData is called N times for various
properties. From the POV of this method, there is no way to no we're on
teh last property. It simply checks for username and realname.

However, the order the N properties are inserted is effectively
undefined.

The two things together don't work.

This patch also blocks for the password.
Ideally it needs to be setData, setData, setData, then some new flush
method.

There's a technical regression that you can no longer create a user account
with no password, but that's arguably a feature.

CCBUG: 416801

Test Plan

Created a new user
Looked in /etc/shadow

Diff Detail

Repository
R128 User Manager
Branch
Plasma/5.18
Lint
No Linters Available
Unit
No Unit Test Coverage
Build Status
Buildable 21760
Build 21778: arc lint + arc unit
Restricted Application added a project: Plasma. · View Herald TranscriptJan 29 2020, 12:07 AM
Restricted Application added a subscriber: plasma-devel. · View Herald Transcript
davidedmundson requested review of this revision.Jan 29 2020, 12:07 AM
davidedmundson planned changes to this revision.Jan 29 2020, 12:14 AM

Aha, found what changed it:

2471fa7d252de904b305dac77171fa300d66c05d

  • if (!roles.contains(Username) || !roles.contains(RealName) || !roles.contains(Administrator)) {

+ if (!roles.contains(Username) || !roles.contains(RealName)) {

because administrator is set last, it was previously effectively doing what this patch is doing

*but* on closer inspection what this is doing should work regardless, any setData that wasn't needed for creating an account was buffered, any new stuff in theory is on the same row, that row now has an entry in m_users so it should make the call

Oh gosh, every time someone touches that KCM to fix a bug, it breaks something else. :/ It's so fragile.

meven accepted this revision.Jan 29 2020, 8:04 AM
davidedmundson abandoned this revision.Jan 29 2020, 6:10 PM