aboutsummaryrefslogtreecommitdiffstats
path: root/FICS
diff options
context:
space:
mode:
authorMarkus Uhlin <markus@nifty-networks.net>2025-11-08 12:48:55 +0100
committerMarkus Uhlin <markus@nifty-networks.net>2025-11-08 12:48:55 +0100
commitbeef5b174e783f1c60b3a73ca06c2f354b469b7e (patch)
tree0a245a4376bb57534cc5e8e9de3519685faed5c3 /FICS
parent27ea2c7adc6a13a941f131a88f14f17816a67070 (diff)
Added check_some_settings_strictly() -- initial revision
Diffstat (limited to 'FICS')
-rw-r--r--FICS/settings.cpp13
-rw-r--r--FICS/settings.h1
2 files changed, 14 insertions, 0 deletions
diff --git a/FICS/settings.cpp b/FICS/settings.cpp
index 9d78e8f..de25098 100644
--- a/FICS/settings.cpp
+++ b/FICS/settings.cpp
@@ -99,6 +99,19 @@ install_setting(const char *name, const char *value)
return ENOENT;
}
+void
+check_some_settings_strictly(void)
+{
+ err_reason_t reason;
+
+ if (!is_valid_hostname(settings_get("server_hostname"), &reason))
+ errx(1, "error: server_hostname: %s", reason.data);
+ else if (!is_valid_username(settings_get("privdrop_user"), &reason))
+ errx(1, "error: privdrop_user: %s", reason.data);
+ else if (!is_valid_group_name(settings_get("sysgroup")))
+ errx(1, "error: sysgroup: invalid group name");
+}
+
bool
is_valid_hostname(const char *p_str, err_reason_t *p_reason)
{
diff --git a/FICS/settings.h b/FICS/settings.h
index bfc8cf3..4b1f15e 100644
--- a/FICS/settings.h
+++ b/FICS/settings.h
@@ -13,6 +13,7 @@ __FICS_BEGIN_DECLS
void settings_init(void);
void settings_deinit(void);
+void check_some_settings_strictly(void);
bool is_valid_hostname(const char *, err_reason_t *);
bool is_valid_username(const char *, err_reason_t *);
const char *settings_get(const char *set_name);