["Dr. Andreas Kr?ger" <[EMAIL PROTECTED]> - 14:58PM Tuesday Oct  5]:

> In case it matters: When reporting the bug, I had manually re-adjusted 
> Sympa's $HOME to /home/sympa. Upgrading from version 3.4.4.3-6 to version 
> 4.1.2-1 today again moved it back to /var/lib/sympa, again removing the 
> mailing list functionality for me.
> 
> 
>    # diff -u0 /backup/etc/passwd /etc/passwd
>    --- /backup/etc/passwd  2004-09-27 11:51:35.000000000 +0200
>    +++ /etc/passwd 2004-10-05 13:10:09.000000000 +0200
>    @@ -37 +37 @@
>    -sympa:x:104:1012:Sympa mailing list manager:/home/sympa:/bin/bash
>    +sympa:x:104:1012:Sympa mailing list manager:/var/lib/sympa:/bin/false

From sympa-4.1.5/debian/postinst ...

> # creating sympa user if he isn't already there
> if ! grep -q ^sympa: /etc/passwd; then
>         echo Adding system user: sympa.
>         adduser --system --ingroup sympa --home /var/spool/sympa sympa
> fi
> 
> usermod -c "Sympa mailing list manager" sympa
> usermod -d "/var/lib/sympa"        sympa
> usermod -g "sympa"                 sympa
> usermod -s "/bin/false"            sympa

This sill change the comment/homedir/shell of the 'sympa' user every
time the package is upgraded. I believe it may be best to at least put
the group (-g), comment (-c) and shell (-s) usermod lines inside the
"grep /etc/passwd" check. This way, local admin changes will be
preseved.

If the behavour is not dependant on having ~sympa = /var/lib/sympa,
then I believe the homedir (-d) usermod line should also be inside
that 'if' condition. (I also notice that the 'adduser' and 'usermod'
lines for the sympa user's homedirectory don't match. Historical
reasons?)

In addition, I don't believe it is appropriate to check for the
existance of a user by using grep on /etc/passwd - there are other
methods that the local administrator may use, such as libnss-db, where
the user details are stored elsewhere. I believe it would be more
appropriate to use the "id" command, something like:

+ if ! id sympa 2>/dev/null ; then

(And similar for 'grep .. /etc/group').

Matt.

Reply via email to