Bug 73838

Summary: Add abstraction for useradd/remove/etc.
Product: accountsservice Reporter: Allison Lortie (desrt) <desrt>
Component: generalAssignee: Matthias Clasen <mclasen>
Status: RESOLVED MOVED QA Contact:
Severity: normal    
Priority: medium CC: ajacoutot, lantw44, marius.vollmer, robert.ancell, rstrode, stefw
Version: unspecified   
Hardware: Other   
OS: All   
Whiteboard:
i915 platform: i915 features:
Attachments: Support Debian based user management

Description Allison Lortie (desrt) 2014-01-20 15:24:46 UTC
We currently hardcode a argv list to useradd and other commands more or less smack in the middle of a bunch of other code.  Trouble is that the required commands are different on Debian-based systems and different again on BSD.

I think we should split out a separate file with add_user() rm_user() etc. functions which construct the argv the way each system likes it.  That way we can add cases for various systems and keep the #ifdef mess well-contained.

Some vendor patches to look at:

Debian: http://patch-tracker.debian.org/patch/series/view/accountsservice/0.6.21-8/0002-create-and-manage-groups-like-on-a-debian-system.patch
BSD: http://www.marcuscom.com:8080/viewvc/viewvc.cgi/marcuscom/ports/trunk/sysutils/accountsservice/files/patch-src_daemon.c?revision=17112&view=markup
Comment 1 Robert Ancell 2017-12-20 22:10:11 UTC
I was looking at a patch that would check for the existence of adduser which is the required command on Debian-based systems. However, Fedora provides adduser as a symlink to useradd, so it couldn't be runtime checked easily.
Comment 2 Robert Ancell 2017-12-21 21:47:57 UTC
Created attachment 136352 [details] [review]
Support Debian based user management

It's not beautiful but I think this better reflects how A-S is being used. This allows BSD etc to add a similar change for the method they need. We can always come up with a nicer abstraction in the future but I haven't been able to think of one.
Comment 3 GitLab Migration User 2018-08-07 09:33:13 UTC
-- GitLab Migration Automatic Message --

This bug has been migrated to freedesktop.org's GitLab instance and has been closed from further activity.

You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.freedesktop.org/accountsservice/accountsservice/issues/38.

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.