summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGeorge Lebl <jirka@5z.com>2001-02-09 17:02:06 +0000
committerGeorge Lebl <jirka@src.gnome.org>2001-02-09 17:02:06 +0000
commit062e3bc3b85edd0fb732ae9e75d54b55aa9eae29 (patch)
tree752ea213538bf92cf6329c94309231ee44744167
parent464840d537e11f436a4ce6155f0a84db61b64a67 (diff)
fix pop login, and check for NULL after each read_line in the imap code toGNOME_CORE_1_2_99_2
Fri Feb 09 12:05:13 2001 George Lebl <jirka@5z.com> * gen_util/popcheck.c: fix pop login, and check for NULL after each read_line in the imap code to deal with buggy code.
-rw-r--r--mailcheck/ChangeLog5
-rw-r--r--mailcheck/popcheck.c11
2 files changed, 12 insertions, 4 deletions
diff --git a/mailcheck/ChangeLog b/mailcheck/ChangeLog
index fd71a13f5..eab6feca7 100644
--- a/mailcheck/ChangeLog
+++ b/mailcheck/ChangeLog
@@ -1,3 +1,8 @@
+Fri Feb 09 12:05:13 2001 George Lebl <jirka@5z.com>
+
+ * gen_util/popcheck.c: fix pop login, and check for NULL after
+ each read_line in the imap code to deal with buggy code.
+
Thu Feb 08 23:44:01 2001 George Lebl <jirka@5z.com>
* gen_util/clock.c: ability to copy out a full timestamp, plus add
diff --git a/mailcheck/popcheck.c b/mailcheck/popcheck.c
index 34769294a..d74481c42 100644
--- a/mailcheck/popcheck.c
+++ b/mailcheck/popcheck.c
@@ -99,7 +99,7 @@ static int connect_socket(char *h, int def)
static char *read_line(int s)
{
- static char response[256];
+ static char response[1024];
char *c;
int m = sizeof(response);
@@ -175,7 +175,7 @@ int pop3_check(char *h, char* n, char* e)
return -1;
}
- c = g_strdup_printf(c, "USER %s", n);
+ c = g_strdup_printf("USER %s", n);
if (!write_line(s, c) ||
!is_pop3_answer_ok(read_line(s))) {
close(s);
@@ -184,7 +184,7 @@ int pop3_check(char *h, char* n, char* e)
}
g_free(c);
- c = g_strdup_printf(c, "PASS %s", e);
+ c = g_strdup_printf("PASS %s", e);
if (!write_line(s, c) ||
!is_pop3_answer_ok(read_line(s))) {
close(s);
@@ -195,12 +195,14 @@ int pop3_check(char *h, char* n, char* e)
if (write_line(s, "STAT") &&
is_pop3_answer_ok(x = read_line(s)) &&
+ x != NULL &&
sscanf(x, "%*s %d %*d", &msg) == 1)
r = ((unsigned int)msg & 0x0000FFFFL);
if (r != -1 &&
write_line(s, "LAST") &&
is_pop3_answer_ok(x = read_line(s)) &&
+ x != NULL &&
sscanf(x, "%*s %d", &last) == 1)
r |= (unsigned int)(msg - last) << 16;
@@ -276,7 +278,8 @@ int imap_check(char *h, char* n, char* e)
int total = 0, unseen = 0;
x = read_line(s);
- sscanf(x, "%*s %*s %*s %*s %d %*s %d", &total, &unseen);
+ if (x != NULL)
+ sscanf(x, "%*s %*s %*s %*s %d %*s %d", &total, &unseen);
r = (((unsigned int) unseen ) << 16) | /* lt unseen only */
((unsigned int) total & 0x0000FFFFL);