aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/inifile.cpp138
-rw-r--r--src/init_opt.cpp9
-rw-r--r--src/libstate.cpp3
3 files changed, 0 insertions, 150 deletions
diff --git a/src/inifile.cpp b/src/inifile.cpp
deleted file mode 100644
index a75ca654f..000000000
--- a/src/inifile.cpp
+++ /dev/null
@@ -1,138 +0,0 @@
-/*************************************************
-* Configuration Reader Source File *
-* (C) 1999-2007 The Botan Project *
-*************************************************/
-
-#include <botan/config.h>
-#include <botan/charset.h>
-#include <botan/parsing.h>
-#include <botan/exceptn.h>
-#include <fstream>
-#include <map>
-
-namespace Botan {
-
-namespace {
-
-/*************************************************
-* Strip comments and whitespace from line *
-*************************************************/
-std::string strip_whitespace(const std::string& line)
- {
- bool is_escaped = false, in_quote = false, in_string = false;
- std::string new_line;
-
- for(std::string::const_iterator j = line.begin(); j != line.end(); ++j)
- {
- const char c = *j;
-
- if(c == '"' && !is_escaped && !in_string)
- { in_quote = !in_quote; continue; }
- if(c == '\'' && !is_escaped && !in_quote)
- { in_string = !in_string; continue; }
- if(c == '#' && !is_escaped && !in_quote && !in_string)
- return new_line;
- if(c == '\\' && !is_escaped) { is_escaped = true; continue; }
-
- if(Charset::is_space(c) && !in_quote && !in_string && !is_escaped)
- continue;
-
- new_line += c;
- is_escaped = false;
- }
-
- return new_line;
- }
-
-/*************************************************
-* Do variable interpolation *
-*************************************************/
-std::string interpolate(const std::string& value,
- const std::map<std::string, std::string>& variables)
- {
- std::string variable, suffix;
-
- if(value.find('.') == std::string::npos)
- variable = value;
- else
- {
- variable = value.substr(0, value.find('.'));
- suffix = value.substr(value.find('.'), std::string::npos);
- }
-
- if(variables.find(variable) != variables.end())
- {
- const std::string result = variables.find(variable)->second;
- if(variable == result)
- return value;
- return interpolate(result, variables) + suffix;
- }
- return value;
- }
-
-}
-
-/*************************************************
-* Load a configuration file *
-*************************************************/
-void Config::load_inifile(const std::string& fsname)
- {
- std::ifstream config(fsname.c_str());
-
- if(!config)
- throw Config_Error("Could not open config file " + fsname);
-
- u32bit line_no = 0;
- std::string line, section;
- std::map<std::string, std::string> variables;
-
- while(std::getline(config, line))
- {
- ++line_no;
-
- line = strip_whitespace(line);
-
- if(line == "")
- continue;
-
- if(line[0] == '[' && line[line.size()-1] == ']')
- {
- section = line.substr(1, line.size() - 2);
- if(section == "")
- throw Config_Error("Empty section name", line_no);
- continue;
- }
-
- if(section == "")
- throw Config_Error("Section must be set before assignment", line_no);
-
- std::vector<std::string> name_and_value;
- try {
- name_and_value = split_on(line, '=');
- }
- catch(Format_Error)
- {
- throw Config_Error("Bad assignment: " + line, line_no);
- }
-
- if(name_and_value.size() != 2)
- throw Config_Error("Bad line: " + line, line_no);
- const std::string name = name_and_value[0];
- const std::string value = interpolate(name_and_value[1], variables);
-
- if(variables.find(name) == variables.end())
- variables[name] = value;
-
- if(section == "oids")
- {
- set("oid2str", name, value, false);
- set("str2oid", value, name, false);
- }
- else if(section == "aliases")
- set("alias", name, value);
- else
- set("conf", section + '/' + name, value);
- }
- }
-
-}
diff --git a/src/init_opt.cpp b/src/init_opt.cpp
index a92d795b0..48dd00967 100644
--- a/src/init_opt.cpp
+++ b/src/init_opt.cpp
@@ -86,15 +86,6 @@ bool InitializerOptions::self_test() const
}
/*************************************************
-* Return the config file to load, if any *
-*************************************************/
-std::string InitializerOptions::config_file() const
- {
- std::map<std::string, std::string>::const_iterator i = args.find("config");
- return (i != args.end()) ? i->second : "";
- }
-
-/*************************************************
* Setup an InitializerOptions *
*************************************************/
InitializerOptions::InitializerOptions(const std::string& arg_string)
diff --git a/src/libstate.cpp b/src/libstate.cpp
index 9dda38b1f..7b6a929c5 100644
--- a/src/libstate.cpp
+++ b/src/libstate.cpp
@@ -340,9 +340,6 @@ void Library_State::initialize(const InitializerOptions& args,
timer = modules.timer();
transcoder = modules.transcoder();
- if(args.config_file() != "")
- config().load_inifile(args.config_file());
-
locks["settings"] = get_mutex();
locks["allocator"] = get_mutex();
locks["rng"] = get_mutex();