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]>
Signed-off-by: Alejandro Colomar <[email protected]>
  • Loading branch information
alejandro-colomar committed Dec 6, 2024
1 parent b75ea29 commit a015e91
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 a015e91

Please sign in to comment.