diff options
author | lloyd <[email protected]> | 2006-07-01 23:17:47 +0000 |
---|---|---|
committer | lloyd <[email protected]> | 2006-07-01 23:17:47 +0000 |
commit | 984d1c480e724ffba5a5aa1f09980016bb9b03ca (patch) | |
tree | 4a71e6678ec7e235e9f1118204d07c48b32c0977 | |
parent | 6cf2f6d9554f724d0e8afc0020424950b8452d98 (diff) |
Fix config handling (stupid mismatch was causing the getter for the
config options to always fail).
Move the default config stuff from libstate to the config object.
-rw-r--r-- | include/config.h | 4 | ||||
-rw-r--r-- | include/libstate.h | 1 | ||||
-rw-r--r-- | src/config.cpp | 2 | ||||
-rw-r--r-- | src/init_def.cpp | 6 | ||||
-rw-r--r-- | src/policy.cpp | 11 |
5 files changed, 11 insertions, 13 deletions
diff --git a/include/config.h b/include/config.h index 0b28cb848..e230314a7 100644 --- a/include/config.h +++ b/include/config.h @@ -20,6 +20,8 @@ namespace Botan { class Config { public: + void load_defaults(); + std::string get(const std::string&, const std::string&) const; bool is_set(const std::string&, const std::string&) const; void set(const std::string&, const std::string&, @@ -37,8 +39,8 @@ class Config static void choose_sig_format(const std::string&, std::string&, Signature_Format&); - private: + std::map<std::string, std::string> settings; }; diff --git a/include/libstate.h b/include/libstate.h index ebc42ac01..951cdf57e 100644 --- a/include/libstate.h +++ b/include/libstate.h @@ -58,7 +58,6 @@ class Library_State void set_transcoder(class Charset_Transcoder*); std::string transcode(const std::string, Character_Set, Character_Set) const; - void set_default_policy(); Library_State(class Mutex_Factory*); ~Library_State(); diff --git a/src/config.cpp b/src/config.cpp index 819bc61f5..2e0a6609d 100644 --- a/src/config.cpp +++ b/src/config.cpp @@ -78,7 +78,7 @@ std::string Config::deref_alias(const std::string& key) const *************************************************/ std::string Config::option(const std::string& key) const { - return get("option", key); + return get("conf", key); } /************************************************* diff --git a/src/init_def.cpp b/src/init_def.cpp index 26e759120..2edd43b97 100644 --- a/src/init_def.cpp +++ b/src/init_def.cpp @@ -50,13 +50,11 @@ void initialize(const std::string& arg_string) } set_global_state(new Library_State(mutex_factory)); - global_state().set_default_policy(); - - global_state().load(modules); - + global_state().config().load_defaults(); if(args.config_file() != "") global_config().load_inifile(args.config_file()); + global_state().load(modules); global_state().set_transcoder(new Default_Charset_Transcoder); global_state().set_prng(new ANSI_X931_RNG); diff --git a/src/policy.cpp b/src/policy.cpp index e4fa78edf..2a5329e89 100644 --- a/src/policy.cpp +++ b/src/policy.cpp @@ -3,7 +3,6 @@ * (C) 1999-2006 The Botan Project * *************************************************/ -#include <botan/libstate.h> #include <botan/config.h> namespace Botan { @@ -363,12 +362,12 @@ void set_default_dl_groups(Config& config) /************************************************* * Set the default policy * *************************************************/ -void Library_State::set_default_policy() +void Config::load_defaults() { - set_default_config(config()); - set_default_aliases(config()); - set_default_oids(config()); - set_default_dl_groups(config()); + set_default_config(*this); + set_default_aliases(*this); + set_default_oids(*this); + set_default_dl_groups(*this); } } |