From 313a954360f1659a3a27e1b02c8de7d2aaf99e15 Mon Sep 17 00:00:00 2001 From: "Eric S. Raymond" Date: Sat, 4 Oct 1997 14:29:37 +0000 Subject: [PATCH] Enable conditioning out of POP3, IMAP, ETRN. svn path=/trunk/; revision=1477 --- INSTALL | 5 +++++ NEWS | 1 + acconfig.h | 9 +++++++++ configure.in | 21 +++++++++++++++++++++ etrn.c | 2 ++ fetchmail.c | 43 ++++++++++++++++++++++++++++++++++++++++--- pop3.c | 3 ++- rpa.c | 4 ++-- uid.c | 7 +++++++ 9 files changed, 89 insertions(+), 6 deletions(-) diff --git a/INSTALL b/INSTALL index 3ad1cad9..1453ba6d 100644 --- a/INSTALL +++ b/INSTALL @@ -59,6 +59,11 @@ Kerberos lives. If your configuration doesn't match one of the four that fetchmail's configure.in knows about, you may find you have to hand-hack the Makefile a bit. +It is also possible to explicitly condition out the support for +POP3, IMAP, and ETRN (with configure arguments of --disable-POP3, +--disable-IMAP, and --disable-ETRN respectively). However, none +of these wins back more that 3 to 4K on an Intel box. + If you want to build for debugging, CFLAGS=-g LDFLAGS=" " ./configure diff --git a/NEWS b/NEWS index 1ca45724..a8aedb4a 100644 --- a/NEWS +++ b/NEWS @@ -20,6 +20,7 @@ fetchmail-4.3.0 () * Luca Olivetti's --qvirtual option patch for qmail users. * Fixed a bug in the code that was supposed to suppress expansion of RFC822 groupnames. (Thanks to Santiago Vila Doncel for pointing this.) +* It's now possible to explicitly configure out POP3, IMAP, or ETRN There are 286 people on the fetchmail-friends list. diff --git a/acconfig.h b/acconfig.h index e31bd2fb..a9c6ac48 100644 --- a/acconfig.h +++ b/acconfig.h @@ -55,6 +55,15 @@ /* Define if you want POP2 support compiled in */ #undef POP2_ENABLE +/* Define if you want POP3 support compiled in */ +#undef POP3_ENABLE + +/* Define if you want IMAP support compiled in */ +#undef IMAP_ENABLE + +/* Define if you want ETRN support compiled in */ +#undef ETRN_ENABLE + /* Define if you want RPA support compiled in */ #undef RPA_ENABLE diff --git a/configure.in b/configure.in index 16b81a11..32f756b3 100644 --- a/configure.in +++ b/configure.in @@ -154,6 +154,27 @@ AC_ARG_ENABLE(POP2, [with_POP2=no]) test "$with_POP2" = "yes" && AC_DEFINE(POP2_ENABLE) +### use option --disable-POP3 to omit the POP3 support +AC_ARG_ENABLE(POP3, + [ --disable-POP3 don't compile in POP3 protocol support], + [with_POP3=$enableval], + [with_POP3=yes]) +test "$with_POP3" = "yes" && AC_DEFINE(POP3_ENABLE) + +### use option --disable-IMAP to omit the IMAP support +AC_ARG_ENABLE(IMAP, + [ --disable-IMAP don't compile in IMAP protocol support], + [with_IMAP=$enableval], + [with_IMAP=yes]) +test "$with_IMAP" = "yes" && AC_DEFINE(IMAP_ENABLE) + +### use option --disable-ETRN to omit the ETRN support +AC_ARG_ENABLE(ETRN, + [ --disable-ETRN don't compile in ETRN protocol support], + [with_ETRN=$enableval], + [with_ETRN=yes]) +test "$with_ETRN" = "yes" && AC_DEFINE(ETRN_ENABLE) + ### use option --enable-RPA to compile in the RPA support AC_ARG_ENABLE(RPA, [ --enable-RPA compile in RPA protocol support], diff --git a/etrn.c b/etrn.c index 5d9334b9..66f1317d 100644 --- a/etrn.c +++ b/etrn.c @@ -5,6 +5,7 @@ */ #include "config.h" +#ifdef ETRN_ENABLE #include #include #include @@ -158,5 +159,6 @@ int doETRN (struct query *ctl) status = PS_SUCCESS; return(status); } +#endif /* ETRN_ENABLE */ /* etrn.c ends here */ diff --git a/fetchmail.c b/fetchmail.c index 443d16d8..4c4fdd5f 100644 --- a/fetchmail.c +++ b/fetchmail.c @@ -119,9 +119,18 @@ int main (int argc, char **argv) #ifdef POP2_ENABLE printf("+POP2"); #endif /* POP2_ENABLE */ +#ifndef POP3_ENABLE + printf("-POP3"); +#endif /* POP3_ENABLE */ +#ifndef IMAP_ENABLE + printf("-IMAP"); +#endif /* IMAP_ENABLE */ #ifdef RPA_ENABLE printf("+RPA"); #endif /* RPA_ENABLE */ +#ifndef ETRN_ENABLE + printf("-ETRN"); +#endif /* ETRN_ENABLE */ putchar('\n'); /* this is an attempt to help remote debugging */ @@ -423,8 +432,10 @@ int main (int argc, char **argv) if (querystatus == PS_SUCCESS) { successes++; +#ifdef POP3_ENABLE if (!check_only) update_str_lists(ctl); +#endif /* POP3_ENABLE */ } #ifdef linux if (ctl->server.monitor) @@ -707,8 +718,10 @@ static int load_params(int argc, char **argv, int optind) /* initialize UID handling */ if (!versioninfo && (st = prc_filecheck(idfile)) != 0) exit(st); +#ifdef POP3_ENABLE else initialize_saved_lists(querylist, idfile); +#endif /* POP3_ENABLE */ /* if cmd_logfile was explicitly set, use it to override logfile */ if (cmd_logfile) @@ -748,8 +761,10 @@ void termhook(int sig) if (ctl->smtp_socket != -1) SMTP_quit(ctl->smtp_socket); +#ifdef POP3_ENABLE if (!check_only) write_saved_lists(querylist, idfile); +#endif /* POP3_ENABLE */ /* * Craig Metz, the RFC1938 one-time-password guy, points out: @@ -776,11 +791,18 @@ void termhook(int sig) /* * Sequence of protocols to try when autoprobing, most capable to least. */ +static const int autoprobe[] = +{ +#ifdef IMAP_ENABLE + P_IMAP, +#endif /* IMAP_ENABLE */ +#ifdef POP3_ENABLE + P_POP3, +#endif /* POP3_ENABLE */ #ifdef POP2_ENABLE -static const int autoprobe[] = {P_IMAP, P_POP3, P_POP2}; -#else -static const int autoprobe[] = {P_IMAP, P_POP3}; + P_POP2 #endif /* POP2_ENABLE */ +}; static int query_host(struct query *ctl) /* perform fetch transaction with single host */ @@ -818,19 +840,34 @@ static int query_host(struct query *ctl) case P_POP3: case P_APOP: case P_RPOP: +#ifdef POP3_ENABLE return(doPOP3(ctl)); +#else + fprintf(stderr, "POP3 support is not configured.\n"); + return(PS_PROTOCOL); +#endif /* POP3_ENABLE */ break; case P_IMAP: case P_IMAP_K4: +#ifdef IMAP_ENABLE return(doIMAP(ctl)); +#else + fprintf(stderr, "IMAP support is not configured.\n"); + return(PS_PROTOCOL); +#endif /* IMAP_ENABLE */ break; case P_ETRN: +#ifndef ETRN_ENABLE + fprintf(stderr, "ETRN support is not configured.\n"); + return(PS_PROTOCOL); +#else #ifdef HAVE_GETHOSTBYNAME return(doETRN(ctl)); #else fprintf(stderr, "Cannot support ETRN without gethostbyname(2).\n"); return(PS_PROTOCOL); #endif /* HAVE_GETHOSTBYNAME */ +#endif /* ETRN_ENABLE */ default: error(0, 0, "unsupported protocol selected."); return(PS_PROTOCOL); diff --git a/pop3.c b/pop3.c index 9e6fe993..090b292c 100644 --- a/pop3.c +++ b/pop3.c @@ -5,7 +5,7 @@ */ #include "config.h" - +#ifdef POP3_ENABLE #include #include #include @@ -517,5 +517,6 @@ int doPOP3 (struct query *ctl) peek_capable = FALSE; return(do_protocol(ctl, &pop3)); } +#endif /* POP3_ENABLE */ /* pop3.c ends here */ diff --git a/rpa.c b/rpa.c index 99e37f53..e6b015a8 100644 --- a/rpa.c +++ b/rpa.c @@ -10,7 +10,7 @@ #include "config.h" -#ifdef RPA_ENABLE +#if defined(POP3_ENABLE) && defined(RPA_ENABLE) #include #include #include @@ -881,6 +881,6 @@ unsigned char* out; fprintf(stderr,"\n"); } } -#endif /* RPA_ENABLE */ +#endif /* POP3_ENABLE && RPA_ENABLE */ /* rpa.c ends here */ diff --git a/uid.c b/uid.c index ec31d892..01ace720 100644 --- a/uid.c +++ b/uid.c @@ -23,6 +23,9 @@ * useful for making the IMAP4 querying logic UID-oriented, if a future * revision of IMAP forces me to. * + * These functions are also used by the rest of the code to maintain + * string lists. + * * Here's the theory: * * At start of a query, we have a (possibly empty) list of UIDs to be @@ -60,6 +63,7 @@ /* UIDs associated with un-queried hosts */ static struct idlist *scratchlist; +#ifdef POP3_ENABLE void initialize_saved_lists(struct query *hostlist, const char *idfile) /* read file of saved IDs and attach to each host */ { @@ -99,6 +103,7 @@ void initialize_saved_lists(struct query *hostlist, const char *idfile) fclose(tmpfp); } } +#endif /* POP3_ENABLE */ struct idlist *save_str(struct idlist **idl, int num, const char *str) /* save a number/UID pair on the given UID list */ @@ -256,6 +261,7 @@ void append_str_list(struct idlist **idl, struct idlist **nidl) append_str_list(&(*idl)->next, nidl); } +#ifdef POP3_ENABLE void update_str_lists(struct query *ctl) /* perform end-of-query actions on UID lists */ { @@ -294,5 +300,6 @@ void write_saved_lists(struct query *hostlist, const char *idfile) fclose(tmpfp); } } +#endif /* POP3_ENABLE */ /* uid.c ends here */ -- 2.43.2