use same regex for Samba profile path

This commit is contained in:
Roland Gruber 2004-04-23 15:34:22 +00:00
parent e91f0bd591
commit ba6f56e09a
2 changed files with 3 additions and 2 deletions

View File

@ -443,7 +443,7 @@ switch ($_POST['select']) {
if ( (!$account_new->smb_scriptPath=='') && (!eregi('^([\\])*([a-z0-9\\._%äöüß-])+(\\\([a-z0-9\\._%äöüß-])+)*((\.bat)|(\.cmd))$', $account_new->smb_scriptPath)))
$errors[] = array('ERROR', _('Logon script'), _('Logon script is invalid!'));
if ( (!$account_new->smb_profilePath=='') && (!eregi('^[/][a-z]([a-z]|[0-9]|[.]|[-]|[_]|[%])*([/][a-z]([a-z]|[0-9]|[.]|[-]|[_]|[%])*)*$', $account_new->smb_profilePath))
&& (!ereg('^[\][\]([a-z]|[A-Z]|[0-9]|[.]|[-]|[%])+([\]([a-z]|[A-Z]|[0-9]|[.]|[-]|[%])+)+$', $account_new->smb_profilePath)))
&& (!eregi('^[\][\]([a-z0-9_]|[.]|[-]|[%])+([\]([a-z0-9_]|[.]|[-]|[%])+)+$', $account_new->smb_profilePath)))
$errors[] = array('ERROR', _('Profile path'), _('Profile path is invalid!'));
if ((!$account_new->smb_domain=='') && (!is_object($account_new->smb_domain)) && !ereg('^([a-z]|[A-Z]|[0-9]|[-])+$', $account_new->smb_domain))
$errors[] = array('ERROR', _('Domain name'), _('Domain name contains invalid characters. Valid characters are: a-z, A-Z, 0-9 and -.'));

View File

@ -198,7 +198,8 @@ if ($_GET['type'] == "user") {
exit;
}
if (get_magic_quotes_gpc() == 1) $_POST['smb_profilepath'] = stripslashes($_POST['smb_profilepath']);
if ($_POST['smb_profilepath'] && eregi("^[\][\]([a-z0-9])+([\][a-z0-9_\\-\\$%]+)+$", $_POST['smb_profilepath'])) {
if ($_POST['smb_profilepath'] && (eregi("^[\][\]([a-z0-9])+([\][a-z0-9_\\-\\$%]+)+$", $_POST['smb_profilepath']) ||
eregi('^[/][a-z]([a-z]|[0-9]|[.]|[-]|[_]|[%])*([/][a-z]([a-z]|[0-9]|[.]|[-]|[_]|[%])*)*$', $_POST['smb_profilepath']))) {
$acct->smb_profilePath = $_POST['smb_profilepath'];
}
elseif ($_POST['smb_profilepath']) {