aboutsummaryrefslogtreecommitdiff
path: root/common
diff options
context:
space:
mode:
authorJulien Dessaux2019-04-01 14:19:42 +0200
committerJulien Dessaux2019-04-01 14:19:42 +0200
commitb372795ac777b979e32a71a03911c80126ae0d8a (patch)
tree01e7d38c5026daf4d9df51ece7bfd44e2f4af3ca /common
parentFixed session recording that was broken, and install the session player from ... (diff)
downloadbastion-b372795ac777b979e32a71a03911c80126ae0d8a.tar.gz
bastion-b372795ac777b979e32a71a03911c80126ae0d8a.tar.bz2
bastion-b372795ac777b979e32a71a03911c80126ae0d8a.zip
Added argument parsing with libparg, along with usefull running modes
Diffstat (limited to '')
-rw-r--r--common/config.c4
-rw-r--r--common/config.h.in4
2 files changed, 5 insertions, 3 deletions
diff --git a/common/config.c b/common/config.c
index 1c45e7e..11a06d7 100644
--- a/common/config.c
+++ b/common/config.c
@@ -7,12 +7,12 @@
config_t * config = NULL;
char // returns 0 if ok, greater than 0 otherwise
-config_load(void)
+config_load(const char *config_file)
{
config = malloc(sizeof(config_t));
config_init(config);
config_set_tab_width(config, 4);
- if (config_read_file(config, CONFIG_PATH) != CONFIG_TRUE) {
+ if (config_read_file(config, config_file) != CONFIG_TRUE) {
switch(config_error_type(config)) {
case CONFIG_ERR_NONE:
fprintf(stderr, "Configuration read error with none type reported... This shouldn't happen!\n");
diff --git a/common/config.h.in b/common/config.h.in
index 95d43c9..a671414 100644
--- a/common/config.h.in
+++ b/common/config.h.in
@@ -3,6 +3,8 @@
#define CONFIG_DIR "@CMAKE_INSTALL_PREFIX@/etc/bastion/"
#define CONFIG_PATH CONFIG_DIR "bastion.conf"
+#define VERSION "@PROJECT_VERSION@"
+#define GIT_HASH "@GIT_HASH@"
#define MAX_HOSTNAME_LENGTH 64
@@ -17,7 +19,7 @@
#define SESSION_RECORDING_DIRECTORY_MODE S_IRUSR | S_IWUSR | S_IXUSR
#endif
-char config_load(void);
+char config_load(const char *config_file);
int config_get_port(void);
const char * config_get_key_dsa(void);
const char * config_get_key_rsa(void);