Skip to content

Commit 7975929

Browse files
committed
update unityuser to do same checks on login shell as frontend does
1 parent 74a7325 commit 7975929

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

resources/lib/UnityUser.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -450,6 +450,9 @@ public function setLoginShell($shell, $operator = null, $send_mail = true)
450450
if (!mb_check_encoding($shell, 'ASCII')) {
451451
throw new Exception("non ascii characters are not allowed in a login shell!");
452452
}
453+
if ($shell != trim($shell)) {
454+
throw new Exception("leading/trailing whitespace is not allowed in a login shell!");
455+
}
453456
$ldapUser = $this->getLDAPUser();
454457
if ($ldapUser->exists()) {
455458
$ldapUser->setAttribute("loginshell", $shell);

test/functional/LoginShellSetTest.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,9 @@ public function testSetLoginShellCustom(string $shell): void
3636
if (!mb_check_encoding($shell, 'ASCII')) {
3737
$this->expectException("Exception");
3838
}
39+
if ($shell != trim($shell)) {
40+
$this->expectException("Exception");
41+
}
3942
// FIXME shell is not validated
4043
post(
4144
__DIR__ . "/../../webroot/panel/account.php",

0 commit comments

Comments
 (0)