Subject: Bug#1014444: need rollback mechanism in case of aborts

From: Marc Haber <[email-masked]>
Date: Wed, 06 Jul 2022 10:56:27 +0200

Package: adduser
Version: 3.121
Severity: normal

Hi,

this is material for one of the next development rounds _after_ the
policy issues (especially everything around locking accounts) has been
cleared.

If adduser is aborted for some reason (for example, a lock not being
available in time, see #983405), we leave the system in some kind of
inconclusive state, such as groups having been created but accounts not
etc. So we should try to roll back the system to the state that it was
before we got invoked.

I think the easiest way would be that we have a list of commands to be
used in case of premature abort, and insert the opposite of any command
that we have executed successfully into that list. If we abort, we just
execute everthing that is in this list. If we end with success, the list
doesnt get executed.

Greetings
Marc