From 4655d888677e71962722ad86f255a27386e1e621 Mon Sep 17 00:00:00 2001 From: Not Zed Date: Tue, 7 May 2002 07:31:26 +0000 Subject: Check for LOGIN xxxx as well if debug is on, so we dont print passwords to 2002-05-07 Not Zed * camel-remote-store.c (remote_send_string): Check for LOGIN xxxx as well if debug is on, so we dont print passwords to evolution logs. * providers/imap/camel-imap-utils.c (imap_is_atom_char): This was really broken. 1. isprint() is locale dependent, and 2. it looked up an 8 bit value in a 7 bit table without truncating it. I've removed the isprint() stuff and just put it directly into the special table, which i've expanded to the right size too. * providers/imap/*: Applied patch from Preston Elder to make camel only use literals if it needs to for simple strings. Changed slightly to use imap_is_atom() and more consistent formatting. providers/imap/camel-imap-utils.c (imap_is_atom): Chagned from imap_needs_quoting(). ** Merged in camel-object2 branch. Simpler camelobject implementation + object args interface. * camel.c (camel_init): Call camel_object_get_type() to make sure camel_object_type is initialised. * camel-object.h (CAMEL_OBJECT_TYPE): Changed to return global camel_object_type pointer, not call camel_object_get_type. svn path=/trunk/; revision=16701 --- camel/providers/imap/camel-imap-utils.c | 58 +++++++++++++++++++++++++++++---- 1 file changed, 52 insertions(+), 6 deletions(-) (limited to 'camel/providers/imap/camel-imap-utils.c') diff --git a/camel/providers/imap/camel-imap-utils.c b/camel/providers/imap/camel-imap-utils.c index 91d2efb702..7ee7ff807d 100644 --- a/camel/providers/imap/camel-imap-utils.c +++ b/camel/providers/imap/camel-imap-utils.c @@ -271,17 +271,63 @@ imap_parse_flag_list (char **flag_list_p) return flags; } -static char imap_atom_specials[128] = { - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 0, 0, +/* + From rfc2060 + +ATOM_CHAR ::= + +atom_specials ::= "(" / ")" / "{" / SPACE / CTL / list_wildcards / + quoted_specials + +CHAR ::= + +CTL ::= + +SPACE ::= + +list_wildcards ::= "%" / "*" + +quoted_specials ::= <"> / "\" +*/ + +static unsigned char imap_atom_specials[256] = { +/* 00 */0, 0, 0, 0, 0, 0, 0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 0) + +gboolean +imap_is_atom(const char *in) +{ + register unsigned char c; + register const char *p = in; + + while ((c = (unsigned char)*p)) { + if (!imap_is_atom_char(c)) + return FALSE; + p++; + } + + /* check for empty string */ + return p!=in; +} /** * imap_parse_string_generic: -- cgit v1.2.3