summaryrefslogtreecommitdiff
path: root/hscript/user.cc
diff options
context:
space:
mode:
authorA. Wilcox <AWilcox@Wilcox-Tech.com>2024-10-05 07:10:47 -0500
committerA. Wilcox <AWilcox@Wilcox-Tech.com>2024-10-05 07:12:06 -0500
commit84925ed56fb4a299998773293b92c920779ccbec (patch)
tree2c62f4dac31b54f476aeb7605daec1620e23ea8f /hscript/user.cc
parentd56707af8b9c856776b546952a23686b210f22d8 (diff)
downloadhorizon-84925ed56fb4a299998773293b92c920779ccbec.tar.gz
horizon-84925ed56fb4a299998773293b92c920779ccbec.tar.bz2
horizon-84925ed56fb4a299998773293b92c920779ccbec.tar.xz
horizon-84925ed56fb4a299998773293b92c920779ccbec.zip
Refactor handling of valid account names
* Move our system_names and system_groups out to a util header. * Qt UI: Validate that the user's chosen account name is not contained in either system_names nor system_groups. Closes: #388 Acked-by: Síle Ekaterin Liszka <sheila@vulpine.house>
Diffstat (limited to 'hscript/user.cc')
-rw-r--r--hscript/user.cc20
1 files changed, 2 insertions, 18 deletions
diff --git a/hscript/user.cc b/hscript/user.cc
index 5a1d6cf..eb8813a 100644
--- a/hscript/user.cc
+++ b/hscript/user.cc
@@ -3,7 +3,7 @@
* libhscript, the HorizonScript library for
* Project Horizon
*
- * Copyright (c) 2019-2020 Adélie Linux and contributors. All rights reserved.
+ * Copyright (c) 2019-2024 Adélie Linux and contributors. All rights reserved.
* This code is licensed under the AGPL 3.0 license, as noted in the
* LICENSE-code file in the root directory of this repository.
*
@@ -21,26 +21,10 @@
#include "util/filesystem.hh"
#include "util/net.hh"
#include "util/output.hh"
+#include "util/user.hh"
using namespace Horizon::Keys;
-const static std::set<std::string> system_names = {
- "root", "bin", "daemon", "adm", "lp", "sync", "shutdown", "halt", "mail",
- "news", "uucp", "operator", "man", "postmaster", "cron", "ftp", "sshd",
- "at", "squid", "xfs", "games", "postgres", "cyrus", "vpopmail", "utmp",
- "catchlog", "alias", "qmaild", "qmailp", "qmailq", "qmailr", "qmails",
- "qmaill", "ntp", "smmsp", "guest", "nobody"
-};
-
-const static std::set<std::string> system_groups = {
- "root", "bin", "daemon", "sys", "adm", "tty", "disk", "lp", "mem", "kmem",
- "wheel", "floppy", "mail", "news", "uucp", "man", "cron", "console",
- "audio", "cdrom", "dialout", "ftp", "sshd", "input", "at", "tape", "video",
- "netdev", "readproc", "squid", "xfs", "kvm", "games", "shadow", "postgres",
- "cdrw", "usb", "vpopmail", "users", "catchlog", "ntp", "nofiles", "qmail",
- "qmaill", "smmsp", "locate", "abuild", "utmp", "ping", "nogroup", "nobody"
-};
-
/*
* is_valid_name is from shadow libmisc/chkname.c: