rpms/dbmail/F-13 dbmail-2.2.15-clip-to-zero.patch, NONE, 1.1 dbmail-2.2.15-long-running-iquery.patch, NONE, 1.1 dbmail-2.2.15-query-regression.patch, NONE, 1.1 dbmail-2.2.15-stack-smash.patch, NONE, 1.1 dbmail.spec, 1.34, 1.35

Bernard Johnson bjohnson at fedoraproject.org
Sat Apr 17 02:16:16 UTC 2010


Author: bjohnson

Update of /cvs/pkgs/rpms/dbmail/F-13
In directory cvs01.phx2.fedoraproject.org:/tmp/cvs-serv29517/F-13

Modified Files:
	dbmail.spec 
Added Files:
	dbmail-2.2.15-clip-to-zero.patch 
	dbmail-2.2.15-long-running-iquery.patch 
	dbmail-2.2.15-query-regression.patch 
	dbmail-2.2.15-stack-smash.patch 
Log Message:
- clip to zero patch
- query regression patch
- stack smash patch
- long running iquery patch


dbmail-2.2.15-clip-to-zero.patch:
 db.c |    5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

--- NEW FILE dbmail-2.2.15-clip-to-zero.patch ---
>From d6ceab981b8bbbe4925460d2043f4c03453315a5 Mon Sep 17 00:00:00 2001
From: Paul J Stevens <paul at nfg.nl>
Date: Tue, 16 Mar 2010 16:48:30 +0100
Subject: [PATCH] clip to zero when subtracting unsigned below zero

---
 db.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/db.c b/db.c
index 29d4e48..a95e622 100644
--- a/db.c
+++ b/db.c
@@ -440,8 +440,8 @@ static int user_quotum_dec(u64_t user_idnr, u64_t size)
 	TRACE(TRACE_DEBUG, "subtracting %llu from mailsize", size);
 
 	snprintf(query, DEF_QUERYSIZE,
-		 "UPDATE %susers SET curmail_size = curmail_size - %llu "
-		 "WHERE user_idnr = %llu", DBPFX, size, user_idnr);
+		 "UPDATE %susers SET curmail_size = CASE curmail_size >= %llu THEN curmail_size - %llu ELSE 0 END "
+		 "WHERE user_idnr = %llu", DBPFX, size, size, user_idnr);
 	
 	if (db_query(query) == -1)
 		return DM_EQUERY;
-- 
1.7.0.2


dbmail-2.2.15-long-running-iquery.patch:
 db.c |   41 ++++++++++++++++++++++++++++++++---------
 1 file changed, 32 insertions(+), 9 deletions(-)

--- NEW FILE dbmail-2.2.15-long-running-iquery.patch ---
>From 2adf5966f78326b382bda304fdf2ae0b78493c19 Mon Sep 17 00:00:00 2001
From: Paul J Stevens <paul at nfg.nl>
Date: Thu, 15 Apr 2010 09:48:24 +0200
Subject: [PATCH] fix long-running icheck query

backport for deleting orphaned physmessages where a sub-query is
taking too long
---
 db.c |   40 ++++++++++++++++++++++++++++++++--------
 1 files changed, 32 insertions(+), 8 deletions(-)

diff --git a/db.c b/db.c
index dd50a2e..d6fb3b7 100644
--- a/db.c
+++ b/db.c
@@ -1549,28 +1549,52 @@ int db_icheck_messageblks(struct dm_list *lost_list)
 }
 int db_icheck_physmessages(gboolean cleanup)
 {
-	int result;
+	int result, i, n;
 	char query[DEF_QUERYSIZE];
 	memset(query,0,sizeof(query));
+	GList *ids = NULL;
 
 	if (cleanup) {
 		snprintf(query, DEF_QUERYSIZE, 
-				"DELETE FROM %sphysmessage WHERE id NOT IN "
-				"(SELECT physmessage_id FROM %smessages)", DBPFX, DBPFX);
+		                "SELECT p.id FROM %sphysmessage p LEFT JOIN %smessages m ON p.id = m.physmessage_id "
+				"WHERE m.physmessage_id IS NULL", DBPFX, DBPFX);
+
+		if ((result = db_query(query)) < 0) {
+			db_free_result();
+			return result;
+		}
+		n = db_num_rows();
+		for (i = 0; i < n; i++) {
+			u64_t *id = g_new0(u64_t,1);
+			*id = db_get_result_u64(i, 0);
+			ids = g_list_prepend(ids, id);
+		}
+		while(ids) {
+			snprintf(query, DEF_QUERYSIZE,
+					"DELETE FROM %sphysmessage WHERE id = %llu", DBPFX, *(u64_t *)ids->data);
+			if ((result = db_query(query)) < 0) {
+				db_free_result();
+				return result;
+			}
+			if (! g_list_next(ids)) break;
+			ids = g_list_next(ids);
+		}
+
 	} else {
 		snprintf(query, DEF_QUERYSIZE, 
 				"SELECT COUNT(*) FROM %sphysmessage p "
 				"LEFT JOIN %smessages m ON p.id = m.physmessage_id "
 				"WHERE m.message_idnr IS NULL ", DBPFX, DBPFX);
-	}
 
