freebsd-ports/mail/dbmail/files/patch-0002-fix-compiler-warnings-for-GCC5
Muhammad Moinur Rahman 9eff14e488 mail/dbmail: adopt latest fixes from git:
- login_disabled option before starttls for pop3
- fix compiler warnings for GCC5
- Fix IMAP mailbox maintanence
- prevent assertion in p_string_erase
- improve crypt authentication, also don't segfault when spasswd is empty
- simplify log_query_time duration logic
- Disconnect IMAP clients if only few free FDs left
- Add primary key constraint to dbmail_authlog
- Rework temporary connection failures
- Give sensible default for retry 120s
- Add retries for binding and searching
- Bump search timeout to 60s
- Increase ldap timeout to 600s 10 mins
- Refactor deprecated functions
- Get timeout from config
- Remove redundant event_assign
- Remove deprecated non functioning g_mem_profile
- Add definition for authldap_free
- Revert inadvertent event_assign removal
- Reduce failed LDAP connection for search to error
- Update LDAP to non deprecated search
- Clear the ldap connection
- Update ldap deprecated unbind
- Fix typo
- Update to ldap_unbind_ext_s and remove redundant sigaction
- Rebalance commit rollback
- Ensure mailbox2dbmail is using Python 2
- Tidy mailbox2dbmail man page
- Update description of pid file location in server man page
- Boundaries fixups ordering of parts do not add newline on
- Prepend headers during delivery
- Allow for systems that don't use proc

PR:		210274
Submitted by:	fluffy
2017-02-24 21:15:52 +00:00

346 lines
10 KiB
Text

