diff options
author | Jason A. Donenfeld <Jason@zx2c4.com> | 2022-03-30 23:15:48 -0400 |
---|---|---|
committer | William Hubbs <w.d.hubbs@gmail.com> | 2022-03-30 22:25:19 -0500 |
commit | 586d1c9af378dcb024be095fd4965d124c2f4c6a (patch) | |
tree | 723b1d9c13777ee2b7e0d0f304950e227c72b060 | |
parent | 96b0c695d971745bf43180971c3a11e28ec79756 (diff) |
seedrng: remove environment variables
Now that we have the command line arguments, there's no need for the
environment variables.
This fixes #511.
-rw-r--r-- | src/rc/seedrng.c | 24 |
1 files changed, 6 insertions, 18 deletions
diff --git a/src/rc/seedrng.c b/src/rc/seedrng.c index fc456619..95fb947d 100644 --- a/src/rc/seedrng.c +++ b/src/rc/seedrng.c @@ -77,7 +77,6 @@ static char *lock_file = NULL; static char *seed_dir = NULL; static char *creditable_seed = NULL; static char *non_creditable_seed = NULL; -static bool skip_credit = false; enum blake2s_lengths { BLAKE2S_BLOCK_LEN = 64, @@ -405,20 +404,10 @@ static int seed_from_file_if_exists(const char *filename, bool credit, struct bl static void populate_global_paths(void) { - if (!lock_file) { - lock_file = xstrdup(getenv("SEEDRNG_LOCK_FILE")); - if (!lock_file || !*lock_file) { - free(lock_file); - lock_file = xstrdup("/var/run/seedrng.lock"); - } - } - if (!seed_dir) { - seed_dir = xstrdup(getenv("SEEDRNG_SEED_DIR")); - if (!seed_dir || !*seed_dir) { - free(seed_dir); - seed_dir = xstrdup("/var/lib/seedrng"); - } - } + if (!lock_file) + lock_file = xstrdup("/var/run/seedrng.lock"); + if (!seed_dir) + seed_dir = xstrdup("/var/lib/seedrng"); xasprintf(&creditable_seed, "%s/seed.credit", seed_dir); xasprintf(&non_creditable_seed, "%s/seed.no-credit", seed_dir); } @@ -442,6 +431,7 @@ int main(int argc, char **argv) bool new_seed_creditable; struct timespec realtime = { 0 }, boottime = { 0 }; struct blake2s_state hash; + bool skip_credit = false; atexit(cleanup); applet = basename_c(argv[0]); @@ -489,9 +479,7 @@ int main(int argc, char **argv) ret = seed_from_file_if_exists(non_creditable_seed, false, &hash); if (ret < 0) program_ret |= 1 << 1; - ret = seed_from_file_if_exists(creditable_seed, - skip_credit ? !skip_credit : !rc_yesno(getenv("SEEDRNG_SKIP_CREDIT")), - &hash); + ret = seed_from_file_if_exists(creditable_seed, !skip_credit, &hash); if (ret < 0) program_ret |= 1 << 2; |