-	if ((result = db_query(query)) < 0) {
-		db_free_result();
-		return result;
+		if ((result = db_query(query)) < 0) {
+			db_free_result();
+			return result;
+		}
+		result = db_get_result_int(0,0);
 	}
 
+
 	if (! cleanup)
-		result = db_get_result_int(0,0);
 
 	db_free_result();
 	return result;
-- 
1.7.0.2


dbmail-2.2.15-query-regression.patch:
 db.c |    3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

--- NEW FILE dbmail-2.2.15-query-regression.patch ---
>From a91d55fb1bb85cdfe980b9c5f615175605d41dd7 Mon Sep 17 00:00:00 2001
From: Paul J Stevens <paul at nfg.nl>
Date: Fri, 26 Mar 2010 15:33:46 +0100
Subject: [PATCH] fix small regression

---
 db.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/db.c b/db.c
index a95e622..ecd8c5e 100644
--- a/db.c
+++ b/db.c
@@ -440,7 +440,7 @@ static int user_quotum_dec(u64_t user_idnr, u64_t size)
 	TRACE(TRACE_DEBUG, "subtracting %llu from mailsize", size);
 
 	snprintf(query, DEF_QUERYSIZE,
-		 "UPDATE %susers SET curmail_size = CASE curmail_size >= %llu THEN curmail_size - %llu ELSE 0 END "
+		 "UPDATE %susers SET curmail_size = CASE WHEN curmail_size >= %llu THEN curmail_size - %llu ELSE 0 END "
 		 "WHERE user_idnr = %llu", DBPFX, size, size, user_idnr);
 	
 	if (db_query(query) == -1)
-- 
1.7.0.2


dbmail-2.2.15-stack-smash.patch:
 db.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

--- NEW FILE dbmail-2.2.15-stack-smash.patch ---
>From 46aa049b93e2e1d7a7ceac11af38fde86da4725d Mon Sep 17 00:00:00 2001
From: Leontiy Onishchuk <lonish at finestudio.net>
Date: Thu, 15 Apr 2010 09:29:55 +0200
Subject: [PATCH] fix stack smash (#842)

Signed-off-by: Paul J Stevens <paul at nfg.nl>
---
 db.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/db.c b/db.c
index ecd8c5e..dd50a2e 100644
--- a/db.c
+++ b/db.c
@@ -4698,7 +4698,8 @@ int db_usermap_resolve(clientinfo_t *ci, const char *username, char *real_userna
 	} else {
 		/* get the socket the client is connecting on */
 		int serr;
-                socklen_t len = sizeof(struct sockaddr_storage);
+                //socklen_t len = sizeof(struct sockaddr_storage);
+                socklen_t len = sizeof(saddr);
                 char host[NI_MAXHOST], serv[NI_MAXSERV];
 
                 if (getsockname(fileno(ci->tx), &saddr, &len) < 0) {
-- 
1.7.0.2



Index: dbmail.spec
===================================================================
RCS file: /cvs/pkgs/rpms/dbmail/F-13/dbmail.spec,v
retrieving revision 1.34
retrieving revision 1.35
diff -u -p -r1.34 -r1.35
--- dbmail.spec	13 Mar 2010 21:25:37 -0000	1.34
+++ dbmail.spec	17 Apr 2010 02:16:15 -0000	1.35
@@ -10,7 +10,7 @@
 
 Name:           dbmail
 Version:        2.2.15
-Release:        1%{?dist}
+Release:        2%{?dist}
 Summary:        A database backed mail storage system
 
 Group:          System Environment/Daemons
@@ -33,6 +33,10 @@ Source7:        README.fedora
 # be reintroduced.
 Patch0:         dbmail-2.2.14-glib2-version.patch
 Patch1:         dbmail-2.2.14-reverse-md5-implementation.patch
+Patch2:         dbmail-2.2.15-clip-to-zero.patch
+Patch3:         dbmail-2.2.15-query-regression.patch
+Patch4:         dbmail-2.2.15-stack-smash.patch
+Patch5:         dbmail-2.2.15-long-running-iquery.patch
 
 BuildRoot:      %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
 
@@ -79,6 +83,10 @@ installation and configuration in Fedora
 # Note the use of -R to reverse this patch
 %patch1 -R -p1 -b .md5-implementation
 %endif
+%patch2 -p1 -b .clip-to-zero
+%patch3 -p1 -b .query-regression
+%patch4 -p1 -b .stack-smash
+%patch5 -p1 -b .long-running-iquery
 
 # we don't need README.solaris and we don't want it caught up in the %%doc
 # README* wildcard - but we do want our shiny new README.fedora file to be
@@ -239,6 +247,12 @@ This is the postgresql libraries for dbm
 %{_libdir}/dbmail/libpgsql*
 
 %changelog
+* Fri Apr 16 2010 Bernard Johnson <bjohnson at symetrix.com> - 2.2.15-2
+- clip to zero patch
+- query regression patch
+- stack smash patch
+- long running iquery patch
+
 * Sun Feb 14 2010 Bernard Johnson <bjohnson at symetrix.com> - 2.2.15-1
 - v 2.2.15
 - remove patches upstreamed



More information about the scm-commits mailing list