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

@@ -46,11 +46,18 @@
#include "defines.h"
#include "chkname.h"
int allow_bad_names = false;
static bool is_valid_name (const char *name)
{
if (allow_bad_names) {
return true;
}
/*
* User/group names must match [a-z_][a-z0-9_-]*[$]
*/
if (('\0' == *name) ||
!((('a' <= *name) && ('z' >= *name)) || ('_' == *name))) {
return false;