aboutsummaryrefslogtreecommitdiffstats
path: root/camel/providers/imap/camel-imap-command.c
diff options
context:
space:
mode:
authorJeffrey Stedfast <fejj@helixcode.com>2000-10-17 10:38:18 +0800
committerJeffrey Stedfast <fejj@src.gnome.org>2000-10-17 10:38:18 +0800
commit2003a6950166d8e470d71e4e07ef9bbf4bc35ccd (patch)
tree49a51006bba541a03b63ae40af8f012e8006c438 /camel/providers/imap/camel-imap-command.c
parent08d9c142f470f68893661bced2876a1a6af7de7a (diff)
downloadgsoc2013-evolution-2003a6950166d8e470d71e4e07ef9bbf4bc35ccd.tar
gsoc2013-evolution-2003a6950166d8e470d71e4e07ef9bbf4bc35ccd.tar.gz
gsoc2013-evolution-2003a6950166d8e470d71e4e07ef9bbf4bc35ccd.tar.bz2
gsoc2013-evolution-2003a6950166d8e470d71e4e07ef9bbf4bc35ccd.tar.lz
gsoc2013-evolution-2003a6950166d8e470d71e4e07ef9bbf4bc35ccd.tar.xz
gsoc2013-evolution-2003a6950166d8e470d71e4e07ef9bbf4bc35ccd.tar.zst
gsoc2013-evolution-2003a6950166d8e470d71e4e07ef9bbf4bc35ccd.zip
Don't free 'resp' as it doesn't point to the beginning of the allocated
2000-10-16 Jeffrey Stedfast <fejj@helixcode.com> * providers/imap/camel-imap-command.c (camel_imap_response_extract): Don't free 'resp' as it doesn't point to the beginning of the allocated data, instead free response->untagged->pdata[i]. Also, if '*resp' is equal to a space character, then set resp = imap_next_word (resp) rather than expecting resp++ to work (there's a list broken IMAP daemons that like to put extra spaces between tokens). (imap_read_response): Don't expect 'respbuf+2' to be where the untagged number response to start (see above fix for an explanation). svn path=/trunk/; revision=5960
Diffstat (limited to 'camel/providers/imap/camel-imap-command.c')
-rw-r--r--camel/providers/imap/camel-imap-command.c21
1 files changed, 11 insertions, 10 deletions
diff --git a/camel/providers/imap/camel-imap-command.c b/camel/providers/imap/camel-imap-command.c
index 7a6045d16d..1827869c14 100644
--- a/camel/providers/imap/camel-imap-command.c
+++ b/camel/providers/imap/camel-imap-command.c
@@ -134,7 +134,7 @@ imap_read_response (CamelImapStore *store, CamelException *ex)
CamelImapResponse *response;
int number, exists = 0;
GArray *expunged = NULL;
- char *respbuf, *retcode, *p;
+ char *respbuf, *retcode, *word, *p;
/* Read first line */
if (camel_remote_store_recv_line (CAMEL_REMOTE_STORE (store),
@@ -154,14 +154,15 @@ imap_read_response (CamelImapStore *store, CamelException *ex)
/* If it starts with a number, we might deal with
* it ourselves.
*/
- number = strtoul (respbuf + 2, &p, 10);
- if (p != respbuf + 2 && store->current_folder) {
- p = imap_next_word (p);
- if (!g_strcasecmp (p, "EXISTS")) {
+ word = imap_next_word (respbuf + 2);
+ number = strtoul (word, &p, 10);
+ if (p != word && store->current_folder) {
+ word = imap_next_word (p);
+ if (!g_strcasecmp (word, "EXISTS")) {
exists = number;
g_free (respbuf);
goto next;
- } else if (!g_strcasecmp (p, "EXPUNGE")) {
+ } else if (!g_strcasecmp (word, "EXPUNGE")) {
if (!expunged) {
expunged = g_array_new (FALSE, FALSE,
sizeof (int));
@@ -171,8 +172,7 @@ imap_read_response (CamelImapStore *store, CamelException *ex)
goto next;
}
} else {
- p = imap_next_word (respbuf);
- if (!g_strncasecmp (p, "BYE", 3)) {
+ if (!g_strncasecmp (word, "BYE", 3)) {
/* connection was lost, no more data to fetch */
store->connected = FALSE;
g_free (respbuf);
@@ -349,11 +349,12 @@ camel_imap_response_extract (CamelImapResponse *response, const char *type,
/* Skip "* ", and initial sequence number, if present */
strtoul (resp + 2, &resp, 10);
if (*resp == ' ')
- resp++;
+ resp = imap_next_word (resp);
if (!g_strncasecmp (resp, type, len))
break;
- g_free (resp);
+
+ g_free (response->untagged->pdata[i]);
}
if (i < response->untagged->len) {