dovecot-2.2: lib-imap: NIL as astring is the same as "NIL"
dovecot at dovecot.org
dovecot at dovecot.org
Sat Nov 2 22:32:36 EET 2013
details: http://hg.dovecot.org/dovecot-2.2/rev/b631a76e8992
changeset: 16917:b631a76e8992
user: Timo Sirainen <tss at iki.fi>
date: Sat Nov 02 22:30:42 2013 +0200
description:
lib-imap: NIL as astring is the same as "NIL"
This is a bit klugdy but works as long as all callers use
imap_arg_get_astring() instead of trying to handle it themselves.
diffstat:
src/lib-imap/imap-arg.c | 6 ++++++
src/lib-imap/imap-arg.h | 4 +++-
2 files changed, 9 insertions(+), 1 deletions(-)
diffs (30 lines):
diff -r 0a08efeb3f40 -r b631a76e8992 src/lib-imap/imap-arg.c
--- a/src/lib-imap/imap-arg.c Sat Nov 02 21:29:39 2013 +0200
+++ b/src/lib-imap/imap-arg.c Sat Nov 02 22:30:42 2013 +0200
@@ -32,6 +32,12 @@
bool imap_arg_get_astring(const struct imap_arg *arg, const char **str_r)
{
+ if (arg->type == IMAP_ARG_NIL) {
+ /* RFC 3501 4.5. specifies that NIL is the same as "NIL" when
+ reading astring. */
+ *str_r = "NIL";
+ return TRUE;
+ }
if (!IMAP_ARG_IS_ASTRING(arg))
return FALSE;
diff -r 0a08efeb3f40 -r b631a76e8992 src/lib-imap/imap-arg.h
--- a/src/lib-imap/imap-arg.h Sat Nov 02 21:29:39 2013 +0200
+++ b/src/lib-imap/imap-arg.h Sat Nov 02 22:30:42 2013 +0200
@@ -60,7 +60,9 @@
unsigned int literal8:1; /* BINARY literal8 used */
};
-/* RFC 3501's astring type */
+/* RFC 3501's astring type. Note that this doesn't return TRUE for
+ IMAP_ARG_NIL, although it should be treated the same as "NIL" string when
+ reading an astring. */
#define IMAP_ARG_TYPE_IS_ASTRING(type) \
((type) == IMAP_ARG_ATOM || \
(type) == IMAP_ARG_STRING || \
More information about the dovecot-cvs
mailing list