Skip to content

Commit

Permalink
src/useradd.c: E_BAD_NAME: Use a different error code for bad login n…
Browse files Browse the repository at this point in the history
…ames

Wrappers like adduser(8) want to do their own stuff if the login name is
bad.  For that, they need to be able to differentiate such an error.

Closes: <#1103>
Suggested-by: Chris Hofstaedtler <[email protected]>
Cc: Marc 'Zugschlus' Haber <[email protected]>
Reviewed-by: Serge Hallyn <[email protected]>
Signed-off-by: Alejandro Colomar <[email protected]>
  • Loading branch information
alejandro-colomar committed Feb 8, 2025
1 parent 1d7dfa0 commit 01ddd7d
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/useradd.c
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,7 @@ static bool home_added = false;
#define E_SUB_UID_UPDATE 16 /* can't update the subordinate uid file */
#define E_SUB_GID_UPDATE 18 /* can't update the subordinate gid file */
#endif /* ENABLE_SUBIDS */
#define E_BAD_NAME 19 /* Bad login name */

#define DGROUP "GROUP"
#define DGROUPS "GROUPS"
Expand Down Expand Up @@ -1549,7 +1550,7 @@ static void process_flags (int argc, char **argv)
user_name, AUDIT_NO_ID,
SHADOW_AUDIT_FAILURE);
#endif
exit (E_BAD_ARG);
exit (E_BAD_NAME);
}
if (!dflg) {
char *uh;
Expand Down

0 comments on commit 01ddd7d

Please sign in to comment.