#include <opie.h>
#endif /* OPIE_ENABLE */
-static int last;
-#ifdef SDPS_ENABLE
-char *sdps_envfrom;
-char *sdps_envto;
-#endif /* SDPS_ENABLE */
+/* global variables: please reinitialize them explicitly for proper
+ * working in daemon mode */
+/* TODO: session variables to be initialized before server greeting */
#ifdef OPIE_ENABLE
static char lastok[POPBUFSIZE+1];
#endif /* OPIE_ENABLE */
-/* these variables are shared between the CAPA probe and the authenticator */
+/* session variables initialized in capa_probe() or pop3_getauth() */
#if defined(GSSAPI)
- flag has_gssapi = FALSE;
+flag has_gssapi = FALSE;
#endif /* defined(GSSAPI) */
#if defined(KERBEROS_V4) || defined(KERBEROS_V5)
- flag has_kerberos = FALSE;
+flag has_kerberos = FALSE;
#endif /* defined(KERBEROS_V4) || defined(KERBEROS_V5) */
- static flag has_cram = FALSE;
+static flag has_cram = FALSE;
#ifdef OPIE_ENABLE
- flag has_otp = FALSE;
+flag has_otp = FALSE;
#endif /* OPIE_ENABLE */
#ifdef SSL_ENABLE
- static flag has_ssl = FALSE;
+static flag has_ssl = FALSE;
#endif /* SSL_ENABLE */
+/* mailbox variables initialized in pop3_getrange() */
+static int last;
+
+/* mail variables initialized in pop3_fetch() */
+#ifdef SDPS_ENABLE
+char *sdps_envfrom;
+char *sdps_envto;
+#endif /* SDPS_ENABLE */
+
#ifdef NTLM_ENABLE
#include "ntlm.h"
-static tSmbNtlmAuthRequest request;
-static tSmbNtlmAuthChallenge challenge;
-static tSmbNtlmAuthResponse response;
-
/*
* NTLM support by Grant Edwards.
*
static int do_pop3_ntlm(int sock, struct query *ctl,
int msn_instead /** if true, send AUTH MSN, else send AUTH NTLM */)
{
+ tSmbNtlmAuthRequest request;
+ tSmbNtlmAuthChallenge challenge;
+ tSmbNtlmAuthResponse response;
+
char msgbuf[2048];
int result,len;
has_ssl = FALSE;
#endif /* SSL_ENABLE */
+ /* Set this up before authentication quits early. */
+ set_peek_capable(ctl);
+ /*
+ * The "Maillennium POP3/PROXY server" deliberately truncates
+ * TOP replies after c. 64 or 80 kByte (we have varying reports), so
+ * disable TOP. Comcast once spewed marketing babble to the extent
+ * of protecting Outlook -- pretty overzealous to break a protocol
+ * for that that Microsoft could have read, too. Comcast aren't
+ * alone in using this software though.
+ * <http://lists.ccil.org/pipermail/fetchmail-friends/2004-April/008523.html>
+ * (Thanks to Ed Wilts for reminding me of that.)
+ *
+ * The warning is printed once per server, until fetchmail exits.
+ * It will be suppressed when --fetchall or other circumstances make
+ * us use RETR anyhow.
+ *
+ * Matthias Andree
+ */
+ if (peek_capable && strstr(greeting, "Maillennium POP3/PROXY server")) {
+ if ((ctl->server.workarounds & WKA_TOP) == 0) {
+ report(stdout, GT_("Warning: \"Maillennium POP3/PROXY server\" found, using RETR command instead of TOP.\n"));
+ ctl->server.workarounds |= WKA_TOP;
+ }
+ peek_capable = 0;
+ }
if (ctl->server.authenticate == A_SSH) {
return PS_SUCCESS;
}
sleep(3); /* to be _really_ safe, probably need sleep(5)! */
#endif
- set_peek_capable(ctl);
-
/* we're approved */
return(PS_SUCCESS);
}
{
#ifndef MBOX
if (ctl->mailboxes->id) {
- fprintf(stderr,GT_("Option --remote is not supported with POP3\n"));
+ fprintf(stderr,GT_("Option --folder is not supported with POP3\n"));
return(PS_SYNTAX);
}
#endif /* MBOX */
- set_peek_capable(ctl); /* XXX FIXME: is this needed or do we always
- call this from pop3_getauth anyways? */
+
return(do_protocol(ctl, &pop3));
}
#endif /* POP3_ENABLE */