From 7b0ca5ffe4f2074dce460b501ba70374bebd5f77 Mon Sep 17 00:00:00 2001 From: hiro Date: Wed, 12 Oct 2005 08:46:49 +0000 Subject: also log IMAP4 literal strings. git-svn-id: svn://sylpheed.sraoss.jp/sylpheed/trunk@639 ee746299-78ed-0310-b773-934348b2243d --- ChangeLog | 6 ++++++ ChangeLog.ja | 7 +++++++ libsylph/imap.c | 4 ++++ libsylph/recv.c | 6 ++++-- 4 files changed, 21 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 2d8e148b..ffe0f801 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2005-10-12 + + * libsylph/recv.c: recv_bytes(): null-terminate the received data + in case it's a string. + libsylph/imap.c: imap_cmd_ok(): also log literal strings. + 2005-10-12 * src/alertpanel.c: win32: make dialog in front on focus out. diff --git a/ChangeLog.ja b/ChangeLog.ja index 7a7f73f9..bf5ae05d 100644 --- a/ChangeLog.ja +++ b/ChangeLog.ja @@ -1,3 +1,10 @@ +2005-10-12 + + * libsylph/recv.c: recv_bytes(): 受信したデータを null 終端するように + した(文字列の場合のため)。 + libsylph/imap.c: imap_cmd_ok(): リテラル文字列もログに記録する + ようにした。 + 2005-10-12 * src/alertpanel.c: win32: focus out のときダイアログを前面にもって diff --git a/libsylph/imap.c b/libsylph/imap.c index 0f75f73c..38bce92a 100644 --- a/libsylph/imap.c +++ b/libsylph/imap.c @@ -3756,6 +3756,10 @@ static gint imap_cmd_ok(IMAPSession *session, GPtrArray *argbuf) ok = IMAP_SOCKET; break; } + if (memchr(literal, '\n', len)) + log_print("IMAP4< (literal: %d bytes)\n", len); + else + log_print("IMAP4< %s\n", literal); g_string_append(str, "\r\n"); g_string_append_len(str, literal, len); diff --git a/libsylph/recv.c b/libsylph/recv.c index 0b71545c..3d2a7968 100644 --- a/libsylph/recv.c +++ b/libsylph/recv.c @@ -45,19 +45,21 @@ gchar *recv_bytes(SockInfo *sock, glong size) if (size == 0) return NULL; - buf = g_malloc(size); + buf = g_malloc(size + 1); do { gint read_count; read_count = sock_read(sock, buf + count, size - count); - if (read_count < 0) { + if (read_count <= 0) { g_free(buf); return NULL; } count += read_count; } while (count < size); + buf[size] = '\0'; + return buf; } -- cgit v1.2.3