fix register.php in-use username

Signed-off-by: Skylar "The Cobra" Widulski <cobra@vern.cc>
This commit is contained in:
Skylar "The Cobra" Widulski 2022-09-04 17:08:04 -04:00
parent 33f61161c7
commit 4493f7fa94
Signed by: cobra
GPG Key ID: 4FD8F812083FF6F9
1 changed files with 2 additions and 2 deletions

View File

@ -29,7 +29,7 @@
if ($_SERVER['REQUEST_METHOD'] == "POST") {
if (!empty($_POST['username'])) {
if (preg_match($username_re, $_POST['username']) === 1) {
if (preg_match('/^' . $username . ':x:\d+:\d+:[\w\d\s,@()]*:[\w\d\s\/]*:[\d\s\w\/]*/m', file_get_contents('/sshfs/etc/passwd')) !== 1) {
if (!file_exists('/vm/' . $_POST['username'])) {
if (!file_exists("/var/tmp/register/" . sanitize($_POST['username'])))
$username = sanitize($_POST['username']);
else $username_err = "A request for the username " . $_POST['username'] . " exists already. Try again later or choose a different username.";
@ -64,7 +64,7 @@
}
if (!empty($_POST['ssh'])) {
$ret = shell_exec("bash -c 'ssh-keygen -lf - <<< " . escapeshellarg($_POST['ssh']) . " &> /dev/null ; printf %d $?'");
$ret = shell_exec("bash -c \"ssh-keygen -lf - <<< " . escapeshellarg($_POST['ssh']) . " &> /dev/null ; printf %d $?\"");
if ($ret == 0) {
$ssh = $_POST['ssh'];
} else {