#if defined(STDC_HEADERS)
#include <stdlib.h>
#endif
+#ifdef HAVE_STRING_H
+#include <string.h>
+#endif
#include "fetchmail.h"
#include "socket.h"
static int pound_arg, equal_arg;
-int pop2_ok (int sock, char *argbuf)
+static int pop2_ok (int sock, char *argbuf)
/* parse POP2 command response */
{
int ok;
return(ok);
}
-int pop2_getauth(int sock, struct query *ctl, char *buf)
+static int pop2_getauth(int sock, struct query *ctl, char *buf)
/* apply for connection authorization */
{
- return(gen_transact(sock,
+ int status;
+
+ (void)buf;
+ strlcpy(shroud, ctl->password, sizeof(shroud));
+ status = gen_transact(sock,
"HELO %s %s",
- ctl->remotename, ctl->password));
+ ctl->remotename, ctl->password);
+ shroud[0] = '\0';
+ return status;
}
-static int pop2_getrange(int sock, struct query *ctl, const char *folder, int*countp, int*newp)
+static int pop2_getrange(int sock, struct query *ctl, const char *folder,
+ int *countp, int *newp, int *bytes)
/* get range of messages to be fetched */
{
+ (void)ctl;
+
/* maybe the user wanted a non-default folder */
if (folder)
{
return(PS_ERROR);
*countp = pound_arg;
- *newp = -1;
+ *bytes = *newp = -1;
return(0);
}
{
int ok;
+ (void)ctl;
*lenp = 0;
ok = gen_transact(sock, "READ %d", number);
if (ok)
return(ok);
}
-static int pop2_trail(int sock, struct query *ctl, int number)
+static int pop2_trail(int sock, struct query *ctl, const char *tag)
/* send acknowledgement for message data */
{
+ (void)ctl;
+ (void)tag;
return(gen_transact(sock, ctl->keep ? "ACKS" : "ACKD"));
}
-const static struct method pop2 =
+static int pop2_logout(int sock, struct query *ctl)
+/* send logout command */
+{
+ (void)ctl;
+ return(gen_transact(sock, "QUIT"));
+}
+
+static const struct method pop2 =
{
"POP2", /* Post Office Protocol v2 */
- 109, /* standard POP2 port */
+ "pop2", /* standard POP2 port */
+ "pop2", /* ssl POP2 port - not */
FALSE, /* this is not a tagged protocol */
FALSE, /* does not use message delimiter */
pop2_ok, /* parse command response */
pop2_getauth, /* get authorization */
pop2_getrange, /* query range of messages */
NULL, /* no way to get sizes */
+ NULL, /* no way to get sizes of subsets */
NULL, /* messages are always new */
pop2_fetch, /* request given message */
NULL, /* no way to fetch body alone */
pop2_trail, /* eat message trailer */
NULL, /* no POP2 delete method */
- "QUIT", /* the POP2 exit command */
+ NULL, /* how to mark a message as seen */
+ NULL, /* how to end mailbox processing */
+ pop2_logout, /* log out, we're done */
+ FALSE /* no, we can't re-poll */
};
int doPOP2 (struct query *ctl)