X-Git-Url: http://pileus.org/git/?a=blobdiff_plain;f=etrn.c;h=24c532d306607967af0c7dd47ea1128ac1b09988;hb=87bcf29364c4640edb87cc2186b965d1a564d70c;hp=69175149ab9cbea1f32637c06ae4ce6c5da2494b;hpb=c753710356d36bb624bd975a8409a6d794c00dda;p=~andy%2Ffetchmail diff --git a/etrn.c b/etrn.c index 69175149..24c532d3 100644 --- a/etrn.c +++ b/etrn.c @@ -1,5 +1,5 @@ /* - * etrn.c -- ETRN protocol methods + * etrn.c -- ETRN protocol methods (see RFC 1985) * * For license terms, see the file COPYING in this directory. */ @@ -12,6 +12,7 @@ #include #include #include +#include "gettext.h" #include "fetchmail.h" #include "smtp.h" #include "socket.h" @@ -21,14 +22,15 @@ static int etrn_ok (int sock, char *argbuf) { int ok; - ok = SMTP_ok(sock); + (void)argbuf; + ok = SMTP_ok(sock, SMTP_MODE, TIMEOUT_DEFAULT); if (ok == SM_UNRECOVERABLE) return(PS_PROTOCOL); else return(ok); } -static int etrn_getrange(int sock, struct query *ctl, char *id, +static int etrn_getrange(int sock, struct query *ctl, const char *id, int *countp, int *newp, int *bytes) /* send ETRN and interpret the response */ { @@ -36,15 +38,18 @@ static int etrn_getrange(int sock, struct query *ctl, char *id, char buf [MSGBUFSIZE+1]; struct idlist *qnp; /* pointer to Q names */ - if ((ok = SMTP_ehlo(sock, ctl->server.truename, &opts))) + (void)id; + if ((ok = SMTP_ehlo(sock, SMTP_MODE, fetchmailhost, + ctl->server.esmtp_name, ctl->server.esmtp_password, + &opts))) { - error(0, 0, "%s's SMTP listener does not support ESMTP", + report(stderr, GT_("%s's SMTP listener does not support ESMTP\n"), ctl->server.pollname); return(ok); } else if (!(opts & ESMTP_ETRN)) { - error(0, 0, "%s's SMTP listener does not support ETRN", + report(stderr, GT_("%s's SMTP listener does not support ETRN\n"), ctl->server.pollname); return(PS_PROTOCOL); } @@ -56,7 +61,7 @@ static int etrn_getrange(int sock, struct query *ctl, char *id, * By default, the hostlist has a single entry, the fetchmail host's * canonical DNS name. */ - for (qnp = ctl->smtphunt; qnp; qnp = qnp->next) + for (qnp = ctl->domainlist; qnp; qnp = qnp->next) { /* ship the actual poll and get the response */ gen_send(sock, "ETRN %s", qnp->id); @@ -67,36 +72,39 @@ static int etrn_getrange(int sock, struct query *ctl, char *id, switch(atoi(buf)) { case 250: /* OK, queuing for node started */ - error(0, 0, "Queuing for %s started", qnp->id); + if (outlevel > O_SILENT) + report(stdout, GT_("Queuing for %s started\n"), qnp->id); break; case 251: /* OK, no messages waiting for node */ - error(0, 0, "No messages waiting for %s", qnp->id); + if (outlevel > O_SILENT) + report(stdout, GT_("No messages waiting for %s\n"), qnp->id); return(PS_NOMAIL); case 252: /* OK, pending messages for node started */ case 253: /* OK, pending messages for node started */ - error(0, 0, "Pending messages for %s started", qnp->id); + if (outlevel > O_SILENT) + report(stdout, GT_("Pending messages for %s started\n"), qnp->id); break; case 458: /* Unable to queue messages for node */ - error(0, -1, "Unable to queue messages for node %s",qnp->id); + report(stderr, GT_("Unable to queue messages for node %s\n"),qnp->id); return(PS_PROTOCOL); case 459: /* Node not allowed: */ - error(0, -1, "Node %s not allowed: %s", qnp->id, buf); + report(stderr, GT_("Node %s not allowed: %s\n"), qnp->id, buf); return(PS_AUTHFAIL); case 500: /* Syntax Error */ - error(0, -1, "ETRN syntax error"); + report(stderr, GT_("ETRN syntax error\n")); return(PS_PROTOCOL); case 501: /* Syntax Error in Parameters */ - error(0, -1, "ETRN syntax error in parameters"); + report(stderr, GT_("ETRN syntax error in parameters\n")); return(PS_PROTOCOL); default: - error(0, -1, "Unknown ETRN error %d", atoi(buf)); + report(stderr, GT_("Unknown ETRN error %d\n"), atoi(buf)); return(PS_PROTOCOL); } } @@ -107,29 +115,29 @@ static int etrn_getrange(int sock, struct query *ctl, char *id, static int etrn_logout(int sock, struct query *ctl) /* send logout command */ { + (void)ctl; return(gen_transact(sock, "QUIT")); } -const static struct method etrn = +static const struct method etrn = { "ETRN", /* ESMTP ETRN extension */ -#if INET6 "smtp", /* standard SMTP port */ -#else /* INET6 */ - 25, /* standard SMTP port */ -#endif /* INET6 */ + "smtps", /* ssl SMTP port */ FALSE, /* this is not a tagged protocol */ FALSE, /* this does not use a message delimiter */ etrn_ok, /* parse command response */ - NULL, /* no password canonicalization */ NULL, /* no need to get authentication */ etrn_getrange, /* initialize message sending */ NULL, /* we cannot get a list of sizes */ + NULL, /* we cannot get a list of sizes of subsets */ NULL, /* how do we tell a message is old? */ NULL, /* no way to fetch headers */ NULL, /* no way to fetch body */ NULL, /* no message trailer */ NULL, /* how to delete a message */ + NULL, /* how to mark a message as seen */ + NULL, /* no mailbox support */ etrn_logout, /* log out, we're done */ FALSE, /* no, we can't re-poll */ }; @@ -140,19 +148,19 @@ int doETRN (struct query *ctl) int status; if (ctl->keep) { - fprintf(stderr, "Option --keep is not supported with ETRN\n"); + fprintf(stderr, GT_("Option --keep is not supported with ETRN\n")); return(PS_SYNTAX); } if (ctl->flush) { - fprintf(stderr, "Option --flush is not supported with ETRN\n"); + fprintf(stderr, GT_("Option --flush is not supported with ETRN\n")); return(PS_SYNTAX); } if (ctl->mailboxes->id) { - fprintf(stderr, "Option --remote is not supported with ETRN\n"); + fprintf(stderr, GT_("Option --folder is not supported with ETRN\n")); return(PS_SYNTAX); } if (check_only) { - fprintf(stderr, "Option --check is not supported with ETRN\n"); + fprintf(stderr, GT_("Option --check is not supported with ETRN\n")); return(PS_SYNTAX); } peek_capable = FALSE;