+2001-04-30
+
+ * src/recv.c: recv_bytes_write(): fixed another bug that caused
+ infinite loop and buffer overrun.
+
+2001-04-30
+
+ * src/socket.[ch]: renamed sock_read() and fd_read() to
+ sock_gets() and fd_gets() for preventing confusion.
+ Added sock_read() and fd_read() which is the wrapper of read().
+ * src/recv.c: recv_bytes_write(): fixed a bug that caused infinite
+ loop. Use sock_read() instead of fd_read().
+ * src/esmtp.c
+ src/imap.c
+ src/news.c
+ src/nntp.c
+ src/pop.c
+ src/recv.c
+ src/smtp.c: use sock_gets() instead of sock_read().
+ * src/imap.c: imap_session_new(): fixed the error detection
+ of imap_open().
+
2001-04-28
* src/inc.c: made it displays current read bytes to the dialog.
+2001-04-30 [alfons]
+
+ 0.4.65claws7
+
+ * sync with 0.4.65cvs12
+
+ NOTE: nntp.c and news.c in claws and cvs branch differ significantly!
+
2001-04-30 [sergey]
* src/nntp.h (NNTPSockInfo): new field auth_failed.
+2001-04-30
+
+ * src/recv.c: recv_bytes_write(): ̵¸Â¥ë¡¼¥×¤È¥Ð¥Ã¥Õ¥¡¥ª¡¼¥Ð¡¼¥é¥ó
+ ¤òµ¯¤³¤¹¤â¤¦°ì¤Ä¤Î¥Ð¥°¤ò½¤Àµ¡£
+
+2001-04-30
+
+ * src/socket.[ch]: º®Íð¤òÈò¤±¤ë¤¿¤á¡¢ sock_read() ¤È fd_read() ¤ò
+ sock_gets() ¤È fd_read() ¤Ë̾¾ÎÊѹ¹¡£ read() ¤Î¥é¥Ã¥Ñ¡¼¤Ç¤¢¤ë
+ sock_read() ¤È fd_read() ¤òÄɲá£
+ * src/recv.c: recv_bytes_write(): ̵¸Â¥ë¡¼¥×¤òµ¯¤³¤¹¥Ð¥°¤ò½¤Àµ¡£
+ fd_read() ¤ÎÂå¤ï¤ê¤Ë sock_read() ¤ò»ÈÍѤ¹¤ë¤è¤¦¤Ë¤·¤¿¡£
+ * src/esmtp.c
+ src/imap.c
+ src/news.c
+ src/nntp.c
+ src/pop.c
+ src/recv.c
+ src/smtp.c: sock_read() ¤ÎÂå¤ï¤ê¤Ë sock_gets() ¤ò»ÈÍѤ¹¤ë¤è¤¦¤Ë
+ ¤·¤¿¡£
+ * src/imap.c: imap_session_new(): imap_open() ¤Î¥¨¥é¡¼¸¡½Ð¤ò½¤Àµ¡£
+
2001-04-28
* src/inc.c: ¥À¥¤¥¢¥í¥°¤Ë¸½ºß¤ÎÆÉ¤ß¹þ¤ó¤À¥Ð¥¤¥È¿ô¤òɽ¼¨¤¹¤ë¤è¤¦¤Ë
MICRO_VERSION=65
INTERFACE_AGE=65
BINARY_AGE=65
-EXTRA_VERSION=claws6
+EXTRA_VERSION=claws7
VERSION=$MAJOR_VERSION.$MINOR_VERSION.$MICRO_VERSION$EXTRA_VERSION
dnl
log_message(_("creating IMAP4 connection to %s:%d ...\n"),
server, port);
- if ((imap_sock = imap_open(server, port, buf)) < 0)
+ if ((imap_sock = imap_open(server, port, buf)) == NULL)
return NULL;
if (imap_auth(imap_sock, user, pass) != IMAP_SUCCESS) {
imap_logout(imap_sock);
}
for (;;) {
- if (sock_read(SESSION(session)->sock, buf, sizeof(buf)) < 0) {
+ if (sock_gets(SESSION(session)->sock, buf, sizeof(buf)) < 0) {
log_warning(_("error occurred while getting envelope.\n"));
return newlist;
}
imap_gen_send(sock, "FETCH %d BODY[]", num);
- if (sock_read(sock, buf, sizeof(buf)) < 0)
+ if (sock_gets(sock, buf, sizeof(buf)) < 0)
return IMAP_ERROR;
strretchomp(buf);
if (buf[0] != '*' || buf[1] != ' ')
g_return_val_if_fail(orig_buf != NULL, cur_pos);
- if (sock_read(sock, orig_buf, IMAPBUFSIZE) < 0)
+ if (sock_gets(sock, orig_buf, IMAPBUFSIZE) < 0)
return cur_pos;
strretchomp(orig_buf);
log_print("IMAP4< %s\n", orig_buf);
static gint imap_gen_recv(SockInfo *sock, gchar *buf, gint size)
{
- if (sock_read(sock, buf, size) == -1)
+ if (sock_gets(sock, buf, size) == -1)
return IMAP_SOCKET;
strretchomp(buf);
nb = sock_is_nonblocking_mode(sock);
if (nb && (sock_set_nonblocking_mode(sock, FALSE) < 0)) return -1;
- while (sock_read(sock, buf, sizeof(buf)) >= 0) {
+ while (sock_gets(sock, buf, sizeof(buf)) >= 0) {
gint num;
if (buf[0] == '.') break;
nb = sock_is_nonblocking_mode(sock);
if (nb && (sock_set_nonblocking_mode(sock, FALSE) < 0)) return -1;
- while (sock_read(sock, buf, sizeof(buf)) >= 0) {
+ while (sock_gets(sock, buf, sizeof(buf)) >= 0) {
gint num, size;
if (buf[0] == '.') break;
if (nb && (sock_set_nonblocking_mode(sock, FALSE) < 0))
return PS_SOCKET;
- if (sock_read(sock, buf, size) < 0) {
+ if (sock_gets(sock, buf, size) < 0) {
return PS_SOCKET;
} else {
strretchomp(buf);
if (nb) sock_set_nonblocking_mode(sock, FALSE);
for (;;) {
- if (sock_read(sock, buf, sizeof(buf)) < 0) {
+ if (sock_gets(sock, buf, sizeof(buf)) < 0) {
g_warning(_("error occurred while retrieving data.\n"));
if (nb) sock_set_nonblocking_mode(sock, TRUE);
return -1;
Xalloca(buf, size, return -1);
do {
- size_t read_count;
+ gint read_count;
- /* FIXME: put this into socket.c :WK: */
- read_count = fd_read(sock->sock, buf + count, size - count);
+ read_count = sock_read(sock, buf + count, size - count);
if (read_count < 0) {
if (nb) sock_set_nonblocking_mode(sock, TRUE);
return -1;
count += read_count;
} while (count < size);
+ /* +------------------+----------------+--------------------------+ *
+ * ^buf ^prev ^cur buf+size-1^ */
+
prev = buf;
- while ((cur = memchr(prev, '\r', size)) != NULL) {
- if (cur - buf + 1 < size && *(cur + 1) == '\n') {
- if (fwrite(prev, sizeof(gchar), cur - prev, fp) == EOF ||
- fwrite("\n", sizeof(gchar), 1, fp) == EOF) {
- perror("fwrite");
- g_warning(_("Can't write to file.\n"));
- if (nb) sock_set_nonblocking_mode(sock, TRUE);
- return -1;
- }
- prev = cur + 2;
- if (prev - buf >= size) break;
+ while ((cur = memchr(prev, '\r', size - (prev - buf))) != NULL) {
+ if (cur == buf + size - 1) break;
+
+ if (fwrite(prev, sizeof(gchar), cur - prev, fp) == EOF ||
+ fwrite("\n", sizeof(gchar), 1, fp) == EOF) {
+ perror("fwrite");
+ g_warning(_("Can't write to file.\n"));
+ if (nb) sock_set_nonblocking_mode(sock, TRUE);
+ return -1;
}
+
+ if (*(cur + 1) == '\n')
+ prev = cur + 2;
+ else
+ prev = cur + 1;
+
+ if (prev - buf >= size) break;
}
if (prev - buf < size && fwrite(buf, sizeof(gchar),
gint smtp_ok(SockInfo *sock)
{
- while ((sock_read(sock, smtp_response, sizeof(smtp_response) - 1))
+ while ((sock_gets(sock, smtp_response, sizeof(smtp_response) - 1))
!= 1) {
if (strlen(smtp_response) < 4)
return SM_ERROR;
gboolean sock_is_nonblocking_mode(SockInfo *sock)
{
- g_assert(sock);
+ g_return_val_if_fail(sock != NULL, FALSE);
return is_nonblocking_mode(sock->sock);
}
return sock_write(sock, buf, strlen(buf));
}
+gint sock_read(SockInfo *sock, gchar *buf, gint len)
+{
+ g_return_val_if_fail(sock != NULL, -1);
+
+ return fd_read(sock->sock, buf, len);
+}
+
+gint fd_read(gint fd, gchar *buf, gint len)
+{
+ return read(fd, buf, len);
+}
+
gint sock_write(SockInfo *sock, const gchar *buf, gint len)
{
g_return_val_if_fail(sock != NULL, -1);
return wrlen;
}
-gint sock_read(SockInfo *sock, gchar *buf, gint len)
-{
- g_return_val_if_fail(sock != NULL, -1);
-
- return fd_read(sock->sock, buf, len);
-}
-
-gint fd_read(gint fd, gchar *buf, gint len)
+gint fd_gets(gint fd, gchar *buf, gint len)
{
gchar *newline, *bp = buf;
gint n;
return bp - buf;
}
+gint sock_gets(SockInfo *sock, gchar *buf, gint len)
+{
+ g_return_val_if_fail(sock != NULL, -1);
+
+ return fd_gets(sock->sock, buf, len);
+}
+
+
gint sock_puts(SockInfo *sock, const gchar *buf)
{
gint ret;
gint sock_printf (SockInfo *sock, const gchar *format, ...)
G_GNUC_PRINTF(2, 3);
+gint sock_read (SockInfo *sock, gchar *buf, gint len);
gint sock_write (SockInfo *sock, const gchar *buf, gint len);
-gint sock_read (SockInfo *sock, gchar *buf, gint len);
+gint sock_gets (SockInfo *sock, gchar *buf, gint len);
gint sock_puts (SockInfo *sock, const gchar *buf);
gint sock_close (SockInfo *sock);