From c3badbdb282a5ffb411ee2b5062ed345896fb149 Mon Sep 17 00:00:00 2001
From: Paul J Stevens <p.stevens@lukkien.com>
Date: Fri, 8 Jan 2016 18:42:24 +0100
Subject: [PATCH 02/33] fix compiler warnings for GCC5
---
src/dm_db.c | 26 +++++++++++++-------------
src/dm_mailbox.c | 6 +++---
src/dm_mailboxstate.c | 4 ++--
src/dm_message.c | 12 ++++++------
src/dm_misc.c | 6 +++---
src/dm_sievescript.c | 2 +-
src/maintenance.c | 2 +-
src/modules/authsql.c | 12 ++++++------
src/pop3.c | 2 +-
9 files changed, 36 insertions(+), 36 deletions(-)
diff --git src/dm_db.c src/dm_db.c
index 8d72214..feb0b34 100644
--- src/dm_db.c
+++ src/dm_db.c
@@ -1047,7 +1047,7 @@ int db_check_version(void)
/* test existence of usermap table */
int db_use_usermap(void)
{
- int use_usermap = TRUE;
+ volatile int use_usermap = TRUE;
Connection_T c = db_con_get();
TRY
if (! db_query(c, db_get_sql(SQL_TABLE_EXISTS), DBPFX, "usermap"))
@@ -1214,7 +1214,7 @@ static int dm_quota_user_validate(uint64_t user_idnr, uint64_t msg_size)
int dm_quota_rebuild_user(uint64_t user_idnr)
{
Connection_T c; ResultSet_T r; volatile int t = DM_SUCCESS;
- uint64_t quotum = 0;
+ volatile uint64_t quotum = 0;
c = db_con_get();
TRY
@@ -1257,7 +1257,7 @@ int dm_quota_rebuild()
GList *quota = NULL;
struct used_quota *q;
- int i = 0;
+ volatile int i = 0;
int result;
c = db_con_get();
@@ -1375,7 +1375,7 @@ int db_get_reply_body(uint64_t user_idnr, char **reply_body)
uint64_t db_get_useridnr(uint64_t message_idnr)
{
Connection_T c; ResultSet_T r;
- uint64_t user_idnr = 0;
+ volatile uint64_t user_idnr = 0;
c = db_con_get();
TRY
r = db_query(c, "SELECT %smailboxes.owner_idnr FROM %smailboxes, %smessages "
@@ -1397,7 +1397,7 @@ uint64_t db_get_useridnr(uint64_t message_idnr)
int db_log_ip(const char *ip)
{
Connection_T c; ResultSet_T r; PreparedStatement_T s; volatile int t = DM_SUCCESS;
- uint64_t id = 0;
+ volatile uint64_t id = 0;
c = db_con_get();
TRY
@@ -1444,8 +1444,8 @@ int db_empty_mailbox(uint64_t user_idnr, int only_empty)
Connection_T c; ResultSet_T r; volatile int t = DM_SUCCESS;
GList *mboxids = NULL;
uint64_t *id;
- unsigned i = 0;
- int result = 0;
+ volatile unsigned i = 0;
+ volatile int result = 0;
c = db_con_get();
@@ -2165,7 +2165,7 @@ static int mailboxes_by_regex(uint64_t user_idnr, int only_subscribed, const cha
char *spattern;
char *namespace, *username;
GString *qs = NULL;
- int n_rows = 0;
+ volatile int n_rows = 0;
PreparedStatement_T stmt;
int prml;
@@ -2862,7 +2862,7 @@ int db_movemsg(uint64_t mailbox_to, uint64_t mailbox_from)
#define EXPIRE_DAYS 3
int db_mailbox_has_message_id(uint64_t mailbox_idnr, const char *messageid)
{
- int rows = 0;
+ volatile int rows = 0;
Connection_T c; ResultSet_T r; PreparedStatement_T s;
char expire[DEF_FRAGSIZE], partial[DEF_FRAGSIZE];
INIT_QUERY;
@@ -2909,7 +2909,7 @@ int db_mailbox_has_message_id(uint64_t mailbox_idnr, const char *messageid)
static uint64_t message_get_size(uint64_t message_idnr)
{
Connection_T c; ResultSet_T r;
- uint64_t size = 0;
+ volatile uint64_t size = 0;
c = db_con_get();
TRY
@@ -3443,8 +3443,8 @@ int db_usermap_resolve(ClientBase_T *ci, const char *username, char *real_userna
{
char clientsock[DM_SOCKADDR_LEN];
const char *userid = NULL, *sockok = NULL, *sockno = NULL, *login = NULL;
- unsigned row = 0;
- int result = TRUE;
+ volatile unsigned row = 0;
+ volatile int result = TRUE;
int score, bestscore = -1;
char *bestlogin = NULL, *bestuserid = NULL;
Connection_T c; ResultSet_T r; PreparedStatement_T s;
@@ -3653,7 +3653,7 @@ int db_user_validate(ClientBase_T *ci, const char *pwfield, uint64_t *user_idnr,
{
int is_validated = 0;
char salt[13], cryptres[35];
- int t = FALSE;
+ volatile int t = FALSE;
char dbpass[COLUMN_WIDTH+1];
char encode[COLUMN_WIDTH+1];
char hashstr[FIELDSIZE];
diff --git src/dm_mailbox.c src/dm_mailbox.c
index 3558b8e..6f4b99c 100644
--- src/dm_mailbox.c
+++ src/dm_mailbox.c
@@ -181,7 +181,7 @@ static int _mimeparts_dump(DbmailMailbox *self, GMimeStream *ostream)
uint64_t msgid, physid, *id;
DbmailMessage *m;
GTree *uids;
- int count = 0;
+ volatile int count = 0;
PreparedStatement_T stmt;
Connection_T c;
ResultSet_T r;
@@ -475,7 +475,7 @@ char * dbmail_mailbox_sorted_as_string(DbmailMailbox *self)
uint64_t *msn;
l = g_list_first(self->sorted);
- if (! g_list_length(l)>0)
+ if (! (g_list_length(l) > 0))
return s;
t = g_string_new("");
@@ -1224,7 +1224,7 @@ static GTree * mailbox_search(DbmailMailbox *self, search_key *s)
char partial[DEF_FRAGSIZE];
Connection_T c; ResultSet_T r; PreparedStatement_T st;
GTree *ids;
- char *inset = NULL;
+ volatile char *inset = NULL;
GString *t;
String_T q;
diff --git src/dm_mailboxstate.c src/dm_mailboxstate.c
index 2ef3fd3..723689a 100644
--- src/dm_mailboxstate.c
+++ src/dm_mailboxstate.c
@@ -977,7 +977,7 @@ int MailboxState_hasPermission(T M, uint64_t userid, const char *right_flag)
if (! owner_id) {
result = db_get_mailbox_owner(mboxid, &owner_id);
MailboxState_setOwner(M, owner_id);
- if (! result > 0)
+ if (! (result > 0))
return result;
}
@@ -1116,7 +1116,7 @@ int MailboxState_build_recent(T M)
return 0;
}
-static long long int _update_recent(GList *slices, uint64_t seq)
+static long long int _update_recent(volatile GList *slices, uint64_t seq)
{
INIT_QUERY;
Connection_T c;
diff --git src/dm_message.c src/dm_message.c
index 066634a..9d30d52 100644
--- src/dm_message.c
+++ src/dm_message.c
@@ -361,11 +361,11 @@ static DbmailMessage * _mime_retrieve(DbmailMessage *self)
ResultSet_T r;
char internal_date[SQL_INTERNALDATE_LEN];
GMimeContentType *mimetype = NULL;
- int prevdepth, depth = 0, row = 0;
+ volatile int prevdepth, depth = 0, row = 0;
volatile int t = FALSE;
- gboolean got_boundary = FALSE, prev_boundary = FALSE, is_header = TRUE, prev_header, finalized=FALSE;
- gboolean prev_is_message = FALSE, is_message = FALSE;
- String_T m = NULL, n = NULL;
+ volatile gboolean got_boundary = FALSE, prev_boundary = FALSE, is_header = TRUE, prev_header, finalized=FALSE;
+ volatile gboolean prev_is_message = FALSE, is_message = FALSE;
+ volatile String_T m = NULL, n = NULL;
const void *blob;
Field_T frag;
@@ -530,7 +530,7 @@ static gboolean store_mime_multipart(GMimeObject *object, DbmailMessage *m, cons
{
const char *boundary;
const char *preface = NULL, *postface = NULL;
- int n, i, c;
+ int n = 0, i, c;
g_return_val_if_fail(GMIME_IS_OBJECT(object), TRUE);
@@ -1977,7 +1977,7 @@ DbmailMessage * dbmail_message_construct(DbmailMessage *self,
static int get_mailbox_from_filters(DbmailMessage *message, uint64_t useridnr, const char *mailbox, char *into, size_t into_n)
{
- int t = FALSE;
+ volatile int t = FALSE;
uint64_t anyone = 0;
PreparedStatement_T stmt;
Connection_T c;
diff --git src/dm_misc.c src/dm_misc.c
index e6ca9a0..1294930 100644
--- src/dm_misc.c
+++ src/dm_misc.c
@@ -1029,7 +1029,7 @@ int g_tree_merge(GTree *a, GTree *b, int condition)
type=g_strdup("AND");
- if (! g_tree_nnodes(a) > 0)
+ if (! (g_tree_nnodes(a) > 0))
break;
/* delete from A all keys not in B */
@@ -1053,7 +1053,7 @@ int g_tree_merge(GTree *a, GTree *b, int condition)
case IST_SUBSEARCH_OR:
type=g_strdup("OR");
- if (! g_tree_nnodes(b) > 0)
+ if (! (g_tree_nnodes(b) > 0))
break;
merger->tree = a;
@@ -1081,7 +1081,7 @@ int g_tree_merge(GTree *a, GTree *b, int condition)
case IST_SUBSEARCH_NOT:
type=g_strdup("NOT");
- if (! g_tree_nnodes(b) > 0)
+ if (! (g_tree_nnodes(b) > 0))
break;
keys = g_tree_keys(b);
diff --git src/dm_sievescript.c src/dm_sievescript.c
index e163413..80f333d 100644
--- src/dm_sievescript.c
+++ src/dm_sievescript.c
@@ -132,7 +132,7 @@ int dm_sievescript_list(uint64_t user_idnr, GList **scriptlist)
int dm_sievescript_rename(uint64_t user_idnr, char *scriptname, char *newname)
{
- int active = 0;
+ volatile int active = 0;
Connection_T c; ResultSet_T r; PreparedStatement_T s; volatile int t = FALSE;
assert(scriptname);
diff --git src/maintenance.c src/maintenance.c
index 2e46453..b4a020b 100644
--- src/maintenance.c
+++ src/maintenance.c
@@ -1012,7 +1012,7 @@ int do_migrate(int migrate_limit)
{
Connection_T c; ResultSet_T r;
int id = 0;
- int count = 0;
+ volatile int count = 0;
DbmailMessage *m;
qprintf ("Migrate legacy 2.2.x messageblks to mimeparts...\n");
diff --git src/modules/authsql.c src/modules/authsql.c
index 49e1dc9..8e4829e 100644
--- src/modules/authsql.c
+++ src/modules/authsql.c
@@ -97,7 +97,7 @@ int auth_getclientid(uint64_t user_idnr, uint64_t * client_idnr)
{
assert(client_idnr != NULL);
*client_idnr = 0;
- C c; R r; int t = TRUE;
+ C c; R r; volatile int t = TRUE;
c = db_con_get();
TRY
@@ -118,7 +118,7 @@ int auth_getmaxmailsize(uint64_t user_idnr, uint64_t * maxmail_size)
{
assert(maxmail_size != NULL);
*maxmail_size = 0;
- C c; R r; int t = TRUE;
+ C c; R r; volatile int t = TRUE;
c = db_con_get();
TRY
@@ -361,7 +361,7 @@ uint64_t auth_md5_validate(ClientBase_T *ci UNUSED, char *username,
uint64_t user_idnr = 0;
const char *dbpass;
C c; R r;
- int t = FALSE;
+ volatile int t = FALSE;
/* lookup the user_idnr */
if (! auth_user_exists(username, &user_idnr))
@@ -430,7 +430,7 @@ char *auth_get_userid(uint64_t user_idnr)
int auth_check_userid(uint64_t user_idnr)
{
- C c; R r; gboolean t = TRUE;
+ C c; R r; volatile gboolean t = TRUE;
c = db_con_get();
TRY
@@ -570,7 +570,7 @@ int auth_addalias_ext(const char *alias,
int auth_removealias(uint64_t user_idnr, const char *alias)
{
- C c; S s; gboolean t = FALSE;
+ C c; S s; volatile gboolean t = FALSE;
c = db_con_get();
TRY
@@ -590,7 +590,7 @@ int auth_removealias(uint64_t user_idnr, const char *alias)
int auth_removealias_ext(const char *alias, const char *deliver_to)
{
- C c; S s; gboolean t = FALSE;
+ C c; S s; volatile gboolean t = FALSE;
c = db_con_get();
TRY
diff --git src/pop3.c src/pop3.c
index d03f71a..b7106d3 100644
--- src/pop3.c
+++ src/pop3.c
@@ -99,7 +99,7 @@ static int db_createsession(uint64_t user_idnr, ClientSession_T * session)
{
Connection_T c; ResultSet_T r; volatile int t = DM_SUCCESS;
struct message *tmpmessage;
- int message_counter = 0;
+ volatile int message_counter = 0;
const char *query_result;
uint64_t mailbox_idnr;
INIT_QUERY;
--
2.10.1 (Apple Git-78)