From 5870d275d69aef036d452a4f051f247d46130854 Mon Sep 17 00:00:00 2001 From: Simon Leary Date: Thu, 24 Apr 2025 14:05:40 -0400 Subject: [PATCH 01/11] add check for special characters in login shell --- resources/lib/UnityUser.php | 4 ++- webroot/panel/account.php | 52 ++++++++++++++++++++++++++++++++++++- 2 files changed, 54 insertions(+), 2 deletions(-) diff --git a/resources/lib/UnityUser.php b/resources/lib/UnityUser.php index ccf7fb9e..6fe2548d 100644 --- a/resources/lib/UnityUser.php +++ b/resources/lib/UnityUser.php @@ -446,8 +446,10 @@ public function getSSHKeys($ignorecache = false) */ public function setLoginShell($shell, $operator = null, $send_mail = true) { - // FIXME throw error if shell is not ascii // ldap schema syntax is "IA5 String (1.3.6.1.4.1.1466.115.121.1.26)" + if (!mb_check_encoding($shell, 'ASCII')) { + throw new Exception("non ascii characters are not allowed in a login shell!"); + } $ldapUser = $this->getLDAPUser(); if ($ldapUser->exists()) { $ldapUser->setAttribute("loginshell", $shell); diff --git a/webroot/panel/account.php b/webroot/panel/account.php index 9e6272da..cd843393 100644 --- a/webroot/panel/account.php +++ b/webroot/panel/account.php @@ -257,7 +257,6 @@
-