aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--NEWS3
-rw-r--r--driver.c8
-rw-r--r--fetchmail.h1
-rw-r--r--imap.c2
-rw-r--r--pop3.c4
-rw-r--r--uid.c13
6 files changed, 26 insertions, 5 deletions
diff --git a/NEWS b/NEWS
index c3a6670d..be18b231 100644
--- a/NEWS
+++ b/NEWS
@@ -11,6 +11,9 @@
Release Notes:
------------------------------------------------------------------------------
+fetchmail-4.3.2 ()
+* More slow-UIDL patches from Wolfgang Wander.
+
fetchmail-4.3.1 (Mon Oct 13 17:12:40 EDT 1997)
* Minor portation fixes for early AIX versions and NextSTEP.
* Fixed a bad interaction between --limit and the repoll feature.
diff --git a/driver.c b/driver.c
index 01014f96..6c22a49e 100644
--- a/driver.c
+++ b/driver.c
@@ -49,7 +49,7 @@
#include <krb.h>
#define krb_get_err_text(e) (krb_err_txt[e])
#else
-#if defined(__FreeBSD__)
+#if defined(__FreeBSD__) || defined(__linux__)
#define krb_get_err_text(e) (krb_err_txt[e])
#include <krb.h>
#include <des.h>
@@ -751,9 +751,11 @@ int num; /* index of message */
{
if( ctl->server.uidl )
{
- char id[IDLEN+1];
+ char id[IDLEN+1];
+ /* prevent stack overflows */
+ buf[IDLEN+12] = 0;
sscanf( buf+12, "%s", id);
- if( !str_in_list( &ctl->newsaved, id ) )
+ if( !str_find( &ctl->newsaved, num ) )
save_str(&ctl->newsaved, num, id );
}
}
diff --git a/fetchmail.h b/fetchmail.h
index 1ea49ae2..ed43b94a 100644
--- a/fetchmail.h
+++ b/fetchmail.h
@@ -269,6 +269,7 @@ void free_str_pair_list(struct idlist **);
int delete_str(struct idlist **, int);
int str_in_list(struct idlist **, const char *);
int str_nr_in_list(struct idlist **, const char *);
+int str_nr_last_in_list(struct idlist **, const char *);
int count_list( struct idlist **idl );
char *str_from_nr_list( struct idlist **idl, int number );
char *str_find(struct idlist **, int);
diff --git a/imap.c b/imap.c
index 0a08688d..53779e8d 100644
--- a/imap.c
+++ b/imap.c
@@ -20,7 +20,7 @@
#include <des.h>
#define krb_get_err_text(e) (krb_err_txt[e])
#endif
-#if defined (__FreeBSD__)
+#if defined (__FreeBSD__) || defined(__linux__)
#define krb_get_err_text(e) (krb_err_txt[e])
#endif
#include <krb.h>
diff --git a/pop3.c b/pop3.c
index 9fda2861..0cdf3179 100644
--- a/pop3.c
+++ b/pop3.c
@@ -243,6 +243,8 @@ pop3_gettopid( int sock, int num , char *id)
break;
if( ! got_it && ! strncasecmp("Message-Id:", buf, 11 )) {
got_it = 1;
+ /* prevent stack overflows */
+ buf[IDLEN+12] = 0;
sscanf( buf+12, "%s", id);
}
}
@@ -284,7 +286,7 @@ pop3_slowuidl( int sock, struct query *ctl, int *countp, int *newp)
if( (ok = pop3_gettopid( sock, try_id, id )) != 0 )
return ok;
- try_nr = str_nr_in_list(&ctl->oldsaved, id);
+ try_nr = str_nr_last_in_list(&ctl->oldsaved, id);
} else {
try_id = *countp+1;
try_nr = -1;
diff --git a/uid.c b/uid.c
index 000c0233..50d8ede6 100644
--- a/uid.c
+++ b/uid.c
@@ -197,6 +197,19 @@ int str_nr_in_list( struct idlist **idl, const char *str )
return -1;
}
+int str_nr_last_in_list( struct idlist **idl, const char *str )
+ /* return the last position of str in idl */
+{
+ int nr, ret = -1;
+ struct idlist *walk;
+ if ( !str )
+ return -1;
+ for( walk = *idl, nr = 0; walk; nr ++, walk = walk->next )
+ if( strcasecmp( str, walk->id) == 0 )
+ ret = nr;
+ return ret;
+}
+
int count_list( struct idlist **idl )
/* count the number of elements in the list */
{