summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBalint Reczey <balint@balintreczey.hu>2022-11-11 12:59:33 +0100
committerBalint Reczey <balint@balintreczey.hu>2022-11-11 12:59:33 +0100
commitb4c00e119f97707cd4301d9bc875eee503b1e65c (patch)
tree67cc236679251beaf5e95d9bc5a6a69b745202d0
parent326f1566ef0168e0c5aa85bb3b6211f27279e54c (diff)
downloadshadow-b4c00e119f97707cd4301d9bc875eee503b1e65c.tar.gz
debian/patches/506_relaxed_usernames: Fix refreshing the patchdebian/1%4.13+dfsg1-1
Gbp-Dch: Ignore
-rw-r--r--debian/patches/506_relaxed_usernames60
1 files changed, 41 insertions, 19 deletions
diff --git a/debian/patches/506_relaxed_usernames b/debian/patches/506_relaxed_usernames
index b8b1ce17..0e066d91 100644
--- a/debian/patches/506_relaxed_usernames
+++ b/debian/patches/506_relaxed_usernames
@@ -17,20 +17,28 @@ Details:
--- a/libmisc/chkname.c
+++ b/libmisc/chkname.c
-@@ -31,6 +31,7 @@
- return true;
+@@ -32,44 +32,26 @@
}
-+#if 0
/*
- * User/group names must match gnu e-regex:
- * [a-zA-Z0-9_.][a-zA-Z0-9_.-]{0,30}[a-zA-Z0-9_.$-]?
-@@ -52,8 +53,28 @@
- *name == '.')) {
- return false;
- }
-+#endif
-+ /*
+- * User/group names must match gnu e-regex:
+- * [a-zA-Z0-9_.][a-zA-Z0-9_.-]{0,30}[a-zA-Z0-9_.$-]?
+- *
+- * as a non-POSIX, extension, allow "$" as the last char for
+- * sake of Samba 3.x "add machine script"
+- *
+- * Also do not allow fully numeric names or just "." or "..".
+- */
+- int numeric;
+-
+- if ('\0' == *name ||
+- ('.' == *name && (('.' == name[1] && '\0' == name[2]) ||
+- '\0' == name[1])) ||
+- !((*name >= 'a' && *name <= 'z') ||
+- (*name >= 'A' && *name <= 'Z') ||
+- (*name >= '0' && *name <= '9') ||
+- *name == '_' ||
+- *name == '.')) {
+ * POSIX indicate that usernames are composed of characters from the
+ * portable filename character set [A-Za-z0-9._-], and that the hyphen
+ * should not be used as the first character of a portable user name.
@@ -41,20 +49,34 @@ Details:
+ || ('-' == *name)
+ || ('~' == *name)
+ || ('+' == *name)) {
-+ return false;
-+ }
+ return false;
+ }
+-
+- numeric = isdigit(*name);
+-
+- while ('\0' != *++name) {
+- if (!((*name >= 'a' && *name <= 'z') ||
+- (*name >= 'A' && *name <= 'Z') ||
+- (*name >= '0' && *name <= '9') ||
+- *name == '_' ||
+- *name == '.' ||
+- *name == '-' ||
+- (*name == '$' && name[1] == '\0')
+- )) {
+ do {
+ if ((':' == *name) || (',' == *name) || isspace(*name)) {
-+ return false;
-+ }
+ return false;
+ }
+- numeric &= isdigit(*name);
+- }
+ name++;
+ } while ('\0' != *name);
-- numeric = isdigit(*name);
-+ int numeric = isdigit(*name);
+- return !numeric;
++ return true;
+ }
- while ('\0' != *++name) {
- if (!((*name >= 'a' && *name <= 'z') ||
+ bool is_valid_user_name (const char *name)
--- a/man/useradd.8.xml
+++ b/man/useradd.8.xml
@@ -708,6 +708,14 @@