mirror of
https://github.com/servalproject/serval-dna.git
synced 2024-12-19 05:07:56 +00:00
Improve keyring environment variables
Rename to SERVALD_... Interpret SERVALD_KEYRING_PATH relative to instance dir unless absolute. Explicitly unset them in setup_servald() test defs function
This commit is contained in:
parent
3164172c08
commit
aa20fd1a9b
13
keyring.c
13
keyring.c
@ -1500,20 +1500,19 @@ keyring_file *keyring_open_instance()
|
||||
if (create_serval_instance_dir() == -1)
|
||||
RETURN(NULL);
|
||||
// Work out the absolute path to the keyring file.
|
||||
const char *keyringpath = getenv("SERVAL_KEYRING_PATH");
|
||||
const char *env = getenv("SERVALD_KEYRING_PATH");
|
||||
if (!env)
|
||||
env = "serval.keyring";
|
||||
char keyringFile[1024];
|
||||
if (!keyringpath) {
|
||||
if (!FORM_SERVAL_INSTANCE_PATH(keyringFile, "serval.keyring"))
|
||||
if (!FORM_SERVAL_INSTANCE_PATH(keyringFile, env))
|
||||
RETURN(NULL);
|
||||
keyringpath = keyringFile;
|
||||
}
|
||||
// Work out if the keyring file is writeable.
|
||||
int writeable = 0;
|
||||
const char *readonly_env = getenv("SERVAL_KEYRING_READONLY");
|
||||
const char *readonly_env = getenv("SERVALD_KEYRING_READONLY");
|
||||
bool_t readonly_b;
|
||||
if (readonly_env == NULL || cf_opt_boolean(&readonly_b, readonly_env) != CFOK || !readonly_b)
|
||||
writeable = 1;
|
||||
if ((k = keyring_open(keyringpath, writeable)) == NULL)
|
||||
if ((k = keyring_open(keyringFile, writeable)) == NULL)
|
||||
RETURN(NULL);
|
||||
RETURN(k);
|
||||
OUT();
|
||||
|
@ -90,6 +90,8 @@ setup_servald() {
|
||||
unset SERVALD_SERVER_CHDIR
|
||||
unset SERVALD_START_POST_SLEEP
|
||||
unset SERVALD_LOG_FILE
|
||||
unset SERVALD_KEYRING_PATH
|
||||
unset SERVALD_KEYRING_READONLY
|
||||
servald_instances_dir="$SERVALD_VAR/instance"
|
||||
set_instance +Z
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user