summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--acl.c8
-rw-r--r--check_dbmail_db.c2
-rw-r--r--check_dbmail_mailbox.c4
-rw-r--r--db.c408
-rw-r--r--dbmail-imapsession.c70
-rw-r--r--dbmail-mailbox.c42
-rw-r--r--dbmail-message.c20
-rw-r--r--dbmail-user.c28
-rw-r--r--dbmailtypes.h1
-rw-r--r--dsn.c12
-rw-r--r--export.c4
-rw-r--r--imapcommands.c34
-rw-r--r--list.c4
-rw-r--r--main.c2
-rw-r--r--maintenance.c44
-rw-r--r--misc.c8
-rw-r--r--modules/authldap.c40
-rw-r--r--modules/authsql.c56
-rw-r--r--pipe.c24
-rw-r--r--pop3.c34
-rw-r--r--sort.c20
-rw-r--r--timsieve.c4
22 files changed, 445 insertions, 424 deletions
diff --git a/acl.c b/acl.c
index f090bf8a..043488aa 100644
--- a/acl.c
+++ b/acl.c
@@ -153,7 +153,7 @@ acl_replace_rights(u64_t userid, u64_t mboxid, const char *rightsstring)
unsigned i;
int set;
- TRACE(TRACE_DEBUG, "replacing rights for user [%llu], mailbox [%llu] to %s", userid, mboxid, rightsstring);
+ TRACE(TRACE_DEBUG, "replacing rights for user [%" U64_T_FORMAT "], mailbox [%" U64_T_FORMAT "] to %s", userid, mboxid, rightsstring);
for (i = ACL_RIGHT_LOOKUP; i < ACL_RIGHT_NONE; i++) {
if (strchr(rightsstring, (int) acl_right_chars[i]))
@@ -203,7 +203,7 @@ char *acl_get_acl(u64_t mboxid)
result = db_acl_get_identifier(mboxid, &identifier_list);
if (result < 0) {
- TRACE(TRACE_ERROR, "error when getting identifier list for mailbox [%llu].", mboxid);
+ TRACE(TRACE_ERROR, "error when getting identifier list for mailbox [%" U64_T_FORMAT "].", mboxid);
dm_list_free(&identifier_list.start);
return NULL;
}
@@ -218,7 +218,7 @@ char *acl_get_acl(u64_t mboxid)
}
if ((username = auth_get_userid(userid)) == NULL) {
- TRACE(TRACE_ERROR, "error getting username for user [%llu]", userid);
+ TRACE(TRACE_ERROR, "error getting username for user [%" U64_T_FORMAT "]", userid);
dm_list_free(&identifier_list.start);
return NULL;
}
@@ -341,7 +341,7 @@ int acl_get_rightsstring(u64_t userid, u64_t mboxid, char *rightsstring)
return result;
if (owner_idnr == userid) {
- TRACE(TRACE_DEBUG, "mailbox [%llu] is owned by user [%llu], giving all rights", mboxid, userid);
+ TRACE(TRACE_DEBUG, "mailbox [%" U64_T_FORMAT "] is owned by user [%" U64_T_FORMAT "], giving all rights", mboxid, userid);
g_strlcat(rightsstring, acl_right_chars, NR_ACL_FLAGS+1);
return 1;
}
diff --git a/check_dbmail_db.c b/check_dbmail_db.c
index a2bdd818..77cef278 100644
--- a/check_dbmail_db.c
+++ b/check_dbmail_db.c
@@ -179,7 +179,7 @@ START_TEST(test_db_mailbox_set_permission)
int result;
u64_t mailbox_id;
result = db_find_create_mailbox("testpermissionbox", BOX_DEFAULT, testidnr, &mailbox_id);
- fail_unless(mailbox_id, "db_find_create_mailbox [testpermissionbox] owned by [%llu] failed [%llu].", testidnr, mailbox_id);
+ fail_unless(mailbox_id, "db_find_create_mailbox [testpermissionbox] owned by [%" U64_T_FORMAT "] failed [%" U64_T_FORMAT "].", testidnr, mailbox_id);
result = db_mailbox_set_permission(mailbox_id, IMAPPERM_READ);
fail_unless(result==0,"db_mailbox_set_permission failed");
diff --git a/check_dbmail_mailbox.c b/check_dbmail_mailbox.c
index ac8aff15..a57cabd9 100644
--- a/check_dbmail_mailbox.c
+++ b/check_dbmail_mailbox.c
@@ -58,7 +58,7 @@ static gboolean tree_print(gpointer key, gpointer value, gpointer data UNUSED)
u64_t *k = (u64_t *)key;
u64_t *v = (u64_t *)value;
- printf("[%llu: %llu]\n", *k, *v);
+ printf("[%" U64_T_FORMAT ": %" U64_T_FORMAT "]\n", *k, *v);
return FALSE;
}
@@ -74,7 +74,7 @@ static gboolean _node_cat(u64_t *key, u64_t *value, GString **s)
if (! (key && value))
return TRUE;
- g_string_append_printf(*(GString **)s, "[%llu: %llu]\n", *key,*value);
+ g_string_append_printf(*(GString **)s, "[%" U64_T_FORMAT ": %" U64_T_FORMAT "]\n", *key,*value);
return FALSE;
}
diff --git a/db.c b/db.c
index 2c1aa049..dc64b48f 100644
--- a/db.c
+++ b/db.c
@@ -335,7 +335,7 @@ int db_get_physmessage_id(u64_t mailbox_idnr, u64_t message_idnr, u64_t * physme
snprintf(query, DEF_QUERYSIZE,
"SELECT physmessage_id FROM %smessages "
- "WHERE mailbox_idnr = %llu AND message_idnr = %llu", DBPFX, mailbox_idnr, message_idnr);
+ "WHERE mailbox_idnr = %" U64_T_FORMAT " AND message_idnr = %" U64_T_FORMAT, DBPFX, mailbox_idnr, message_idnr);
if (db_query(query) == -1) {
TRACE(TRACE_ERROR, "error getting physmessage_id");
@@ -364,10 +364,10 @@ int db_get_quotum_used(u64_t user_idnr, u64_t * curmail_size)
snprintf(query, DEF_QUERYSIZE,
"SELECT curmail_size FROM %susers "
- "WHERE user_idnr = %llu", DBPFX, user_idnr);
+ "WHERE user_idnr = %" U64_T_FORMAT, DBPFX, user_idnr);
if (db_query(query) == -1) {
TRACE(TRACE_ERROR, "error getting used quotum for "
- "user [%llu]" , user_idnr);
+ "user [%" U64_T_FORMAT "]" , user_idnr);
return DM_EQUERY;
}
@@ -390,8 +390,8 @@ static int user_quotum_set(u64_t user_idnr, u64_t size)
return DM_SUCCESS;
snprintf(query, DEF_QUERYSIZE,
- "UPDATE %susers SET curmail_size = %llu "
- "WHERE user_idnr = %llu", DBPFX, size, user_idnr);
+ "UPDATE %susers SET curmail_size = %" U64_T_FORMAT " "
+ "WHERE user_idnr = %" U64_T_FORMAT, DBPFX, size, user_idnr);
if (db_query(query) == DM_EQUERY)
return DM_EQUERY;
@@ -412,11 +412,11 @@ static int user_quotum_inc(u64_t user_idnr, u64_t size)
if (result == 1)
return DM_SUCCESS;
- TRACE(TRACE_DEBUG, "adding %llu to mailsize", size);
+ TRACE(TRACE_DEBUG, "adding %" U64_T_FORMAT " to 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 = curmail_size + %" U64_T_FORMAT " "
+ "WHERE user_idnr = %" U64_T_FORMAT, DBPFX, size, user_idnr);
if (db_query(query) == DM_EQUERY)
return DM_EQUERY;
@@ -437,11 +437,11 @@ static int user_quotum_dec(u64_t user_idnr, u64_t size)
if (result == 1)
return DM_SUCCESS;
- TRACE(TRACE_DEBUG, "subtracting %llu from mailsize", size);
+ TRACE(TRACE_DEBUG, "subtracting %" U64_T_FORMAT " from mailsize", size);
snprintf(query, DEF_QUERYSIZE,
- "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);
+ "UPDATE %susers SET curmail_size = CASE WHEN curmail_size >= %" U64_T_FORMAT " THEN curmail_size - %" U64_T_FORMAT " ELSE 0 END "
+ "WHERE user_idnr = %" U64_T_FORMAT, DBPFX, size, size, user_idnr);
if (db_query(query) == -1)
return DM_EQUERY;
@@ -466,13 +466,13 @@ static int user_quotum_check(u64_t user_idnr, u64_t msg_size)
snprintf(query, DEF_QUERYSIZE,
"SELECT 1 FROM %susers "
- "WHERE user_idnr = %llu "
- "AND (curmail_size + %llu > %llu)",
+ "WHERE user_idnr = %" U64_T_FORMAT " "
+ "AND (curmail_size + %" U64_T_FORMAT " > %" U64_T_FORMAT ")",
DBPFX, user_idnr, msg_size, maxmail_size);
if (db_query(query) == -1) {
TRACE(TRACE_ERROR, "error checking quotum for "
- "user [%llu]", user_idnr);
+ "user [%" U64_T_FORMAT "]", user_idnr);
return DM_EQUERY;
}
@@ -572,7 +572,7 @@ int db_calculate_quotum_used(u64_t user_idnr)
"FROM %sphysmessage pm, %smessages m, %smailboxes mb "
"WHERE m.physmessage_id = pm.id "
"AND m.mailbox_idnr = mb.mailbox_idnr "
- "AND mb.owner_idnr = %llu " "AND m.status < %d",
+ "AND mb.owner_idnr = %" U64_T_FORMAT " " "AND m.status < %d",
DBPFX,DBPFX,DBPFX,user_idnr, MESSAGE_STATUS_DELETE);
if (db_query(query) == -1) {
@@ -586,11 +586,11 @@ int db_calculate_quotum_used(u64_t user_idnr)
quotum = db_get_result_u64(0, 0);
}
db_free_result();
- TRACE(TRACE_DEBUG, "found quotum usage of [%llu] bytes", quotum);
+ TRACE(TRACE_DEBUG, "found quotum usage of [%" U64_T_FORMAT "] bytes", quotum);
/* now insert the used quotum into the users table */
if (user_quotum_set(user_idnr, quotum) == -1) {
if (db_query(query) == -1) {
- TRACE(TRACE_ERROR, "error setting quotum for user [%llu]"
+ TRACE(TRACE_ERROR, "error setting quotum for user [%" U64_T_FORMAT "]"
, user_idnr);
return DM_EQUERY;
}
@@ -609,7 +609,7 @@ int db_get_sievescript_byname(u64_t user_idnr, char *scriptname, char **script)
escaped_scriptname = dm_stresc(scriptname);
snprintf(query, DEF_QUERYSIZE,
"SELECT script FROM %ssievescripts WHERE "
- "owner_idnr = %llu AND name = '%s'",
+ "owner_idnr = %" U64_T_FORMAT " AND name = '%s'",
DBPFX,user_idnr,escaped_scriptname);
g_free(escaped_scriptname);
@@ -661,14 +661,14 @@ int db_check_sievescript_active_byname(u64_t user_idnr, const char *scriptname)
snprintf(query, DEF_QUERYSIZE,
"SELECT name FROM %ssievescripts WHERE "
- "owner_idnr = %llu AND active = 1 AND name = '%s'",
+ "owner_idnr = %" U64_T_FORMAT " AND active = 1 AND name = '%s'",
DBPFX, user_idnr, name);
g_free(name);
} else {
snprintf(query, DEF_QUERYSIZE,
"SELECT name FROM %ssievescripts WHERE "
- "owner_idnr = %llu AND active = 1",
+ "owner_idnr = %" U64_T_FORMAT " AND active = 1",
DBPFX, user_idnr);
}
@@ -700,7 +700,7 @@ int db_get_sievescript_active(u64_t user_idnr, char **scriptname)
snprintf(query, DEF_QUERYSIZE,
"SELECT name from %ssievescripts where "
- "owner_idnr = %llu and active = 1",
+ "owner_idnr = %" U64_T_FORMAT " and active = 1",
DBPFX, user_idnr);
if (db_query(query) == -1) {
@@ -727,7 +727,7 @@ int db_get_sievescript_listall(u64_t user_idnr, struct dm_list *scriptlist)
dm_list_init(scriptlist);
snprintf(query, DEF_QUERYSIZE,
"SELECT name,active FROM %ssievescripts WHERE "
- "owner_idnr = %llu",
+ "owner_idnr = %" U64_T_FORMAT,
DBPFX,user_idnr);
if (db_query(query) == -1) {
@@ -769,7 +769,7 @@ int db_rename_sievescript(u64_t user_idnr, char *scriptname, char *newname)
snprintf(query, DEF_QUERYSIZE,
"SELECT active FROM %ssievescripts "
- "WHERE owner_idnr = %llu AND name = '%s'",
+ "WHERE owner_idnr = %" U64_T_FORMAT " AND name = '%s'",
DBPFX,user_idnr,escaped_newname);
if (db_query(query) == -1 ) {
@@ -784,7 +784,7 @@ int db_rename_sievescript(u64_t user_idnr, char *scriptname, char *newname)
db_free_result();
snprintf(query, DEF_QUERYSIZE,
"DELETE FROM %ssievescripts "
- "WHERE owner_idnr = %llu AND name = '%s'",
+ "WHERE owner_idnr = %" U64_T_FORMAT " AND name = '%s'",
DBPFX,user_idnr,escaped_newname);
if (db_query(query) == -1 ) {
@@ -798,14 +798,14 @@ int db_rename_sievescript(u64_t user_idnr, char *scriptname, char *newname)
db_free_result();
snprintf(query, DEF_QUERYSIZE,
"UPDATE %ssievescripts SET name = '%s', active = %d "
- "WHERE owner_idnr = %llu AND name = '%s'",
+ "WHERE owner_idnr = %" U64_T_FORMAT " AND name = '%s'",
DBPFX,escaped_newname,active,user_idnr,escaped_scriptname);
g_free(escaped_scriptname);
g_free(escaped_newname);
if (db_query(query) == -1) {
TRACE(TRACE_ERROR, "error replacing sievescript '%s' "
- "for user_idnr [%llu]" ,
+ "for user_idnr [%" U64_T_FORMAT "]" ,
scriptname, user_idnr);
db_rollback_transaction();
return DM_EQUERY;
@@ -830,7 +830,7 @@ int db_add_sievescript(u64_t user_idnr, char *scriptname, char *script)
escaped_scriptname = dm_stresc(scriptname);
snprintf(query, DEF_QUERYSIZE,
"SELECT COUNT(*) FROM %ssievescripts "
- "WHERE owner_idnr = %llu AND name = '%s'",
+ "WHERE owner_idnr = %" U64_T_FORMAT " AND name = '%s'",
DBPFX,user_idnr,escaped_scriptname);
if (db_query(query) == -1 ) {
@@ -843,7 +843,7 @@ int db_add_sievescript(u64_t user_idnr, char *scriptname, char *script)
db_free_result();
snprintf(query, DEF_QUERYSIZE,
"DELETE FROM %ssievescripts "
- "WHERE owner_idnr = %llu AND name = '%s'",
+ "WHERE owner_idnr = %" U64_T_FORMAT " AND name = '%s'",
DBPFX,user_idnr,escaped_scriptname);
if (db_query(query) == -1 ) {
@@ -860,7 +860,7 @@ int db_add_sievescript(u64_t user_idnr, char *scriptname, char *script)
startlen = snprintf(escaped_query, maxesclen,
"INSERT INTO %ssievescripts "
"(owner_idnr, name, script, active) "
- "VALUES (%llu,'%s', '",
+ "VALUES (%" U64_T_FORMAT ",'%s', '",
DBPFX, user_idnr, escaped_scriptname);
/* escape & add data */
@@ -872,7 +872,7 @@ int db_add_sievescript(u64_t user_idnr, char *scriptname, char *script)
if (db_query(escaped_query) == -1) {
TRACE(TRACE_ERROR, "error adding sievescript '%s' "
- "for user_idnr [%llu]" ,
+ "for user_idnr [%" U64_T_FORMAT "]" ,
scriptname, user_idnr);
db_rollback_transaction();
g_free(escaped_query);
@@ -894,13 +894,13 @@ int db_deactivate_sievescript(u64_t user_idnr, char *scriptname)
escaped_scriptname = dm_stresc(scriptname);
snprintf(query, DEF_QUERYSIZE,
"UPDATE %ssievescripts set active = 0 "
- "where owner_idnr = %llu and name = '%s'",
+ "where owner_idnr = %" U64_T_FORMAT " and name = '%s'",
DBPFX,user_idnr,escaped_scriptname);
g_free(escaped_scriptname);
if (db_query(query) == -1) {
TRACE(TRACE_ERROR, "error deactivating sievescript '%s' "
- "for user_idnr [%llu]" ,
+ "for user_idnr [%" U64_T_FORMAT "]" ,
scriptname, user_idnr);
return DM_EQUERY;
}
@@ -919,12 +919,12 @@ int db_activate_sievescript(u64_t user_idnr, char *scriptname)
escaped_scriptname = dm_stresc(scriptname);
snprintf(query, DEF_QUERYSIZE,
"UPDATE %ssievescripts SET active = 0 "
- "WHERE owner_idnr = %llu ",
+ "WHERE owner_idnr = %" U64_T_FORMAT " ",
DBPFX,user_idnr);
if (db_query(query) == -1) {
TRACE(TRACE_ERROR, "error activating sievescript '%s' "
- "for user_idnr [%llu]" ,
+ "for user_idnr [%" U64_T_FORMAT "]" ,
scriptname, user_idnr);
g_free(escaped_scriptname);
db_rollback_transaction();
@@ -933,13 +933,13 @@ int db_activate_sievescript(u64_t user_idnr, char *scriptname)
snprintf(query, DEF_QUERYSIZE,
"UPDATE %ssievescripts SET active = 1 "
- "WHERE owner_idnr = %llu AND name = '%s'",
+ "WHERE owner_idnr = %" U64_T_FORMAT " AND name = '%s'",
DBPFX,user_idnr,escaped_scriptname);
g_free(escaped_scriptname);
if (db_query(query) == -1) {
TRACE(TRACE_ERROR, "error activating sievescript '%s' "
- "for user_idnr [%llu]" ,
+ "for user_idnr [%" U64_T_FORMAT "]" ,
scriptname, user_idnr);
db_rollback_transaction();
return DM_EQUERY;
@@ -959,13 +959,13 @@ int db_delete_sievescript(u64_t user_idnr, char *scriptname)
escaped_scriptname = dm_stresc(scriptname);
snprintf(query, DEF_QUERYSIZE,
"DELETE FROM %ssievescripts "
- "WHERE owner_idnr = %llu AND name = '%s'",
+ "WHERE owner_idnr = %" U64_T_FORMAT " AND name = '%s'",
DBPFX,user_idnr,escaped_scriptname);
g_free(escaped_scriptname);
if (db_query(query) == -1) {
TRACE(TRACE_ERROR, "error deleting sievescript '%s' "
- "for user_idnr [%llu]" ,
+ "for user_idnr [%" U64_T_FORMAT "]" ,
scriptname, user_idnr);
return DM_EQUERY;
}
@@ -976,7 +976,7 @@ int db_delete_sievescript(u64_t user_idnr, char *scriptname)
int db_check_sievescript_quota(u64_t user_idnr, u64_t scriptlen)
{
/* TODO function db_check_sievescript_quota */
- TRACE(TRACE_DEBUG, "checking %llu sievescript quota with %llu"
+ TRACE(TRACE_DEBUG, "checking %" U64_T_FORMAT " sievescript quota with %" U64_T_FORMAT
, user_idnr, scriptlen);
return DM_SUCCESS;
}
@@ -984,7 +984,7 @@ int db_check_sievescript_quota(u64_t user_idnr, u64_t scriptlen)
int db_set_sievescript_quota(u64_t user_idnr, u64_t quotasize)
{
/* TODO function db_set_sievescript_quota */
- TRACE(TRACE_DEBUG, "setting %llu sievescript quota with %llu"
+ TRACE(TRACE_DEBUG, "setting %" U64_T_FORMAT " sievescript quota with %" U64_T_FORMAT
, user_idnr, quotasize);
return DM_SUCCESS;
}
@@ -992,7 +992,7 @@ int db_set_sievescript_quota(u64_t user_idnr, u64_t quotasize)
int db_get_sievescript_quota(u64_t user_idnr, u64_t * quotasize)
{
/* TODO function db_get_sievescript_quota */
- TRACE(TRACE_DEBUG, "getting sievescript quota for %llu"
+ TRACE(TRACE_DEBUG, "getting sievescript quota for %" U64_T_FORMAT
, user_idnr);
*quotasize = 0;
return DM_SUCCESS;
@@ -1009,7 +1009,7 @@ int db_get_notify_address(u64_t user_idnr, char **notify_address)
*notify_address = NULL;
snprintf(query, DEF_QUERYSIZE, "SELECT notify_address "
- "FROM %sauto_notifications WHERE user_idnr = %llu",
+ "FROM %sauto_notifications WHERE user_idnr = %" U64_T_FORMAT,
DBPFX,user_idnr);
if (db_query(query) == -1) {
@@ -1039,7 +1039,7 @@ int db_get_reply_body(u64_t user_idnr, char **reply_body)
snprintf(query, DEF_QUERYSIZE,
"SELECT reply_body FROM %sauto_replies "
- "WHERE user_idnr = %llu "
+ "WHERE user_idnr = %" U64_T_FORMAT " "
"AND (start_date IS NULL OR start_date <= %s) "
"AND (stop_date IS NULL OR stop_date >= %s)", DBPFX,
user_idnr, db_get_sql(SQL_CURRENT_TIMESTAMP), db_get_sql(SQL_CURRENT_TIMESTAMP));
@@ -1070,7 +1070,7 @@ u64_t db_get_mailbox_from_message(u64_t message_idnr)
snprintf(query, DEF_QUERYSIZE,
"SELECT mailbox_idnr FROM %smessages "
- "WHERE message_idnr = %llu", DBPFX,message_idnr);
+ "WHERE message_idnr = %" U64_T_FORMAT, DBPFX,message_idnr);
if (db_query(query) == -1) {
/* query failed */
@@ -1099,8 +1099,8 @@ u64_t db_get_useridnr(u64_t mailbox_idnr, u64_t message_idnr)
snprintf(query, DEF_QUERYSIZE,
"SELECT %smailboxes.owner_idnr FROM %smailboxes, %smessages "
"WHERE %smailboxes.mailbox_idnr = %smessages.mailbox_idnr "
- "AND %smessages.mailbox_idnr = %llu "
- "AND %smessages.message_idnr = %llu", DBPFX,DBPFX,DBPFX,
+ "AND %smessages.mailbox_idnr = %" U64_T_FORMAT " "
+ "AND %smessages.message_idnr = %" U64_T_FORMAT, DBPFX,DBPFX,DBPFX,
DBPFX,DBPFX,DBPFX,mailbox_idnr,DBPFX,message_idnr);
if (db_query(query) == -1) {
/* query failed */
@@ -1168,10 +1168,10 @@ int db_message_set_unique_id(u64_t mailbox_idnr, u64_t message_idnr, const char
snprintf(query, DEF_QUERYSIZE,
"UPDATE %smessages SET unique_id = '%s', status = %d "
- "WHERE mailbox_idnr = %llu AND message_idnr = %llu", DBPFX,
+ "WHERE mailbox_idnr = %" U64_T_FORMAT " AND message_idnr = %" U64_T_FORMAT, DBPFX,
unique_id, MESSAGE_STATUS_NEW, mailbox_idnr, message_idnr);
if (db_query(query) == DM_EQUERY) {
- TRACE(TRACE_ERROR, "setting unique id for mailbox [%llu] message [%llu] failed",
+ TRACE(TRACE_ERROR, "setting unique id for mailbox [%" U64_T_FORMAT "] message [%" U64_T_FORMAT "] failed",
mailbox_idnr, message_idnr);
return DM_EQUERY;
}
@@ -1186,12 +1186,12 @@ int db_physmessage_set_sizes(u64_t physmessage_id, u64_t message_size,
snprintf(query, DEF_QUERYSIZE,
"UPDATE %sphysmessage SET "
- "messagesize = %llu, rfcsize = %llu "
- "WHERE id = %llu", DBPFX, message_size, rfc_size, physmessage_id);
+ "messagesize = %" U64_T_FORMAT ", rfcsize = %" U64_T_FORMAT " "
+ "WHERE id = %" U64_T_FORMAT, DBPFX, message_size, rfc_size, physmessage_id);
if (db_query(query) < 0) {
TRACE(TRACE_ERROR, "error setting messagesize and "
- "rfcsize for physmessage [%llu]",
+ "rfcsize for physmessage [%" U64_T_FORMAT "]",
physmessage_id);
return DM_EQUERY;
}
@@ -1216,7 +1216,7 @@ int db_update_message(u64_t mailbox_idnr, u64_t message_idnr, const char *unique
if (user_quotum_inc(db_get_useridnr(mailbox_idnr, message_idnr), message_size)) {
TRACE(TRACE_ERROR, "error calculating quotum "
- "used for user [%llu]. Database might be "
+ "used for user [%" U64_T_FORMAT "]. Database might be "
"inconsistent. Run dbmail-util.",
db_get_useridnr(mailbox_idnr, message_idnr));
return DM_EQUERY;
@@ -1244,7 +1244,7 @@ int db_insert_message_block_physmessage(const char *block,
}
if (block_size > READ_BLOCK_SIZE) {
- TRACE(TRACE_ERROR, "blocksize [%llu], maximum is [%ld]",
+ TRACE(TRACE_ERROR, "blocksize [%" U64_T_FORMAT "], maximum is [%ld]",
block_size, READ_BLOCK_SIZE);
return DM_EQUERY;
}
@@ -1259,7 +1259,7 @@ int db_insert_message_block_physmessage(const char *block,
/* escape & add data */
esclen = db_escape_binary(&escaped_query[startlen], block, block_size);
snprintf(&escaped_query[esclen + startlen],
- maxesclen - esclen - startlen, "', %llu, %llu) %s",
+ maxesclen - esclen - startlen, "', %" U64_T_FORMAT ", %" U64_T_FORMAT ") %s",
block_size, physmessage_id, db_returning("messageblk_idnr"));
if (db_query(escaped_query) == DM_EQUERY) {
@@ -1291,7 +1291,7 @@ int db_insert_message_block(const char *block, u64_t block_size,
assert(*physmessage_id > 0);
if (db_insert_message_block_physmessage(block, block_size, *physmessage_id, messageblk_idnr, is_header) < 0) {
- TRACE(TRACE_ERROR, "error inserting messageblks for physmessage [%llu]",
+ TRACE(TRACE_ERROR, "error inserting messageblks for physmessage [%" U64_T_FORMAT "]",
physmessage_id);
return DM_EQUERY;
}
@@ -1329,7 +1329,7 @@ int db_log_ip(const char *ip)
if (id) {
/* this IP is already in the table, update the 'since' field */
snprintf(query, DEF_QUERYSIZE, "UPDATE %spbsp "
- "SET since = %s WHERE idnr=%llu",
+ "SET since = %s WHERE idnr=%" U64_T_FORMAT,
DBPFX, db_get_sql(SQL_CURRENT_TIMESTAMP), id);
if (db_query(query) == DM_EQUERY) {
@@ -1465,7 +1465,7 @@ int db_empty_mailbox(u64_t user_idnr)
snprintf(query, DEF_QUERYSIZE,
- "SELECT mailbox_idnr FROM %smailboxes WHERE owner_idnr=%llu",
+ "SELECT mailbox_idnr FROM %smailboxes WHERE owner_idnr=%" U64_T_FORMAT,
DBPFX, user_idnr);
if (db_query(query) == -1) {
@@ -1475,7 +1475,7 @@ int db_empty_mailbox(u64_t user_idnr)
n = db_num_rows();
if (n == 0) {
db_free_result();
- TRACE(TRACE_WARNING, "user [%llu] does not have any mailboxes?",
+ TRACE(TRACE_WARNING, "user [%" U64_T_FORMAT "] does not have any mailboxes?",
user_idnr);
return DM_SUCCESS;
}
@@ -1489,7 +1489,7 @@ int db_empty_mailbox(u64_t user_idnr)
for (i = 0; i < n; i++) {
if (db_delete_mailbox(mboxids[i], 1, 1)) {
- TRACE(TRACE_ERROR, "error emptying mailbox [%llu]",
+ TRACE(TRACE_ERROR, "error emptying mailbox [%" U64_T_FORMAT "]",
mboxids[i]);
result = -1;
}
@@ -1536,7 +1536,7 @@ int db_icheck_messageblks(struct dm_list *lost_list)
if (!(messageblk_idnr = db_get_result_u64(i, 0)))
continue;
- TRACE(TRACE_INFO, "found lost block id [%llu]",
+ TRACE(TRACE_INFO, "found lost block id [%" U64_T_FORMAT "]",
messageblk_idnr);
if (!dm_list_nodeadd
(lost_list, &messageblk_idnr, sizeof(u64_t))) {
@@ -1573,7 +1573,7 @@ int db_icheck_physmessages(gboolean cleanup)
}
while(ids) {
snprintf(query, DEF_QUERYSIZE,
- "DELETE FROM %sphysmessage WHERE id = %llu", DBPFX, *(u64_t *)ids->data);
+ "DELETE FROM %sphysmessage WHERE id = %" U64_T_FORMAT, DBPFX, *(u64_t *)ids->data);
if ((result = db_query(query)) < 0) {
db_free_result();
return result;
@@ -1637,7 +1637,7 @@ int db_icheck_messages(struct dm_list *lost_list)
if (!(box_uid.uid = db_get_result_u64(i, 1)))
continue;
- TRACE(TRACE_INFO, "found lost message id [%llu/%llu]", box_uid.mailbox, box_uid.uid);
+ TRACE(TRACE_INFO, "found lost message id [%" U64_T_FORMAT "/%" U64_T_FORMAT "]", box_uid.mailbox, box_uid.uid);
if (!dm_list_nodeadd(lost_list, &box_uid, sizeof(box_uid_t))) {
TRACE(TRACE_ERROR, "could not add message to list");
dm_list_free(&lost_list->start);
@@ -1681,7 +1681,7 @@ int db_icheck_mailboxes(struct dm_list *lost_list)
if (!(mailbox_idnr = db_get_result_u64(i, 0)))
continue;
- TRACE(TRACE_INFO, "found lost mailbox id [%llu]",
+ TRACE(TRACE_INFO, "found lost mailbox id [%" U64_T_FORMAT "]",
mailbox_idnr);
if (!dm_list_nodeadd(lost_list, &mailbox_idnr, sizeof(u64_t))) {
TRACE(TRACE_ERROR, "could not add mailbox to list");
@@ -1726,7 +1726,7 @@ int db_icheck_null_physmessages(struct dm_list *lost_list)
if (!(physmessage_id = db_get_result_u64(i, 0)))
continue;
- TRACE(TRACE_INFO, "found empty physmessage_id [%llu]", physmessage_id);
+ TRACE(TRACE_INFO, "found empty physmessage_id [%" U64_T_FORMAT "]", physmessage_id);
if (!dm_list_nodeadd
(lost_list, &physmessage_id, sizeof(u64_t))) {
TRACE(TRACE_ERROR, "could not add physmessage to list");
@@ -1773,7 +1773,7 @@ int db_icheck_null_messages(struct dm_list *lost_list)
if (!(box_uid.uid = db_get_result_u64(i, 1)))
continue;
- TRACE(TRACE_INFO, "found empty mailbox id [ %llu] message id [%llu]", box_uid.mailbox, box_uid.uid);
+ TRACE(TRACE_INFO, "found empty mailbox id [ %" U64_T_FORMAT "] message id [%" U64_T_FORMAT "]", box_uid.mailbox, box_uid.uid);
if (!dm_list_nodeadd(lost_list, &box_uid, sizeof(box_uid_t))) {
TRACE(TRACE_ERROR, "could not add message to list");
dm_list_free(&lost_list->start);
@@ -1890,15 +1890,15 @@ int db_update_rfcsize(GList *lost)
}
if (! (msg = dbmail_message_retrieve(msg, *pmsid, DBMAIL_MESSAGE_FILTER_FULL))) {
- TRACE(TRACE_WARNING, "error retrieving physmessage: [%llu]", *pmsid);
+ TRACE(TRACE_WARNING, "error retrieving physmessage: [%" U64_T_FORMAT "]", *pmsid);
fprintf(stderr,"E");
} else {
db_begin_transaction();
- g_string_printf(q,"UPDATE %sphysmessage SET rfcsize = %llu "
- "WHERE id = %llu", DBPFX, (u64_t)dbmail_message_get_size(msg,TRUE),
+ g_string_printf(q,"UPDATE %sphysmessage SET rfcsize = %" U64_T_FORMAT " "
+ "WHERE id = %" U64_T_FORMAT, DBPFX, (u64_t)dbmail_message_get_size(msg,TRUE),
*pmsid);
if (db_query(q->str)==-1) {
- TRACE(TRACE_WARNING, "error setting rfcsize physmessage: [%llu]",
+ TRACE(TRACE_WARNING, "error setting rfcsize physmessage: [%" U64_T_FORMAT "]",
*pmsid);
db_rollback_transaction();
fprintf(stderr,"E");
@@ -1935,12 +1935,12 @@ int db_set_headercache(GList *lost)
return DM_EQUERY;
if (! (msg = dbmail_message_retrieve(msg, pmsgid, DBMAIL_MESSAGE_FILTER_HEAD))) {
- TRACE(TRACE_WARNING, "error retrieving physmessage: [%llu]", pmsgid);
+ TRACE(TRACE_WARNING, "error retrieving physmessage: [%" U64_T_FORMAT "]", pmsgid);
fprintf(stderr,"E");
} else {
db_begin_transaction();
if (dbmail_message_cache_headers(msg) != 1) {
- TRACE(TRACE_WARNING,"error caching headers for physmessage: [%llu]",
+ TRACE(TRACE_WARNING,"error caching headers for physmessage: [%" U64_T_FORMAT "]",
pmsgid);
db_rollback_transaction();
fprintf(stderr,"E");
@@ -2007,7 +2007,7 @@ int db_set_envelope(GList *lost)
return DM_EQUERY;
if (! (msg = dbmail_message_retrieve(msg, pmsgid, DBMAIL_MESSAGE_FILTER_HEAD))) {
- TRACE(TRACE_WARNING,"error retrieving physmessage: [%llu]", pmsgid);
+ TRACE(TRACE_WARNING,"error retrieving physmessage: [%" U64_T_FORMAT "]", pmsgid);
fprintf(stderr,"E");
} else {
dbmail_message_cache_envelope(msg);
@@ -2042,7 +2042,7 @@ int db_icheck_envelope(GList **lost)
for (i = 0; i < db_num_rows(); i++) {
if (! (id = g_try_new0(u64_t,1))) {
- TRACE(TRACE_FATAL,"alloction error at physmessage.id [%llu]",
+ TRACE(TRACE_FATAL,"alloction error at physmessage.id [%" U64_T_FORMAT "]",
db_get_result_u64(i,0));
return DM_EGENERAL;
}
@@ -2061,7 +2061,7 @@ int db_set_message_status(u64_t mailbox_idnr, u64_t message_idnr, MessageStatus_
char query[DEF_QUERYSIZE];
memset(query,0,DEF_QUERYSIZE);
- snprintf(query, DEF_QUERYSIZE, "UPDATE %smessages SET status = %d WHERE mailbox_idnr = %llu AND message_idnr = %llu",
+ snprintf(query, DEF_QUERYSIZE, "UPDATE %smessages SET status = %d WHERE mailbox_idnr = %" U64_T_FORMAT " AND message_idnr = %" U64_T_FORMAT,
DBPFX, status, mailbox_idnr, message_idnr);
return db_query(query);
}
@@ -2071,7 +2071,7 @@ int db_delete_messageblk(u64_t messageblk_idnr)
char query[DEF_QUERYSIZE];
memset(query,0,DEF_QUERYSIZE);
- snprintf(query, DEF_QUERYSIZE, "DELETE FROM %smessageblks WHERE messageblk_idnr = %llu",
+ snprintf(query, DEF_QUERYSIZE, "DELETE FROM %smessageblks WHERE messageblk_idnr = %" U64_T_FORMAT,
DBPFX, messageblk_idnr);
return db_query(query);
}
@@ -2081,14 +2081,14 @@ int db_delete_physmessage(u64_t physmessage_id)
char query[DEF_QUERYSIZE];
memset(query,0,DEF_QUERYSIZE);
- snprintf(query, DEF_QUERYSIZE, "DELETE FROM %sphysmessage WHERE id = %llu",
+ snprintf(query, DEF_QUERYSIZE, "DELETE FROM %sphysmessage WHERE id = %" U64_T_FORMAT,
DBPFX, physmessage_id);
if (db_query(query) == -1)
return DM_EQUERY;
/* if foreign keys do their work (not with MySQL ISAM tables :( )
the next query would not be necessary */
- snprintf(query, DEF_QUERYSIZE, "DELETE FROM %smessageblks WHERE physmessage_id = %llu",
+ snprintf(query, DEF_QUERYSIZE, "DELETE FROM %smessageblks WHERE physmessage_id = %" U64_T_FORMAT,
DBPFX, physmessage_id);
if (db_query(query) == -1) {
TRACE(TRACE_ERROR, "could not execute query. There "
@@ -2115,20 +2115,20 @@ int db_delete_message(u64_t mailbox_idnr, u64_t message_idnr)
/* now delete the message from the message table */
snprintf(query, DEF_QUERYSIZE, "DELETE FROM %smessages "
- "WHERE mailbox_idnr = %llu AND message_idnr = %llu",
+ "WHERE mailbox_idnr = %" U64_T_FORMAT " AND message_idnr = %" U64_T_FORMAT,
DBPFX, mailbox_idnr, message_idnr);
if (db_query(query) == DM_EQUERY) {
- TRACE(TRACE_ERROR,"error deleting mailbox [%llu] message [%llu]", mailbox_idnr, message_idnr);
+ TRACE(TRACE_ERROR,"error deleting mailbox [%" U64_T_FORMAT "] message [%" U64_T_FORMAT "]", mailbox_idnr, message_idnr);
return DM_EQUERY;
}
/* find other messages pointing to the same physmessage entry */
snprintf(query, DEF_QUERYSIZE, "SELECT mailbox_idnr, message_idnr FROM %smessages "
- "WHERE physmessage_id = %llu",DBPFX, physmessage_id);
+ "WHERE physmessage_id = %" U64_T_FORMAT,DBPFX, physmessage_id);
if (db_query(query) == -1) {
- TRACE(TRACE_ERROR, "error finding physmessage for mailbox [%llu] message [%llu]", mailbox_idnr, message_idnr);
+ TRACE(TRACE_ERROR, "error finding physmessage for mailbox [%" U64_T_FORMAT "] message [%" U64_T_FORMAT "]", mailbox_idnr, message_idnr);
return DM_EQUERY;
}
@@ -2152,7 +2152,7 @@ static int mailbox_delete(u64_t mailbox_idnr)
memset(query,0,DEF_QUERYSIZE);
snprintf(query, DEF_QUERYSIZE,
- "DELETE FROM %smailboxes WHERE mailbox_idnr = %llu",DBPFX,
+ "DELETE FROM %smailboxes WHERE mailbox_idnr = %" U64_T_FORMAT,DBPFX,
mailbox_idnr);
if (db_query(query) == -1)
@@ -2173,7 +2173,7 @@ static int mailbox_empty(u64_t mailbox_idnr)
* need to find all messages in the box */
snprintf(query, DEF_QUERYSIZE,
"SELECT message_idnr FROM %smessages "
- "WHERE mailbox_idnr = %llu",DBPFX, mailbox_idnr);
+ "WHERE mailbox_idnr = %" U64_T_FORMAT,DBPFX, mailbox_idnr);
if (db_query(query) == -1)
return DM_EQUERY;
@@ -2214,11 +2214,11 @@ int db_delete_mailbox(u64_t mailbox_idnr, int only_empty,
result = db_get_mailbox_owner(mailbox_idnr, &user_idnr);
if (result == DM_EQUERY) {
TRACE(TRACE_ERROR, "cannot find owner of mailbox for "
- "mailbox [%llu]", mailbox_idnr);
+ "mailbox [%" U64_T_FORMAT "]", mailbox_idnr);
return DM_EQUERY;
}
if (result == 0) {
- TRACE(TRACE_ERROR, "unable to find owner of mailbox [%llu]",
+ TRACE(TRACE_ERROR, "unable to find owner of mailbox [%" U64_T_FORMAT "]",
mailbox_idnr);
return DM_EGENERAL;
}
@@ -2226,7 +2226,7 @@ int db_delete_mailbox(u64_t mailbox_idnr, int only_empty,
if (update_curmail_size) {
if (db_get_mailbox_size(mailbox_idnr, 0, &mailbox_size) < 0) {
TRACE(TRACE_ERROR, "error getting mailbox size "
- "for mailbox [%llu]",
+ "for mailbox [%" U64_T_FORMAT "]",
mailbox_idnr);
return DM_EQUERY;
}
@@ -2269,7 +2269,7 @@ int db_send_message_lines(void *fstream, u64_t mailbox_idnr, u64_t message_idnr,
if (db_get_physmessage_id(mailbox_idnr, message_idnr, &physmessage_id) != DM_SUCCESS)
return DM_EGENERAL;
- TRACE(TRACE_DEBUG, "sending [%ld] lines from message [%llu]",
+ TRACE(TRACE_DEBUG, "sending [%ld] lines from message [%" U64_T_FORMAT "]",
lines, message_idnr);
msg = dbmail_message_new();
@@ -2324,7 +2324,7 @@ int db_createsession(u64_t user_idnr, PopSession_t * session_ptr)
dm_list_init(&session_ptr->messagelst);
if (db_find_create_mailbox("INBOX", BOX_DEFAULT, user_idnr, &mailbox_idnr) < 0) {
- TRACE(TRACE_MESSAGE, "find_create INBOX for user [%llu] failed, exiting..", user_idnr);
+ TRACE(TRACE_MESSAGE, "find_create INBOX for user [%" U64_T_FORMAT "] failed, exiting..", user_idnr);
return DM_EQUERY;
}
@@ -2338,7 +2338,7 @@ int db_createsession(u64_t user_idnr, PopSession_t * session_ptr)
snprintf(query, DEF_QUERYSIZE,
"SELECT pm.messagesize, msg.message_idnr, msg.status, "
"msg.unique_id FROM %smessages msg, %sphysmessage pm "
- "WHERE msg.mailbox_idnr = %llu "
+ "WHERE msg.mailbox_idnr = %" U64_T_FORMAT " "
"AND msg.status < %d "
"AND msg.physmessage_id = pm.id "
"ORDER BY msg.message_idnr DESC",DBPFX,DBPFX,
@@ -2440,7 +2440,7 @@ int db_update_pop(PopSession_t * session_ptr)
/* yes they need an update, do the query */
snprintf(query, DEF_QUERYSIZE,
"UPDATE %smessages set status=%d WHERE "
- "mailbox_idnr=%llu AND message_idnr=%llu AND status < %d",DBPFX,
+ "mailbox_idnr=%" U64_T_FORMAT " AND message_idnr=%" U64_T_FORMAT " AND status < %d",DBPFX,
((struct message *)
tmpelement->data)->virtual_messagestatus,
((struct message *)
@@ -2459,7 +2459,7 @@ int db_update_pop(PopSession_t * session_ptr)
* recalculated */
if (user_idnr != 0) {
if (db_calculate_quotum_used(user_idnr) == -1) {
- TRACE(TRACE_ERROR, "Could not calculate quotum used for user [%llu]", user_idnr);
+ TRACE(TRACE_ERROR, "Could not calculate quotum used for user [%" U64_T_FORMAT "]", user_idnr);
return DM_EQUERY;
}
}
@@ -2550,7 +2550,7 @@ int db_deleted_purge(u64_t * affected_rows)
db_free_result();
for (i = 0; i < *affected_rows; i++) {
if (db_delete_message(mailbox_idnrs[i], message_idnrs[i]) == -1) {
- TRACE(TRACE_ERROR, "error deleting mailbox [%llu] message [%llu]",
+ TRACE(TRACE_ERROR, "error deleting mailbox [%" U64_T_FORMAT "] message [%" U64_T_FORMAT "]",
mailbox_idnrs[i], message_idnrs[i]);
g_free(message_idnrs);
return DM_EQUERY;
@@ -2622,12 +2622,12 @@ int db_imap_append_msg(const char *msgdata, u64_t datalen UNUSED,
switch (result) {
case -2:
- TRACE(TRACE_DEBUG, "error copying message to user [%llu],"
+ TRACE(TRACE_DEBUG, "error copying message to user [%" U64_T_FORMAT "],"
"maxmail exceeded", user_idnr);
db_rollback_transaction();
return -2;
case -1:
- TRACE(TRACE_ERROR, "error copying message to user [%llu]",
+ TRACE(TRACE_ERROR, "error copying message to user [%" U64_T_FORMAT "]",
user_idnr);
db_rollback_transaction();
return -1;
@@ -2636,7 +2636,7 @@ int db_imap_append_msg(const char *msgdata, u64_t datalen UNUSED,
if (db_commit_transaction() == DM_EQUERY)
return DM_EQUERY;
- TRACE(TRACE_MESSAGE, "message id=%llu is inserted", *msg_idnr);
+ TRACE(TRACE_MESSAGE, "message id=%" U64_T_FORMAT " is inserted", *msg_idnr);
return db_set_message_status(mailbox_idnr, *msg_idnr, MESSAGE_STATUS_SEEN);
}
@@ -2677,7 +2677,7 @@ int db_findmailbox(const char *fq_name, u64_t owner_idnr, u64_t * mailbox_idnr)
result = db_findmailbox_owner(simple_name, owner_idnr, mailbox_idnr);
if (result < 0) {
- TRACE(TRACE_ERROR, "error finding mailbox [%s] with owner [%s, %llu]",
+ TRACE(TRACE_ERROR, "error finding mailbox [%s] with owner [%s, %" U64_T_FORMAT "]",
simple_name, username, owner_idnr);
g_free(username);
return DM_EQUERY;
@@ -2774,7 +2774,7 @@ static int db_findmailbox_owner(const char *name, u64_t owner_idnr,
mailbox_like = db_imap_utf7_like("name", name, "");
snprintf(query, DEF_QUERYSIZE,
"SELECT mailbox_idnr FROM %smailboxes "
- "WHERE %s AND owner_idnr=%llu",
+ "WHERE %s AND owner_idnr=%" U64_T_FORMAT,
DBPFX, mailbox_like, owner_idnr);
g_free(mailbox_like);
@@ -2861,9 +2861,9 @@ static int mailboxes_by_regex(u64_t user_idnr, int only_subscribed, const char *
"LEFT JOIN %sacl acl ON mbx.mailbox_idnr = acl.mailbox_id "
"LEFT JOIN %susers usr ON acl.user_id = usr.user_idnr "
"LEFT JOIN %ssubscription sub ON sub.mailbox_id = mbx.mailbox_idnr "
- "WHERE %s (sub.user_id = %llu "
- "AND ((mbx.owner_idnr = %llu) "
- "%s (acl.user_id = %llu AND acl.lookup_flag = 1) "
+ "WHERE %s (sub.user_id = %" U64_T_FORMAT " "
+ "AND ((mbx.owner_idnr = %" U64_T_FORMAT ") "
+ "%s (acl.user_id = %" U64_T_FORMAT " AND acl.lookup_flag = 1) "
"OR (usr.userid = '%s' AND acl.lookup_flag = 1)))",
DBPFX, DBPFX, DBPFX, DBPFX, matchname,
user_idnr, search_user_idnr,
@@ -2877,8 +2877,8 @@ static int mailboxes_by_regex(u64_t user_idnr, int only_subscribed, const char *
"LEFT JOIN %sacl acl ON mbx.mailbox_idnr = acl.mailbox_id "
"LEFT JOIN %susers usr ON acl.user_id = usr.user_idnr "
"WHERE %s 1=1 "
- "AND ((mbx.owner_idnr = %llu) "
- "%s (acl.user_id = %llu AND acl.lookup_flag = 1) "
+ "AND ((mbx.owner_idnr = %" U64_T_FORMAT ") "
+ "%s (acl.user_id = %" U64_T_FORMAT " AND acl.lookup_flag = 1) "
"OR (usr.userid = '%s' AND acl.lookup_flag = 1))",
DBPFX, DBPFX, DBPFX, matchname,
search_user_idnr,
@@ -3015,7 +3015,7 @@ int db_getmailbox_flags(mailbox_t *mb)
snprintf(query, DEF_QUERYSIZE,
"SELECT permission,seen_flag,answered_flag,deleted_flag,"
"flagged_flag,recent_flag,draft_flag "
- "FROM %smailboxes WHERE mailbox_idnr = %llu",DBPFX, mb->uid);
+ "FROM %smailboxes WHERE mailbox_idnr = %" U64_T_FORMAT,DBPFX, mb->uid);
if (db_query(query) == -1) {
TRACE(TRACE_ERROR, "could not select mailbox");
@@ -3059,11 +3059,11 @@ int db_getmailbox_count(mailbox_t *mb)
/* count messages */
snprintf(query, DEF_QUERYSIZE,
- "SELECT 0,COUNT(*) FROM %smessages WHERE mailbox_idnr=%llu "
+ "SELECT 0,COUNT(*) FROM %smessages WHERE mailbox_idnr=%" U64_T_FORMAT " "
"AND (status < %d) UNION "
- "SELECT 1,COUNT(*) FROM %smessages WHERE mailbox_idnr=%llu "
+ "SELECT 1,COUNT(*) FROM %smessages WHERE mailbox_idnr=%" U64_T_FORMAT " "
"AND (status < %d) AND seen_flag=1 UNION "
- "SELECT 2,COUNT(*) FROM %smessages WHERE mailbox_idnr=%llu "
+ "SELECT 2,COUNT(*) FROM %smessages WHERE mailbox_idnr=%" U64_T_FORMAT " "
"AND (status < %d) AND recent_flag=1",
DBPFX, mb->uid, MESSAGE_STATUS_DELETE, // MESSAGE_STATUS_NEW, MESSAGE_STATUS_SEEN,
DBPFX, mb->uid, MESSAGE_STATUS_DELETE, // MESSAGE_STATUS_NEW, MESSAGE_STATUS_SEEN,
@@ -3094,7 +3094,7 @@ int db_getmailbox_count(mailbox_t *mb)
memset(query,0,DEF_QUERYSIZE);
snprintf(query, DEF_QUERYSIZE, "SELECT max(message_idnr)+1 FROM %smessages "
- "WHERE mailbox_idnr=%llu ", DBPFX, mb->uid);
+ "WHERE mailbox_idnr=%" U64_T_FORMAT " ", DBPFX, mb->uid);
if (db_query(query) == -1)
return DM_EQUERY;
@@ -3296,7 +3296,7 @@ int db_mailbox_create_with_parents(const char * mailbox, mailbox_source_t source
assert(mailbox_idnr);
assert(message);
- TRACE(TRACE_INFO, "Creating mailbox [%s] source [%d] for user [%llu]",
+ TRACE(TRACE_INFO, "Creating mailbox [%s] source [%d] for user [%" U64_T_FORMAT "]",
mailbox, source, owner_idnr);
/* Check if new name is valid. */
@@ -3385,7 +3385,7 @@ int db_mailbox_create_with_parents(const char * mailbox, mailbox_source_t source
if (source != BOX_BRUTEFORCE) {
TRACE(TRACE_DEBUG, "Checking if we have the right to "
- "create mailboxes under mailbox [%llu]", mbox->uid);
+ "create mailboxes under mailbox [%" U64_T_FORMAT "]", mbox->uid);
/* Mailbox does exist, failure if no_inferiors flag set. */
result = db_noinferiors(mbox->uid);
@@ -3442,10 +3442,10 @@ int db_createmailbox(const char * name, u64_t owner_idnr, u64_t * mailbox_idnr)
if (auth_requires_shadow_user()) {
- TRACE(TRACE_DEBUG, "creating shadow user for [%llu]",
+ TRACE(TRACE_DEBUG, "creating shadow user for [%" U64_T_FORMAT "]",
owner_idnr);
if ((db_user_find_create(owner_idnr) < 0)) {
- TRACE(TRACE_ERROR, "unable to find or create sql shadow account for useridnr [%llu]",
+ TRACE(TRACE_ERROR, "unable to find or create sql shadow account for useridnr [%" U64_T_FORMAT "]",
owner_idnr);
return DM_EQUERY;
}
@@ -3463,7 +3463,7 @@ int db_createmailbox(const char * name, u64_t owner_idnr, u64_t * mailbox_idnr)
"INSERT INTO %smailboxes (name, owner_idnr,"
"seen_flag, answered_flag, deleted_flag, flagged_flag, "
"recent_flag, draft_flag, permission)"
- " VALUES ('%s', %llu, 1, 1, 1, 1, 1, 1, %d) %s",DBPFX,
+ " VALUES ('%s', %" U64_T_FORMAT ", 1, 1, 1, 1, 1, 1, %d) %s",DBPFX,
escaped_simple_name, owner_idnr, IMAPPERM_READWRITE,
db_returning("mailbox_idnr"));
@@ -3482,7 +3482,7 @@ int db_createmailbox(const char * name, u64_t owner_idnr, u64_t * mailbox_idnr)
*mailbox_idnr = db_insert_result("mailbox_idnr");
}
- TRACE(TRACE_DEBUG, "created mailbox %s with idnr [%llu] for user [%llu] result [%d]",
+ TRACE(TRACE_DEBUG, "created mailbox %s with idnr [%" U64_T_FORMAT "] for user [%" U64_T_FORMAT "] result [%d]",
name, *mailbox_idnr, owner_idnr, result);
return DM_SUCCESS;
@@ -3497,7 +3497,7 @@ int db_mailbox_set_permission(u64_t mailbox_id, int permission)
assert(mailbox_id);
- snprintf(query,DEF_QUERYSIZE,"UPDATE %smailboxes SET permission=%d WHERE mailbox_idnr=%llu",
+ snprintf(query,DEF_QUERYSIZE,"UPDATE %smailboxes SET permission=%d WHERE mailbox_idnr=%" U64_T_FORMAT,
DBPFX, permission, mailbox_id);
if ((result = db_query(query))) {
TRACE(TRACE_ERROR, "query failed");
@@ -3574,7 +3574,7 @@ int db_listmailboxchildren(u64_t mailbox_idnr, u64_t user_idnr,
/* retrieve the name of this mailbox */
snprintf(query, DEF_QUERYSIZE,
"SELECT name FROM %smailboxes WHERE "
- "mailbox_idnr = %llu AND owner_idnr = %llu",DBPFX,
+ "mailbox_idnr = %" U64_T_FORMAT " AND owner_idnr = %" U64_T_FORMAT,DBPFX,
mailbox_idnr, user_idnr);
if (db_query(query) == -1) {
@@ -3583,7 +3583,7 @@ int db_listmailboxchildren(u64_t mailbox_idnr, u64_t user_idnr,
}
if (db_num_rows() == 0) {
- TRACE(TRACE_WARNING, "No mailbox found with mailbox_idnr [%llu]", mailbox_idnr);
+ TRACE(TRACE_WARNING, "No mailbox found with mailbox_idnr [%" U64_T_FORMAT "]", mailbox_idnr);
db_free_result();
*children = NULL;
*nchildren = 0;
@@ -3600,14 +3600,14 @@ int db_listmailboxchildren(u64_t mailbox_idnr, u64_t user_idnr,
if (mailbox_like) {
snprintf(query, DEF_QUERYSIZE,
"SELECT mailbox_idnr FROM %smailboxes WHERE %s"
- " AND owner_idnr = %llu",DBPFX,
+ " AND owner_idnr = %" U64_T_FORMAT,DBPFX,
mailbox_like, user_idnr);
g_free(mailbox_like);
}
else
snprintf(query, DEF_QUERYSIZE,
"SELECT mailbox_idnr FROM %smailboxes WHERE"
- " owner_idnr = %llu", DBPFX, user_idnr);
+ " owner_idnr = %" U64_T_FORMAT, DBPFX, user_idnr);
/* now find the children */
if (db_query(query) == -1) {
@@ -3649,7 +3649,7 @@ int db_isselectable(u64_t mailbox_idnr)
snprintf(query, DEF_QUERYSIZE,
- "SELECT no_select FROM %smailboxes WHERE mailbox_idnr = %llu",DBPFX,
+ "SELECT no_select FROM %smailboxes WHERE mailbox_idnr = %" U64_T_FORMAT,DBPFX,
mailbox_idnr);
if (db_query(query) == -1) {
@@ -3686,7 +3686,7 @@ int db_noinferiors(u64_t mailbox_idnr)
snprintf(query, DEF_QUERYSIZE,
- "SELECT no_inferiors FROM %smailboxes WHERE mailbox_idnr = %llu",DBPFX,
+ "SELECT no_inferiors FROM %smailboxes WHERE mailbox_idnr = %" U64_T_FORMAT,DBPFX,
mailbox_idnr);
if (db_query(query) == -1) {
@@ -3717,7 +3717,7 @@ int db_setselectable(u64_t mailbox_idnr, int select_value)
memset(query,0,DEF_QUERYSIZE);
snprintf(query, DEF_QUERYSIZE,
- "UPDATE %smailboxes SET no_select = %d WHERE mailbox_idnr = %llu",DBPFX,
+ "UPDATE %smailboxes SET no_select = %d WHERE mailbox_idnr = %" U64_T_FORMAT,DBPFX,
(!select_value), mailbox_idnr);
if (db_query(query) == -1) {
@@ -3744,7 +3744,7 @@ int db_get_mailbox_size(u64_t mailbox_idnr, int only_deleted,
"SELECT sum(pm.messagesize) FROM %smessages msg, "
"%sphysmessage pm "
"WHERE msg.physmessage_id = pm.id "
- "AND msg.mailbox_idnr = %llu "
+ "AND msg.mailbox_idnr = %" U64_T_FORMAT " "
"AND msg.status < %d "
"AND msg.deleted_flag = 1",DBPFX,DBPFX, mailbox_idnr,
MESSAGE_STATUS_DELETE);
@@ -3753,12 +3753,12 @@ int db_get_mailbox_size(u64_t mailbox_idnr, int only_deleted,
"SELECT sum(pm.messagesize) FROM %smessages msg, "
"%sphysmessage pm "
"WHERE msg.physmessage_id = pm.id "
- "AND msg.mailbox_idnr = %llu "
+ "AND msg.mailbox_idnr = %" U64_T_FORMAT " "
"AND msg.status < %d",DBPFX,DBPFX, mailbox_idnr,
MESSAGE_STATUS_DELETE);
if (db_query(query) == -1) {
- TRACE(TRACE_ERROR, "could not calculate size of mailbox [%llu]", mailbox_idnr);
+ TRACE(TRACE_ERROR, "could not calculate size of mailbox [%" U64_T_FORMAT "]", mailbox_idnr);
return DM_EQUERY;
}
@@ -3781,7 +3781,7 @@ int db_removemsg(u64_t user_idnr, u64_t mailbox_idnr)
return DM_EQUERY;
if (db_get_mailbox_size(mailbox_idnr, 0, &mailbox_size) < 0) {
- TRACE(TRACE_ERROR, "error getting size for mailbox [%llu]",
+ TRACE(TRACE_ERROR, "error getting size for mailbox [%" U64_T_FORMAT "]",
mailbox_idnr);
return DM_EQUERY;
}
@@ -3789,7 +3789,7 @@ int db_removemsg(u64_t user_idnr, u64_t mailbox_idnr)
/* update messages belonging to this mailbox: mark as deleted (status
MESSAGE_STATUS_PURGE) */
snprintf(query, DEF_QUERYSIZE,
- "UPDATE %smessages SET status=%d WHERE mailbox_idnr = %llu",DBPFX,
+ "UPDATE %smessages SET status=%d WHERE mailbox_idnr = %" U64_T_FORMAT,DBPFX,
MESSAGE_STATUS_PURGE, mailbox_idnr);
if (db_query(query) == -1) {
@@ -3799,7 +3799,7 @@ int db_removemsg(u64_t user_idnr, u64_t mailbox_idnr)
if (user_quotum_dec(user_idnr, mailbox_size) < 0) {
TRACE(TRACE_ERROR, "error subtracting mailbox size from "
- "used quotum for mailbox [%llu], user [%llu]. Database "
+ "used quotum for mailbox [%" U64_T_FORMAT "], user [%" U64_T_FORMAT "]. Database "
"might be inconsistent. Run dbmail-util",
mailbox_idnr, user_idnr);
return DM_EQUERY;
@@ -3813,8 +3813,8 @@ int db_movemsg(u64_t mailbox_to, u64_t mailbox_from)
memset(query,0,DEF_QUERYSIZE);
snprintf(query, DEF_QUERYSIZE,
- "UPDATE %smessages SET mailbox_idnr=%llu WHERE"
- " mailbox_idnr = %llu",DBPFX, mailbox_to, mailbox_from);
+ "UPDATE %smessages SET mailbox_idnr=%" U64_T_FORMAT " WHERE"
+ " mailbox_idnr = %" U64_T_FORMAT,DBPFX, mailbox_to, mailbox_from);
if (db_query(query) == -1) {
TRACE(TRACE_ERROR, "could not update messages in mailbox");
@@ -3844,7 +3844,7 @@ int db_mailbox_has_message_id(u64_t mailbox_idnr, const char *messageid)
"JOIN %sphysmessage p ON m.physmessage_id=p.id "
"JOIN %sheadervalue v ON v.physmessage_id=p.id "
"JOIN %sheadername n ON v.headername_id=n.id "
- "WHERE m.mailbox_idnr=%llu "
+ "WHERE m.mailbox_idnr=%" U64_T_FORMAT " "
"AND n.headername IN ('resent-message-id','message-id') "
"AND %s='%s' "
"AND p.internal_date > %s", DBPFX, DBPFX, DBPFX, DBPFX,
@@ -3871,7 +3871,7 @@ static u64_t message_get_size(u64_t mailbox_idnr, u64_t message_idnr)
snprintf(query, DEF_QUERYSIZE,
"SELECT pm.messagesize FROM %sphysmessage pm, %smessages msg "
"WHERE pm.id = msg.physmessage_id "
- "AND mailbox_idnr = %llu AND message_idnr = %llu",DBPFX,DBPFX, mailbox_idnr, message_idnr);
+ "AND mailbox_idnr = %" U64_T_FORMAT " AND message_idnr = %" U64_T_FORMAT,DBPFX,DBPFX, mailbox_idnr, message_idnr);
if (db_query(query))
return size; /* err */
@@ -3895,7 +3895,7 @@ int db_copymsg(u64_t mailbox_from, u64_t msg_idnr, u64_t mailbox_to,
/* Get the size of the message to be copied. */
if (! (msgsize = message_get_size(mailbox_from, msg_idnr))) {
TRACE(TRACE_ERROR, "error getting message size for "
- "mailbox [%llu] message [%llu]", mailbox_from, msg_idnr);
+ "mailbox [%" U64_T_FORMAT "] message [%" U64_T_FORMAT "]", mailbox_from, msg_idnr);
return DM_EQUERY;
}
@@ -3905,7 +3905,7 @@ int db_copymsg(u64_t mailbox_from, u64_t msg_idnr, u64_t mailbox_to,
TRACE(TRACE_ERROR, "error checking quotum");
return DM_EQUERY;
case 1:
- TRACE(TRACE_INFO, "user [%llu] would exceed quotum",
+ TRACE(TRACE_INFO, "user [%" U64_T_FORMAT "] would exceed quotum",
user_idnr);
return -2;
}
@@ -3917,10 +3917,10 @@ int db_copymsg(u64_t mailbox_from, u64_t msg_idnr, u64_t mailbox_to,
"INSERT INTO %smessages (mailbox_idnr,"
"physmessage_id, seen_flag, answered_flag, deleted_flag, "
"flagged_flag, recent_flag, draft_flag, unique_id, status) "
- "SELECT %llu, "
+ "SELECT %" U64_T_FORMAT ", "
"physmessage_id, seen_flag, answered_flag, deleted_flag, "
"flagged_flag, recent_flag, draft_flag, '%s', status "
- "FROM %smessages WHERE mailbox_idnr = %llu AND message_idnr = %llu %s",
+ "FROM %smessages WHERE mailbox_idnr = %" U64_T_FORMAT " AND message_idnr = %" U64_T_FORMAT " %s",
DBPFX, mailbox_to, unique_id, DBPFX, mailbox_from, msg_idnr,
db_returning("message_idnr"));
@@ -3935,7 +3935,7 @@ int db_copymsg(u64_t mailbox_from, u64_t msg_idnr, u64_t mailbox_to,
/* update quotum */
if (user_quotum_inc(user_idnr, msgsize) == -1) {
TRACE(TRACE_ERROR, "error setting the new quotum "
- "used value for user [%llu]",
+ "used value for user [%" U64_T_FORMAT "]",
user_idnr);
return DM_EQUERY;
}
@@ -3961,7 +3961,7 @@ int db_getmailboxname(u64_t mailbox_idnr, u64_t user_idnr, char *name)
}
snprintf(query, DEF_QUERYSIZE,
- "SELECT name FROM %smailboxes WHERE mailbox_idnr = %llu",DBPFX,
+ "SELECT name FROM %smailboxes WHERE mailbox_idnr = %" U64_T_FORMAT,DBPFX,
mailbox_idnr);
if (db_query(query) == -1) {
@@ -4011,7 +4011,7 @@ int db_setmailboxname(u64_t mailbox_idnr, const char *name)
snprintf(query, DEF_QUERYSIZE,
"UPDATE %smailboxes SET name = '%s' "
- "WHERE mailbox_idnr = %llu",
+ "WHERE mailbox_idnr = %" U64_T_FORMAT,
DBPFX, escaped_name, mailbox_idnr);
g_free(escaped_name);
@@ -4035,7 +4035,7 @@ int db_expunge(u64_t mailbox_idnr, u64_t user_idnr,
if (db_get_mailbox_size(mailbox_idnr, 1, &mailbox_size) < 0) {
TRACE(TRACE_ERROR, "error getting mailbox size "
- "for mailbox [%llu]",
+ "for mailbox [%" U64_T_FORMAT "]",
mailbox_idnr);
return DM_EQUERY;
}
@@ -4046,7 +4046,7 @@ int db_expunge(u64_t mailbox_idnr, u64_t user_idnr,
/* first select msg UIDs */
snprintf(query, DEF_QUERYSIZE,
"SELECT message_idnr FROM %smessages WHERE "
- "mailbox_idnr = %llu AND deleted_flag=1 "
+ "mailbox_idnr = %" U64_T_FORMAT " AND deleted_flag=1 "
"AND status < %d "
"ORDER BY message_idnr DESC",DBPFX, mailbox_idnr,
MESSAGE_STATUS_DELETE);
@@ -4078,7 +4078,7 @@ int db_expunge(u64_t mailbox_idnr, u64_t user_idnr,
snprintf(query, DEF_QUERYSIZE,
"UPDATE %smessages SET status=%d "
- "WHERE mailbox_idnr = %llu "
+ "WHERE mailbox_idnr = %" U64_T_FORMAT " "
"AND deleted_flag=1 AND status < %d",DBPFX,
MESSAGE_STATUS_DELETE, mailbox_idnr,
MESSAGE_STATUS_DELETE);
@@ -4098,7 +4098,7 @@ int db_expunge(u64_t mailbox_idnr, u64_t user_idnr,
if (user_quotum_dec(user_idnr, mailbox_size) < 0) {
TRACE(TRACE_ERROR, "error decreasing used quotum for "
- "user [%llu]. Database might be inconsistent now",
+ "user [%" U64_T_FORMAT "]. Database might be inconsistent now",
user_idnr);
return DM_EQUERY;
}
@@ -4114,7 +4114,7 @@ u64_t db_first_unseen(u64_t mailbox_idnr)
snprintf(query, DEF_QUERYSIZE,
"SELECT MIN(message_idnr) FROM %smessages "
- "WHERE mailbox_idnr = %llu "
+ "WHERE mailbox_idnr = %" U64_T_FORMAT " "
"AND status < %d AND seen_flag = 0",
DBPFX, mailbox_idnr, MESSAGE_STATUS_DELETE);
@@ -4137,8 +4137,8 @@ int db_subscribe(u64_t mailbox_idnr, u64_t user_idnr)
snprintf(query, DEF_QUERYSIZE,
"SELECT * FROM %ssubscription "
- "WHERE mailbox_id = %llu "
- "AND user_id = %llu",DBPFX, mailbox_idnr, user_idnr);
+ "WHERE mailbox_id = %" U64_T_FORMAT " "
+ "AND user_id = %" U64_T_FORMAT,DBPFX, mailbox_idnr, user_idnr);
if (db_query(query) == -1) {
TRACE(TRACE_ERROR, "could not verify subscription");
@@ -4146,7 +4146,7 @@ int db_subscribe(u64_t mailbox_idnr, u64_t user_idnr)
}
if (db_num_rows() > 0) {
- TRACE(TRACE_DEBUG, "already subscribed to mailbox [%llu]", mailbox_idnr);
+ TRACE(TRACE_DEBUG, "already subscribed to mailbox [%" U64_T_FORMAT "]", mailbox_idnr);
db_free_result();
return DM_SUCCESS;
}
@@ -4156,15 +4156,15 @@ int db_subscribe(u64_t mailbox_idnr, u64_t user_idnr)
snprintf(query, DEF_QUERYSIZE,
"INSERT INTO %ssubscription (user_id, mailbox_id) "
- "VALUES (%llu, %llu)",DBPFX, user_idnr, mailbox_idnr);
+ "VALUES (%" U64_T_FORMAT ", %" U64_T_FORMAT ")",DBPFX, user_idnr, mailbox_idnr);
if (db_query(query) == -1) {
/* Verify subscription once again - perhaps other party made it at the same time with us */
memset(query,0,DEF_QUERYSIZE);
snprintf(query, DEF_QUERYSIZE,
"SELECT * FROM %ssubscription "
- "WHERE mailbox_id = %llu "
- "AND user_id = %llu",DBPFX, mailbox_idnr, user_idnr);
+ "WHERE mailbox_id = %" U64_T_FORMAT " "
+ "AND user_id = %" U64_T_FORMAT,DBPFX, mailbox_idnr, user_idnr);
if (db_query(query) == -1) {
TRACE(TRACE_ERROR, "could not verify subscription");
@@ -4172,7 +4172,7 @@ int db_subscribe(u64_t mailbox_idnr, u64_t user_idnr)
}
if (db_num_rows() > 0) {
- TRACE(TRACE_DEBUG, "already subscribed to mailbox [%llu], verified after attempt to subscribe", mailbox_idnr);
+ TRACE(TRACE_DEBUG, "already subscribed to mailbox [%" U64_T_FORMAT "], verified after attempt to subscribe", mailbox_idnr);
db_free_result();
} else {
TRACE(TRACE_ERROR, "could not insert subscription");
@@ -4191,7 +4191,7 @@ int db_unsubscribe(u64_t mailbox_idnr, u64_t user_idnr)
snprintf(query, DEF_QUERYSIZE,
"DELETE FROM %ssubscription "
- "WHERE user_id = %llu AND mailbox_id = %llu",DBPFX,
+ "WHERE user_id = %" U64_T_FORMAT " AND mailbox_id = %" U64_T_FORMAT,DBPFX,
user_idnr, mailbox_idnr);
if (db_query(query) == -1) {
@@ -4229,8 +4229,8 @@ int db_get_msgflag(const char *flag_name, u64_t msg_idnr,
snprintf(query, DEF_QUERYSIZE,
"SELECT %s FROM %smessages "
- "WHERE message_idnr = %llu AND status < %d "
- "AND mailbox_idnr = %llu",
+ "WHERE message_idnr = %" U64_T_FORMAT " AND status < %d "
+ "AND mailbox_idnr = %" U64_T_FORMAT,
the_flag_name, DBPFX, msg_idnr,
MESSAGE_STATUS_DELETE, mailbox_idnr);
@@ -4279,8 +4279,8 @@ int db_set_msgflag(u64_t msg_idnr, u64_t mailbox_idnr, int *flags, int action_ty
}
snprintf(query + pos, DEF_QUERYSIZE - pos,
- " WHERE message_idnr = %llu"
- " AND status < %d AND mailbox_idnr = %llu",
+ " WHERE message_idnr = %" U64_T_FORMAT
+ " AND status < %d AND mailbox_idnr = %" U64_T_FORMAT,
msg_idnr, MESSAGE_STATUS_DELETE,
mailbox_idnr);
@@ -4303,7 +4303,7 @@ int db_acl_has_right(mailbox_t *mailbox, u64_t userid, const char *right_flag)
u64_t mboxid = mailbox->uid;
- TRACE(TRACE_DEBUG, "checking ACL [%s] for user [%llu] on mailbox [%llu]",
+ TRACE(TRACE_DEBUG, "checking ACL [%s] for user [%" U64_T_FORMAT "] on mailbox [%" U64_T_FORMAT "]",
right_flag, userid, mboxid);
/* If we don't know who owns the mailbox, look it up. */
@@ -4314,15 +4314,15 @@ int db_acl_has_right(mailbox_t *mailbox, u64_t userid, const char *right_flag)
}
if (mailbox->owner_idnr == userid) {
- TRACE(TRACE_DEBUG, "mailbox [%llu] is owned by user [%llu], giving all rights",
+ TRACE(TRACE_DEBUG, "mailbox [%" U64_T_FORMAT "] is owned by user [%" U64_T_FORMAT "], giving all rights",
mboxid, userid);
return 1;
}
snprintf(query, DEF_QUERYSIZE,
"SELECT * FROM %sacl "
- "WHERE user_id = %llu "
- "AND mailbox_id = %llu "
+ "WHERE user_id = %" U64_T_FORMAT " "
+ "AND mailbox_id = %" U64_T_FORMAT " "
"AND %s = 1",DBPFX, userid, mboxid, right_flag);
if (db_query(query) < 0) {
@@ -4344,7 +4344,7 @@ static int acl_query(u64_t mailbox_idnr, u64_t userid)
char query[DEF_QUERYSIZE];
memset(query,0,DEF_QUERYSIZE);
- TRACE(TRACE_DEBUG,"for mailbox [%llu] userid [%llu]",
+ TRACE(TRACE_DEBUG,"for mailbox [%" U64_T_FORMAT "] userid [%" U64_T_FORMAT "]",
mailbox_idnr, userid);
snprintf(query, DEF_QUERYSIZE,
@@ -4352,7 +4352,7 @@ static int acl_query(u64_t mailbox_idnr, u64_t userid)
"write_flag,insert_flag,post_flag,"
"create_flag,delete_flag,administer_flag "
"FROM %sacl "
- "WHERE user_id = %llu AND mailbox_id = %llu",DBPFX,
+ "WHERE user_id = %" U64_T_FORMAT " AND mailbox_id = %" U64_T_FORMAT,DBPFX,
userid, mailbox_idnr);
if (db_query(query) < 0) {
@@ -4413,7 +4413,7 @@ static int db_acl_has_acl(u64_t userid, u64_t mboxid)
snprintf(query, DEF_QUERYSIZE,
"SELECT user_id, mailbox_id FROM %sacl "
- "WHERE user_id = %llu AND mailbox_id = %llu",DBPFX,
+ "WHERE user_id = %" U64_T_FORMAT " AND mailbox_id = %" U64_T_FORMAT,DBPFX,
userid, mboxid);
if (db_query(query) < 0) {
@@ -4437,12 +4437,12 @@ static int db_acl_create_acl(u64_t userid, u64_t mboxid)
snprintf(query, DEF_QUERYSIZE,
"INSERT INTO %sacl (user_id, mailbox_id) "
- "VALUES (%llu, %llu)",DBPFX, userid, mboxid);
+ "VALUES (%" U64_T_FORMAT ", %" U64_T_FORMAT ")",DBPFX, userid, mboxid);
if (db_query(query) < 0) {
TRACE(TRACE_ERROR,
"Error creating ACL entry for user "
- "[%llu], mailbox [%llu].",
+ "[%" U64_T_FORMAT "], mailbox [%" U64_T_FORMAT "].",
userid, mboxid);
return DM_EQUERY;
}
@@ -4461,7 +4461,7 @@ int db_acl_set_right(u64_t userid, u64_t mboxid, const char *right_flag,
assert(set == 0 || set == 1);
- TRACE(TRACE_DEBUG, "Setting ACL for user [%llu], mailbox [%llu].",
+ TRACE(TRACE_DEBUG, "Setting ACL for user [%" U64_T_FORMAT "], mailbox [%" U64_T_FORMAT "].",
userid, mboxid);
owner_result = db_user_is_mailbox_owner(userid, mboxid);
@@ -4476,7 +4476,7 @@ int db_acl_set_right(u64_t userid, u64_t mboxid, const char *right_flag,
result = db_acl_has_acl(userid, mboxid);
if (result == -1) {
TRACE(TRACE_ERROR, "Error finding acl for user "
- "[%llu], mailbox [%llu]",
+ "[%" U64_T_FORMAT "], mailbox [%" U64_T_FORMAT "]",
userid, mboxid);
return DM_EQUERY;
}
@@ -4484,7 +4484,7 @@ int db_acl_set_right(u64_t userid, u64_t mboxid, const char *right_flag,
if (result == 0) {
if (db_acl_create_acl(userid, mboxid) == -1) {
TRACE(TRACE_ERROR, "Error creating ACL for "
- "user [%llu], mailbox [%llu]",
+ "user [%" U64_T_FORMAT "], mailbox [%" U64_T_FORMAT "]",
userid, mboxid);
return DM_EQUERY;
}
@@ -4492,17 +4492,17 @@ int db_acl_set_right(u64_t userid, u64_t mboxid, const char *right_flag,
snprintf(query, DEF_QUERYSIZE,
"UPDATE %sacl SET %s = %i "
- "WHERE user_id = %llu AND mailbox_id = %llu",DBPFX,
+ "WHERE user_id = %" U64_T_FORMAT " AND mailbox_id = %" U64_T_FORMAT,DBPFX,
right_flag, set, userid, mboxid);
if (db_query(query) < 0) {
TRACE(TRACE_ERROR, "Error updating ACL for user "
- "[%llu], mailbox [%llu].",
+ "[%" U64_T_FORMAT "], mailbox [%" U64_T_FORMAT "].",
userid, mboxid);
return DM_EQUERY;
}
- TRACE(TRACE_DEBUG, "Updated ACL for user [%llu], "
- "mailbox [%llu].", userid, mboxid);
+ TRACE(TRACE_DEBUG, "Updated ACL for user [%" U64_T_FORMAT "], "
+ "mailbox [%" U64_T_FORMAT "].", userid, mboxid);
return DM_EGENERAL;
}
@@ -4511,12 +4511,12 @@ int db_acl_delete_acl(u64_t userid, u64_t mboxid)
char query[DEF_QUERYSIZE];
memset(query,0,DEF_QUERYSIZE);
- TRACE(TRACE_DEBUG, "deleting ACL for user [%llu], "
- "mailbox [%llu].", userid, mboxid);
+ TRACE(TRACE_DEBUG, "deleting ACL for user [%" U64_T_FORMAT "], "
+ "mailbox [%" U64_T_FORMAT "].", userid, mboxid);
snprintf(query, DEF_QUERYSIZE,
"DELETE FROM %sacl "
- "WHERE user_id = %llu AND mailbox_id = %llu",DBPFX,
+ "WHERE user_id = %" U64_T_FORMAT " AND mailbox_id = %" U64_T_FORMAT,DBPFX,
userid, mboxid);
if (db_query(query) < 0) {
@@ -4541,13 +4541,13 @@ int db_acl_get_identifier(u64_t mboxid, struct dm_list *identifier_list)
snprintf(query, DEF_QUERYSIZE,
"SELECT %susers.userid FROM %susers, %sacl "
- "WHERE %sacl.mailbox_id = %llu "
+ "WHERE %sacl.mailbox_id = %" U64_T_FORMAT " "
"AND %susers.user_idnr = %sacl.user_id",DBPFX,DBPFX,DBPFX,
DBPFX,mboxid,DBPFX,DBPFX);
if (db_query(query) < 0) {
TRACE(TRACE_ERROR, "error getting acl identifiers "
- "for mailbox [%llu].",
+ "for mailbox [%" U64_T_FORMAT "].",
mboxid);
return DM_EQUERY;
}
@@ -4575,11 +4575,11 @@ int db_get_mailbox_owner(u64_t mboxid, u64_t * owner_id)
snprintf(query, DEF_QUERYSIZE,
"SELECT owner_idnr FROM %smailboxes "
- "WHERE mailbox_idnr = %llu", DBPFX, mboxid);
+ "WHERE mailbox_idnr = %" U64_T_FORMAT, DBPFX, mboxid);
if (db_query(query) < 0) {
TRACE(TRACE_ERROR, "error finding owner of mailbox "
- "[%llu]", mboxid);
+ "[%" U64_T_FORMAT "]", mboxid);
return DM_EQUERY;
}
@@ -4600,13 +4600,13 @@ int db_user_is_mailbox_owner(u64_t userid, u64_t mboxid)
snprintf(query, DEF_QUERYSIZE,
"SELECT mailbox_idnr FROM %smailboxes "
- "WHERE mailbox_idnr = %llu "
- "AND owner_idnr = %llu", DBPFX, mboxid, userid);
+ "WHERE mailbox_idnr = %" U64_T_FORMAT " "
+ "AND owner_idnr = %" U64_T_FORMAT, DBPFX, mboxid, userid);
if (db_query(query) < 0) {
TRACE(TRACE_ERROR,
- "error checking if user [%llu] is "
- "owner of mailbox [%llu]",
+ "error checking if user [%" U64_T_FORMAT "] is "
+ "owner of mailbox [%" U64_T_FORMAT "]",
userid, mboxid);
return DM_EQUERY;
}
@@ -4706,7 +4706,7 @@ int db_getmailbox_list_result(u64_t mailbox_idnr, u64_t user_idnr, mailbox_t * m
snprintf(query, DEF_QUERYSIZE,
"SELECT owner_idnr, name, no_select, no_inferiors, children "
- "FROM %smailboxes WHERE mailbox_idnr = %llu",
+ "FROM %smailboxes WHERE mailbox_idnr = %" U64_T_FORMAT,
DBPFX, mailbox_idnr);
if (db_query(query) == -1) {
@@ -4736,7 +4736,27 @@ int db_getmailbox_list_result(u64_t mailbox_idnr, u64_t user_idnr, mailbox_t * m
mb->no_inferiors=db_get_result_bool(0,i++);
/* no_children */
+<<<<<<< HEAD
+ mailbox_like = db_imap_utf7_like("name", name, "/%");
+
+ memset(query,0,DEF_QUERYSIZE);
+
+ snprintf(query, DEF_QUERYSIZE,
+ "SELECT COUNT(*) AS nr_children "
+ "FROM %smailboxes WHERE owner_idnr = %" U64_T_FORMAT " "
+ "AND %s",
+ DBPFX, mb->owner_idnr, mailbox_like);
+
+ g_free(mailbox_like);
+
+ if (db_query(query) == -1) {
+ TRACE(TRACE_ERROR, "db error");
+ return DM_EQUERY;
+ }
+ mb->no_children=db_get_result_u64(0,0)?0:1;
+=======
mb->no_children=db_get_result_u64(0,i++)?0:1;
+>>>>>>> c03d2eb5128671bf602338c0eb497a07e7823e96
g_free(name);
db_free_result();
@@ -4950,14 +4970,14 @@ int db_user_create(const char *username, const char *password, const char *encty
snprintf(query, DEF_QUERYSIZE, "INSERT INTO %susers "
"(userid,passwd,client_idnr,maxmail_size,"
"encryption_type, last_login) VALUES "
- "('%s','%s',%llu,%llu,'%s', %s)",
+ "('%s','%s',%" U64_T_FORMAT ",%" U64_T_FORMAT ",'%s', %s)",
DBPFX, escaped_username, escaped_password, clientid,
maxmail, enctype ? enctype : "", db_get_sql(SQL_CURRENT_TIMESTAMP));
} else {
snprintf(query, DEF_QUERYSIZE, "INSERT INTO %susers "
"(userid,user_idnr,passwd,client_idnr,maxmail_size,"
"encryption_type, last_login) VALUES "
- "('%s',%llu,'%s',%llu,%llu,'%s', %s) %s",
+ "('%s',%" U64_T_FORMAT ",'%s',%" U64_T_FORMAT ",%" U64_T_FORMAT ",'%s', %s) %s",
DBPFX,escaped_username,*user_idnr, escaped_password,clientid,
maxmail, enctype ? enctype : "", db_get_sql(SQL_CURRENT_TIMESTAMP),
db_returning("user_idnr"));
@@ -4981,12 +5001,12 @@ int db_change_mailboxsize(u64_t user_idnr, u64_t new_size)
memset(query,0,DEF_QUERYSIZE);
snprintf(query, DEF_QUERYSIZE,
- "UPDATE %susers SET maxmail_size = %llu "
- "WHERE user_idnr = %llu",
+ "UPDATE %susers SET maxmail_size = %" U64_T_FORMAT " "
+ "WHERE user_idnr = %" U64_T_FORMAT,
DBPFX, new_size, user_idnr);
if (db_query(query) == -1) {
- TRACE(TRACE_ERROR, "could not change maxmailsize for user [%llu]", user_idnr);
+ TRACE(TRACE_ERROR, "could not change maxmailsize for user [%" U64_T_FORMAT "]", user_idnr);
return -1;
}
@@ -5022,12 +5042,12 @@ int db_user_rename(u64_t user_idnr, const char *new_name)
escaped_new_name = dm_stresc(new_name);
- snprintf(query, DEF_QUERYSIZE, "UPDATE %susers SET userid = '%s' WHERE user_idnr=%llu",
+ snprintf(query, DEF_QUERYSIZE, "UPDATE %susers SET userid = '%s' WHERE user_idnr=%" U64_T_FORMAT,
DBPFX, escaped_new_name, user_idnr);
g_free(escaped_new_name);
if (db_query(query) == -1) {
- TRACE(TRACE_ERROR, "could not change name for user [%llu]", user_idnr);
+ TRACE(TRACE_ERROR, "could not change name for user [%" U64_T_FORMAT "]", user_idnr);
return DM_EQUERY;
}
return DM_SUCCESS;
@@ -5041,7 +5061,7 @@ int db_user_find_create(u64_t user_idnr)
assert(user_idnr > 0);
- TRACE(TRACE_DEBUG,"user_idnr [%llu]", user_idnr);
+ TRACE(TRACE_DEBUG,"user_idnr [%" U64_T_FORMAT "]", user_idnr);
if ((result = user_idnr_is_delivery_user_idnr(user_idnr)))
return result;
@@ -5049,7 +5069,7 @@ int db_user_find_create(u64_t user_idnr)
if (! (username = auth_get_userid(user_idnr)))
return DM_EQUERY;
- TRACE(TRACE_DEBUG,"found username for user_idnr [%llu -> %s]",
+ TRACE(TRACE_DEBUG,"found username for user_idnr [%" U64_T_FORMAT " -> %s]",
user_idnr, username);
if ((db_user_exists(username, &idnr) < 0)) {
@@ -5059,7 +5079,7 @@ int db_user_find_create(u64_t user_idnr)
if ((idnr > 0) && (idnr != user_idnr)) {
TRACE(TRACE_ERROR, "user_idnr for sql shadow account "
- "differs from user_idnr [%llu != %llu]",
+ "differs from user_idnr [%" U64_T_FORMAT " != %" U64_T_FORMAT "]",
idnr, user_idnr);
g_free(username);
return DM_EQUERY;
@@ -5206,7 +5226,7 @@ int db_user_log_login(u64_t user_idnr)
create_current_timestring(&timestring);
snprintf(query, DEF_QUERYSIZE,
"UPDATE %susers SET last_login = '%s' "
- "WHERE user_idnr = %llu",DBPFX, timestring,
+ "WHERE user_idnr = %" U64_T_FORMAT,DBPFX, timestring,
user_idnr);
if ((result = db_query(query)) == DM_EQUERY)
diff --git a/dbmail-imapsession.c b/dbmail-imapsession.c
index bb01bd89..aa25d057 100644
--- a/dbmail-imapsession.c
+++ b/dbmail-imapsession.c
@@ -352,7 +352,7 @@ static u64_t _imap_cache_update(struct ImapSession *self, message_filter_t filte
char *buf = NULL;
char *rfc = NULL;
- TRACE(TRACE_DEBUG,"cache message [%llu] filter [%d]", self->msg_idnr, filter);
+ TRACE(TRACE_DEBUG,"cache message [%" U64_T_FORMAT "] filter [%d]", self->msg_idnr, filter);
if (cached_msg.file_dumped == 1 && cached_msg.num == self->msg_idnr) {
outcnt = cached_msg.dumpsize;
@@ -403,7 +403,7 @@ static u64_t _imap_cache_update(struct ImapSession *self, message_filter_t filte
mrewind(cached_msg.memdump);
mrewind(cached_msg.tmpdump);
- TRACE(TRACE_DEBUG,"cache size [%llu]", outcnt);
+ TRACE(TRACE_DEBUG,"cache size [%" U64_T_FORMAT "]", outcnt);
return outcnt;
}
@@ -594,7 +594,7 @@ int dbmail_imap_session_fetch_parse_args(struct ImapSession * self)
token = self->args[self->args_idx];
nexttoken = self->args[self->args_idx+1];
- TRACE(TRACE_DEBUG,"parse args[%llu] = [%s]", self->args_idx, token);
+ TRACE(TRACE_DEBUG,"parse args[%" U64_T_FORMAT "] = [%s]", self->args_idx, token);
if (MATCH(token,"flags")) {
self->fi->getFlags = 1;
@@ -738,9 +738,9 @@ GTree * dbmail_imap_session_get_msginfo(struct ImapSession *self, GTree *ids)
db_free_result();
if (*lo == *hi)
- snprintf(range,RANGE_SIZE,"= %llu", *lo);
+ snprintf(range,RANGE_SIZE,"= %" U64_T_FORMAT, *lo);
else
- snprintf(range,RANGE_SIZE,"BETWEEN %llu AND %llu", *lo, *hi);
+ snprintf(range,RANGE_SIZE,"BETWEEN %" U64_T_FORMAT " AND %" U64_T_FORMAT, *lo, *hi);
snprintf(query, DEF_QUERYSIZE,
"SELECT seen_flag, answered_flag, deleted_flag, flagged_flag, "
@@ -748,7 +748,7 @@ GTree * dbmail_imap_session_get_msginfo(struct ImapSession *self, GTree *ids)
"FROM %smessages msg, %sphysmessage pm "
"WHERE pm.id = msg.physmessage_id "
"AND message_idnr %s "
- "AND mailbox_idnr = %llu AND status IN (%d,%d,%d) "
+ "AND mailbox_idnr = %" U64_T_FORMAT " AND status IN (%d,%d,%d) "
"ORDER BY message_idnr ASC",to_char_str,DBPFX,DBPFX,
range, ud->mailbox.uid,
MESSAGE_STATUS_NEW, MESSAGE_STATUS_SEEN,MESSAGE_STATUS_DELETE);
@@ -825,7 +825,7 @@ static int _fetch_get_items(struct ImapSession *self, u64_t *uid)
/* queue this message's recent_flag for removal */
if (ud->mailbox.permission == IMAPPERM_READWRITE)
- self->recent = g_list_prepend(self->recent, g_strdup_printf("%llu",self->msg_idnr));
+ self->recent = g_list_prepend(self->recent, g_strdup_printf("%" U64_T_FORMAT,self->msg_idnr));
if (self->fi->getInternalDate) {
SEND_SPACE;
@@ -835,7 +835,7 @@ static int _fetch_get_items(struct ImapSession *self, u64_t *uid)
}
if (self->fi->getSize) {
SEND_SPACE;
- dbmail_imap_session_buff_append(self, "RFC822.SIZE %llu", msginfo->rfcsize);
+ dbmail_imap_session_buff_append(self, "RFC822.SIZE %" U64_T_FORMAT, msginfo->rfcsize);
}
if (self->fi->getFlags) {
SEND_SPACE;
@@ -846,7 +846,7 @@ static int _fetch_get_items(struct ImapSession *self, u64_t *uid)
}
if (self->fi->getUID) {
SEND_SPACE;
- dbmail_imap_session_buff_append(self, "UID %llu", msginfo->uid);
+ dbmail_imap_session_buff_append(self, "UID %" U64_T_FORMAT, msginfo->uid);
}
if (self->fi->getMIME_IMB) {
@@ -887,7 +887,7 @@ static int _fetch_get_items(struct ImapSession *self, u64_t *uid)
SEND_SPACE;
_imap_cache_update(self, DBMAIL_MESSAGE_FILTER_FULL);
- dbmail_imap_session_buff_append(self, "RFC822 {%llu}\r\n", cached_msg.dumpsize);
+ dbmail_imap_session_buff_append(self, "RFC822 {%" U64_T_FORMAT "}\r\n", cached_msg.dumpsize);
dbmail_imap_session_buff_flush(self);
send_data(self->ci->tx, cached_msg.memdump, cached_msg.dumpsize);
@@ -902,7 +902,7 @@ static int _fetch_get_items(struct ImapSession *self, u64_t *uid)
_imap_cache_update(self, DBMAIL_MESSAGE_FILTER_FULL);
if (dbmail_imap_session_bodyfetch_get_last_octetcnt(self) == 0) {
- dbmail_imap_session_buff_append(self, "BODY[] {%llu}\r\n", cached_msg.dumpsize);
+ dbmail_imap_session_buff_append(self, "BODY[] {%" U64_T_FORMAT "}\r\n", cached_msg.dumpsize);
dbmail_imap_session_buff_flush(self);
send_data(self->ci->tx, cached_msg.memdump, cached_msg.dumpsize);
} else {
@@ -912,7 +912,7 @@ static int _fetch_get_items(struct ImapSession *self, u64_t *uid)
? (((long long)cached_msg.dumpsize) - dbmail_imap_session_bodyfetch_get_last_octetstart(self))
: dbmail_imap_session_bodyfetch_get_last_octetcnt(self);
- dbmail_imap_session_buff_append(self, "BODY[]<%llu> {%llu}\r\n",
+ dbmail_imap_session_buff_append(self, "BODY[]<%" U64_T_FORMAT "> {%" U64_T_FORMAT "}\r\n",
dbmail_imap_session_bodyfetch_get_last_octetstart(self), actual_cnt);
dbmail_imap_session_buff_flush(self);
send_data(self->ci->tx, cached_msg.memdump, actual_cnt);
@@ -928,7 +928,7 @@ static int _fetch_get_items(struct ImapSession *self, u64_t *uid)
SEND_SPACE;
tmpdumpsize = _imap_cache_update(self,DBMAIL_MESSAGE_FILTER_HEAD);
- dbmail_imap_session_buff_append(self, "RFC822.HEADER {%llu}\r\n", tmpdumpsize);
+ dbmail_imap_session_buff_append(self, "RFC822.HEADER {%" U64_T_FORMAT "}\r\n", tmpdumpsize);
dbmail_imap_session_buff_flush(self);
send_data(self->ci->tx, cached_msg.tmpdump, tmpdumpsize);
}
@@ -938,7 +938,7 @@ static int _fetch_get_items(struct ImapSession *self, u64_t *uid)
SEND_SPACE;
tmpdumpsize = _imap_cache_update(self,DBMAIL_MESSAGE_FILTER_BODY);
- dbmail_imap_session_buff_append(self, "RFC822.TEXT {%llu}\r\n", tmpdumpsize);
+ dbmail_imap_session_buff_append(self, "RFC822.TEXT {%" U64_T_FORMAT "}\r\n", tmpdumpsize);
dbmail_imap_session_buff_flush(self);
send_data(self->ci->tx, cached_msg.tmpdump, tmpdumpsize);
@@ -987,7 +987,7 @@ static gboolean _do_fetch(u64_t *uid, gpointer UNUSED value, struct ImapSession
g_return_val_if_fail(id,TRUE);
- dbmail_imap_session_buff_append(self, "* %llu FETCH (", *id);
+ dbmail_imap_session_buff_append(self, "* %" U64_T_FORMAT " FETCH (", *id);
/* go fetch the items */
fflush(self->ci->tx);
@@ -1040,11 +1040,11 @@ static void imap_cache_send_tmpdump(struct ImapSession *self, body_fetch_t *body
if (bodyfetch->octetcnt > 0) {
cnt = get_dumpsize(bodyfetch, size);
- dbmail_imap_session_buff_append(self, "]<%llu> {%llu}\r\n", bodyfetch->octetstart, cnt);
+ dbmail_imap_session_buff_append(self, "]<%" U64_T_FORMAT "> {%" U64_T_FORMAT "}\r\n", bodyfetch->octetstart, cnt);
mseek(cached_msg.tmpdump, bodyfetch->octetstart, SEEK_SET);
} else {
cnt = size;
- dbmail_imap_session_buff_append(self, "] {%llu}\r\n", size);
+ dbmail_imap_session_buff_append(self, "] {%" U64_T_FORMAT "}\r\n", size);
mrewind(cached_msg.tmpdump);
}
dbmail_imap_session_buff_flush(self);
@@ -1085,15 +1085,15 @@ static void _fetch_envelopes(struct ImapSession *self)
hi = *(u64_t *)last->data;
if (self->msg_idnr == hi)
- snprintf(range,RANGE_SIZE,"= %llu", self->msg_idnr);
+ snprintf(range,RANGE_SIZE,"= %" U64_T_FORMAT, self->msg_idnr);
else
- snprintf(range,RANGE_SIZE,"BETWEEN %llu AND %llu", self->msg_idnr, hi);
+ snprintf(range,RANGE_SIZE,"BETWEEN %" U64_T_FORMAT " AND %" U64_T_FORMAT, self->msg_idnr, hi);
q = g_string_new("");
g_string_printf(q,"SELECT message_idnr,envelope "
"FROM %senvelope e "
"JOIN %smessages m ON m.physmessage_id=e.physmessage_id "
- "WHERE m.mailbox_idnr = %llu "
+ "WHERE m.mailbox_idnr = %" U64_T_FORMAT " "
"AND message_idnr %s",
DBPFX, DBPFX,
self->mailbox->id, range);
@@ -1155,12 +1155,12 @@ void _send_headers(struct ImapSession *self, const body_fetch_t *bodyfetch, gboo
tmp = get_crlf_encoded(ts->str);
cnt = strlen(tmp);
- dbmail_imap_session_buff_append(self, "<%llu> {%llu}\r\n%s\r\n",
+ dbmail_imap_session_buff_append(self, "<%" U64_T_FORMAT "> {%" U64_T_FORMAT "}\r\n%s\r\n",
bodyfetch->octetstart, cnt+2, tmp);
} else {
tmp = get_crlf_encoded(ts->str);
cnt = strlen(tmp);
- dbmail_imap_session_buff_append(self, "{%llu}\r\n%s\r\n", cnt+2, tmp);
+ dbmail_imap_session_buff_append(self, "{%" U64_T_FORMAT "}\r\n%s\r\n", cnt+2, tmp);
}
g_string_free(ts,TRUE);
@@ -1213,7 +1213,7 @@ static void _fetch_headers(struct ImapSession *self, body_fetch_t *bodyfetch, gb
}
- TRACE(TRACE_DEBUG,"for %llu [%s]", self->msg_idnr, bodyfetch->hdrplist);
+ TRACE(TRACE_DEBUG,"for %" U64_T_FORMAT " [%s]", self->msg_idnr, bodyfetch->hdrplist);
// did we prefetch this message already?
s = g_tree_lookup(self->headers, &(self->msg_idnr));
@@ -1229,15 +1229,15 @@ static void _fetch_headers(struct ImapSession *self, body_fetch_t *bodyfetch, gb
hi = *(u64_t *)last->data;
if (self->msg_idnr == hi)
- snprintf(range,RANGE_SIZE,"= %llu", self->msg_idnr);
+ snprintf(range,RANGE_SIZE,"= %" U64_T_FORMAT, self->msg_idnr);
else
- snprintf(range,RANGE_SIZE,"BETWEEN %llu AND %llu", self->msg_idnr, hi);
+ snprintf(range,RANGE_SIZE,"BETWEEN %" U64_T_FORMAT " AND %" U64_T_FORMAT, self->msg_idnr, hi);
g_string_printf(q,"SELECT message_idnr,headername,headervalue "
"FROM %sheadervalue v "
"JOIN %smessages m ON v.physmessage_id=m.physmessage_id "
"JOIN %sheadername n ON v.headername_id=n.id "
- "WHERE m.mailbox_idnr = %llu "
+ "WHERE m.mailbox_idnr = %" U64_T_FORMAT " "
"AND message_idnr %s "
"AND lower(headername) %s IN ('%s')",
DBPFX, DBPFX, DBPFX,
@@ -1621,7 +1621,7 @@ int dbmail_imap_session_handle_auth(struct ImapSession * self, char * username,
int valid = auth_validate(self->ci, username, password, &userid);
- TRACE(TRACE_MESSAGE, "user (id:%llu, name %s) tries login",
+ TRACE(TRACE_MESSAGE, "user (id:%" U64_T_FORMAT ", name %s) tries login",
userid, username);
if (valid == -1) {
@@ -1643,7 +1643,7 @@ int dbmail_imap_session_handle_auth(struct ImapSession * self, char * username,
}
/* login ok */
- TRACE(TRACE_MESSAGE, "user (id %llu, name %s) login accepted", userid, username);
+ TRACE(TRACE_MESSAGE, "user (id %" U64_T_FORMAT ", name %s) login accepted", userid, username);
/* update client info */
ud->userid = userid;
@@ -1771,7 +1771,7 @@ static gboolean imap_msginfo_notify(u64_t *uid, msginfo_t *msginfo, struct ImapS
msn = g_tree_lookup(self->mailbox->ids, uid);
if (! msn) {
- TRACE(TRACE_DEBUG,"can't find uid [%llu]", *uid);
+ TRACE(TRACE_DEBUG,"can't find uid [%" U64_T_FORMAT "]", *uid);
return TRUE;
}
// EXPUNGE
@@ -1779,7 +1779,7 @@ static gboolean imap_msginfo_notify(u64_t *uid, msginfo_t *msginfo, struct ImapS
case IMAP_COMM_NOOP:
case IMAP_COMM_IDLE:
if (! newmsginfo) {
- dbmail_imap_session_printf(self, "* %llu EXPUNGE\r\n", *msn);
+ dbmail_imap_session_printf(self, "* %" U64_T_FORMAT " EXPUNGE\r\n", *msn);
dbmail_mailbox_remove_uid(self->mailbox, uid);
return FALSE;
@@ -1792,7 +1792,7 @@ static gboolean imap_msginfo_notify(u64_t *uid, msginfo_t *msginfo, struct ImapS
for (i=0; i< IMAP_NFLAGS; i++) {
if (msginfo->flags[i] != newmsginfo->flags[i]) {
s = imap_flags_as_string(newmsginfo);
- dbmail_imap_session_printf(self,"* %llu FETCH (FLAGS %s)\r\n", *msn, s);
+ dbmail_imap_session_printf(self,"* %" U64_T_FORMAT " FETCH (FLAGS %s)\r\n", *msn, s);
g_free(s);
break;
}
@@ -1940,11 +1940,11 @@ int dbmail_imap_session_mailbox_show_info(struct ImapSession * self)
dbmail_imap_session_printf(self, "* OK [PERMANENTFLAGS (%s)]\r\n", string->str);
/* UIDNEXT */
- dbmail_imap_session_printf(self, "* OK [UIDNEXT %llu] Predicted next UID\r\n",
+ dbmail_imap_session_printf(self, "* OK [UIDNEXT %" U64_T_FORMAT "] Predicted next UID\r\n",
ud->mailbox.msguidnext);
/* UID */
- dbmail_imap_session_printf(self, "* OK [UIDVALIDITY %llu] UID value\r\n",
+ dbmail_imap_session_printf(self, "* OK [UIDVALIDITY %" U64_T_FORMAT "] UID value\r\n",
ud->mailbox.uid);
g_string_free(string,TRUE);
@@ -1963,7 +1963,7 @@ int dbmail_imap_session_mailbox_open(struct ImapSession * self, const char * mai
/* create missing INBOX for this authenticated user */
if ((! mailbox_idnr ) && (strcasecmp(mailbox, "INBOX")==0)) {
- TRACE(TRACE_INFO, "Auto-creating INBOX for user id [%llu]", ud->userid);
+ TRACE(TRACE_INFO, "Auto-creating INBOX for user id [%" U64_T_FORMAT "]", ud->userid);
result = db_createmailbox("INBOX", ud->userid, &mailbox_idnr);
}
@@ -2096,7 +2096,7 @@ static int imap_session_update_recent(struct DbmailMailbox *mailbox, GList *rece
db_begin_transaction();
while (slices) {
snprintf(query, DEF_QUERYSIZE, "UPDATE %smessages SET recent_flag = 0 "
- "WHERE mailbox_idnr = %llu AND message_idnr IN (%s) AND recent_flag = 1",
+ "WHERE mailbox_idnr = %" U64_T_FORMAT " AND message_idnr IN (%s) AND recent_flag = 1",
DBPFX, mailbox->id, (gchar *)slices->data);
if (db_query(query) == -1) {
db_rollback_transaction();
diff --git a/dbmail-mailbox.c b/dbmail-mailbox.c
index e8222725..eaaaa198 100644
--- a/dbmail-mailbox.c
+++ b/dbmail-mailbox.c
@@ -189,7 +189,7 @@ int dbmail_mailbox_open(struct DbmailMailbox *self)
GString *q = g_string_new("");
g_string_printf(q, "SELECT message_idnr FROM %smessages "
- "WHERE mailbox_idnr = %llu "
+ "WHERE mailbox_idnr = %" U64_T_FORMAT " "
"AND status IN (%d,%d) "
"ORDER BY message_idnr", DBPFX,
dbmail_mailbox_get_id(self),
@@ -211,7 +211,7 @@ int dbmail_mailbox_open(struct DbmailMailbox *self)
int dbmail_mailbox_remove_uid(struct DbmailMailbox *self, u64_t *id)
{
if (! g_tree_remove(self->ids, id)) {
- TRACE(TRACE_ERROR,"trying to remove unknown UID [%llu]", *id);
+ TRACE(TRACE_ERROR,"trying to remove unknown UID [%" U64_T_FORMAT "]", *id);
return DM_EGENERAL;
}
@@ -308,7 +308,7 @@ int dbmail_mailbox_dump(struct DbmailMailbox *self, FILE *file)
ids = g_tree_keys(self->ids);
while (ids) {
- cids = g_list_append(cids,g_strdup_printf("%llu", *(u64_t *)ids->data));
+ cids = g_list_append(cids,g_strdup_printf("%" U64_T_FORMAT, *(u64_t *)ids->data));
if (! g_list_next(ids))
break;
ids = g_list_next(ids);
@@ -326,7 +326,7 @@ int dbmail_mailbox_dump(struct DbmailMailbox *self, FILE *file)
g_string_printf(q,"SELECT is_header,messageblk,%s FROM %smessageblks b "
"JOIN %sphysmessage p ON b.physmessage_id = p.id "
"JOIN %smessages m ON m.physmessage_id = p.id "
- "WHERE mailbox_idnr = %llu AND message_idnr IN (%s) "
+ "WHERE mailbox_idnr = %" U64_T_FORMAT " AND message_idnr IN (%s) "
"ORDER BY messageblk_idnr ",
date2char,
DBPFX, DBPFX, DBPFX, self->id,
@@ -400,7 +400,7 @@ static gboolean _tree_foreach(gpointer key UNUSED, gpointer value, GString * dat
sublist = g_list_first(sublist);
while(sublist) {
id = sublist->data;
- g_string_append_printf(t, "(%llu)", *id);
+ g_string_append_printf(t, "(%" U64_T_FORMAT ")", *id);
if (! g_list_next(sublist))
break;
@@ -432,7 +432,7 @@ char * dbmail_mailbox_orderedsubject(struct DbmailMailbox *self)
"FROM %smessages "
"JOIN %ssubjectfield USING (physmessage_id) "
"JOIN %sdatefield USING (physmessage_id) "
- "WHERE mailbox_idnr=%llu "
+ "WHERE mailbox_idnr=%" U64_T_FORMAT " "
"AND status IN (%d, %d) "
"GROUP BY subjectfield",
DBPFX, DBPFX, DBPFX,
@@ -469,7 +469,7 @@ char * dbmail_mailbox_orderedsubject(struct DbmailMailbox *self)
"FROM %smessages "
"JOIN %ssubjectfield using (physmessage_id) "
"JOIN %sdatefield using (physmessage_id) "
- "WHERE mailbox_idnr=%llu "
+ "WHERE mailbox_idnr=%" U64_T_FORMAT " "
"AND status IN (%d,%d) "
"ORDER BY subjectfield,datefield",
DBPFX, DBPFX, DBPFX,
@@ -545,7 +545,7 @@ char * dbmail_mailbox_ids_as_string(struct DbmailMailbox *self)
h = l;
while(l->data) {
- g_string_append_printf(t,"%llu ", *(u64_t *)l->data);
+ g_string_append_printf(t,"%" U64_T_FORMAT " ", *(u64_t *)l->data);
if (! g_list_next(l))
break;
l = g_list_next(l);
@@ -578,9 +578,9 @@ char * dbmail_mailbox_sorted_as_string(struct DbmailMailbox *self)
msn = g_tree_lookup(self->ids, l->data);
if (msn) {
if (uid)
- g_string_append_printf(t,"%llu ", *(u64_t *)l->data);
+ g_string_append_printf(t,"%" U64_T_FORMAT " ", *(u64_t *)l->data);
else
- g_string_append_printf(t,"%llu ", *(u64_t *)msn);
+ g_string_append_printf(t,"%" U64_T_FORMAT " ", *(u64_t *)msn);
}
if (! g_list_next(l))
break;
@@ -1165,7 +1165,7 @@ int dbmail_mailbox_build_imap_search(struct DbmailMailbox *self, char **search_k
/* SEARCH */
while( search_keys[*idx] && ((result = _handle_search_args(self, search_keys, idx)) == 0) );
- TRACE(TRACE_DEBUG,"done [%d] at idx [%llu]", result, *idx);
+ TRACE(TRACE_DEBUG,"done [%d] at idx [%" U64_T_FORMAT "]", result, *idx);
return result;
}
@@ -1190,7 +1190,7 @@ static gboolean _do_sort(GNode *node, struct DbmailMailbox *self)
g_string_printf(q, "SELECT message_idnr FROM %smessages m "
"LEFT JOIN %sphysmessage p ON m.physmessage_id=p.id "
"%s"
- "WHERE m.mailbox_idnr = %llu AND m.status IN (%d,%d) "
+ "WHERE m.mailbox_idnr = %" U64_T_FORMAT " AND m.status IN (%d,%d) "
"ORDER BY %smessage_idnr", DBPFX, DBPFX, s->table,
dbmail_mailbox_get_id(self), MESSAGE_STATUS_NEW, MESSAGE_STATUS_SEEN, s->order);
@@ -1268,7 +1268,7 @@ static GTree * mailbox_search(struct DbmailMailbox *self, search_key_t *s)
g_string_printf(q,"SELECT message_idnr FROM %smessages m "
"JOIN %sphysmessage p ON m.physmessage_id=p.id "
"JOIN %sdatefield d ON d.physmessage_id=p.id "
- "WHERE mailbox_idnr= %llu AND status IN (%d,%d) "
+ "WHERE mailbox_idnr= %" U64_T_FORMAT " AND status IN (%d,%d) "
"AND %s "
"ORDER BY message_idnr", DBPFX, DBPFX, DBPFX,
dbmail_mailbox_get_id(self),
@@ -1284,7 +1284,7 @@ static GTree * mailbox_search(struct DbmailMailbox *self, search_key_t *s)
"JOIN %sphysmessage p ON m.physmessage_id=p.id "
"JOIN %sheadervalue v ON v.physmessage_id=p.id "
"JOIN %sheadername n ON v.headername_id=n.id "
- "WHERE mailbox_idnr = %llu "
+ "WHERE mailbox_idnr = %" U64_T_FORMAT " "
"AND status IN (%d,%d) "
"AND headername %s '%s' AND %s %s '%%%s%%' "
"ORDER BY message_idnr",
@@ -1303,7 +1303,7 @@ static GTree * mailbox_search(struct DbmailMailbox *self, search_key_t *s)
"JOIN %sphysmessage p ON k.physmessage_id=p.id "
"JOIN %smessages m ON m.physmessage_id=p.id "
"JOIN %sheadervalue v ON v.physmessage_id=p.id "
- "WHERE m.mailbox_idnr=%llu AND m.status in (%d,%d) "
+ "WHERE m.mailbox_idnr=%" U64_T_FORMAT " AND m.status in (%d,%d) "
"HAVING %s %s '%%%s%%' "
"OR k.messageblk %s '%%%s%%'",
DBPFX,DBPFX,DBPFX,DBPFX,
@@ -1317,7 +1317,7 @@ static GTree * mailbox_search(struct DbmailMailbox *self, search_key_t *s)
case IST_IDATE:
g_string_printf(q, "SELECT message_idnr FROM %smessages m "
"JOIN %sphysmessage p ON m.physmessage_id=p.id "
- "WHERE mailbox_idnr = %llu "
+ "WHERE mailbox_idnr = %" U64_T_FORMAT " "
"AND status IN (%d,%d) AND p.%s "
"ORDER BY message_idnr",
DBPFX, DBPFX,
@@ -1331,7 +1331,7 @@ static GTree * mailbox_search(struct DbmailMailbox *self, search_key_t *s)
g_string_printf(q, "SELECT m.message_idnr,k.messageblk FROM %smessageblks k "
"JOIN %sphysmessage p ON k.physmessage_id = p.id "
"JOIN %smessages m ON p.id = m.physmessage_id "
- "WHERE mailbox_idnr = %llu "
+ "WHERE mailbox_idnr = %" U64_T_FORMAT " "
"AND status IN (%d,%d ) "
"AND k.is_header = '0' "
"GROUP BY m.message_idnr,k.messageblk "
@@ -1349,8 +1349,8 @@ static GTree * mailbox_search(struct DbmailMailbox *self, search_key_t *s)
g_string_printf(q, "SELECT m.message_idnr FROM %smessages m "
"JOIN %sphysmessage p ON m.physmessage_id = p.id "
- "WHERE m.mailbox_idnr = %llu "
- "AND m.status IN (%d,%d) AND p.messagesize %c %llu "
+ "WHERE m.mailbox_idnr = %" U64_T_FORMAT " "
+ "AND m.status IN (%d,%d) AND p.messagesize %c %" U64_T_FORMAT " "
"ORDER BY message_idnr", DBPFX, DBPFX,
dbmail_mailbox_get_id(self),
MESSAGE_STATUS_NEW, MESSAGE_STATUS_SEEN,
@@ -1359,7 +1359,7 @@ static GTree * mailbox_search(struct DbmailMailbox *self, search_key_t *s)
default:
g_string_printf(q, "SELECT message_idnr FROM %smessages "
- "WHERE mailbox_idnr = %llu "
+ "WHERE mailbox_idnr = %" U64_T_FORMAT " "
"AND status IN (%d,%d) AND %s "
"ORDER BY message_idnr", DBPFX,
dbmail_mailbox_get_id(self),
@@ -1387,7 +1387,7 @@ static GTree * mailbox_search(struct DbmailMailbox *self, search_key_t *s)
for (i=0; i < rows; i++) {
id = db_get_result_u64(i,0);
if (! (w = g_tree_lookup(self->ids, &id))) {
- TRACE(TRACE_ERROR, "key missing in self->ids: [%llu]\n", id);
+ TRACE(TRACE_ERROR, "key missing in self->ids: [%" U64_T_FORMAT "]\n", id);
continue;
}
assert(w);
diff --git a/dbmail-message.c b/dbmail-message.c
index 7a7e9383..0465a90e 100644
--- a/dbmail-message.c
+++ b/dbmail-message.c
@@ -733,7 +733,7 @@ static struct DbmailMessage * _fetch_head(struct DbmailMessage *self)
{
char *query_template = "SELECT messageblk, is_header "
"FROM %smessageblks "
- "WHERE physmessage_id = %llu "
+ "WHERE physmessage_id = %" U64_T_FORMAT " "
"AND is_header = '1'";
return _retrieve(self, query_template);
@@ -748,7 +748,7 @@ static struct DbmailMessage * _fetch_full(struct DbmailMessage *self)
{
char *query_template = "SELECT messageblk, is_header "
"FROM %smessageblks "
- "WHERE physmessage_id = %llu "
+ "WHERE physmessage_id = %" U64_T_FORMAT " "
"ORDER BY messageblk_idnr";
return _retrieve(self, query_template);
}
@@ -777,7 +777,7 @@ struct DbmailMessage * dbmail_message_retrieve(struct DbmailMessage *self, u64_t
}
if ((!self) || (! self->content)) {
- TRACE(TRACE_ERROR, "retrieval failed for physid [%llu]", physid);
+ TRACE(TRACE_ERROR, "retrieval failed for physid [%" U64_T_FORMAT "]", physid);
return NULL;
}
@@ -899,7 +899,7 @@ int _message_insert(struct DbmailMessage *self,
snprintf(query, DEF_QUERYSIZE, "INSERT INTO "
"%smessages(mailbox_idnr, physmessage_id, unique_id,"
"recent_flag, status) "
- "VALUES (%llu, %llu, '%s', 1, %d) %s",
+ "VALUES (%" U64_T_FORMAT ", %" U64_T_FORMAT ", '%s', 1, %d) %s",
DBPFX, mailboxid, physmessage_id, unique_id,
MESSAGE_STATUS_INSERT, db_returning("message_idnr"));
@@ -1049,7 +1049,7 @@ static gboolean _header_cache(const char UNUSED *key, const char *header, gpoint
safe_value = dm_stresc(rvalue); g_free(rvalue);
g_string_printf(q,"INSERT INTO %sheadervalue (headername_id, physmessage_id, headervalue) "
- "VALUES (%llu,%llu,'%s')", DBPFX, id, self->physid, safe_value);
+ "VALUES (%" U64_T_FORMAT ",%" U64_T_FORMAT ",'%s')", DBPFX, id, self->physid, safe_value);
g_free(safe_value);
safe_value = NULL;
@@ -1093,7 +1093,7 @@ static void insert_address_cache(u64_t physid, const char *field, InternetAddres
addr = dm_strnesc(ia->value.addr ? ia->value.addr : "", CACHE_WIDTH_ADDR);
g_string_printf(q, "INSERT INTO %s%sfield (physmessage_id, %sname, %saddr) "
- "VALUES (%llu,'%s','%s')", DBPFX, field, field, field,
+ "VALUES (%" U64_T_FORMAT ",'%s','%s')", DBPFX, field, field, field,
physid, name, addr);
g_free(name);
@@ -1122,7 +1122,7 @@ static void insert_field_cache(u64_t physid, const char *field, const char *valu
q = g_string_new("");
g_string_printf(q, "INSERT INTO %s%sfield (physmessage_id, %sfield) "
- "VALUES (%llu,'%s')", DBPFX, field, field, physid, clean_value);
+ "VALUES (%" U64_T_FORMAT ",'%s')", DBPFX, field, field, physid, clean_value);
g_free(clean_value);
@@ -1229,7 +1229,7 @@ void dbmail_message_cache_subjectfield(const struct DbmailMessage *self)
raw = (char *)dbmail_message_get_header(self, "Subject");
if (! raw) {
- TRACE(TRACE_MESSAGE,"no subject field value [%llu]", self->physid);
+ TRACE(TRACE_MESSAGE,"no subject field value [%" U64_T_FORMAT "]", self->physid);
return;
}
@@ -1259,7 +1259,7 @@ void dbmail_message_cache_referencesfield(const struct DbmailMessage *self)
refs = g_mime_references_decode(field);
if (! refs) {
- TRACE(TRACE_MESSAGE, "reference_decode failed [%llu]", self->physid);
+ TRACE(TRACE_MESSAGE, "reference_decode failed [%" U64_T_FORMAT "]", self->physid);
return;
}
@@ -1290,7 +1290,7 @@ void dbmail_message_cache_envelope(const struct DbmailMessage *self)
clean = dm_stresc(envelope);
q = g_strdup_printf("INSERT INTO %senvelope (physmessage_id, envelope) "
- "VALUES (%llu,'%s')", DBPFX, self->physid, clean);
+ "VALUES (%" U64_T_FORMAT ",'%s')", DBPFX, self->physid, clean);
g_free(clean);
g_free(envelope);
diff --git a/dbmail-user.c b/dbmail-user.c
index 0e655cc6..e740e56e 100644
--- a/dbmail-user.c
+++ b/dbmail-user.c
@@ -58,13 +58,13 @@ int do_add(const char * const user,
int result;
if (no_to_all) {
- qprintf("Pretending to add user %s with password type %s, %llu bytes mailbox limit and clientid %llu\n",
+ qprintf("Pretending to add user %s with password type %s, %" U64_T_FORMAT " bytes mailbox limit and clientid %" U64_T_FORMAT "\n",
user, enctype, maxmail, clientid);
return 1;
}
- TRACE(TRACE_DEBUG, "Adding user %s with password type %s,%llu "
- "bytes mailbox limit and clientid %llu... ",
+ TRACE(TRACE_DEBUG, "Adding user %s with password type %s,%" U64_T_FORMAT " "
+ "bytes mailbox limit and clientid %" U64_T_FORMAT "... ",
user, enctype, maxmail, clientid);
if ((result = auth_user_exists(user, &useridnr))) {
@@ -77,7 +77,7 @@ int do_add(const char * const user,
return -1;
}
- TRACE(TRACE_DEBUG, "Ok, user added id [%llu]\n", useridnr);
+ TRACE(TRACE_DEBUG, "Ok, user added id [%" U64_T_FORMAT "]\n", useridnr);
/* Add an INBOX for the user. */
qprintf("Adding INBOX for new user... ");
@@ -110,7 +110,7 @@ int do_username(const u64_t useridnr, const char * const newuser)
assert(newuser);
if (no_to_all) {
- qprintf("Pretending to change username of user id number [%llu] to [%s]\n",
+ qprintf("Pretending to change username of user id number [%" U64_T_FORMAT "] to [%s]\n",
useridnr, newuser);
return 1;
}
@@ -128,7 +128,7 @@ int do_password(const u64_t useridnr,
int result = 0;
if (no_to_all) {
- qprintf("Pretending to change password for user id number [%llu]\n",
+ qprintf("Pretending to change password for user id number [%" U64_T_FORMAT "]\n",
useridnr);
return 1;
}
@@ -270,7 +270,7 @@ int do_clientid(u64_t useridnr, u64_t clientid)
int result = 0;
if (no_to_all) {
- qprintf("Pretending to change client for user id number [%llu] to client id number [%llu]\n",
+ qprintf("Pretending to change client for user id number [%" U64_T_FORMAT "] to client id number [%" U64_T_FORMAT "]\n",
useridnr, clientid);
return 1;
}
@@ -287,7 +287,7 @@ int do_maxmail(u64_t useridnr, u64_t maxmail)
int result = 0;
if (no_to_all) {
- qprintf("Pretending to change mail quota for user id number [%llu] to [%llu] bytes\n",
+ qprintf("Pretending to change mail quota for user id number [%" U64_T_FORMAT "] to [%" U64_T_FORMAT "] bytes\n",
useridnr, maxmail);
return 1;
}
@@ -406,7 +406,7 @@ int do_aliases(const u64_t useridnr,
GList *current_aliases, *matching_aliases, *matching_alias_del;
if (no_to_all) {
- qprintf("Pretending to remove aliases for user id number [%llu]\n",
+ qprintf("Pretending to remove aliases for user id number [%" U64_T_FORMAT "]\n",
useridnr);
if (alias_del) {
alias_del = g_list_first(alias_del);
@@ -415,7 +415,7 @@ int do_aliases(const u64_t useridnr,
alias_del = g_list_next(alias_del);
}
}
- qprintf("Pretending to add aliases for user id number [%llu]\n",
+ qprintf("Pretending to add aliases for user id number [%" U64_T_FORMAT "]\n",
useridnr);
if (alias_add) {
alias_add = g_list_first(alias_add);
@@ -506,7 +506,7 @@ int do_delete(const u64_t useridnr, const char * const name)
GList *aliases = NULL;
if (no_to_all) {
- qprintf("Pretending to delete alias [%s] for user id number [%llu]\n",
+ qprintf("Pretending to delete alias [%s] for user id number [%" U64_T_FORMAT "]\n",
name, useridnr);
return 1;
}
@@ -663,8 +663,8 @@ static void show_user(u64_t useridnr, int concise UNUSED)
g_free(username);
out = g_list_append_printf(out,"x");
- out = g_list_append_printf(out,"%llu", useridnr);
- out = g_list_append_printf(out,"%llu", cid);
+ out = g_list_append_printf(out,"%" U64_T_FORMAT, useridnr);
+ out = g_list_append_printf(out,"%" U64_T_FORMAT, cid);
out = g_list_append_printf(out,"%.02f",
(double) quotum / (1024.0 * 1024.0));
out = g_list_append_printf(out,"%.02f",
@@ -700,7 +700,7 @@ int do_empty(u64_t useridnr)
char mailbox[IMAP_MAX_MAILBOX_NAMELEN];
mailbox_t *mb;
- qprintf("You've requested to delete all mailboxes owned by user number [%llu]:\n", useridnr);
+ qprintf("You've requested to delete all mailboxes owned by user number [%" U64_T_FORMAT "]:\n", useridnr);
db_findmailbox_by_regex(useridnr, "*", &children, &nchildren, 0, &mb);
for (i = 0; i < nchildren; i++) {
diff --git a/dbmailtypes.h b/dbmailtypes.h
index 41a0d08d..8af524ec 100644
--- a/dbmailtypes.h
+++ b/dbmailtypes.h
@@ -53,6 +53,7 @@
/** use 64-bit unsigned integers as common data type */
//typedef unsigned long long u64_t;
#define u64_t guint64
+#define U64_T_FORMAT G_GUINT64_FORMAT
typedef enum {
DM_EQUERY = -1,
diff --git a/dsn.c b/dsn.c
index 95b5a2bf..833533cd 100644
--- a/dsn.c
+++ b/dsn.c
@@ -321,7 +321,7 @@ static int address_is_username_mailbox(deliver_to_user_t *delivery)
return -1;
}
- TRACE(TRACE_DEBUG, "added user [%s] id [%llu] to delivery list", newaddress, userid);
+ TRACE(TRACE_DEBUG, "added user [%s] id [%" U64_T_FORMAT "] to delivery list", newaddress, userid);
g_free(newaddress);
return 1;
@@ -354,7 +354,7 @@ static int address_is_username(deliver_to_user_t *delivery)
return -1;
}
- TRACE(TRACE_DEBUG, "added user [%s] id [%llu] to delivery list", delivery->address, userid);
+ TRACE(TRACE_DEBUG, "added user [%s] id [%" U64_T_FORMAT "] to delivery list", delivery->address, userid);
return 1;
}
@@ -546,18 +546,18 @@ int dsnuser_resolve(deliver_to_user_t *delivery)
* We just want to make sure that the userid actually exists... */
if (delivery->useridnr != 0) {
- TRACE(TRACE_INFO, "checking if [%llu] is a valid useridnr.", delivery->useridnr);
+ TRACE(TRACE_INFO, "checking if [%" U64_T_FORMAT "] is a valid useridnr.", delivery->useridnr);
switch (auth_check_userid(delivery->useridnr)) {
case -1:
/* Temp fail. Address related. D.N.E. */
set_dsn(&delivery->dsn, DSN_CLASS_TEMP, 1, 1);
- TRACE(TRACE_INFO, "useridnr [%llu] temporary lookup failure.", delivery->useridnr);
+ TRACE(TRACE_INFO, "useridnr [%" U64_T_FORMAT "] temporary lookup failure.", delivery->useridnr);
break;
case 1:
/* Failure. Address related. D.N.E. */
set_dsn(&delivery->dsn, DSN_CLASS_FAIL, 1, 1);
- TRACE(TRACE_INFO, "useridnr [%llu] does not exist.", delivery->useridnr);
+ TRACE(TRACE_INFO, "useridnr [%" U64_T_FORMAT "] does not exist.", delivery->useridnr);
break;
case 0:
/* Copy the delivery useridnr into the userids list. */
@@ -569,7 +569,7 @@ int dsnuser_resolve(deliver_to_user_t *delivery)
/* Success. Address related. Valid. */
set_dsn(&delivery->dsn, DSN_CLASS_OK, 1, 5);
- TRACE(TRACE_INFO, "delivery [%llu] directly to a useridnr.", delivery->useridnr);
+ TRACE(TRACE_INFO, "delivery [%" U64_T_FORMAT "] directly to a useridnr.", delivery->useridnr);
break;
}
/* Ok, we don't have a useridnr, maybe we have an address? */
diff --git a/export.c b/export.c
index d4692588..84e4dd7f 100644
--- a/export.c
+++ b/export.c
@@ -133,7 +133,7 @@ static int mailbox_dump(u64_t mailbox_idnr, const char *dumpfile,
// Following this, dbmail-util -d sets deleted status
if (delete_after_dump & 1) {
if (db_set_msgflag(*(u64_t *)ids->data, mailbox_idnr, deleted_flag, IMAPFA_ADD) < 0) {
- qerrorf("Error setting flags for message [%llu]\n", *(u64_t *)ids->data);
+ qerrorf("Error setting flags for message [%" U64_T_FORMAT "]\n", *(u64_t *)ids->data);
result = -1;
}
}
@@ -142,7 +142,7 @@ static int mailbox_dump(u64_t mailbox_idnr, const char *dumpfile,
// Following this, dbmail-util -p sets purge status
if (delete_after_dump & 2) {
if (db_set_message_status(mailbox_idnr, *(u64_t *)ids->data, MESSAGE_STATUS_DELETE)) {
- qerrorf("Error setting status for message [%llu]\n", *(u64_t *)ids->data);
+ qerrorf("Error setting status for message [%" U64_T_FORMAT "]\n", *(u64_t *)ids->data);
result = -1;
}
}
diff --git a/imapcommands.c b/imapcommands.c
index 3c288ddd..d231486d 100644
--- a/imapcommands.c
+++ b/imapcommands.c
@@ -136,7 +136,7 @@ int _ic_logout(struct ImapSession *self)
create_current_timestring(&timestring);
dbmail_imap_session_set_state(self,IMAPCS_LOGOUT);
- TRACE(TRACE_MESSAGE, "user (id:%llu) logging out @ [%s]", ud->userid, timestring);
+ TRACE(TRACE_MESSAGE, "user (id:%" U64_T_FORMAT ") logging out @ [%s]", ud->userid, timestring);
dbmail_imap_session_printf(self, "* BYE dbmail imap server kisses you goodbye\r\n");
@@ -277,7 +277,7 @@ int _ic_select(struct ImapSession *self)
key = db_first_unseen(ud->mailbox.uid);
if ( (key > 0) && (msn = g_tree_lookup(self->mailbox->ids, &key))) {
dbmail_imap_session_printf(self,
- "* OK [UNSEEN %llu] first unseen message\r\n", *msn);
+ "* OK [UNSEEN %" U64_T_FORMAT "] first unseen message\r\n", *msn);
}
}
/* permission */
@@ -289,7 +289,7 @@ int _ic_select(struct ImapSession *self)
g_snprintf(permstring, PERMSTRING_SIZE, "READ-WRITE");
break;
default:
- TRACE(TRACE_ERROR, "detected invalid permission mode for mailbox %llu ('%s')",
+ TRACE(TRACE_ERROR, "detected invalid permission mode for mailbox %" U64_T_FORMAT " ('%s')",
ud->mailbox.uid, self->args[self->args_idx]);
dbmail_imap_session_printf(self,
@@ -532,19 +532,19 @@ int _ic_rename(struct ImapSession *self)
/* Check if the user has ACL delete rights to old name,
* and create rights to the parent of the new name, or
* if the user just owns both mailboxes. */
- TRACE(TRACE_DEBUG, "Checking right to DELETE [%llu]", mboxid);
+ TRACE(TRACE_DEBUG, "Checking right to DELETE [%" U64_T_FORMAT "]", mboxid);
result = dbmail_imap_session_mailbox_check_acl(self, mboxid, ACL_RIGHT_DELETE);
if (result != 0)
return result;
- TRACE(TRACE_DEBUG, "We have the right to DELETE [%llu]", mboxid);
+ TRACE(TRACE_DEBUG, "We have the right to DELETE [%" U64_T_FORMAT "]", mboxid);
if (!parentmboxid) {
TRACE(TRACE_DEBUG, "Destination is a top-level mailbox; not checking right to CREATE.");
} else {
- TRACE(TRACE_DEBUG, "Checking right to CREATE under [%llu]", parentmboxid);
+ TRACE(TRACE_DEBUG, "Checking right to CREATE under [%" U64_T_FORMAT "]", parentmboxid);
result = dbmail_imap_session_mailbox_check_acl(self, parentmboxid, ACL_RIGHT_CREATE);
if (result != 0)
return result;
- TRACE(TRACE_DEBUG, "We have the right to CREATE under [%llu]", parentmboxid);
+ TRACE(TRACE_DEBUG, "We have the right to CREATE under [%" U64_T_FORMAT "]", parentmboxid);
}
/* check if it is INBOX to be renamed */
@@ -935,9 +935,9 @@ int _ic_status(struct ImapSession *self)
else if (strcasecmp(self->args[i], "unseen") == 0)
plst = g_list_append_printf(plst,"UNSEEN %u", mb.unseen);
else if (strcasecmp(self->args[i], "uidnext") == 0) {
- plst = g_list_append_printf(plst,"UIDNEXT %llu", mb.msguidnext);
+ plst = g_list_append_printf(plst,"UIDNEXT %" U64_T_FORMAT, mb.msguidnext);
} else if (strcasecmp(self->args[i], "uidvalidity") == 0) {
- plst = g_list_append_printf(plst,"UIDVALIDITY %llu", mb.uid);
+ plst = g_list_append_printf(plst,"UIDVALIDITY %" U64_T_FORMAT, mb.uid);
} else if (strcasecmp(self->args[i], ")") == 0)
break;
else {
@@ -1024,7 +1024,7 @@ int _ic_append(struct ImapSession *self)
return 1;
}
- TRACE(TRACE_DEBUG, "mailbox [%s] found, id: %llu", self->args[0], mboxid);
+ TRACE(TRACE_DEBUG, "mailbox [%s] found, id: %" U64_T_FORMAT, self->args[0], mboxid);
/* check if user has right to append to mailbox */
mailbox.uid = mboxid;
result = acl_has_right(&mailbox, ud->userid, ACL_RIGHT_INSERT);
@@ -1168,7 +1168,7 @@ int _ic_append(struct ImapSession *self)
if (result == 0 && flagcount > 0) {
if (db_set_msgflag(msg_idnr, mboxid, flaglist, IMAPFA_ADD) < 0) {
- TRACE(TRACE_ERROR, "error setting flags for message [%llu]", msg_idnr);
+ TRACE(TRACE_ERROR, "error setting flags for message [%" U64_T_FORMAT "]", msg_idnr);
return -1;
}
}
@@ -1317,10 +1317,10 @@ int _ic_expunge(struct ImapSession *self)
msn = g_tree_lookup(self->mailbox->ids, &uid);
if (! msn) {
- TRACE(TRACE_DEBUG,"can't find uid [%llu]", uid);
+ TRACE(TRACE_DEBUG,"can't find uid [%" U64_T_FORMAT "]", uid);
break;
}
- dbmail_imap_session_printf(self, "* %llu EXPUNGE\r\n", *msn);
+ dbmail_imap_session_printf(self, "* %" U64_T_FORMAT " EXPUNGE\r\n", *msn);
dbmail_mailbox_remove_uid(self->mailbox, &uid);
}
@@ -1523,7 +1523,7 @@ int _ic_fetch(struct ImapSession *self)
dbmail_imap_session_printf(self, "%s BAD invalid argument list to fetch\r\n", self->tag);
return 1;
}
- TRACE(TRACE_DEBUG,"dbmail_imap_session_fetch_parse_args loop idx %llu state %d ", self->args_idx, state);
+ TRACE(TRACE_DEBUG,"dbmail_imap_session_fetch_parse_args loop idx %" U64_T_FORMAT " state %d ", self->args_idx, state);
self->args_idx++;
} while (state > 0);
@@ -1564,7 +1564,7 @@ static gboolean _do_store(u64_t *id, gpointer UNUSED value, struct ImapSession *
msginfo = g_tree_lookup(self->msginfo, id);
if (! msginfo) {
- TRACE(TRACE_WARNING, "unable to lookup msginfo struct for [%llu]", *id);
+ TRACE(TRACE_WARNING, "unable to lookup msginfo struct for [%" U64_T_FORMAT "]", *id);
return TRUE;
}
@@ -1601,7 +1601,7 @@ static gboolean _do_store(u64_t *id, gpointer UNUSED value, struct ImapSession *
if (! cmd->silent) {
s = imap_flags_as_string(msginfo);
- dbmail_imap_session_printf(self,"* %llu FETCH (FLAGS %s)\r\n", *msn, s);
+ dbmail_imap_session_printf(self,"* %" U64_T_FORMAT " FETCH (FLAGS %s)\r\n", *msn, s);
g_free(s);
}
@@ -1916,7 +1916,7 @@ void send_quota(struct ImapSession *self, quota_t * quota)
continue;
}
dbmail_imap_session_printf(self,
- "* QUOTA \"%s\" (%s %llu %llu)\r\n",
+ "* QUOTA \"%s\" (%s %" U64_T_FORMAT " %" U64_T_FORMAT ")\r\n",
quota->root, name, usage, limit);
}
}
diff --git a/list.c b/list.c
index 79edb7b2..e543f6dd 100644
--- a/list.c
+++ b/list.c
@@ -182,12 +182,12 @@ GList *g_list_slices_u64(GList *list, unsigned limit)
list = g_list_first(list);
while(list) {
slice = g_string_new("");
- g_string_append_printf(slice,"%llu",*(u64_t *)list->data);
+ g_string_append_printf(slice,"%" U64_T_FORMAT,*(u64_t *)list->data);
for (i=1; i<limit; i++) {
if (! g_list_next(list))
break;
list = g_list_next(list);
- g_string_append_printf(slice,",%llu", *(u64_t *)list->data);
+ g_string_append_printf(slice,",%" U64_T_FORMAT, *(u64_t *)list->data);
}
new = g_list_append_printf(new, "%s", slice->str);
g_string_free(slice,TRUE);
diff --git a/main.c b/main.c
index e1599dc9..87a17da9 100644
--- a/main.c
+++ b/main.c
@@ -269,7 +269,7 @@ int main(int argc, char *argv[])
if (dbmail_message_get_hdrs_size(msg, FALSE) > READ_BLOCK_SIZE) {
TRACE(TRACE_ERROR, "failed to read header because header is too "
- "big (larger than READ_BLOCK_SIZE (%llu))", (u64_t) READ_BLOCK_SIZE);
+ "big (larger than READ_BLOCK_SIZE (%" U64_T_FORMAT "))", (u64_t) READ_BLOCK_SIZE);
exitcode = EX_DATAERR;
goto freeall;
}
diff --git a/maintenance.c b/maintenance.c
index 68027b6e..d2423b4a 100644
--- a/maintenance.c
+++ b/maintenance.c
@@ -313,7 +313,7 @@ int do_purge_deleted(void)
serious_errors = 1;
return -1;
}
- qprintf("Ok. [%llu] messages have DELETE status.\n",
+ qprintf("Ok. [%" U64_T_FORMAT "] messages have DELETE status.\n",
deleted_messages);
}
if (yes_to_all) {
@@ -324,7 +324,7 @@ int do_purge_deleted(void)
serious_errors = 1;
return -1;
}
- qprintf("Ok. [%llu] messages deleted.\n", deleted_messages);
+ qprintf("Ok. [%" U64_T_FORMAT "] messages deleted.\n", deleted_messages);
}
return 0;
}
@@ -342,7 +342,7 @@ int do_set_deleted(void)
serious_errors = 1;
return -1;
}
- qprintf("Ok. [%llu] messages need to be set for deletion.\n",
+ qprintf("Ok. [%" U64_T_FORMAT "] messages need to be set for deletion.\n",
messages_set_to_delete);
}
if (yes_to_all) {
@@ -353,7 +353,7 @@ int do_set_deleted(void)
serious_errors = 1;
return -1;
}
- qprintf("Ok. [%llu] messages set for deletion.\n",
+ qprintf("Ok. [%" U64_T_FORMAT "] messages set for deletion.\n",
messages_set_to_delete);
qprintf("Re-calculating used quota for all users...\n");
if (db_calculate_quotum_all() < 0) {
@@ -428,7 +428,7 @@ int do_dangling_aliases(void)
dangling = g_list_first(dangling);
while (dangling) {
count++;
- g_snprintf(deliver_to, 21, "%llu", *(u64_t *)dangling->data);
+ g_snprintf(deliver_to, 21, "%" U64_T_FORMAT, *(u64_t *)dangling->data);
qverbosef("Dangling alias [%s] delivers to nonexistent user [%s]\n",
(char *)aliases->data, deliver_to);
if (yes_to_all) {
@@ -499,9 +499,9 @@ int do_null_messages(void)
mailbox = ((box_uid_t *) el->data)->mailbox;
id = ((box_uid_t *) el->data)->uid;
if (db_set_message_status(mailbox, id, MESSAGE_STATUS_ERROR) < 0)
- qerrorf("Warning: could not set status on mailbox [%llu] message [%llu]. Check log.\n", mailbox, id);
+ qerrorf("Warning: could not set status on mailbox [%" U64_T_FORMAT "] message [%" U64_T_FORMAT "]. Check log.\n", mailbox, id);
else
- qverbosef("[%llu/%llu] set to MESSAGE_STATUS_ERROR)\n", mailbox, id);
+ qverbosef("[%" U64_T_FORMAT "/%" U64_T_FORMAT "] set to MESSAGE_STATUS_ERROR)\n", mailbox, id);
el = el->nextnode;
}
@@ -529,9 +529,9 @@ int do_null_messages(void)
while (el) {
id = *((u64_t *) el->data);
if (db_delete_physmessage(id) < 0)
- qerrorf("Warning: could not delete physmessage [%llu]. Check log.\n", id);
+ qerrorf("Warning: could not delete physmessage [%" U64_T_FORMAT "]. Check log.\n", id);
else
- qverbosef("[%llu] deleted.\n", id);
+ qverbosef("[%" U64_T_FORMAT "] deleted.\n", id);
el = el->nextnode;
}
dm_list_free(&lostlist.start);
@@ -587,15 +587,15 @@ int do_check_integrity(void)
while (el) {
id = *((u64_t *) el->data);
if (no_to_all) {
- qerrorf("%llu ", id);
+ qerrorf("%" U64_T_FORMAT " ", id);
} else if (yes_to_all) {
if (db_delete_messageblk(id) < 0)
qerrorf
- ("Warning: could not delete messageblock #%llu. Check log.\n",
+ ("Warning: could not delete messageblock #%" U64_T_FORMAT ". Check log.\n",
id);
else
qerrorf
- ("%llu (removed from dbase)\n",
+ ("%" U64_T_FORMAT " (removed from dbase)\n",
id);
}
@@ -671,15 +671,15 @@ int do_check_integrity(void)
id = ((box_uid_t *) el->data)->uid;
if (no_to_all) {
- qerrorf("%llu ", id);
+ qerrorf("%" U64_T_FORMAT " ", id);
} else if (yes_to_all) {
if (db_delete_message(mailbox,id) < 0)
qerrorf
- ("Warning: could not delete message #%llu. Check log.\n",
+ ("Warning: could not delete message #%" U64_T_FORMAT ". Check log.\n",
id);
else
qerrorf
- ("%llu (removed from dbase)\n",
+ ("%" U64_T_FORMAT " (removed from dbase)\n",
id);
}
@@ -724,12 +724,12 @@ int do_check_integrity(void)
id = *((u64_t *) el->data);
if (no_to_all) {
- qerrorf("%llu ", id);
+ qerrorf("%" U64_T_FORMAT " ", id);
} else if (yes_to_all) {
if (db_delete_mailbox(id, 0, 0))
- qerrorf("Warning: could not delete mailbox #%llu. Check log.\n", id);
+ qerrorf("Warning: could not delete mailbox #%" U64_T_FORMAT ". Check log.\n", id);
else
- qerrorf("%llu (removed from dbase)\n", id);
+ qerrorf("%" U64_T_FORMAT " (removed from dbase)\n", id);
}
el = el->nextnode;
}
@@ -950,7 +950,7 @@ int do_check_iplog(const char *timespec)
serious_errors = 1;
return -1;
}
- qprintf("Ok. [%llu] IP entries are older than [%s].\n",
+ qprintf("Ok. [%" U64_T_FORMAT "] IP entries are older than [%s].\n",
log_count, timestring);
}
if (yes_to_all) {
@@ -961,7 +961,7 @@ int do_check_iplog(const char *timespec)
return -1;
}
- qprintf("Ok. [%llu] IP entries were older than [%s].\n",
+ qprintf("Ok. [%" U64_T_FORMAT "] IP entries were older than [%s].\n",
log_count, timestring);
}
return 0;
@@ -986,7 +986,7 @@ int do_check_replycache(const char *timespec)
serious_errors = 1;
return -1;
}
- qprintf("Ok. [%llu] RC entries are older than [%s].\n",
+ qprintf("Ok. [%" U64_T_FORMAT "] RC entries are older than [%s].\n",
log_count, timestring);
}
if (yes_to_all) {
@@ -997,7 +997,7 @@ int do_check_replycache(const char *timespec)
return -1;
}
- qprintf("Ok. [%llu] RC entries were older than [%s].\n",
+ qprintf("Ok. [%" U64_T_FORMAT "] RC entries were older than [%s].\n",
log_count, timestring);
}
return 0;
diff --git a/misc.c b/misc.c
index cac7f032..0db89326 100644
--- a/misc.c
+++ b/misc.c
@@ -100,8 +100,8 @@ void create_unique_id(char *target, u64_t mailbox_idnr, u64_t message_idnr)
char *a_mailbox_idnr, *a_message_idnr, *a_rand;
char *md5_str;
- a_mailbox_idnr = g_strdup_printf("%llu",mailbox_idnr);
- a_message_idnr = g_strdup_printf("%llu",message_idnr);
+ a_mailbox_idnr = g_strdup_printf("%" U64_T_FORMAT,mailbox_idnr);
+ a_message_idnr = g_strdup_printf("%" U64_T_FORMAT,message_idnr);
a_rand = g_strdup_printf("%d",g_random_int());
if (message_idnr != 0)
@@ -458,10 +458,10 @@ GString * g_list_join_u64(GList * list, const gchar * sep)
return string;
list = g_list_first(list);
token = (u64_t*)list->data;
- g_string_append_printf(string,"%llu",*token);
+ g_string_append_printf(string,"%" U64_T_FORMAT,*token);
while((list = g_list_next(list))) {
token = (u64_t*)list->data;
- g_string_append_printf(string,"%s%llu", sep,*token);
+ g_string_append_printf(string,"%s%" U64_T_FORMAT, sep,*token);
if (! g_list_next(list))
break;
}
diff --git a/modules/authldap.c b/modules/authldap.c
index cac70270..d15b8d7d 100644
--- a/modules/authldap.c
+++ b/modules/authldap.c
@@ -420,7 +420,7 @@ static u64_t dm_ldap_get_freeid(const gchar *attribute)
g_list_free(ids);
id=t;
- TRACE(TRACE_DEBUG,"return free id [%llu]\n", id);
+ TRACE(TRACE_DEBUG,"return free id [%" U64_T_FORMAT "]\n", id);
return id;
}
@@ -429,7 +429,7 @@ static char * dm_ldap_user_getdn(u64_t user_idnr)
GString *t = g_string_new("");
char *dn;
- g_string_printf(t, "(%s=%llu)", _ldap_cfg.field_nid, user_idnr);
+ g_string_printf(t, "(%s=%" U64_T_FORMAT ")", _ldap_cfg.field_nid, user_idnr);
TRACE(TRACE_DEBUG, "searching with query [%s]", t->str);
@@ -693,7 +693,7 @@ int auth_user_exists(const char *username, u64_t * user_idnr)
if (id_char != NULL)
g_free(id_char);
- TRACE(TRACE_DEBUG, "returned value is [%llu]", *user_idnr);
+ TRACE(TRACE_DEBUG, "returned value is [%" U64_T_FORMAT "]", *user_idnr);
if (*user_idnr != 0)
return 1;
@@ -710,7 +710,7 @@ char *auth_get_userid(u64_t user_idnr)
char query[AUTH_QUERY_SIZE];
char *fields[] = { _ldap_cfg.field_uid, NULL };
- snprintf(query, AUTH_QUERY_SIZE, "(%s=%llu)", _ldap_cfg.field_nid, user_idnr);
+ snprintf(query, AUTH_QUERY_SIZE, "(%s=%" U64_T_FORMAT ")", _ldap_cfg.field_nid, user_idnr);
returnid = __auth_get_first_match(query, fields);
TRACE(TRACE_DEBUG, "returned value is [%s]", returnid);
@@ -726,15 +726,15 @@ int auth_check_userid(u64_t user_idnr)
char *fields[] = { _ldap_cfg.field_nid, NULL };
int ret;
- snprintf(query, AUTH_QUERY_SIZE, "(%s=%llu)", _ldap_cfg.field_nid, user_idnr);
+ snprintf(query, AUTH_QUERY_SIZE, "(%s=%" U64_T_FORMAT ")", _ldap_cfg.field_nid, user_idnr);
returnid = __auth_get_first_match(query, fields);
if (returnid) {
ret = 0;
- TRACE(TRACE_DEBUG, "found user_idnr [%llu]", user_idnr);
+ TRACE(TRACE_DEBUG, "found user_idnr [%" U64_T_FORMAT "]", user_idnr);
} else {
ret = 1;
- TRACE(TRACE_DEBUG, "didn't find user_idnr [%llu]", user_idnr);
+ TRACE(TRACE_DEBUG, "didn't find user_idnr [%" U64_T_FORMAT "]", user_idnr);
}
g_free(returnid);
@@ -762,14 +762,14 @@ int auth_getclientid(u64_t user_idnr, u64_t * client_idnr)
return -1;
}
- snprintf(query, AUTH_QUERY_SIZE, "(%s=%llu)", _ldap_cfg.field_nid,
+ snprintf(query, AUTH_QUERY_SIZE, "(%s=%" U64_T_FORMAT ")", _ldap_cfg.field_nid,
user_idnr);
cid_char = __auth_get_first_match(query, fields);
*client_idnr = (cid_char) ? strtoull(cid_char, NULL, 0) : 0;
if (cid_char != NULL)
g_free(cid_char);
- TRACE(TRACE_DEBUG, "found client_idnr [%llu]", *client_idnr);
+ TRACE(TRACE_DEBUG, "found client_idnr [%" U64_T_FORMAT "]", *client_idnr);
return 1;
}
@@ -789,7 +789,7 @@ int auth_getmaxmailsize(u64_t user_idnr, u64_t * maxmail_size)
return 0;
}
- snprintf(query, AUTH_QUERY_SIZE, "(%s=%llu)", _ldap_cfg.field_nid,
+ snprintf(query, AUTH_QUERY_SIZE, "(%s=%" U64_T_FORMAT ")", _ldap_cfg.field_nid,
user_idnr);
max_char = __auth_get_first_match(query, fields);
*maxmail_size = (max_char) ? strtoull(max_char, 0, 10) : 0;
@@ -797,7 +797,7 @@ int auth_getmaxmailsize(u64_t user_idnr, u64_t * maxmail_size)
// if max_char is NULL g_free will not fail it simply return
g_free(max_char);
- TRACE(TRACE_DEBUG, "returned value is [%llu]", *maxmail_size);
+ TRACE(TRACE_DEBUG, "returned value is [%" U64_T_FORMAT "]", *maxmail_size);
return 1;
}
@@ -943,7 +943,7 @@ int auth_check_user_ext(const char *address, struct dm_list *userids,
id = strtoull(address, &endptr, 10);
if (*endptr == 0) {
/* numeric deliver-to --> this is a userid */
- TRACE(TRACE_DEBUG, "adding [%llu] to userids", id);
+ TRACE(TRACE_DEBUG, "adding [%" U64_T_FORMAT "] to userids", id);
dm_list_nodeadd(userids, &id, sizeof(id));
} else {
TRACE(TRACE_DEBUG, "adding [%s] to forwards", address);
@@ -1002,9 +1002,9 @@ int auth_adduser(const char *username, const char *password,
u64_t newidnr = dm_ldap_get_freeid(_ldap_cfg.field_nid);
- g_string_printf(nid,"%llu", newidnr);
- g_string_printf(cid,"%llu",clientid);
- g_string_printf(maxm,"%llu",maxmail);
+ g_string_printf(nid,"%" U64_T_FORMAT, newidnr);
+ g_string_printf(cid,"%" U64_T_FORMAT,clientid);
+ g_string_printf(maxm,"%" U64_T_FORMAT,maxmail);
char **obj_values = g_strsplit(_ldap_cfg.user_objectclass,",",0);
char *pw_values[] = { (char *)password, NULL };
@@ -1152,10 +1152,10 @@ static int dm_ldap_user_shadow_rename(u64_t user_idnr, const char *new_name)
oldname = auth_get_userid(user_idnr);
db_user_exists(oldname,&dbidnr);
if (dbidnr) {
- TRACE(TRACE_DEBUG, "call db_user_rename ([%llu],[%s])\n", dbidnr, new_name);
+ TRACE(TRACE_DEBUG, "call db_user_rename ([%" U64_T_FORMAT "],[%s])\n", dbidnr, new_name);
}
if ((! dbidnr) || (db_user_rename(dbidnr, new_name))) {
- TRACE(TRACE_ERROR, "renaming shadow account in db failed for [%llu]->[%s]", user_idnr, new_name);
+ TRACE(TRACE_ERROR, "renaming shadow account in db failed for [%" U64_T_FORMAT "]->[%s]", user_idnr, new_name);
return -1;
}
return 0;
@@ -1225,7 +1225,7 @@ int auth_change_password(u64_t user_idnr, const char *new_pass, const char *enct
int auth_change_clientid(u64_t user_idnr, u64_t newcid)
{
char newcid_str[16];
- snprintf(newcid_str, 16, "%llu", newcid);
+ snprintf(newcid_str, 16, "%" U64_T_FORMAT, newcid);
return dm_ldap_mod_field(user_idnr, _ldap_cfg.field_cid, newcid_str);
}
@@ -1233,7 +1233,7 @@ int auth_change_mailboxsize(u64_t user_idnr, u64_t new_size)
{
int result;
char newsize_str[16];
- snprintf(newsize_str, 16, "%llu", new_size);
+ snprintf(newsize_str, 16, "%" U64_T_FORMAT, new_size);
if ((result = db_change_mailboxsize(user_idnr, new_size)))
return result;
return dm_ldap_mod_field(user_idnr, _ldap_cfg.field_maxmail, newsize_str);
@@ -1368,7 +1368,7 @@ GList * auth_get_user_aliases(u64_t user_idnr)
GList *aliases = NULL;
GList *entlist, *fldlist, *attlist;
- g_string_printf(t,"%s=%llu", _ldap_cfg.field_nid, user_idnr);
+ g_string_printf(t,"%s=%" U64_T_FORMAT, _ldap_cfg.field_nid, user_idnr);
if ((entlist = __auth_get_every_match(t->str, fields))) {
entlist = g_list_first(entlist);
fldlist = g_list_first(entlist->data);
diff --git a/modules/authsql.c b/modules/authsql.c
index 1d57a0da..b33e0880 100644
--- a/modules/authsql.c
+++ b/modules/authsql.c
@@ -116,11 +116,11 @@ int auth_getclientid(u64_t user_idnr, u64_t * client_idnr)
*client_idnr = 0;
snprintf(__auth_query_data, AUTH_QUERY_SIZE,
- "SELECT client_idnr FROM %susers WHERE user_idnr = %llu",DBPFX,
+ "SELECT client_idnr FROM %susers WHERE user_idnr = %" U64_T_FORMAT,DBPFX,
user_idnr);
if (__auth_query(__auth_query_data) == -1) {
- TRACE(TRACE_ERROR, "could not retrieve client id for user [%llu]\n", user_idnr);
+ TRACE(TRACE_ERROR, "could not retrieve client id for user [%" U64_T_FORMAT "]\n", user_idnr);
return -1;
}
@@ -144,11 +144,11 @@ int auth_getmaxmailsize(u64_t user_idnr, u64_t * maxmail_size)
*maxmail_size = 0;
snprintf(__auth_query_data, AUTH_QUERY_SIZE,
- "SELECT maxmail_size FROM %susers WHERE user_idnr = %llu",DBPFX,
+ "SELECT maxmail_size FROM %susers WHERE user_idnr = %" U64_T_FORMAT,DBPFX,
user_idnr);
if (__auth_query(__auth_query_data) == -1) {
- TRACE(TRACE_ERROR, "could not retrieve client id for user [%llu]", user_idnr);
+ TRACE(TRACE_ERROR, "could not retrieve client id for user [%" U64_T_FORMAT "]", user_idnr);
return -1;
}
@@ -176,16 +176,16 @@ char *auth_getencryption(u64_t user_idnr)
/* assume another function returned an error code (-1)
* or this user does not exist (0)
*/
- TRACE(TRACE_ERROR, "got (%lld) as userid", user_idnr);
+ TRACE(TRACE_ERROR, "got (%" U64_T_FORMAT ") as userid", user_idnr);
return __auth_encryption_desc_string; /* return empty */
}
snprintf(__auth_query_data, AUTH_QUERY_SIZE,
- "SELECT encryption_type FROM %susers WHERE user_idnr = %llu",DBPFX,
+ "SELECT encryption_type FROM %susers WHERE user_idnr = %" U64_T_FORMAT,DBPFX,
user_idnr);
if (__auth_query(__auth_query_data) == -1) {
- TRACE(TRACE_ERROR, "could not retrieve encryption type for user [%llu]", user_idnr);
+ TRACE(TRACE_ERROR, "could not retrieve encryption type for user [%" U64_T_FORMAT "]", user_idnr);
return __auth_encryption_desc_string; /* return empty */
}
@@ -330,11 +330,11 @@ int auth_change_password(u64_t user_idnr, const char *new_pass,
snprintf(__auth_query_data, AUTH_QUERY_SIZE,
"UPDATE %susers SET passwd = '%s', encryption_type = '%s' "
- " WHERE user_idnr=%llu", DBPFX,
+ " WHERE user_idnr=%" U64_T_FORMAT, DBPFX,
escapedpass, enctype ? enctype : "", user_idnr);
if (__auth_query(__auth_query_data) == -1) {
- TRACE(TRACE_ERROR, "could not change passwd for user [%llu]", user_idnr);
+ TRACE(TRACE_ERROR, "could not change passwd for user [%" U64_T_FORMAT "]", user_idnr);
return -1;
}
@@ -344,12 +344,12 @@ int auth_change_password(u64_t user_idnr, const char *new_pass,
int auth_change_clientid(u64_t user_idnr, u64_t new_cid)
{
snprintf(__auth_query_data, AUTH_QUERY_SIZE,
- "UPDATE %susers SET client_idnr = %llu "
- "WHERE user_idnr=%llu",
+ "UPDATE %susers SET client_idnr = %" U64_T_FORMAT " "
+ "WHERE user_idnr=%" U64_T_FORMAT,
DBPFX, new_cid, user_idnr);
if (__auth_query(__auth_query_data) == -1) {
- TRACE(TRACE_ERROR, "could not change client id for user [%llu]", user_idnr);
+ TRACE(TRACE_ERROR, "could not change client id for user [%" U64_T_FORMAT "]", user_idnr);
return -1;
}
@@ -402,7 +402,7 @@ int auth_validate(clientinfo_t *ci, char *username, char *password, u64_t * user
snprintf(__auth_query_data, AUTH_QUERY_SIZE,
"SELECT user_idnr, passwd, encryption_type FROM %susers "
- "WHERE user_idnr = %llu", DBPFX, *user_idnr);
+ "WHERE user_idnr = %" U64_T_FORMAT, DBPFX, *user_idnr);
if (__auth_query(__auth_query_data) == -1) {
TRACE(TRACE_ERROR, "could not select user information");
@@ -483,7 +483,7 @@ u64_t auth_md5_validate(clientinfo_t *ci UNUSED, char *username,
snprintf(__auth_query_data, AUTH_QUERY_SIZE,
"SELECT passwd,user_idnr FROM %susers WHERE "
- "user_idnr = %llu", DBPFX, user_idnr);
+ "user_idnr = %" U64_T_FORMAT, DBPFX, user_idnr);
if (__auth_query(__auth_query_data) == -1) {
TRACE(TRACE_ERROR, "error calling __auth_query()");
@@ -535,7 +535,7 @@ char *auth_get_userid(u64_t user_idnr)
char *returnid = NULL;
snprintf(__auth_query_data, AUTH_QUERY_SIZE,
- "SELECT userid FROM %susers WHERE user_idnr = %llu",
+ "SELECT userid FROM %susers WHERE user_idnr = %" U64_T_FORMAT,
DBPFX, user_idnr);
if (__auth_query(__auth_query_data) == -1) {
@@ -568,7 +568,7 @@ char *auth_get_userid(u64_t user_idnr)
int auth_check_userid(u64_t user_idnr)
{
snprintf(__auth_query_data, AUTH_QUERY_SIZE,
- "SELECT userid FROM %susers WHERE user_idnr = %llu",
+ "SELECT userid FROM %susers WHERE user_idnr = %" U64_T_FORMAT,
DBPFX, user_idnr);
if (__auth_query(__auth_query_data) == -1) {
@@ -577,12 +577,12 @@ int auth_check_userid(u64_t user_idnr)
}
if (db_num_rows() < 1) {
- TRACE(TRACE_DEBUG, "didn't find user_idnr [%llu]", user_idnr);
+ TRACE(TRACE_DEBUG, "didn't find user_idnr [%" U64_T_FORMAT "]", user_idnr);
db_free_result();
return 1;
}
- TRACE(TRACE_DEBUG, "found user_idnr [%llu]", user_idnr);
+ TRACE(TRACE_DEBUG, "found user_idnr [%" U64_T_FORMAT "]", user_idnr);
db_free_result();
return 0;
}
@@ -599,10 +599,10 @@ int auth_get_users_from_clientid(u64_t client_id, u64_t ** user_ids,
*num_users = 0;
snprintf(__auth_query_data, DEF_QUERYSIZE,
- "SELECT user_idnr FROM %susers WHERE client_idnr = %llu",
+ "SELECT user_idnr FROM %susers WHERE client_idnr = %" U64_T_FORMAT,
DBPFX, client_id);
if (__auth_query(__auth_query_data) == -1) {
- TRACE(TRACE_ERROR, "error gettings users for client_id [%llu]", client_id);
+ TRACE(TRACE_ERROR, "error gettings users for client_id [%" U64_T_FORMAT "]", client_id);
return -1;
}
*num_users = db_num_rows();
@@ -634,8 +634,8 @@ int auth_addalias(u64_t user_idnr, const char *alias, u64_t clientid)
/* check if this alias already exists */
snprintf(__auth_query_data, DEF_QUERYSIZE,
"SELECT alias_idnr FROM %saliases "
- "WHERE lower(alias) = lower('%s') AND deliver_to = '%llu' "
- "AND client_idnr = %llu",DBPFX, escaped_alias, user_idnr, clientid);
+ "WHERE lower(alias) = lower('%s') AND deliver_to = '%" U64_T_FORMAT "' "
+ "AND client_idnr = %" U64_T_FORMAT,DBPFX, escaped_alias, user_idnr, clientid);
if (__auth_query(__auth_query_data) == -1) {
/* query failed */
@@ -645,7 +645,7 @@ int auth_addalias(u64_t user_idnr, const char *alias, u64_t clientid)
}
if (db_num_rows() > 0) {
- TRACE(TRACE_INFO, "alias [%s] for user [%llu] already exists", escaped_alias, user_idnr);
+ TRACE(TRACE_INFO, "alias [%s] for user [%" U64_T_FORMAT "] already exists", escaped_alias, user_idnr);
g_free(escaped_alias);
db_free_result();
@@ -655,7 +655,7 @@ int auth_addalias(u64_t user_idnr, const char *alias, u64_t clientid)
db_free_result();
snprintf(__auth_query_data, DEF_QUERYSIZE,
"INSERT INTO %saliases (alias,deliver_to,client_idnr) "
- "VALUES ('%s','%llu',%llu)",DBPFX, escaped_alias, user_idnr,
+ "VALUES ('%s','%" U64_T_FORMAT "',%" U64_T_FORMAT ")",DBPFX, escaped_alias, user_idnr,
clientid);
g_free(escaped_alias);
@@ -693,7 +693,7 @@ int auth_addalias_ext(const char *alias,
"SELECT alias_idnr FROM %saliases "
"WHERE lower(alias) = lower('%s') AND "
"lower(deliver_to) = lower('%s') "
- "AND client_idnr = %llu",DBPFX, escaped_alias, escaped_deliver_to,
+ "AND client_idnr = %" U64_T_FORMAT,DBPFX, escaped_alias, escaped_deliver_to,
clientid);
} else {
snprintf(__auth_query_data, DEF_QUERYSIZE,
@@ -723,7 +723,7 @@ int auth_addalias_ext(const char *alias,
snprintf(__auth_query_data, DEF_QUERYSIZE,
"INSERT INTO %saliases (alias,deliver_to,client_idnr) "
- "VALUES ('%s','%s',%llu)",DBPFX, escaped_alias, escaped_deliver_to, clientid);
+ "VALUES ('%s','%s',%" U64_T_FORMAT ")",DBPFX, escaped_alias, escaped_deliver_to, clientid);
g_free(escaped_alias);
g_free(escaped_deliver_to);
@@ -747,7 +747,7 @@ int auth_removealias(u64_t user_idnr, const char *alias)
db_escape_string(escaped_alias, alias, strlen(alias));
snprintf(__auth_query_data, DEF_QUERYSIZE,
- "DELETE FROM %saliases WHERE deliver_to='%llu' "
+ "DELETE FROM %saliases WHERE deliver_to='%" U64_T_FORMAT "' "
"AND lower(alias) = lower('%s')",DBPFX, user_idnr, escaped_alias);
g_free(escaped_alias);
@@ -800,7 +800,7 @@ GList * auth_get_user_aliases(u64_t user_idnr)
/* do a inverted (DESC) query because adding the names to the
* final list inverts again */
snprintf(__auth_query_data, DEF_QUERYSIZE,
- "SELECT alias FROM %saliases WHERE deliver_to = '%llu' "
+ "SELECT alias FROM %saliases WHERE deliver_to = '%" U64_T_FORMAT "' "
"ORDER BY alias DESC",DBPFX, user_idnr);
if (__auth_query(__auth_query_data) == -1) {
diff --git a/pipe.c b/pipe.c
index 75b21517..66c7b01b 100644
--- a/pipe.c
+++ b/pipe.c
@@ -516,7 +516,7 @@ int store_message_in_blocks(const char *message, u64_t message_size,
rest_size : READ_BLOCK_SIZE);
rest_size = (rest_size < READ_BLOCK_SIZE ?
0 : rest_size - READ_BLOCK_SIZE);
- TRACE(TRACE_DEBUG, "inserting message: size [%llu] block[%d]", message_size, block_nr);
+ TRACE(TRACE_DEBUG, "inserting message: size [%" U64_T_FORMAT "] block[%d]", message_size, block_nr);
if (db_insert_message_block(&message[offset],
block_size, mailbox, msgidnr, &physmsg_id,
&tmp_messageblk_idnr,0) < 0) {
@@ -586,7 +586,7 @@ int insert_messages(struct DbmailMessage *message,
db_rollback_transaction();
return -1;
default:
- TRACE(TRACE_DEBUG, "temporary msgidnr is [%llu]", message->id);
+ TRACE(TRACE_DEBUG, "temporary msgidnr is [%" U64_T_FORMAT "]", message->id);
break;
}
/* if committing the transaction fails, a rollback is performed */
@@ -617,30 +617,30 @@ int insert_messages(struct DbmailMessage *message,
* delivery. */
for (userid_elem = dm_list_getstart(delivery->userids); userid_elem != NULL; userid_elem = userid_elem->nextnode) {
u64_t useridnr = *(u64_t *) userid_elem->data;
- TRACE(TRACE_DEBUG, "calling sort_and_deliver for useridnr [%llu]", useridnr);
+ TRACE(TRACE_DEBUG, "calling sort_and_deliver for useridnr [%" U64_T_FORMAT "]", useridnr);
switch (sort_and_deliver(message,
delivery->address, useridnr,
delivery->mailbox, delivery->source)) {
case DSN_CLASS_OK:
/* Indicate success. */
- TRACE(TRACE_INFO, "successful sort_and_deliver for useridnr [%llu]", useridnr);
+ TRACE(TRACE_INFO, "successful sort_and_deliver for useridnr [%" U64_T_FORMAT "]", useridnr);
has_2 = 1;
break;
case DSN_CLASS_FAIL:
/* Indicate permanent failure. */
- TRACE(TRACE_ERROR, "permanent failure sort_and_deliver for useridnr [%llu]", useridnr);
+ TRACE(TRACE_ERROR, "permanent failure sort_and_deliver for useridnr [%" U64_T_FORMAT "]", useridnr);
has_5 = 1;
break;
case DSN_CLASS_QUOTA:
/* Indicate over quota. */
- TRACE(TRACE_MESSAGE, "mailbox over quota, message rejected for useridnr [%llu]", useridnr);
+ TRACE(TRACE_MESSAGE, "mailbox over quota, message rejected for useridnr [%" U64_T_FORMAT "]", useridnr);
has_5_2 = 1;
break;
case DSN_CLASS_TEMP:
default:
/* Assume a temporary failure */
- TRACE(TRACE_ERROR, "unknown temporary failure in sort_and_deliver for useridnr [%llu]", useridnr);
+ TRACE(TRACE_ERROR, "unknown temporary failure in sort_and_deliver for useridnr [%" U64_T_FORMAT "]", useridnr);
has_4 = 1;
break;
}
@@ -705,7 +705,7 @@ int insert_messages(struct DbmailMessage *message,
* It is the MTA's job to requeue or bounce the message,
* and our job to keep a tidy database ;-) */
if (db_delete_message(tmpbox, tmpid) < 0)
- TRACE(TRACE_ERROR, "failed to delete temporary message [%llu]", message->id);
+ TRACE(TRACE_ERROR, "failed to delete temporary message [%" U64_T_FORMAT "]", message->id);
TRACE(TRACE_DEBUG, "temporary message deleted from database. Done.");
return 0;
@@ -721,15 +721,15 @@ int send_alert(u64_t user_idnr, char *subject, char *body)
// Only send each unique alert once a day.
char *tmp = g_strconcat(subject, body, NULL);
char *handle = dm_md5((unsigned char *)tmp);
- char *userchar = g_strdup_printf("%llu", user_idnr);
+ char *userchar = g_strdup_printf("%" U64_T_FORMAT, user_idnr);
if (db_replycache_validate(userchar, "send_alert", handle, 1) != DM_SUCCESS) {
- TRACE(TRACE_INFO, "Already sent alert [%s] to user [%llu] today", subject, user_idnr);
+ TRACE(TRACE_INFO, "Already sent alert [%s] to user [%" U64_T_FORMAT "] today", subject, user_idnr);
g_free(userchar);
g_free(handle);
g_free(tmp);
return 0;
} else {
- TRACE(TRACE_INFO, "Sending alert [%s] to user [%llu]", subject, user_idnr);
+ TRACE(TRACE_INFO, "Sending alert [%s] to user [%" U64_T_FORMAT "]", subject, user_idnr);
db_replycache_register(userchar, "send_alert", handle);
g_free(userchar);
g_free(handle);
@@ -762,7 +762,7 @@ int send_alert(u64_t user_idnr, char *subject, char *body)
if (sort_deliver_to_mailbox(new_message, user_idnr,
"INBOX", BOX_BRUTEFORCE, msgflags) != DSN_CLASS_OK) {
- TRACE(TRACE_ERROR, "Unable to deliver alert [%s] to user [%llu]", subject, user_idnr);
+ TRACE(TRACE_ERROR, "Unable to deliver alert [%s] to user [%" U64_T_FORMAT "]", subject, user_idnr);
}
g_free(to);
diff --git a/pop3.c b/pop3.c
index 0a02a98e..88c435db 100644
--- a/pop3.c
+++ b/pop3.c
@@ -182,7 +182,7 @@ int pop3_handle_connection(clientinfo_t * ci)
if (session.username != NULL && (session.was_apop || session.password != NULL)) {
switch (session.SessionResult) {
case 0:
- TRACE(TRACE_MESSAGE, "user %s logging out [messages=%llu, octets=%llu]",
+ TRACE(TRACE_MESSAGE, "user %s logging out [messages=%" U64_T_FORMAT ", octets=%" U64_T_FORMAT "]",
session.username,
session.virtual_totalmessages,
session.virtual_totalsize);
@@ -430,11 +430,11 @@ int pop3(clientinfo_t *ci, char *buffer, PopSession_t * session)
result = db_createsession(result, session);
if (result == 1) {
- ci_write((FILE *) stream, "+OK %s has %llu messages (%llu octets)\r\n",
+ ci_write((FILE *) stream, "+OK %s has %" U64_T_FORMAT " messages (%" U64_T_FORMAT " octets)\r\n",
session->username,
session->virtual_totalmessages,
session->virtual_totalsize);
- TRACE(TRACE_MESSAGE, "user %s logged in [messages=%llu, octets=%llu]",
+ TRACE(TRACE_MESSAGE, "user %s logged in [messages=%" U64_T_FORMAT ", octets=%" U64_T_FORMAT "]",
session->username,
session->virtual_totalmessages,
session->virtual_totalsize);
@@ -455,7 +455,7 @@ int pop3(clientinfo_t *ci, char *buffer, PopSession_t * session)
while (tmpelement != NULL) {
msg = (struct message *)tmpelement->data;
if (msg->messageid == strtoull(value,NULL, 10) && msg->virtual_messagestatus < MESSAGE_STATUS_DELETE) {
- ci_write((FILE *) stream, "+OK %llu %llu\r\n", msg->messageid,msg->msize);
+ ci_write((FILE *) stream, "+OK %" U64_T_FORMAT " %" U64_T_FORMAT "\r\n", msg->messageid,msg->msize);
found = 1;
}
tmpelement = tmpelement->nextnode;
@@ -467,7 +467,7 @@ int pop3(clientinfo_t *ci, char *buffer, PopSession_t * session)
}
/* just drop the list */
- ci_write((FILE *) stream, "+OK %llu messages (%llu octets)\r\n",
+ ci_write((FILE *) stream, "+OK %" U64_T_FORMAT " messages (%" U64_T_FORMAT " octets)\r\n",
session->virtual_totalmessages,
session->virtual_totalsize);
@@ -476,7 +476,7 @@ int pop3(clientinfo_t *ci, char *buffer, PopSession_t * session)
while (tmpelement != NULL) {
msg = (struct message *)tmpelement->data;
if (msg->virtual_messagestatus < MESSAGE_STATUS_DELETE)
- ci_write((FILE *) stream, "%llu %llu\r\n", msg->messageid,msg->msize);
+ ci_write((FILE *) stream, "%" U64_T_FORMAT " %" U64_T_FORMAT "\r\n", msg->messageid,msg->msize);
tmpelement = tmpelement->nextnode;
}
}
@@ -487,7 +487,7 @@ int pop3(clientinfo_t *ci, char *buffer, PopSession_t * session)
if (session->state != POP3_TRANSACTION_STATE)
return pop3_error(session, stream, "-ERR wrong command mode\r\n");
- ci_write((FILE *) stream, "+OK %llu %llu\r\n",
+ ci_write((FILE *) stream, "+OK %" U64_T_FORMAT " %" U64_T_FORMAT "\r\n",
session->virtual_totalmessages,
session->virtual_totalsize);
@@ -508,7 +508,7 @@ int pop3(clientinfo_t *ci, char *buffer, PopSession_t * session)
msg = (struct message *) tmpelement->data;
if (msg->messageid == strtoull(value, NULL, 10) && msg->virtual_messagestatus < MESSAGE_STATUS_DELETE) { /* message is not deleted */
msg->virtual_messagestatus = MESSAGE_STATUS_SEEN;
- ci_write((FILE *) stream, "+OK %llu octets\r\n", msg->msize);
+ ci_write((FILE *) stream, "+OK %" U64_T_FORMAT " octets\r\n", msg->msize);
return db_send_message_lines((void *) stream, session->mailbox_idnr, msg->realmessageid, -2, 0);
}
tmpelement = tmpelement->nextnode;
@@ -529,7 +529,7 @@ int pop3(clientinfo_t *ci, char *buffer, PopSession_t * session)
session->virtual_totalsize -= msg->msize;
session->virtual_totalmessages -= 1;
- ci_write((FILE *) stream, "+OK message %llu deleted\r\n", msg->messageid);
+ ci_write((FILE *) stream, "+OK message %" U64_T_FORMAT " deleted\r\n", msg->messageid);
return 1;
}
tmpelement = tmpelement->nextnode;
@@ -551,7 +551,7 @@ int pop3(clientinfo_t *ci, char *buffer, PopSession_t * session)
tmpelement = tmpelement->nextnode;
}
- ci_write((FILE *) stream, "+OK %llu messages (%llu octets)\r\n", session->virtual_totalmessages, session->virtual_totalsize);
+ ci_write((FILE *) stream, "+OK %" U64_T_FORMAT " messages (%" U64_T_FORMAT " octets)\r\n", session->virtual_totalmessages, session->virtual_totalsize);
return 1;
@@ -565,14 +565,14 @@ int pop3(clientinfo_t *ci, char *buffer, PopSession_t * session)
msg = (struct message *) tmpelement->data;
if (msg->virtual_messagestatus == MESSAGE_STATUS_NEW) {
/* we need the last message that has been accessed */
- ci_write((FILE *) stream, "+OK %llu\r\n", msg->messageid - 1);
+ ci_write((FILE *) stream, "+OK %" U64_T_FORMAT "\r\n", msg->messageid - 1);
return 1;
}
tmpelement = tmpelement->nextnode;
}
/* all old messages */
- ci_write((FILE *) stream, "+OK %llu\r\n", session->virtual_totalmessages);
+ ci_write((FILE *) stream, "+OK %" U64_T_FORMAT "\r\n", session->virtual_totalmessages);
return 1;
@@ -594,7 +594,7 @@ int pop3(clientinfo_t *ci, char *buffer, PopSession_t * session)
while (tmpelement != NULL) {
msg = (struct message *)tmpelement->data;
if (msg->messageid == strtoull(value,NULL, 10) && msg->virtual_messagestatus < MESSAGE_STATUS_DELETE) {
- ci_write((FILE *) stream, "+OK %llu %s\r\n", msg->messageid,msg->uidl);
+ ci_write((FILE *) stream, "+OK %" U64_T_FORMAT " %s\r\n", msg->messageid,msg->uidl);
found = 1;
}
tmpelement = tmpelement->nextnode;
@@ -613,7 +613,7 @@ int pop3(clientinfo_t *ci, char *buffer, PopSession_t * session)
while (tmpelement != NULL) {
msg = (struct message *)tmpelement->data;
if (msg->virtual_messagestatus < MESSAGE_STATUS_DELETE)
- ci_write((FILE *) stream, "%llu %s\r\n", msg->messageid, msg->uidl);
+ ci_write((FILE *) stream, "%" U64_T_FORMAT " %s\r\n", msg->messageid, msg->uidl);
tmpelement = tmpelement->nextnode;
}
@@ -708,11 +708,11 @@ int pop3(clientinfo_t *ci, char *buffer, PopSession_t * session)
result = db_createsession(result, session);
if (result == 1) {
- ci_write((FILE *) stream, "+OK %s has %llu messages (%llu octets)\r\n",
+ ci_write((FILE *) stream, "+OK %s has %" U64_T_FORMAT " messages (%" U64_T_FORMAT " octets)\r\n",
session->username,
session->virtual_totalmessages,
session->virtual_totalsize);
- TRACE(TRACE_MESSAGE, "user %s logged in [messages=%llu, octets=%llu]",
+ TRACE(TRACE_MESSAGE, "user %s logged in [messages=%" U64_T_FORMAT ", octets=%" U64_T_FORMAT "]",
session->username,
session->virtual_totalmessages,
session->virtual_totalsize);
@@ -768,7 +768,7 @@ int pop3(clientinfo_t *ci, char *buffer, PopSession_t * session)
while (tmpelement != NULL) {
msg = (struct message *) tmpelement->data;
if (msg->messageid == top_messageid && msg->virtual_messagestatus < MESSAGE_STATUS_DELETE) { /* message is not deleted */
- ci_write((FILE *) stream, "+OK %llu lines of message %llu\r\n", top_lines, top_messageid);
+ ci_write((FILE *) stream, "+OK %" U64_T_FORMAT " lines of message %" U64_T_FORMAT "\r\n", top_lines, top_messageid);
return db_send_message_lines(stream, session->mailbox_idnr, msg->realmessageid, top_lines, 0);
}
tmpelement = tmpelement->nextnode;
diff --git a/sort.c b/sort.c
index 89579910..ebe52e83 100644
--- a/sort.c
+++ b/sort.c
@@ -46,12 +46,12 @@ dsn_class_t sort_and_deliver(struct DbmailMessage *message,
* We skip the Sieve scripts, and down the call
* chain we don't check permissions on the mailbox. */
if (source == BOX_BRUTEFORCE) {
- TRACE(TRACE_MESSAGE, "Beginning brute force delivery for user [%llu] to mailbox [%s].",
+ TRACE(TRACE_MESSAGE, "Beginning brute force delivery for user [%" U64_T_FORMAT "] to mailbox [%s].",
useridnr, mailbox);
return sort_deliver_to_mailbox(message, useridnr, mailbox, source, NULL);
}
- TRACE(TRACE_INFO, "Destination [%s] useridnr [%llu], mailbox [%s], source [%d]",
+ TRACE(TRACE_INFO, "Destination [%s] useridnr [%" U64_T_FORMAT "], mailbox [%s], source [%d]",
destination, useridnr, mailbox, source);
/* This is the only condition when called from pipe.c, actually. */
@@ -124,7 +124,7 @@ dsn_class_t sort_deliver_to_mailbox(struct DbmailMessage *message,
field_t val;
size_t msgsize = (u64_t)dbmail_message_get_size(message, FALSE);
- TRACE(TRACE_INFO,"useridnr [%llu] mailbox [%s]", useridnr, mailbox);
+ TRACE(TRACE_INFO,"useridnr [%" U64_T_FORMAT "] mailbox [%s]", useridnr, mailbox);
if (db_find_create_mailbox(mailbox, source, useridnr, &mboxidnr) != 0) {
TRACE(TRACE_ERROR, "mailbox [%s] not found", mailbox);
@@ -146,12 +146,12 @@ dsn_class_t sort_deliver_to_mailbox(struct DbmailMessage *message,
switch (acl_has_right(&mbox, useridnr, ACL_RIGHT_POST)) {
case -1:
- TRACE(TRACE_MESSAGE, "error retrieving right for [%llu] to deliver mail to [%s]",
+ TRACE(TRACE_MESSAGE, "error retrieving right for [%" U64_T_FORMAT "] to deliver mail to [%s]",
useridnr, mailbox);
return DSN_CLASS_TEMP;
case 0:
// No right.
- TRACE(TRACE_MESSAGE, "user [%llu] does not have right to deliver mail to [%s]",
+ TRACE(TRACE_MESSAGE, "user [%" U64_T_FORMAT "] does not have right to deliver mail to [%s]",
useridnr, mailbox);
// Switch to INBOX.
if (strcmp(mailbox, "INBOX") == 0) {
@@ -162,7 +162,7 @@ dsn_class_t sort_deliver_to_mailbox(struct DbmailMessage *message,
return sort_deliver_to_mailbox(message, useridnr, "INBOX", BOX_DEFAULT, msgflags);
case 1:
// Has right.
- TRACE(TRACE_INFO, "user [%llu] has right to deliver mail to [%s]",
+ TRACE(TRACE_INFO, "user [%" U64_T_FORMAT "] has right to deliver mail to [%s]",
useridnr, mailbox);
break;
default:
@@ -184,18 +184,18 @@ dsn_class_t sort_deliver_to_mailbox(struct DbmailMessage *message,
// Ok, we have the ACL right, time to deliver the message.
switch (db_copymsg(message->mailbox, message->id, mboxidnr, useridnr, &newmsgidnr)) {
case -2:
- TRACE(TRACE_DEBUG, "error copying message to user [%llu],"
+ TRACE(TRACE_DEBUG, "error copying message to user [%" U64_T_FORMAT "],"
"maxmail exceeded", useridnr);
return DSN_CLASS_QUOTA;
case -1:
- TRACE(TRACE_ERROR, "error copying message to user [%llu]",
+ TRACE(TRACE_ERROR, "error copying message to user [%" U64_T_FORMAT "]",
useridnr);
return DSN_CLASS_TEMP;
default:
- TRACE(TRACE_MESSAGE, "message id=%llu, size=%zd is inserted to mailbox id=%llu",
+ TRACE(TRACE_MESSAGE, "message id=%" U64_T_FORMAT ", size=%zd is inserted to mailbox id=%" U64_T_FORMAT "",
newmsgidnr, msgsize, mboxidnr);
if (msgflags) {
- TRACE(TRACE_MESSAGE, "mbox id=%llu, message id=%llu, setting imap flags",
+ TRACE(TRACE_MESSAGE, "mbox id=%" U64_T_FORMAT ", message id=%" U64_T_FORMAT ", setting imap flags",
mboxidnr, newmsgidnr);
db_set_msgflag(newmsgidnr, mboxidnr, msgflags, IMAPFA_ADD);
}
diff --git a/timsieve.c b/timsieve.c
index a826ebaa..becffa37 100644
--- a/timsieve.c
+++ b/timsieve.c
@@ -403,9 +403,9 @@ int tims(clientinfo_t *ci, char *buffer, PopSession_t * session)
g_free(tmpleft);
scriptlen = strtoull(tmpcharlen, NULL, 10);
- TRACE(TRACE_INFO, "Client sending script of length [%llu]", scriptlen);
+ TRACE(TRACE_INFO, "Client sending script of length [%" U64_T_FORMAT "]", scriptlen);
if (scriptlen >= UINT_MAX) {
- TRACE(TRACE_INFO, "Length [%llu] is larger than UINT_MAX [%u]",
+ TRACE(TRACE_INFO, "Length [%" U64_T_FORMAT "] is larger than UINT_MAX [%u]",
scriptlen, UINT_MAX);
ci_write((FILE *) stream, "NO \"Invalid script length.\"\r\n");
break;