chkname.c, pwck.c, useradd.c, usermod.c, newusers.c: Allow names that do not conform to standards

Closes #121.

Changelog: squashed commits fixing tab style
Changelog: update 'return true' to match file's style (no parens).
This commit is contained in:
ed
2019-08-23 21:42:37 +01:00
committed by Serge Hallyn
parent 5687be5f31
commit a2cd3e9ef0
9 changed files with 93 additions and 5 deletions

View File

@@ -206,6 +206,8 @@ static void update_faillog (void);
static void move_mailbox (void);
#endif
extern int allow_bad_names;
static void date_to_str (/*@unique@*//*@out@*/char *buf, size_t maxsize,
long int date)
{
@@ -408,6 +410,7 @@ static /*@noreturn@*/void usage (int status)
"\n"
"Options:\n"),
Prog);
(void) fputs (_(" -b, --badnames allow bad names\n"), usageout);
(void) fputs (_(" -c, --comment COMMENT new value of the GECOS field\n"), usageout);
(void) fputs (_(" -d, --home HOME_DIR new home directory for the user account\n"), usageout);
(void) fputs (_(" -e, --expiredate EXPIRE_DATE set account expiration date to EXPIRE_DATE\n"), usageout);
@@ -991,6 +994,7 @@ static void process_flags (int argc, char **argv)
int c;
static struct option long_options[] = {
{"append", no_argument, NULL, 'a'},
{"badnames", no_argument, NULL, 'b'},
{"comment", required_argument, NULL, 'c'},
{"home", required_argument, NULL, 'd'},
{"expiredate", required_argument, NULL, 'e'},
@@ -1020,7 +1024,7 @@ static void process_flags (int argc, char **argv)
{NULL, 0, NULL, '\0'}
};
while ((c = getopt_long (argc, argv,
"ac:d:e:f:g:G:hl:Lmop:R:s:u:UP:"
"abc:d:e:f:g:G:hl:Lmop:R:s:u:UP:"
#ifdef ENABLE_SUBIDS
"v:w:V:W:"
#endif /* ENABLE_SUBIDS */
@@ -1032,6 +1036,9 @@ static void process_flags (int argc, char **argv)
case 'a':
aflg = true;
break;
case 'b':
allow_bad_names = true;
break;
case 'c':
if (!VALID (optarg)) {
fprintf (stderr,