dovecot-2.2: fts-solr: Don't crash if fts_solr setting is invalid.
dovecot at dovecot.org
dovecot at dovecot.org
Tue Apr 23 13:47:51 EEST 2013
details: http://hg.dovecot.org/dovecot-2.2/rev/d728b4682b0a
changeset: 16311:d728b4682b0a
user: Timo Sirainen <tss at iki.fi>
date: Tue Apr 23 13:47:46 2013 +0300
description:
fts-solr: Don't crash if fts_solr setting is invalid.
diffstat:
src/plugins/fts-solr/fts-backend-solr-old.c | 7 +++++--
src/plugins/fts-solr/fts-backend-solr.c | 7 +++++--
2 files changed, 10 insertions(+), 4 deletions(-)
diffs (39 lines):
diff -r 2bf265dc0e68 -r d728b4682b0a src/plugins/fts-solr/fts-backend-solr-old.c
--- a/src/plugins/fts-solr/fts-backend-solr-old.c Tue Apr 23 13:33:12 2013 +0300
+++ b/src/plugins/fts-solr/fts-backend-solr-old.c Tue Apr 23 13:47:46 2013 +0300
@@ -229,11 +229,14 @@
{
struct solr_fts_backend *backend = (struct solr_fts_backend *)_backend;
struct fts_solr_user *fuser = FTS_SOLR_USER_CONTEXT(_backend->ns->user);
- const struct fts_solr_settings *set = &fuser->set;
const char *str;
+ if (fuser == NULL) {
+ *error_r = "Invalid fts_solr setting";
+ return -1;
+ }
if (solr_conn == NULL) {
- if (solr_connection_init(set->url, set->debug,
+ if (solr_connection_init(fuser->set.url, fuser->set.debug,
&solr_conn, error_r) < 0)
return -1;
}
diff -r 2bf265dc0e68 -r d728b4682b0a src/plugins/fts-solr/fts-backend-solr.c
--- a/src/plugins/fts-solr/fts-backend-solr.c Tue Apr 23 13:33:12 2013 +0300
+++ b/src/plugins/fts-solr/fts-backend-solr.c Tue Apr 23 13:47:46 2013 +0300
@@ -158,10 +158,13 @@
fts_backend_solr_init(struct fts_backend *_backend, const char **error_r)
{
struct fts_solr_user *fuser = FTS_SOLR_USER_CONTEXT(_backend->ns->user);
- const struct fts_solr_settings *set = &fuser->set;
+ if (fuser == NULL) {
+ *error_r = "Invalid fts_solr setting";
+ return -1;
+ }
if (solr_conn == NULL) {
- if (solr_connection_init(set->url, set->debug,
+ if (solr_connection_init(fuser->set.url, fuser->set.debug,
&solr_conn, error_r) < 0)
return -1;
}
More information about the dovecot-cvs
mailing list