On Wed, Mar 05, 2025 at 01:21:24PM +0100, Vincent Lefevre wrote: > adduser foo > adduser --system foo > > That would actually be case (2). This must fail.
yes. We test that now. > (these are flags with power-of-two values, thus can be OR'ed) and > the buggy adduser 3.143 has > > if ($ret == (EXISTING_FOUND|EXISTING_SYSTEM)) { > # a user with this name already exists; it's a problem when it's not > a s > ystem user > log_fatal( mtx("The user `%s' already exists, but is not a system > user. > Exiting."), $new_name ); > exit( RET_WRONG_OBJECT_PROPERTIES ); > } > > i.e. it tests whether *only* EXISTING_FOUND and EXISTING_SYSTEM are > set. That code is fixed resp. gone. > You should add a test for case (1), i.e. when the existing system > account has a password: > > adduser --system foo > passwd foo > [add a password] > adduser --system foo That we don't at the moment. I am not sure whether we will be adding this before trixie. We can pipe things into chpasswd like in debian/tests/f/adduser_system.t: system('echo "aust:*" | chpasswd --encrypted') > adduser --system foo > echo mypassword | passwd -s foo > adduser --system foo > > This one must not fail. root@salida-sid-buildd-amd64-xzcp:/srv/build# adduser --system passwdtest root@salida-sid-buildd-amd64-xzcp:/srv/build# passwd !$ passwd passwdtest New password: Retype new password: passwd: password updated successfully root@salida-sid-buildd-amd64-xzcp:/srv/build# adduser --system passwdtest root@salida-sid-buildd-amd64-xzcp:/srv/build# echo $? 0 root@salida-sid-buildd-amd64-xzcp:/srv/build# It does not. > You should add a similar test for non-system accounts, since this > involves a different part of the code. Something like: > > adduser --disabled-password --uid 2000 foo > adduser --disabled-password --uid 2001 foo We do that now, it says "already exists" root@salida-sid-buildd-amd64-xzcp:/srv/build# adduser --disabled-password --comment "" --uid 4006 u4006 root@salida-sid-buildd-amd64-xzcp:/srv/build# adduser --disabled-password --comment "" --uid 4007 u4006 fatal: The user `u4006' already exists. root@salida-sid-buildd-amd64-xzcp:/srv/build# Greetings Marc