summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Bühler <stbuehler@web.de>2010-08-05 22:55:18 +0000
committerStefan Bühler <stbuehler@web.de>2010-08-05 22:55:18 +0000
commit614bb7538dc9bbccf4299386f8847be018f7d63d (patch)
tree1418ca7f06403d0cb89c90c5602dbc17a4e1dd50
parent12f375f3b186a6abd38874a96ec0f80fc8e7805b (diff)
downloadlighttpd-git-614bb7538dc9bbccf4299386f8847be018f7d63d.tar.gz
Add check to stop loading plugins twice
git-svn-id: svn://svn.lighttpd.net/lighttpd/branches/lighttpd-1.4.x@2751 152afb58-edef-0310-8abb-c4023f1b3aa9
-rw-r--r--NEWS1
-rw-r--r--src/plugin.c9
2 files changed, 9 insertions, 1 deletions
diff --git a/NEWS b/NEWS
index 846a9f49..6d3cb08f 100644
--- a/NEWS
+++ b/NEWS
@@ -26,6 +26,7 @@ NEWS
* autotools: don't recreate parser files with lemon after lemon rebuild
* openssl: silence annoying error messages for errno==0 (fixes #2213)
* array.c: improve array_get_unused_element to check data type; fix mem leak if unused_element didn't find a matching entry (fixes #2145)
+ * add check to stop loading plugins twice
- 1.4.26 - 2010-02-07
* Fix request parser to handle packets with splitted \r\n\r\n (fixes #2105)
diff --git a/src/plugin.c b/src/plugin.c
index 0690629a..2a14e2cd 100644
--- a/src/plugin.c
+++ b/src/plugin.c
@@ -120,12 +120,19 @@ int plugins_load(server *srv) {
plugin *p;
int (*init)(plugin *pl);
const char *error;
- size_t i;
+ size_t i, j;
for (i = 0; i < srv->srvconf.modules->used; i++) {
data_string *d = (data_string *)srv->srvconf.modules->data[i];
char *modules = d->value->ptr;
+ for (j = 0; j < i; j++) {
+ if (buffer_is_equal(d->value, ((data_string *) srv->srvconf.modules->data[j])->value)) {
+ log_error_write(srv, __FILE__, __LINE__, "sbs", "Cannot load plugin", d->value, "more than once");
+ return -1;
+ }
+ }
+
buffer_copy_string_buffer(srv->tmp_buf, srv->srvconf.modules_dir);
buffer_append_string_len(srv->tmp_buf, CONST_STR_LEN("/"));