debian/patches/506_relaxed_usernames: Fix refreshing the patch

Gbp-Dch: Ignore
This commit is contained in:
Balint Reczey
2022-11-11 12:59:33 +01:00
parent 326f1566ef
commit c8e1dcbb4b

View File

@@ -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 @@