1 diff -Naur cyrus-imapd-2.2.12.orig/configure.in cyrus-imapd-2.2.12/configure.in
2 --- cyrus-imapd-2.2.12.orig/configure.in 2005-01-19 00:46:00.000000000 +0100
3 +++ cyrus-imapd-2.2.12/configure.in 2006-04-25 07:35:25.000000000 +0200
8 +dnl Check if `long long int' is available
9 +AC_CHECK_SIZEOF(long long int)
10 +AC_CHECK_SIZEOF(unsigned long long int)
11 +if test "$ac_cv_sizeof_long_long_int" -eq 8 -a \
12 + "$ac_cv_sizeof_unsigned_long_long_int" -eq 8; then
13 + AC_DEFINE(HAVE_LONG_LONG_INT,[],[Does the compiler support long long int?])
20 diff -Naur cyrus-imapd-2.2.12.orig/imap/append.c cyrus-imapd-2.2.12/imap/append.c
21 --- cyrus-imapd-2.2.12.orig/imap/append.c 2004-05-22 05:45:48.000000000 +0200
22 +++ cyrus-imapd-2.2.12/imap/append.c 2006-04-25 07:35:25.000000000 +0200
25 if (m.quota.limit >= 0 && quotacheck >= 0 &&
26 m.quota.used + quotacheck >
27 - ((unsigned) m.quota.limit * QUOTA_UNITS)) {
28 + ((uquota_t) m.quota.limit * QUOTA_UNITS)) {
29 r = IMAP_QUOTA_EXCEEDED;
34 if (as->m.quota.limit >= 0 && quotacheck >= 0 &&
35 as->m.quota.used + quotacheck >
36 - ((unsigned) as->m.quota.limit * QUOTA_UNITS)) {
37 + ((uquota_t) as->m.quota.limit * QUOTA_UNITS)) {
38 quota_abort(&as->tid);
39 mailbox_close(&as->m);
40 r = IMAP_QUOTA_EXCEEDED;
41 diff -Naur cyrus-imapd-2.2.12.orig/imap/imapd.c cyrus-imapd-2.2.12/imap/imapd.c
42 --- cyrus-imapd-2.2.12.orig/imap/imapd.c 2005-02-14 07:39:55.000000000 +0100
43 +++ cyrus-imapd-2.2.12/imap/imapd.c 2006-04-25 07:35:25.000000000 +0200
44 @@ -2626,10 +2626,10 @@
46 int warnsize = config_getint(IMAPOPT_QUOTAWARNKB);
47 if (warnsize <= 0 || warnsize >= imapd_mailbox->quota.limit ||
48 - (int)((imapd_mailbox->quota.limit * QUOTA_UNITS) -
49 - imapd_mailbox->quota.used) < (warnsize * QUOTA_UNITS)) {
50 + ((uquota_t) (imapd_mailbox->quota.limit - warnsize)) * QUOTA_UNITS <
51 + imapd_mailbox->quota.used) {
52 usage = ((double) imapd_mailbox->quota.used * 100.0) / (double)
53 - (imapd_mailbox->quota.limit * QUOTA_UNITS);
54 + ((uquota_t) imapd_mailbox->quota.limit * QUOTA_UNITS);
56 prot_printf(imapd_out, "* NO [ALERT] %s\r\n",
57 error_message(IMAP_NO_OVERQUOTA));
60 prot_printf(imapd_out, " (");
61 if (quota.limit >= 0) {
62 - prot_printf(imapd_out, "STORAGE %lu %d",
63 + prot_printf(imapd_out, "STORAGE " UQUOTA_T_FMT " %d",
64 quota.used/QUOTA_UNITS, quota.limit);
66 prot_printf(imapd_out, ")\r\n");
68 printastring(mailboxname);
69 prot_printf(imapd_out, " (");
70 if (mailbox.quota.limit >= 0) {
71 - prot_printf(imapd_out, "STORAGE %lu %d",
72 + prot_printf(imapd_out, "STORAGE " UQUOTA_T_FMT " %d",
73 mailbox.quota.used/QUOTA_UNITS,
76 diff -Naur cyrus-imapd-2.2.12.orig/imap/mailbox.c cyrus-imapd-2.2.12/imap/mailbox.c
77 --- cyrus-imapd-2.2.12.orig/imap/mailbox.c 2005-02-14 07:39:57.000000000 +0100
78 +++ cyrus-imapd-2.2.12/imap/mailbox.c 2006-04-25 07:36:13.000000000 +0200
83 +#include "byteorder64.h"
85 static int mailbox_doing_reconstruct = 0;
86 #define zeromailbox(m) { memset(&m, 0, sizeof(struct mailbox)); \
89 ntohl(*((bit32 *)(mailbox->index_base+OFFSET_LAST_UID)));
91 - mailbox->quota_mailbox_used =
92 - ntohl(*((bit32 *)(mailbox->index_base+OFFSET_QUOTA_MAILBOX_USED-quota_upgrade_offset)));
93 +#ifdef HAVE_LONG_LONG_INT
94 + if (mailbox->minor_version > 5) {
95 + /* newer versions may use 64bit quotas now */
96 + mailbox->quota_mailbox_used =
97 + ntohll(*((bit64 *)(mailbox->index_base+OFFSET_QUOTA_MAILBOX_USED64)));
101 + mailbox->quota_mailbox_used =
102 + ntohl(*((bit32 *)(mailbox->index_base+OFFSET_QUOTA_MAILBOX_USED-quota_upgrade_offset)));
105 if (mailbox->start_offset < OFFSET_POP3_LAST_LOGIN-quota_upgrade_offset+sizeof(bit32)) {
106 mailbox->pop3_last_login = 0;
107 @@ -1183,9 +1193,18 @@
108 *((bit32 *)(buf+OFFSET_EXISTS)) = htonl(mailbox->exists);
109 *((bit32 *)(buf+OFFSET_LAST_APPENDDATE)) = htonl(mailbox->last_appenddate);
110 *((bit32 *)(buf+OFFSET_LAST_UID)) = htonl(mailbox->last_uid);
111 - *((bit32 *)(buf+OFFSET_QUOTA_RESERVED_FIELD)) = htonl(0); /* RESERVED */
113 + /* quotas may be 64bit now */
114 +#ifdef HAVE_LONG_LONG_INT
115 + *((bit64 *)(buf+OFFSET_QUOTA_MAILBOX_USED64)) =
116 + htonll(mailbox->quota_mailbox_used);
118 + /* zero the unused 32bits */
119 + *((bit32 *)(buf+OFFSET_QUOTA_MAILBOX_USED64)) = htonl(0);
120 *((bit32 *)(buf+OFFSET_QUOTA_MAILBOX_USED)) =
121 htonl(mailbox->quota_mailbox_used);
124 *((bit32 *)(buf+OFFSET_POP3_LAST_LOGIN)) = htonl(mailbox->pop3_last_login);
125 *((bit32 *)(buf+OFFSET_UIDVALIDITY)) = htonl(mailbox->uidvalidity);
126 *((bit32 *)(buf+OFFSET_DELETED)) = htonl(mailbox->deleted);
127 @@ -1430,9 +1449,18 @@
128 *((bit32 *)(buf+OFFSET_EXISTS)) = htonl(mailbox->exists);
129 *((bit32 *)(buf+OFFSET_LAST_APPENDDATE)) = htonl(mailbox->last_appenddate);
130 *((bit32 *)(buf+OFFSET_LAST_UID)) = htonl(mailbox->last_uid);
131 - /* OFFSET_QUOTA_RESERVED_FIELD left as zero */
133 + /* newer versions may use 64bit quotas */
134 +#ifdef HAVE_LONG_LONG_INT
135 + *((bit64 *)(buf+OFFSET_QUOTA_MAILBOX_USED64)) =
136 + htonll(mailbox->quota_mailbox_used);
138 + /* zero the unused 32bits */
139 + *((bit32 *)(buf+OFFSET_QUOTA_MAILBOX_USED64)) = htonl(0);
140 *((bit32 *)(buf+OFFSET_QUOTA_MAILBOX_USED)) =
141 htonl(mailbox->quota_mailbox_used);
144 *((bit32 *)(buf+OFFSET_POP3_LAST_LOGIN)) = htonl(mailbox->pop3_last_login);
145 *((bit32 *)(buf+OFFSET_UIDVALIDITY)) = htonl(mailbox->uidvalidity);
146 *((bit32 *)(buf+OFFSET_DELETED)) = htonl(mailbox->deleted);
147 @@ -1608,7 +1636,8 @@
149 FILE *newindex = NULL, *newcache = NULL;
150 unsigned long *deleted;
151 - unsigned numdeleted = 0, quotadeleted = 0;
152 + unsigned numdeleted = 0;
153 + uquota_t quotadeleted = 0;
154 unsigned numansweredflag = 0;
155 unsigned numdeletedflag = 0;
156 unsigned numflaggedflag = 0;
157 @@ -1829,8 +1858,13 @@
158 *((bit32 *)(buf+OFFSET_FLAGGED)) = htonl(newflagged);
160 /* Fix up quota_mailbox_used */
161 +#ifdef HAVE_LONG_LONG_INT
162 + *((bit64 *)(buf+OFFSET_QUOTA_MAILBOX_USED64)) =
163 + htonll(ntohll(*((bit64 *)(buf+OFFSET_QUOTA_MAILBOX_USED64)))-quotadeleted);
165 *((bit32 *)(buf+OFFSET_QUOTA_MAILBOX_USED)) =
166 htonl(ntohl(*((bit32 *)(buf+OFFSET_QUOTA_MAILBOX_USED)))-quotadeleted);
168 /* Fix up start offset if necessary */
169 if (mailbox->start_offset < INDEX_HEADER_SIZE) {
170 *((bit32 *)(buf+OFFSET_START_OFFSET)) = htonl(INDEX_HEADER_SIZE);
171 @@ -1862,7 +1896,7 @@
172 if (!r) quota_commit(&tid);
175 - "LOSTQUOTA: unable to record free of %u bytes in quota %s",
176 + "LOSTQUOTA: unable to record free of " UQUOTA_T_FMT " bytes in quota %s",
177 quotadeleted, mailbox->quota.root);
180 @@ -2250,7 +2284,7 @@
181 strcmp(oldmailbox->quota.root, newmailbox->quota.root) != 0) {
182 if (!r && newmailbox->quota.limit >= 0 &&
183 newmailbox->quota.used + oldmailbox->quota_mailbox_used >
184 - ((unsigned) newmailbox->quota.limit * QUOTA_UNITS)) {
185 + ((uquota_t) newmailbox->quota.limit * QUOTA_UNITS)) {
186 r = IMAP_QUOTA_EXCEEDED;
189 @@ -2464,7 +2498,7 @@
190 strcmp(oldmailbox.quota.root, newmailbox.quota.root) != 0) {
191 if (!r && newmailbox.quota.limit >= 0 &&
192 newmailbox.quota.used + oldmailbox.quota_mailbox_used >
193 - ((unsigned) newmailbox.quota.limit * QUOTA_UNITS)) {
194 + ((uquota_t) newmailbox.quota.limit * QUOTA_UNITS)) {
195 r = IMAP_QUOTA_EXCEEDED;
198 @@ -2617,7 +2651,7 @@
199 else if (r2 == IMAP_QUOTAROOT_NONEXISTENT) r2 = 0;
202 - "LOSTQUOTA: unable to record use of %lu bytes in quota %s",
203 + "LOSTQUOTA: unable to record use of " UQUOTA_T_FMT " bytes in quota %s",
204 newmailbox.quota_mailbox_used, newmailbox.quota.root);
207 diff -Naur cyrus-imapd-2.2.12.orig/imap/mailbox.h cyrus-imapd-2.2.12/imap/mailbox.h
208 --- cyrus-imapd-2.2.12.orig/imap/mailbox.h 2004-01-22 22:17:09.000000000 +0100
209 +++ cyrus-imapd-2.2.12/imap/mailbox.h 2006-04-25 07:35:25.000000000 +0200
211 #include <sys/types.h>
212 #include <sys/stat.h>
219 #error dont know what to use for bit32
222 +#ifdef HAVE_LONG_LONG_INT
223 +typedef unsigned long long int bit64;
226 #define MAX_MAILBOX_NAME 490
227 #define MAX_MAILBOX_PATH 4096
230 unsigned long exists;
231 time_t last_appenddate;
232 unsigned long last_uid;
233 - unsigned long quota_mailbox_used;
234 + uquota_t quota_mailbox_used;
235 unsigned long pop3_last_login;
236 unsigned long uidvalidity;
239 #define OFFSET_EXISTS 20
240 #define OFFSET_LAST_APPENDDATE 24
241 #define OFFSET_LAST_UID 28
242 -#define OFFSET_QUOTA_RESERVED_FIELD 32 /* Reserved for 64bit quotas */
243 -#define OFFSET_QUOTA_MAILBOX_USED 36
244 +#define OFFSET_QUOTA_MAILBOX_USED64 32 /* offset for 64bit quotas */
245 +#define OFFSET_QUOTA_MAILBOX_USED 36 /* offset for 32bit quotas */
246 #define OFFSET_POP3_LAST_LOGIN 40
247 #define OFFSET_UIDVALIDITY 44
248 #define OFFSET_DELETED 48 /* added for ACAP */
249 diff -Naur cyrus-imapd-2.2.12.orig/imap/mbdump.c cyrus-imapd-2.2.12/imap/mbdump.c
250 --- cyrus-imapd-2.2.12.orig/imap/mbdump.c 2004-05-22 05:45:51.000000000 +0200
251 +++ cyrus-imapd-2.2.12/imap/mbdump.c 2006-04-25 07:35:25.000000000 +0200
254 struct buf file, data;
257 + uquota_t quotaused = 0;
260 const char *userid = NULL;
261 diff -Naur cyrus-imapd-2.2.12.orig/imap/mbexamine.c cyrus-imapd-2.2.12/imap/mbexamine.c
262 --- cyrus-imapd-2.2.12.orig/imap/mbexamine.c 2004-12-17 17:32:16.000000000 +0100
263 +++ cyrus-imapd-2.2.12/imap/mbexamine.c 2006-04-25 07:35:25.000000000 +0200
265 printf(" Minor Version: %d\n", mailbox.minor_version);
266 printf(" Header Size: %ld bytes Record Size: %ld bytes\n",
267 mailbox.start_offset, mailbox.record_size);
268 - printf(" Number of Messages: %lu Mailbox Size: %lu bytes\n",
269 + printf(" Number of Messages: %lu Mailbox Size: " UQUOTA_T_FMT " bytes\n",
270 mailbox.exists, mailbox.quota_mailbox_used);
271 printf(" Last Append Date: (%ld) %s", mailbox.last_appenddate,
272 ctime(&mailbox.last_appenddate));
273 diff -Naur cyrus-imapd-2.2.12.orig/imap/quota.c cyrus-imapd-2.2.12/imap/quota.c
274 --- cyrus-imapd-2.2.12.orig/imap/quota.c 2004-06-30 21:23:26.000000000 +0200
275 +++ cyrus-imapd-2.2.12/imap/quota.c 2006-04-25 07:35:25.000000000 +0200
280 - unsigned long newused;
284 #define QUOTAGROW 300
287 memset("a[quota_num], 0, sizeof(struct quotaentry));
288 quota[quota_num].quota.root = xstrndup(key, keylen);
289 - sscanf(data, "%lu %d",
290 + sscanf(data, UQUOTA_T_FMT " %d",
291 "a[quota_num].quota.used, "a[quota_num].quota.limit);
297 if (quota[thisquota].quota.used != quota[thisquota].newused) {
298 - printf("%s: usage was %lu, now %lu\n", quota[thisquota].quota.root,
299 + printf("%s: usage was " UQUOTA_T_FMT ", now " UQUOTA_T_FMT "\n", quota[thisquota].quota.root,
300 quota[thisquota].quota.used, quota[thisquota].newused);
301 quota[thisquota].quota.used = quota[thisquota].newused;
302 r = quota_write("a[thisquota].quota, tid);
303 @@ -489,12 +489,12 @@
305 char buf[MAX_MAILBOX_PATH+1];
307 - printf(" Quota %% Used Used Root\n");
308 + printf(" Quota %% Used Used Root\n");
310 for (i = 0; i < quota_num; i++) {
311 if (quota[i].deleted) continue;
312 if (quota[i].quota.limit > 0) {
313 - printf(" %7d %7ld", quota[i].quota.limit,
314 + printf(" %7d " QUOTA_REPORT_FMT , quota[i].quota.limit,
315 ((quota[i].quota.used / QUOTA_UNITS) * 100) / quota[i].quota.limit);
317 else if (quota[i].quota.limit == 0) {
319 (*quota_namespace.mboxname_toexternal)("a_namespace,
322 - printf(" %7ld %s\n", quota[i].quota.used / QUOTA_UNITS, buf);
323 + printf(" " QUOTA_REPORT_FMT " %s\n", quota[i].quota.used / QUOTA_UNITS, buf);
326 diff -Naur cyrus-imapd-2.2.12.orig/imap/quota_db.c cyrus-imapd-2.2.12/imap/quota_db.c
327 --- cyrus-imapd-2.2.12.orig/imap/quota_db.c 2004-05-22 05:45:52.000000000 +0200
328 +++ cyrus-imapd-2.2.12/imap/quota_db.c 2006-04-25 07:35:25.000000000 +0200
333 - sscanf(data, "%lu %d", "a->used, "a->limit);
334 + sscanf(data, UQUOTA_T_FMT " %d", "a->used, "a->limit);
339 if (!qrlen) return IMAP_QUOTAROOT_NONEXISTENT;
341 len = snprintf(buf, sizeof(buf) - 1,
342 - "%lu %d", quota->used, quota->limit);
343 + UQUOTA_T_FMT " %d", quota->used, quota->limit);
344 r = QDB->store(qdb, quota->root, qrlen, buf, len, tid);
347 diff -Naur cyrus-imapd-2.2.12.orig/imap/quota.h cyrus-imapd-2.2.12/imap/quota.h
348 --- cyrus-imapd-2.2.12.orig/imap/quota.h 2004-02-27 18:44:56.000000000 +0100
349 +++ cyrus-imapd-2.2.12/imap/quota.h 2006-04-25 07:35:25.000000000 +0200
351 #define INCLUDED_QUOTA_H
356 #define FNAME_QUOTADB "/quotas.db"
358 #define QUOTA_UNITS (1024)
360 +/* Define the proper quota type, it should either be a
361 + * long or a long long int depending upon what the
362 + * the compiler supports.
364 +#ifdef HAVE_LONG_LONG_INT
365 +typedef unsigned long long int uquota_t;
366 +typedef long long int quota_t;
367 +#define UQUOTA_T_FMT "%llu"
368 +#define QUOTA_T_FMT "%lld"
369 +#define QUOTA_REPORT_FMT "%8llu"
371 +typedef unsigned long uquota_t;
372 +typedef long quota_t;
373 +#define UQUOTA_T_FMT "%lu"
374 +#define QUOTA_T_FMT "%ld"
375 +#define QUOTA_REPORT_FMT "%8lu"
378 extern struct db *qdb;
383 /* Information in quota entry */
384 - unsigned long used;
386 int limit; /* in QUOTA_UNITS */
389 diff -Naur cyrus-imapd-2.2.12.orig/imap/reconstruct.c cyrus-imapd-2.2.12/imap/reconstruct.c
390 --- cyrus-imapd-2.2.12.orig/imap/reconstruct.c 2004-10-11 16:01:24.000000000 +0200
391 +++ cyrus-imapd-2.2.12/imap/reconstruct.c 2006-04-25 07:35:25.000000000 +0200
394 #include "convert_code.h"
396 +#include "byteorder64.h"
401 char *list_acl, *list_part;
404 - unsigned long new_quota = 0;
405 + uquota_t new_quota = 0;
407 struct index_record message_index, old_index;
408 static struct index_record zero_index;
410 *((bit32 *)(buf+OFFSET_EXISTS)) = htonl(new_exists);
411 *((bit32 *)(buf+OFFSET_LAST_APPENDDATE)) = htonl(mailbox.last_appenddate);
412 *((bit32 *)(buf+OFFSET_LAST_UID)) = htonl(mailbox.last_uid);
414 + /* quotas may be 64bit now */
415 +#ifdef HAVE_LONG_LONG_INT
416 + *((bit64 *)(buf+OFFSET_QUOTA_MAILBOX_USED64)) = htonll(new_quota);
418 *((bit32 *)(buf+OFFSET_QUOTA_MAILBOX_USED)) = htonl(new_quota);
421 *((bit32 *)(buf+OFFSET_POP3_LAST_LOGIN)) = htonl(mailbox.pop3_last_login);
422 *((bit32 *)(buf+OFFSET_UIDVALIDITY)) = htonl(mailbox.uidvalidity);
423 *((bit32 *)(buf+OFFSET_DELETED)) = htonl(new_deleted);
424 diff -Naur cyrus-imapd-2.2.12.orig/lib/byteorder64.c cyrus-imapd-2.2.12/lib/byteorder64.c
425 --- cyrus-imapd-2.2.12.orig/lib/byteorder64.c 1970-01-01 01:00:00.000000000 +0100
426 +++ cyrus-imapd-2.2.12/lib/byteorder64.c 2006-04-25 07:35:25.000000000 +0200
428 +/* byteorder64.c -- convert 64-bit values between host and network byte order
430 + * Copyright (c) 2004 Carnegie Mellon University. All rights reserved.
432 + * Redistribution and use in source and binary forms, with or without
433 + * modification, are permitted provided that the following conditions
436 + * 1. Redistributions of source code must retain the above copyright
437 + * notice, this list of conditions and the following disclaimer.
439 + * 2. Redistributions in binary form must reproduce the above copyright
440 + * notice, this list of conditions and the following disclaimer in
441 + * the documentation and/or other materials provided with the
444 + * 3. The name "Carnegie Mellon University" must not be used to
445 + * endorse or promote products derived from this software without
446 + * prior written permission. For permission or any other legal
447 + * details, please contact
448 + * Office of Technology Transfer
449 + * Carnegie Mellon University
450 + * 5000 Forbes Avenue
451 + * Pittsburgh, PA 15213-3890
452 + * (412) 268-4387, fax: (412) 268-7395
453 + * tech-transfer@andrew.cmu.edu
455 + * 4. Redistributions of any form whatsoever must retain the following
457 + * "This product includes software developed by Computing Services
458 + * at Carnegie Mellon University (http://www.cmu.edu/computing/)."
460 + * CARNEGIE MELLON UNIVERSITY DISCLAIMS ALL WARRANTIES WITH REGARD TO
461 + * THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
462 + * AND FITNESS, IN NO EVENT SHALL CARNEGIE MELLON UNIVERSITY BE LIABLE
463 + * FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
464 + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN
465 + * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
466 + * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
468 + * $Id: byteorder64.c,v 1.1.2.1 2004/08/09 18:51:21 ken3 Exp $
473 +#if defined(HAVE_LONG_LONG_INT) && !defined(WORDS_BIGENDIAN)
475 +#include <netinet/in.h>
477 +/* Structure used to swap the bytes in a 64-bit unsigned long long. */
478 +union byteswap_64_u {
479 + unsigned long long a;
483 +/* Function to byteswap 64bit unsigned integers on
484 + * little endian machines to big endian network order.
485 + * On big endian machines this will be a null macro.
486 + * The macro htonll() is defined in byteorder64.h,
487 + * and if needed refers to _htonll() here.
489 +unsigned long long _htonll(unsigned long long x)
491 + union byteswap_64_u u1;
492 + union byteswap_64_u u2;
496 + u2.b[0] = htonl(u1.b[1]);
497 + u2.b[1] = htonl(u1.b[0]);
503 +/* Function to byteswap big endian 64bit unsigned integers
504 + * back to little endian host order on little endian machines.
505 + * As above, on big endian machines this will be a null macro.
506 + * The macro ntohll() is defined in byteorder64.h, and if needed,
507 + * refers to _ntohll() here.
509 +unsigned long long _ntohll(unsigned long long x)
511 + union byteswap_64_u u1;
512 + union byteswap_64_u u2;
516 + u2.b[1] = ntohl(u1.b[0]);
517 + u2.b[0] = ntohl(u1.b[1]);
522 +#endif /* defined(HAVE_LONG_LONG_INT) && !defined(WORDS_BIGENDIAN) */
523 diff -Naur cyrus-imapd-2.2.12.orig/lib/byteorder64.h cyrus-imapd-2.2.12/lib/byteorder64.h
524 --- cyrus-imapd-2.2.12.orig/lib/byteorder64.h 1970-01-01 01:00:00.000000000 +0100
525 +++ cyrus-imapd-2.2.12/lib/byteorder64.h 2006-04-25 07:35:25.000000000 +0200
527 +/* byteorder64.h -- convert 64-bit values between host and network byte order
529 + * Copyright (c) 2004 Carnegie Mellon University. All rights reserved.
531 + * Redistribution and use in source and binary forms, with or without
532 + * modification, are permitted provided that the following conditions
535 + * 1. Redistributions of source code must retain the above copyright
536 + * notice, this list of conditions and the following disclaimer.
538 + * 2. Redistributions in binary form must reproduce the above copyright
539 + * notice, this list of conditions and the following disclaimer in
540 + * the documentation and/or other materials provided with the
543 + * 3. The name "Carnegie Mellon University" must not be used to
544 + * endorse or promote products derived from this software without
545 + * prior written permission. For permission or any other legal
546 + * details, please contact
547 + * Office of Technology Transfer
548 + * Carnegie Mellon University
549 + * 5000 Forbes Avenue
550 + * Pittsburgh, PA 15213-3890
551 + * (412) 268-4387, fax: (412) 268-7395
552 + * tech-transfer@andrew.cmu.edu
554 + * 4. Redistributions of any form whatsoever must retain the following
556 + * "This product includes software developed by Computing Services
557 + * at Carnegie Mellon University (http://www.cmu.edu/computing/)."
559 + * CARNEGIE MELLON UNIVERSITY DISCLAIMS ALL WARRANTIES WITH REGARD TO
560 + * THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
561 + * AND FITNESS, IN NO EVENT SHALL CARNEGIE MELLON UNIVERSITY BE LIABLE
562 + * FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
563 + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN
564 + * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
565 + * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
567 + * $Id: byteorder64.h,v 1.1.2.2 2004/08/16 11:44:34 ken3 Exp $
570 +#ifndef _BYTEORDER64_H
571 +#define _BYTEORDER64_H
575 +#ifdef HAVE_LONG_LONG_INT
577 +/* 64-bit host/network byte-order swap macros */
578 +#ifdef WORDS_BIGENDIAN
579 +#define htonll(x) (x)
580 +#define ntohll(x) (x)
582 +#define htonll(x) _htonll(x)
583 +#define ntohll(x) _ntohll(x)
585 +/* little-endian 64-bit host/network byte-order swap functions */
586 +extern unsigned long long _htonll(unsigned long long);
587 +extern unsigned long long _ntohll(unsigned long long);
589 +#endif /* WORDS_BIGENDIAN */
590 +#endif /* HAVE_LONG_LONG_INT */
591 +#endif /* _BYTEORDER64_H */
592 diff -Naur cyrus-imapd-2.2.12.orig/lib/Makefile.in cyrus-imapd-2.2.12/lib/Makefile.in
593 --- cyrus-imapd-2.2.12.orig/lib/Makefile.in 2004-05-28 20:03:04.000000000 +0200
594 +++ cyrus-imapd-2.2.12/lib/Makefile.in 2006-04-25 07:35:25.000000000 +0200
596 $(srcdir)/lsort.h $(srcdir)/stristr.h \
597 $(srcdir)/util.h $(srcdir)/xmalloc.h $(srcdir)/imapurl.h \
598 $(srcdir)/cyrusdb.h $(srcdir)/iptostring.h $(srcdir)/rfc822date.h \
599 - $(srcdir)/libcyr_cfg.h
600 + $(srcdir)/libcyr_cfg.h $(srcdir)/byteorder64.h
602 LIBCYR_OBJS = acl.o bsearch.o charset.o glob.o retry.o util.o \
603 libcyr_cfg.o mkgmtime.o prot.o parseaddr.o imclient.o imparse.o \
605 chartable.o imapurl.o nonblock_@WITH_NONBLOCK@.o lock_@WITH_LOCK@.o \
606 gmtoff_@WITH_GMTOFF@.o map_@WITH_MAP@.o $(ACL) $(AUTH) \
607 @LIBOBJS@ @CYRUSDB_OBJS@ \
608 - iptostring.o xmalloc.o wildmat.o
609 + iptostring.o xmalloc.o wildmat.o byteorder64.o
611 LIBCYRM_HDRS = $(srcdir)/hash.h $(srcdir)/mpool.h $(srcdir)/xmalloc.h \
612 $(srcdir)/strhash.o $(srcdir)/libconfig.h $(srcdir)/assert.h \
613 diff -Naur cyrus-imapd-2.2.12.orig/lib/prot.c cyrus-imapd-2.2.12/lib/prot.c
614 --- cyrus-imapd-2.2.12.orig/lib/prot.c 2004-02-27 23:08:56.000000000 +0100
615 +++ cyrus-imapd-2.2.12/lib/prot.c 2006-04-25 07:35:25.000000000 +0200
617 prot_write(s, buf, strlen(buf));
620 +#ifdef HAVE_LONG_LONG_INT
623 + unsigned long long int ull;
625 + switch (*++percent) {
627 + ll = va_arg(pvar, long long int);
628 + snprintf(buf, sizeof(buf), "%lld", ll);
629 + prot_write(s, buf, strlen(buf));
633 + ull = va_arg(pvar, unsigned long long int);
634 + snprintf(buf, sizeof(buf), "%llu", ull);
635 + prot_write(s, buf, strlen(buf));