--- embedaddon/lighttpd/src/configfile.c 2013/10/14 10:32:48 1.1.1.1 +++ embedaddon/lighttpd/src/configfile.c 2014/06/15 20:20:06 1.1.1.2 @@ -155,13 +155,13 @@ static int config_insert(server *srv) { srv->config_storage = calloc(1, srv->config_context->used * sizeof(specific_config *)); - assert(srv->config_storage); + force_assert(srv->config_storage); for (i = 0; i < srv->config_context->used; i++) { specific_config *s; s = calloc(1, sizeof(specific_config)); - assert(s); + force_assert(s); s->document_root = buffer_init(); s->mimetypes = array_init(); s->server_name = buffer_init(); @@ -339,9 +339,13 @@ int config_setup_connection(server *srv, connection *c PATCH(ssl_pemfile); #ifdef USE_OPENSSL - PATCH(ssl_ctx); + PATCH(ssl_pemfile_x509); + PATCH(ssl_pemfile_pkey); #endif PATCH(ssl_ca_file); +#ifdef USE_OPENSSL + PATCH(ssl_ca_file_cert_names); +#endif PATCH(ssl_cipher_list); PATCH(ssl_dh_file); PATCH(ssl_ec_curve); @@ -409,10 +413,14 @@ int config_patch_connection(server *srv, connection *c } else if (buffer_is_equal_string(du->key, CONST_STR_LEN("ssl.pemfile"))) { PATCH(ssl_pemfile); #ifdef USE_OPENSSL - PATCH(ssl_ctx); + PATCH(ssl_pemfile_x509); + PATCH(ssl_pemfile_pkey); #endif } else if (buffer_is_equal_string(du->key, CONST_STR_LEN("ssl.ca-file"))) { PATCH(ssl_ca_file); +#ifdef USE_OPENSSL + PATCH(ssl_ca_file_cert_names); +#endif } else if (buffer_is_equal_string(du->key, CONST_STR_LEN("ssl.honor-cipher-order"))) { PATCH(ssl_honor_cipher_order); } else if (buffer_is_equal_string(du->key, CONST_STR_LEN("ssl.empty-fragments"))) { @@ -541,7 +549,7 @@ static int tokenizer_close(server *srv, tokenizer_t *t #endif static int config_skip_newline(tokenizer_t *t) { int skipped = 1; - assert(t->input[t->offset] == '\r' || t->input[t->offset] == '\n'); + force_assert(t->input[t->offset] == '\r' || t->input[t->offset] == '\n'); if (t->input[t->offset] == '\r' && t->input[t->offset + 1] == '\n') { skipped ++; t->offset ++; @@ -552,7 +560,7 @@ static int config_skip_newline(tokenizer_t *t) { static int config_skip_comment(tokenizer_t *t) { int i; - assert(t->input[t->offset] == '#'); + force_assert(t->input[t->offset] == '#'); for (i = 1; t->input[t->offset + i] && (t->input[t->offset + i] != '\n' && t->input[t->offset + i] != '\r'); i++); @@ -1018,7 +1026,10 @@ static char* getCWD(void) { s = malloc(len); if (!s) return NULL; while (NULL == getcwd(s, len)) { - if (errno != ERANGE || SSIZE_MAX - len < len) return NULL; + if (errno != ERANGE || SSIZE_MAX - len < len) { + free(s); + return NULL; + } len *= 2; s1 = realloc(s, len); if (!s1) { @@ -1104,7 +1115,7 @@ int config_read(server *srv, const char *fn) { dc = data_config_init(); buffer_copy_string_len(dc->key, CONST_STR_LEN("global")); - assert(context.all_configs->used == 0); + force_assert(context.all_configs->used == 0); dc->context_ndx = context.all_configs->used; array_insert_unique(context.all_configs, (data_unset *)dc); context.current = dc; @@ -1122,12 +1133,14 @@ int config_read(server *srv, const char *fn) { dcwd->value->used = strlen(dcwd->value->ptr) + 1; buffer_copy_string_len(dcwd->key, CONST_STR_LEN("var.CWD")); array_insert_unique(srv->config, (data_unset *)dcwd); + } else { + dcwd->free((data_unset*) dcwd); } ret = config_parse_file(srv, &context, fn); /* remains nothing if parser is ok */ - assert(!(0 == ret && context.ok && 0 != context.configs_stack->used)); + force_assert(!(0 == ret && context.ok && 0 != context.configs_stack->used)); context_free(&context); if (0 != ret) { @@ -1159,6 +1172,7 @@ int config_read(server *srv, const char *fn) { } prepends = (data_array *)configparser_merge_data((data_unset *)prepends, (data_unset *)modules); + force_assert(NULL != prepends); buffer_copy_string_buffer(prepends->key, modules->key); array_replace(srv->config, (data_unset *)prepends); modules->free((data_unset *)modules);