diff options
Diffstat (limited to 'FICS')
| -rw-r--r-- | FICS/settings.cpp | 13 | ||||
| -rw-r--r-- | FICS/settings.h | 1 |
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); |
