aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexander Sulfrian <alexander@sulfrian.net>2009-10-31 12:34:36 +0100
committerAlexander Sulfrian <alexander@sulfrian.net>2009-10-31 12:34:36 +0100
commitc8a9a6550b84412f919b772a9cb8db1e3ef79d19 (patch)
tree270e253e13f67b366970cf2f07f5c06dd4257520
parentaad2cd42ee3d71920648b649e759403b0cb0e138 (diff)
parent771fe630d71993b9d270a9a6145ecaa8510c4f1c (diff)
downloaddovecot-antispam-c8a9a6550b84412f919b772a9cb8db1e3ef79d19.tar.gz
dovecot-antispam-c8a9a6550b84412f919b772a9cb8db1e3ef79d19.tar.xz
dovecot-antispam-c8a9a6550b84412f919b772a9cb8db1e3ef79d19.zip
Merge remote branch 'base/master'
-rw-r--r--antispam-plugin.c14
-rw-r--r--antispam-plugin.h7
-rw-r--r--dovecot-version.c25
-rw-r--r--dspam-exec.c3
4 files changed, 33 insertions, 16 deletions
diff --git a/antispam-plugin.c b/antispam-plugin.c
index cf14d19..455668d 100644
--- a/antispam-plugin.c
+++ b/antispam-plugin.c
@@ -96,8 +96,8 @@ void lowercase_string(const char *in, char *out)
}
}
-static bool mailbox_patternmatch(struct mailbox *box,
- struct mail_storage *storage,
+static bool mailbox_patternmatch(const struct mailbox *box,
+ const struct mail_storage *storage,
const char *name,
bool lowercase)
{
@@ -134,21 +134,21 @@ static bool mailbox_patternmatch(struct mailbox *box,
return rc;
}
-static bool mailbox_patternmatch_case(struct mailbox *box,
- struct mail_storage *storage,
+static bool mailbox_patternmatch_case(const struct mailbox *box,
+ const struct mail_storage *storage,
const char *name)
{
return mailbox_patternmatch(box, storage, name, FALSE);
}
-static bool mailbox_patternmatch_icase(struct mailbox *box,
- struct mail_storage *storage,
+static bool mailbox_patternmatch_icase(const struct mailbox *box,
+ const struct mail_storage *storage,
const char *name)
{
return mailbox_patternmatch(box, storage, name, TRUE);
}
-typedef bool (*match_fn_t)(struct mailbox *, struct mail_storage *,
+typedef bool (*match_fn_t)(const struct mailbox *, const struct mail_storage *,
const char *);
/* match information */
diff --git a/antispam-plugin.h b/antispam-plugin.h
index 493fd1e..38a3be6 100644
--- a/antispam-plugin.h
+++ b/antispam-plugin.h
@@ -8,6 +8,7 @@
#include "dict.h"
#include "imap-search.h"
#include "dovecot-version.h"
+#include <stdlib.h>
#define __stringify_1(x) #x
#define stringify(x) __stringify_1(x)
@@ -84,7 +85,7 @@ extern bool need_folder_hook;
* Dovecot version compat code
*/
-#if DOVECOT_VERSION_CODE(1, 1) == DOVECOT_VERSION || DOVECOT_VERSION_CODE(1, 2) == DOVECOT_VERSION
+#if DOVECOT_VERSION_CODE(1, 1, 0) == DOVECOT_VERSION || DOVECOT_VERSION_CODE(1, 2, 0) == DOVECOT_VERSION
#define __attr_unused__ ATTR_UNUSED
#define ME(err) MAIL_ERROR_ ##err,
#define PLUGIN_ID uint32_t PLUGIN_FUNCTION(id) = 0
@@ -113,7 +114,7 @@ o_stream_create_from_fd(int fd, pool_t pool ATTR_UNUSED)
return o_stream_create_fd(fd, 0, TRUE);
}
-#if DOVECOT_VERSION_CODE(1, 2) == DOVECOT_VERSION
+#if DOVECOT_VERSION_CODE(1, 2, 0) == DOVECOT_VERSION
static inline struct dict *
string_dict_init(const char *uri, const char *username)
{
@@ -131,7 +132,7 @@ string_dict_init(const char *uri, const char *username)
return dict_init(uri, DICT_DATA_TYPE_STRING, username);
}
#endif
-#elif DOVECOT_VERSION_CODE(1, 0) == DOVECOT_VERSION
+#elif DOVECOT_VERSION_CODE(1, 0, 0) == DOVECOT_VERSION
#define ME(err)
#define PLUGIN_ID
#define str_array_length(x) strarray_length(x)
diff --git a/dovecot-version.c b/dovecot-version.c
index fbb7a88..7733e60 100644
--- a/dovecot-version.c
+++ b/dovecot-version.c
@@ -5,8 +5,9 @@
int main(int argc, char **argv)
{
- char *v = PACKAGE_STRING, *e;
- int maj = 0, min = 0;
+ const char *v = PACKAGE_STRING;
+ char *e;
+ int maj = 0, min = 0, patch = 0;
if (strncmp(v, "dovecot ", 8) && strncmp(v, "Dovecot ", 8))
return 1;
@@ -24,11 +25,25 @@ int main(int argc, char **argv)
if (v == e)
return 1;
+ /* not end of string yet? */
+ if (*e) {
+ v = e + 1;
+
+ patch = strtol(v, &e, 10);
+ if (v == e)
+ return 1;
+ }
+
printf("/* Auto-generated file, do not edit */\n\n");
- printf("#define DOVECOT_VERSION_CODE(maj, min) ((maj)<<8 | (min))\n\n");
+ printf("#define DOVECOT_VERSION_CODE(maj, min, patch) "
+ "((maj)<<16 | ((min)<<8) | (patch))\n\n");
- printf("#define DOVECOT_VERSION 0x%.2x%.2x\n", maj, min);
- printf("#define ANTISPAM_STORAGE \"antispam-storage-%d.%d.c\"\n", maj, min);
+ printf("#define DOVECOT_VERSION "
+ "0x%.2x%.2x%.2x\n", maj, min, 0);
+ printf("#define DOVECOT_VPATCH "
+ "0x%.2x%.2x%.2x\n", maj, min, patch);
+ printf("#define ANTISPAM_STORAGE "
+ "\"antispam-storage-%d.%d.c\"\n", maj, min);
return 0;
}
diff --git a/dspam-exec.c b/dspam-exec.c
index 3c52271..ecfb9f1 100644
--- a/dspam-exec.c
+++ b/dspam-exec.c
@@ -58,7 +58,8 @@ static int call_dspam(const char *signature, enum classification wanted)
* non-zero exit code on errors so we treat it as an error
* if it logged anything to stderr.
*/
- pipe(pipes);
+ if (pipe(pipes) < 0)
+ return -1;
pid = fork();
if (pid < 0)