Fix bug #139: Unable to use TLS - due to not handling quotes around configuration strings.

This commit is contained in:
Jan Vidar Krey 2010-07-07 18:53:39 +02:00
parent 0810982b57
commit c30b85bbcb
3 changed files with 23 additions and 0 deletions

View File

@ -110,6 +110,7 @@ static int config_parse_line(char* line, int line_count, void* ptr_data)
key = strip_white_space(key);
data = strip_white_space(data);
data = strip_off_quotes(data);
if (!*key || !*data)
{

View File

@ -448,3 +448,24 @@ void strip_off_ini_line_comments(char* line, int line_count)
}
*out = '\0';
}
char* strip_off_quotes(char* line)
{
size_t len;
if (!*line)
return line;
len = strlen(line);
if (len < 2)
return line;
if ((line[0] == '"' && line[len - 1] == '"') ||
(line[0] == '\'' && line[len - 1] == '\''))
{
line[len-1] = '\0';
return line + 1;
}
return line;
}

View File

@ -34,6 +34,7 @@ extern void base32_encode(const unsigned char* buffer, size_t len, char* result)
extern void base32_decode(const char* src, unsigned char* dst, size_t len);
extern char* strip_white_space(char* string);
extern void strip_off_ini_line_comments(char* line, int line_count);
extern char* strip_off_quotes(char* line);
extern int file_read_lines(const char* file, void* data, file_line_handler_t handler);