X-Git-Url: http://pileus.org/git/?a=blobdiff_plain;f=pop2.c;h=03d58a18f92334be44b0c57bd5774e1cf6893d18;hb=d31db10231e9ed89f64fdf6e0fb7cae182aa377e;hp=88ad42441830e71aa062617569d1538e1ce4514d;hpb=8da5725d04fae61458a4944de12207256e8dbc2a;p=~andy%2Ffetchmail diff --git a/pop2.c b/pop2.c index 88ad4244..03d58a18 100644 --- a/pop2.c +++ b/pop2.c @@ -17,6 +17,7 @@ #endif #include "fetchmail.h" #include "socket.h" +#include "i18n.h" static int pound_arg, equal_arg; @@ -59,10 +60,25 @@ static int pop2_getauth(int sock, struct query *ctl, char *buf) { int status; - strcpy(shroud, ctl->password); + (void)buf; + + if (ctl->sslproto && !strcasecmp(ctl->sslproto, "tls1") && !ctl->use_ssl) + { + report(stderr, GT_("POP2 does not support STLS. Giving up.\n")); + return PS_SOCKET; + } + + if (ctl->server.authenticate != A_ANY && ctl->server.authenticate != A_PASSWORD) + { + report(stderr, GT_("POP2 only supports password authentication. Giving up.\n")); + return PS_AUTHFAIL; + } + + strlcpy(shroud, ctl->password, sizeof(shroud)); status = gen_transact(sock, "HELO %s %s", ctl->remotename, ctl->password); + memset(shroud, 0x55, sizeof(shroud)); shroud[0] = '\0'; return status; } @@ -71,6 +87,8 @@ 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) { @@ -106,6 +124,7 @@ static int pop2_fetch(int sock, struct query *ctl, int number, int *lenp) { int ok; + (void)ctl; *lenp = 0; ok = gen_transact(sock, "READ %d", number); if (ok) @@ -117,28 +136,26 @@ static int pop2_fetch(int sock, struct query *ctl, int number, int *lenp) 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")); } 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 */ -#if INET6_ENABLE "pop2", /* standard POP2 port */ - "pop2", /* ssl POP2 port */ -#else /* INET6_ENABLE */ - 109, /* standard POP2 port */ - 109, /* ssl POP2 port - not */ -#endif /* INET6_ENABLE */ + "pop2", /* ssl POP2 port - not */ FALSE, /* this is not a tagged protocol */ FALSE, /* does not use message delimiter */ pop2_ok, /* parse command response */ @@ -152,8 +169,9 @@ static const struct method pop2 = pop2_trail, /* eat message trailer */ NULL, /* no POP2 delete method */ 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 */ + FALSE /* no, we can't re-poll */ }; int doPOP2 (struct query *ctl)