summaryrefslogtreecommitdiff
path: root/hscript/user.cc
diff options
context:
space:
mode:
authorA. Wilcox <AWilcox@Wilcox-Tech.com>2019-10-08 22:08:14 -0500
committerA. Wilcox <AWilcox@Wilcox-Tech.com>2019-10-08 22:08:14 -0500
commita6c6d0a42920fb9332f810e949fdf5fe20262f22 (patch)
treefd0bf555c53b74fb7ca141738a1428a868050b79 /hscript/user.cc
parenta621e6b86adfe8278d2e9c110eb8ef54e58c6abe (diff)
downloadhorizon-a6c6d0a42920fb9332f810e949fdf5fe20262f22.tar.gz
horizon-a6c6d0a42920fb9332f810e949fdf5fe20262f22.tar.bz2
horizon-a6c6d0a42920fb9332f810e949fdf5fe20262f22.tar.xz
horizon-a6c6d0a42920fb9332f810e949fdf5fe20262f22.zip
hscript: Use StringKey for Hostname (+ others), implement RootPassphrase
Diffstat (limited to 'hscript/user.cc')
-rw-r--r--hscript/user.cc35
1 files changed, 35 insertions, 0 deletions
diff --git a/hscript/user.cc b/hscript/user.cc
index e69de29..12d01fc 100644
--- a/hscript/user.cc
+++ b/hscript/user.cc
@@ -0,0 +1,35 @@
+/*
+ * user.cc - Implementation of the Key classes for user account data
+ * libhscript, the HorizonScript library for
+ * Project Horizon
+ *
+ * Copyright (c) 2019 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.
+ *
+ * SPDX-License-Identifier: AGPL-3.0-only
+ */
+
+#include "user.hh"
+#include "util/output.hh"
+
+using namespace Horizon::Keys;
+
+Key *RootPassphrase::parseFromData(const std::string data, int lineno,
+ int *errors, int *warnings) {
+ if(data.size() < 5 || data[0] != '$' || data[2] != '$') {
+ if(errors) *errors += 1;
+ output_error("installfile:" + std::to_string(lineno),
+ "rootpw: value is not a crypt-style encrypted passphrase");
+ return nullptr;
+ }
+ return new RootPassphrase(lineno, data);
+}
+
+bool RootPassphrase::validate() const {
+ return false;
+}
+
+bool RootPassphrase::execute() const {
+ return false;
+}