1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53
|
Description: Use a more modern UID naming rule.
Author: Mike Gabriel <mike.gabriel@das-netzwerkteam.de>
Abstract:
When strictNamingRules are turned off in gosa.conf, we
should allow UID strings as allowed by concurrent versions
of adduser.
.
For defining "concurrent": This patch has been contributed
in 2015 (Debian jessie/stretch).
--- a/gosa-core/include/functions.inc
+++ b/gosa-core/include/functions.inc
@@ -1577,7 +1577,7 @@
if (strict_uid_mode()){
return "^[a-z0-9_-]+$";
} else {
- return "^[a-zA-Z0-9 _.-]+$";
+ return "^[_.A-Za-z0-9][-\@_.A-Za-z0-9]*\$";
}
}
--- a/gosa-core/include/utils/class_tests.inc
+++ b/gosa-core/include/utils/class_tests.inc
@@ -113,13 +113,7 @@
return (TRUE);
}
- /* STRICT adds spaces and case insenstivity to the uid check.
- This is dangerous and should not be used. */
- if (strict_uid_mode()){
- return preg_match ("/^[a-z0-9_-]+$/", $uid);
- } else {
- return preg_match ("/^[a-z0-9 _.-]+$/i", $uid);
- }
+ return preg_match ("/".get_uid_regexp()."/", $uid);
}
--- a/gosa-core/plugins/personal/generic/class_user.inc
+++ b/gosa-core/plugins/personal/generic/class_user.inc
@@ -1352,11 +1352,7 @@
/* Check for valid input */
if ($this->is_modified && !tests::is_uid($this->uid)){
- if (strict_uid_mode()){
- $message[]= msgPool::invalid(_("Login"), $this->uid, "/[a-z0-9_-]/");
- } else {
- $message[]= msgPool::invalid(_("Login"), $this->uid, "/[a-z0-9_-]/i");
- }
+ $message[]= msgPool::invalid(_("Login"), $this->uid, "/".get_uid_regexp()."/");
}
if (!tests::is_url($this->labeledURI)){
$message[]= msgPool::invalid(_("Homepage"), "", "", "http://www.your-domain.com/yourname");
|