summaryrefslogtreecommitdiff
blob: 3d85fc6bd9d2252e9db5a914197ec2924d689b75 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
diff --git a/dbmail-message.c b/dbmail-message.c
index 21d5bcc..2feb35a 100644
--- a/dbmail-message.c
+++ b/dbmail-message.c
@@ -885,10 +885,14 @@ static int _header_get_id(const struct D
 	u64_t tmp;
 	gpointer cacheid;
 	gchar *safe_header;
+	gchar *tmpheader;
 
-	if (! (safe_header = dm_strnesc(header,CACHE_WIDTH_NAME)))
+	if (! (tmpheader = dm_strnesc(header,CACHE_WIDTH_NAME)))
 		return -1;
 
+	safe_header = g_ascii_strdown(tmpheader,-1);
+	g_free(tmpheader);
+
 	cacheid = g_hash_table_lookup(self->header_dict, (gconstpointer)safe_header);
 	if (cacheid) {
 		*id = GPOINTER_TO_UINT(cacheid);
@@ -897,7 +901,7 @@ static int _header_get_id(const struct D
 	}
 		
 	GString *q = g_string_new("");
-	g_string_printf(q, "SELECT id FROM %sheadername WHERE headername='%s'", DBPFX, safe_header);
+	g_string_printf(q, "SELECT id FROM %sheadername WHERE lower(headername)='%s'", DBPFX, safe_header);
 	if (db_query(q->str) == -1) {
 		g_string_free(q,TRUE);
 		g_free(safe_header);