From ac919a161ef7e311d86acb639098f76d16df10e9 Mon Sep 17 00:00:00 2001 From: Roland Gruber Date: Thu, 6 Nov 2003 22:02:58 +0000 Subject: [PATCH] allow spaces in suffixes and ou's --- lam/lib/config.inc | 10 +++++----- lam/templates/ou_edit.php | 8 ++++---- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/lam/lib/config.inc b/lam/lib/config.inc index 48b4e17e..0fd38f2a 100644 --- a/lam/lib/config.inc +++ b/lam/lib/config.inc @@ -314,7 +314,7 @@ class Config { // returns true if $value has correct format function set_Adminstring($value) { if (is_string($value) && - eregi("^([a-z0-9]|-)+=([a-z0-9]|-)+(,([a-z0-9]|-)+=([a-z0-9]|-)+)+(;([a-z0-9]|-)+=([a-z0-9]|-)+(,([a-z0-9]|-)+=([a-z0-9]|-)+)+)*$", $value)) { + eregi("^[a-z0-9\\-]+=[a-z0-9\\-]+(,[a-z0-9\\-]+=[a-z0-9 \\-]+)+(;[a-z0-9\\-]+=[a-z0-9\\-]+(,[a-z0-9\\-]+=[a-z0-9 \\-]+)+)*$", $value)) { $this->Admins = $value; } else return false; @@ -344,7 +344,7 @@ class Config { // $value: new user suffix // returns true if $value has correct format function set_UserSuffix($value) { - if (is_string($value) && (eregi("^(([a-z]|-|[0-9])*=([a-z]|-|[0-9])*)(,([a-z]|-|[0-9])*=([a-z]|-|[0-9])*)*$", $value))) { + if (is_string($value) && (eregi("^(([a-z0-9 \\-])*=([a-z0-9 \\-])*)(,([a-z0-9 \\-])*=([a-z0-9 \\-])*)*$", $value))) { $this->usersuffix = $value; } else return false; @@ -360,7 +360,7 @@ class Config { // $value: new group suffix // returns true if $value has correct format function set_GroupSuffix($value) { - if (is_string($value) && (eregi("^(([a-z]|-|[0-9])*=([a-z]|-|[0-9])*)(,([a-z]|-|[0-9])*=([a-z]|-|[0-9])*)*$", $value))) { + if (is_string($value) && (eregi("^(([a-z0-9 \\-])*=([a-z0-9 \\-])*)(,([a-z0-9 \\-])*=([a-z0-9 \\-])*)*$", $value))) { $this->groupsuffix = $value; } else return false; @@ -376,7 +376,7 @@ class Config { // $value: new host suffix // returns true if $value has correct format function set_HostSuffix($value) { - if (is_string($value) && (eregi("^(([a-z]|-|[0-9])*=([a-z]|-|[0-9])*)(,([a-z]|-|[0-9])*=([a-z]|-|[0-9])*)*$", $value))) { + if (is_string($value) && (eregi("^(([a-z0-9 \\-])*=([a-z0-9 \\-])*)(,([a-z0-9 \\-])*=([a-z0-9 \\-])*)*$", $value))) { $this->hostsuffix = $value; } else return false; @@ -393,7 +393,7 @@ class Config { // returns true if $value has correct format function set_DomainSuffix($value) { if (!$value && ($this->get_Samba3() == "no")) $this->domainsuffix = ""; - elseif (is_string($value) && (eregi("^(([a-z]|-|[0-9])*=([a-z]|-|[0-9])*)(,([a-z]|-|[0-9])*=([a-z]|-|[0-9])*)*$", $value))) { + elseif (is_string($value) && (eregi("^(([a-z0-9 \\-])*=([a-z0-9 \\-])*)(,([a-z0-9 \\-])*=([a-z0-9 \\-])*)*$", $value))) { $this->domainsuffix = $value; } else return false; diff --git a/lam/templates/ou_edit.php b/lam/templates/ou_edit.php index adefdd4a..a44cf4ca 100644 --- a/lam/templates/ou_edit.php +++ b/lam/templates/ou_edit.php @@ -39,7 +39,7 @@ if ($_POST['submit']) { // new user ou if ($_POST['type'] == "new_usr") { // create ou if valid - if (eregi("^[a-z0-9_\\-]+$", $_POST['newsuff_u'])) { + if (eregi("^[a-z0-9 _\\-]+$", $_POST['newsuff_u'])) { // check if ou already exists $new_dn = "ou=" . $_POST['newsuff_u'] . "," . $_POST['usersuff_n']; if (!in_array(strtolower($new_dn), $_SESSION['ldap']->search_units($_POST['usersuff_n']))) { @@ -104,7 +104,7 @@ if ($_POST['submit']) { // new group ou if ($_POST['type'] == "new_grp") { // create ou if valid - if (eregi("^[a-z0-9_\\-]+$", $_POST['newsuff_g'])) { + if (eregi("^[a-z0-9 _\\-]+$", $_POST['newsuff_g'])) { // check if ou already exists $new_dn = "ou=" . $_POST['newsuff_g'] . "," . $_POST['groupsuff_n']; if (!in_array(strtolower($new_dn), $_SESSION['ldap']->search_units($_POST['groupsuff_n']))) { @@ -169,7 +169,7 @@ if ($_POST['submit']) { // new host ou if ($_POST['type'] == "new_hst") { // create ou if valid - if (eregi("^[a-z0-9_\\-]+$", $_POST['newsuff_h'])) { + if (eregi("^[a-z0-9 _\\-]+$", $_POST['newsuff_h'])) { // check if ou already exists $new_dn = "ou=" . $_POST['newsuff_h'] . "," . $_POST['hostsuff_n']; if (!in_array(strtolower($new_dn), $_SESSION['ldap']->search_units($_POST['hostsuff_n']))) { @@ -234,7 +234,7 @@ if ($_POST['submit']) { // new domain ou if ($_POST['type'] == "new_dom") { // create ou if valid - if (eregi("^[a-z0-9_\\-]+$", $_POST['newsuff_d'])) { + if (eregi("^[a-z0-9 _\\-]+$", $_POST['newsuff_d'])) { // check if ou already exists $new_dn = "ou=" . $_POST['newsuff_d'] . "," . $_POST['domsuff_n']; if (!in_array(strtolower($new_dn), $_SESSION['ldap']->search_units($_POST['domsuff_n']))) {