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
This commit is contained in:
Jeffrey Stedfast
2000-10-17 02:38:18 +00:00
committed by Jeffrey Stedfast
parent 08d9c142f4
commit 2003a69501
2 changed files with 26 additions and 14 deletions

View File

@ -1,3 +1,16 @@
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).
2000-10-16 Chris Toshok <toshok@helixcode.com>
* camel-service.c (get_path): when using the construct (flags &
@ -92,8 +105,7 @@
Fix camel_summary_* function rename
(imap_get_message_info_internal): Likewise.
* camel-mime-parser.c (camel_mime_parser_finalise): Fixed a
spelling mistake.
* camel-mime-parser.c (camel_mime_parser_finalise): Fixed a spelling mistake.
* camel-folder-summary.c (camel_summary_format_address): Uh, why
do we encode and then decode here ... sigh. This is not the way
@ -105,8 +117,7 @@
2000-10-11 Chris Toshok <toshok@helixcode.com>
* providers/nntp/camel-nntp-store.c
(nntp_store_unsubscribe_folder): remove the leading '/'.
* providers/nntp/camel-nntp-store.c (nntp_store_unsubscribe_folder): remove the leading '/'.
(nntp_store_subscribe_folder): same.
(nntp_store_folder_subscribed): same.

View File

@ -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) {