[Pkg-clamav-devel] useradd --system does not signal an error
Sebastian Andrzej Siewior
sebastian at breakpoint.cc
Wed Mar 4 21:17:57 UTC 2015
Hi,
I've been pointed to an error in Ubuntu and I couldn't reproduce the
problem because of:
|root at debsidamd64:~# adduser --no-create-home --disabled-password --disabled-login --shell /bin/false --group --home /var/lib/clamav clamav adduser: The group `clamav' already exists.
|root at debsidamd64:~# echo $?
|1
|root at debsidamd64:~# adduser --system --no-create-home --disabled-password --disabled-login --shell /bin/false --group --home /var/lib/clamav clamav
|The system user `clamav' already exists. Exiting.
|root at debsidamd64:~# echo $?
|0
So without --system there is an error code, with --system there is none.
Is this expected? From a quick browse of useradd.c shadow package I see:
|2088 /*
|2089 * Start with a quick check to see if the user exists.
|2090 */
|2091 if (getpwnam (user_name) != NULL) { /* local, no need for xgetpwnam */
|2092 fprintf (stderr, _("%s: user '%s' already exists\n"), Prog, user_name);
|2093 #ifdef WITH_AUDIT
|2094 audit_logger (AUDIT_ADD_USER, Prog,
|2095 "adding user",
|2096 user_name, AUDIT_NO_ID,
|2097 SHADOW_AUDIT_FAILURE);
|2098 #endif
|2099 fail_exit (E_NAME_IN_USE);
|2100 }
and E_NAME_IN_USE is 9 and not 0.
Sebastian
More information about the Pkg-clamav-devel
mailing list