From c05210483d82bf5f3786725ff80e12444088a701 Mon Sep 17 00:00:00 2001 From: Ken Hornstein Date: Thu, 9 Dec 2010 15:29:29 -0500 Subject: [PATCH] Massive garbage collection. Remove functionality for APOP, RPOP, all NNTP support (including bboards) and MPOP. --- ChangeLog | 28 +++++ configure.in | 40 ------- h/Makefile.in | 2 +- h/mts.h | 14 --- h/nntp.h | 71 ------------- h/popsbr.h | 47 +-------- man/inc.man | 38 ------- man/mh-chart.man | 4 - man/mh-tailor.man | 9 -- man/msgchk.man | 42 -------- sbr/Makefile.in | 3 +- sbr/mts.c | 38 ------- uip/Makefile.in | 9 +- uip/inc.c | 99 +++--------------- uip/msgchk.c | 101 ++++-------------- uip/msh.c | 201 ----------------------------------- uip/mshcmds.c | 105 ------------------- uip/popsbr.c | 301 ++--------------------------------------------------- 18 files changed, 77 insertions(+), 1075 deletions(-) delete mode 100644 h/nntp.h diff --git a/ChangeLog b/ChangeLog index e7ee126..324dddc 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +2010-12-09 Ken Hornstein + + * h/nntp.h, configure.in, h/Makefile.in, h/mts.h, h/popsbr.h, + man/inc.man, man/mh-chart.man, man/mh-tailor.man, man/msgchk.man, + sbr/Makefile.in, sbr/mts.c, uip/Makefile.in, uip/inc.c, uip/msgchk.c, + uip/msh.c, uip/mshcmds.c, uip/popsbr.c: Massive garbage collection. + Remove functionality for APOP, RPOP, all NNTP support (including + bboards), and MPOP. + 2010-12-08 David Levine * uip/whatnowsbr.c: enforce requirement of at least one file @@ -10,6 +19,25 @@ That change allowed mhstore to use the (file)name when extracting attachments. +2010-12-03 Ken Hornstein + + * Everything: remove RCS keywords from files, since they no longer + work after git migration. + +2010-12-02 Ken Hornstein + + * .cvsignore, .gitignore, autogen.sh, */.cvsignore: Update files + for git conversion. + +2010-12-19 Ken Hornstein + + * aclocal.m4, config/Makefile.in, configure.in, man/mh-chart.man, + man/post.man, man/send.man, mts/smtp/Makefile.in, mts/smtp/smtp.c, + mts/smtp/smtp.h, sbr/Makefile.in, uip/Makefile.in, uip/post.c, + uip/send.c, uip/whatnowsbr.c, uip/whom.c: Clean up autoconf + code for handling of compiler flags for SASL, and add support + for TLS to the SMTP MTA. + 2010-11-12 Peter Maydell * man/slocal.man: fix formatting error that meant a diff --git a/configure.in b/configure.in index f866c0a..d68f4f1 100644 --- a/configure.in +++ b/configure.in @@ -37,17 +37,6 @@ dnl -------------------------- dnl CHECK COMMAND LINE OPTIONS dnl -------------------------- -dnl Do you want client-side support for apop? -AC_ARG_ENABLE(apop, AS_HELP_STRING([--enable-apop], - [enable client-side support for POP3 and APOP])) -if test x"$enable_apop" = x"yes"; then - AC_DEFINE(APOP, 1, - [Define to compile client-side support for apop into inc and msgchk.])dnl - APOPLIB=md5.o - enable_pop=yes -fi -AC_SUBST(APOPLIB)dnl - dnl Do you want to debug nmh? AC_ARG_ENABLE(debug, AS_HELP_STRING([--enable-debug],[enable nmh code debugging])) @@ -142,13 +131,6 @@ fi AC_DEFINE_UNQUOTED(BACKUP_PREFIX, "$backup_prefix", [The prefix that is prepended to the name of message files when they are "removed" by rmm. This should typically be `,' or `#'.])dnl -dnl Do you want support for hesiod -AC_ARG_WITH(hesiod, - AS_HELP_STRING([--with-hesiod=DIR],[specify location of Hesiod])) -if test x"$with_hesiod" != x -a x"$with_hesiod" != x"no"; then - AC_DEFINE(HESIOD,1,[Define this to compile support for using Hesiod.])dnl -fi - dnl After we know if we're including apop and kpop support, do pop stuff if test x"$enable_pop" = x"yes"; then AC_DEFINE(POP, 1, @@ -679,28 +661,6 @@ else fi -dnl ---------------- -dnl CHECK FOR HESIOD -dnl ---------------- -if test x"$with_hesiod" != x -a x"$with_hesiod" != x"no"; then - if test x"$with_hesiod" != x"yes"; then - HESIOD_INCLUDES="-I$with_hesiod/include" - HESIOD_LIBS="-L$with_hesiod/lib" - fi - AC_CHECK_FUNC(res_send, - [AC_CHECK_LIB(hesiod, hes_resolve, - [HESIOD_LIBS="$HESIOD_LIBS -lhesiod"], - [AC_MSG_ERROR(Hesiod library not found)], - $HESIOD_LIBS)], - [AC_CHECK_LIB(hesiod, hes_resolve, - [HESIOD_LIBS="$HESIOD_LIBS -lhesiod -lresolv"], - [AC_MSG_ERROR(Hesiod library not found)], - $HESIOD_LIBS -lresolv)]) - -fi -AC_SUBST(HESIOD_INCLUDES)dnl -AC_SUBST(HESIOD_LIBS)dnl - dnl -------------------- dnl CHECK FOR CYRUS-SASL dnl -------------------- diff --git a/h/Makefile.in b/h/Makefile.in index 0988913..b616524 100644 --- a/h/Makefile.in +++ b/h/Makefile.in @@ -10,7 +10,7 @@ VPATH = @srcdir@ # header files included in distribution HDRS = addrsbr.h aliasbr.h crawl_folders.h dropsbr.h fmt_compile.h fmt_scan.h \ md5.h mf.h mh.h mhcachesbr.h mhparse.h mime.h msh.h mts.h \ - netdb.h nmh.h nntp.h picksbr.h popsbr.h prototypes.h rcvmail.h \ + netdb.h nmh.h picksbr.h popsbr.h prototypes.h rcvmail.h \ scansbr.h signals.h tws.h vmhsbr.h utils.h # auxiliary files diff --git a/h/mts.h b/h/mts.h index f782d67..2d2aa95 100644 --- a/h/mts.h +++ b/h/mts.h @@ -61,20 +61,6 @@ extern char *servers; extern char *pophost; /* - * BBoards-specific variables - */ -extern char *bb_domain; - -/* - * POP BBoards-specific variables - */ -#ifdef BPOP -extern char *popbbhost; -extern char *popbbuser; -extern char *popbblist; -#endif /* BPOP */ - -/* * Global MailDelivery File */ extern char *maildelivery; diff --git a/h/nntp.h b/h/nntp.h deleted file mode 100644 index 5464715..0000000 --- a/h/nntp.h +++ /dev/null @@ -1,71 +0,0 @@ -/* - * nntp.h -- Response codes for NNTP server - * - * First digit: - * - * 1xx Informative message - * 2xx Command ok - * 3xx Command ok so far, continue - * 4xx Command was correct, but couldn't be performed - * for some specified reason. - * 5xx Command unimplemented, incorrect, or a - * program error has occured. - * - * Second digit: - * - * x0x Connection, setup, miscellaneous - * x1x Newsgroup selection - * x2x Article selection - * x3x Distribution - * x4x Posting - */ - -#define CHAR_INF '1' -#define CHAR_OK '2' -#define CHAR_CONT '3' -#define CHAR_ERR '4' -#define CHAR_FATAL '5' - -#define INF_HELP 100 /* Help text on way */ -#define INF_DEBUG 199 /* Debug output */ - -#define OK_CANPOST 200 /* Hello; you can post */ -#define OK_NOPOST 201 /* Hello; you can't post */ -#define OK_SLAVE 202 /* Slave status noted */ -#define OK_GOODBYE 205 /* Closing connection */ -#define OK_GROUP 211 /* Group selected */ -#define OK_GROUPS 215 /* Newsgroups follow */ -#define OK_ARTICLE 220 /* Article (head & body) follows */ -#define OK_HEAD 221 /* Head follows */ -#define OK_BODY 222 /* Body follows */ -#define OK_NOTEXT 223 /* No text sent -- stat, next, last */ -#define OK_NEWNEWS 230 /* New articles by message-id follow */ -#define OK_NEWGROUPS 231 /* New newsgroups follow */ -#define OK_XFERED 235 /* Article transferred successfully */ -#define OK_POSTED 240 /* Article posted successfully */ - -#define CONT_XFER 335 /* Continue to send article */ -#define CONT_POST 340 /* Continue to post article */ - -#define ERR_GOODBYE 400 /* Have to hang up for some reason */ -#define ERR_NOGROUP 411 /* No such newsgroup */ -#define ERR_NCING 412 /* Not currently in newsgroup */ -#define ERR_NOCRNT 420 /* No current article selected */ -#define ERR_NONEXT 421 /* No next article in this group */ -#define ERR_NOPREV 422 /* No previous article in this group */ -#define ERR_NOARTIG 423 /* No such article in this group */ -#define ERR_NOART 430 /* No such article at all */ -#define ERR_GOTIT 435 /* Already got that article, don't send */ -#define ERR_XFERFAIL 436 /* Transfer failed */ -#define ERR_XFERRJCT 437 /* Article rejected, don't resend */ -#define ERR_NOPOST 440 /* Posting not allowed */ -#define ERR_POSTFAIL 441 /* Posting failed */ - -#define ERR_COMMAND 500 /* Command not recognized */ -#define ERR_CMDSYN 501 /* Command syntax error */ -#define ERR_ACCESS 502 /* Access to server denied */ -#define ERR_FAULT 503 /* Program fault, command not performed */ - -/* RFC 977 defines this; don't change it. */ - -#define NNTP_STRLEN 512 diff --git a/h/popsbr.h b/h/popsbr.h index 168b8c6..fc06f0b 100644 --- a/h/popsbr.h +++ b/h/popsbr.h @@ -3,24 +3,7 @@ * popsbr.h -- header for POP client subroutines */ -#if 0 -#if !defined(NNTP) && defined(MPOP) -# define command pop_command -# define multiline pop_multiline -#endif -#endif - -#ifdef NNTP -int pop_set (int, int, int, char *); -#else -int pop_set (int, int, int); -#endif - -#ifdef NNTP -int pop_exists (int (*)()); -#endif - -int pop_init (char *, char *, char *, char *, int, int, int, int, char *); +int pop_init (char *, char *, char *, char *, char *, int, int, char *); int pop_fd (char *, int, char *, int); int pop_stat (int *, int *); int pop_retr (int, int (*)(char *)); @@ -30,31 +13,5 @@ int pop_rset (void); int pop_top (int, int, int (*)(char *)); int pop_quit (void); int pop_done (void); - -#ifdef BPOP -int pop_list (int, int *, int *, int *, int *); -#else +int pop_set (int, int, int); int pop_list (int, int *, int *, int *); -#endif - -#ifdef BPOP -int pop_xtnd (int (*)(), char *, ...); -#endif - -#if defined(MPOP) && !defined(NNTP) -int pop_last (void); -#endif - -#if !defined(NNTP) && defined(MPOP) -/* otherwise they are static functions */ -int command(const char *, ...); -int multiline(void); -#endif - -/* - * Flags for the various pop authentication methods - */ -#define POP_APOP -1 -#define POP_PASSWD 0 -#define POP_RPOP 1 -#define POP_KPOP 2 diff --git a/man/inc.man b/man/inc.man index 7e7a787..540b378 100644 --- a/man/inc.man +++ b/man/inc.man @@ -33,8 +33,6 @@ inc \- incorporate new mail .RB [ \-nopack ] .RB [ \-proxy .IR command ] -.RB [ \-apop " | " \-noapop ] -.RB [ \-kpop ] .RB [ \-sasl ] .RB [ \-saslmech .IR mechanism ] @@ -263,42 +261,6 @@ between you and the POP server. .PP If .B nmh -has been compiled with APOP support, the -.B \-apop -switch will cause -.B inc -to use APOP rather than standard POP3 authentication. Under APOP, a -unique string (generally of the format -.RI < pid . timestamp @ hostname > -) is announced by the POP server. -Rather than `USER -.IR user ', -`PASS -.IR password ', -.B inc -sends `APOP -.I user -.IR digest ', -where digest is the MD5 hash of the unique string followed by a -`secret' shared by client and server, essentially equivalent to the user's -password (though an APOP-enabled POP3 server could have separate APOP and plain -POP3 passwords for a single user). -.B \-noapop -disables APOP in cases where it'd otherwise be used. -.PP -If -.B nmh -has been compiled with KPOP support, the -.B \-kpop -switch will allow -.B inc -to use Kerberized POP rather than standard POP3 on a given invocation. -If POPSERVICE was also #defined to "kpop", -.B inc -will be hardwired to always use KPOP. -.PP -If -.B nmh has been compiled with SASL support, the .B \-sasl switch will enable diff --git a/man/mh-chart.man b/man/mh-chart.man index c451f62..793562f 100644 --- a/man/mh-chart.man +++ b/man/mh-chart.man @@ -250,8 +250,6 @@ is equivalent to .RB [ \-pack .IR file ] .RB [ \-nopack ] -.RB [ \-apop " | " \-noapop ] -.RB [ \-kpop ] .RB [ \-sasl ] .RB [ \-saslmech .IR mechanism ] @@ -441,8 +439,6 @@ all/mail/nomail ] .IR hostname ] .RB [ \-user .IR username ] -.RB [ \-apop " | " \-noapop ] -.RB [ \-kpop ] .RB [ \-sasl ] .RB [ \-saslmech .IR mechanism ] diff --git a/man/mh-tailor.man b/man/mh-tailor.man index 31e5b90..15704ee 100644 --- a/man/mh-tailor.man +++ b/man/mh-tailor.man @@ -357,15 +357,6 @@ the named POP service host is consulted. \" BBoards service host. \" .RE -\" .SS "BBoards & The NNTP" -\" This option is only available if you compiled \fInmh\fP with -\" \*(lqbboards:\ nntp\*(rq and \*(lqpop:\ on\*(rq. -\" .PP -\" .BR nntphost : -\" .RS 5 -\" The host which provides the NNTP service. This variable should be set -\" on the NNTP BBoards client host. -\" .RE .SS "File Locking" A few words on locking: .B nmh diff --git a/man/msgchk.man b/man/msgchk.man index 219bfe6..55d4a18 100644 --- a/man/msgchk.man +++ b/man/msgchk.man @@ -18,8 +18,6 @@ all/mail/nomail ] .IR hostname ] .RB [ \-user .IR username ] -.RB [ \-apop " | " \-noapop ] -.RB [ \-kpop ] .RB [ \-sasl ] .RB [ \-saslmech .IR mechanism ] @@ -134,46 +132,6 @@ POP server. .PP If .B nmh -has been compiled with APOP support, the -.B \-apop -switch will cause -.B msgchk -to use APOP rather than standard POP3 authentication. Under APOP, -a unique string (generally of the format -.RI < pid . timestamp @ hostname >) -is announced by the POP server. -Rather than `USER -.IR user ', -`PASS -.IR password ', -.B msgchk -sends `APOP -.I user -.IR digest ', -where digest is the MD5 hash of the unique string -followed by a `secret' shared by client and server, essentially equivalent to -the user's password (though an APOP-enabled POP3 server could have separate APOP -and plain POP3 passwords for a single user). -.B \-noapop -disables APOP in cases -where it'd otherwise be used. -.PP -If -.B nmh -has been compiled with KPOP support, the -.B \-kpop -switch will allow -.B msgchk -to use Kerberized POP rather than standard POP3 on a given -invocation. If -.B POPSERVICE -was also #defined to "kpop", -.B msgchk -will be -hardwired to always use KPOP. -.PP -If -.B nmh has been compiled with SASL support, the .B \-sasl switch will enable diff --git a/sbr/Makefile.in b/sbr/Makefile.in index 95c220d..e2f8cb4 100644 --- a/sbr/Makefile.in +++ b/sbr/Makefile.in @@ -17,7 +17,6 @@ etcdir = @sysconfdir@ CC = @CC@ CFLAGS = @CFLAGS@ DEFS = @DEFS@ -HESIOD_INCLUDES = @HESIOD_INCLUDES@ # for mts CONFIGDEFS = -DNMHETCDIR='"$(etcdir)"' -DMAILSPOOL='"$(mailspool)"' -DSENDMAILPATH='"$(sendmailpath)"' INCLUDES = -I.. -I. -I$(top_srcdir) @CPPFLAGS@ @@ -37,7 +36,7 @@ mailspool = @mailspool@ sendmailpath = @sendmailpath@ COMPILE = $(CC) -c $(DEFS) $(INCLUDES) $(CFLAGS) -COMPILE2 = $(CC) -c $(DEFS) $(CONFIGDEFS) $(INCLUDES) $(HESIOD_INCLUDES) $(CFLAGS) +COMPILE2 = $(CC) -c $(DEFS) $(CONFIGDEFS) $(INCLUDES) $(CFLAGS) diff --git a/sbr/mts.c b/sbr/mts.c index 6a9d84f..cd2a3d8 100644 --- a/sbr/mts.c +++ b/sbr/mts.c @@ -88,21 +88,6 @@ char *servers = "localhost \01localnet"; char *pophost = ""; /* - * BBoards-specific variables - */ -char *bb_domain = ""; - - -/* - * POP BBoards-specific variables - */ -#ifdef BPOP -char *popbbhost = ""; -char *popbbuser = ""; -char *popbblist = nmhetcdir(/hosts.popbb); -#endif /* BPOP */ - -/* * Global MailDelivery file */ char *maildelivery = nmhetcdir(/maildelivery); @@ -146,17 +131,6 @@ static struct bind binds[] = { { "clientname", &clientname }, { "servers", &servers }, { "pophost", &pophost }, - { "bbdomain", &bb_domain }, - -#ifdef BPOP - { "popbbhost", &popbbhost }, - { "popbbuser", &popbbuser }, - { "popbblist", &popbblist }, -#endif - -#ifdef NNTP - { "nntphost", &popbbhost }, -#endif { "maildelivery", &maildelivery }, { "everyone", &everyone }, @@ -401,21 +375,9 @@ getuserinfo (void) register char *np; register struct passwd *pw; -#ifdef KPOP - uid_t uid; - - uid = getuid (); - if (uid == geteuid () && (cp = getenv ("USER")) != NULL - && (pw = getpwnam (cp)) != NULL) - strncpy (username, cp, sizeof(username)); - else if ((pw = getpwuid (uid)) == NULL - || pw->pw_name == NULL - || *pw->pw_name == '\0') { -#else /* KPOP */ if ((pw = getpwuid (getuid ())) == NULL || pw->pw_name == NULL || *pw->pw_name == '\0') { -#endif /* KPOP */ strncpy (username, "unknown", sizeof(username)); snprintf (fullname, sizeof(fullname), "The Unknown User-ID (%d)", (int) getuid ()); diff --git a/uip/Makefile.in b/uip/Makefile.in index 31515ba..370fc15 100644 --- a/uip/Makefile.in +++ b/uip/Makefile.in @@ -17,24 +17,21 @@ etcdir = @sysconfdir@ CC = @CC@ CFLAGS = @CFLAGS@ DEFS = @DEFS@ -HESIOD_INCLUDES = @HESIOD_INCLUDES@ -INCLUDES = -I.. -I$(srcdir) -I$(top_srcdir) $(HESIOD_INCLUDES) @CPPFLAGS@ +INCLUDES = -I.. -I$(srcdir) -I$(top_srcdir) @CPPFLAGS@ LDFLAGS = @LDFLAGS@ LIBS = @LIBS@ MTSLIB = ../mts/libmts.a -HESIOD_LIBS = @HESIOD_LIBS@ NDBM_LIBS = @NDBM_LIBS@ LOCALLIBS = ../config/version.o ../config/config.o $(MTSLIB) ../sbr/libmh.a -LINKLIBS = $(LOCALLIBS) $(HESIOD_LIBS) $(LIBS) +LINKLIBS = $(LOCALLIBS) $(LIBS) LINT = @LINT@ LINTFLAGS = @LINTFLAGS@ TERMLIB = @TERMLIB@ LEXLIB = @LEXLIB@ -APOPLIB = @APOPLIB@ -POPLIB = @POPLIB@ $(APOPLIB) +POPLIB = @POPLIB@ COMPILE = $(CC) -c $(DEFS) $(INCLUDES) $(CFLAGS) LINK = $(CC) $(LDFLAGS) -o $@ diff --git a/uip/inc.c b/uip/inc.c index f23a565..38ab687 100644 --- a/uip/inc.c +++ b/uip/inc.c @@ -35,10 +35,6 @@ # include #endif -#ifdef HESIOD -# include -#endif - #include #include #include @@ -53,24 +49,6 @@ # define POPminc(a) 0 #endif -#ifndef RPOP -# define RPOPminc(a) (a) -#else -# define RPOPminc(a) 0 -#endif - -#ifndef APOP -# define APOPminc(a) (a) -#else -# define APOPminc(a) 0 -#endif - -#ifndef KPOP -# define KPOPminc(a) (a) -#else -# define KPOPminc(a) 0 -#endif - #ifndef CYRUS_SASL # define SASLminc(a) (a) #else @@ -100,14 +78,8 @@ static struct swit switches[] = { { "pack file", POPminc (-4) }, #define NPACKSW 10 { "nopack", POPminc (-6) }, -#define APOPSW 11 - { "apop", APOPminc (-4) }, -#define NAPOPSW 12 - { "noapop", APOPminc (-6) }, -#define RPOPSW 13 - { "rpop", RPOPminc (-4) }, -#define NRPOPSW 14 - { "norpop", RPOPminc (-6) }, +#define PORTSW 13 + { "port name/number", POPminc (-4) }, #define SILSW 15 { "silent", 0 }, #define NSILSW 16 @@ -124,8 +96,6 @@ static struct swit switches[] = { { "help", 0 }, #define SNOOPSW 22 { "snoop", -5 }, -#define KPOPSW 23 - { "kpop", KPOPminc (-4) }, #define SASLSW 24 { "sasl", SASLminc(-4) }, #define SASLMECHSW 25 @@ -205,12 +175,6 @@ if (geteuid() != 0) DROPGROUPPRIVS() #define SAVEGROUPPRIVS() #endif /* not MAILGROUP */ -#ifdef POP -#define DROPUSERPRIVS() setuid(getuid()) -#else -#define DROPUSERPRIVS() -#endif - /* these variables have to be globals so that done() can correctly clean up the lockfile */ static int locked = 0; static char *newmail; @@ -234,11 +198,11 @@ main (int argc, char **argv) { int chgflag = 1, trnflag = 1; int noisy = 1, width = 0; - int rpop, i, hghnum = 0, msgnum = 0; - int kpop = 0, sasl = 0; + int i, hghnum = 0, msgnum = 0; + int sasl = 0; char *cp, *maildir = NULL, *folder = NULL; char *format = NULL, *form = NULL; - char *host = NULL, *user = NULL, *proxy = NULL; + char *host = NULL, *port = NULL, *user = NULL, *proxy = NULL; char *audfile = NULL, *from = NULL, *saslmech = NULL; char buf[BUFSIZ], **argp, *nfs, **arguments; struct msgs *mp = NULL; @@ -257,10 +221,6 @@ main (int argc, char **argv) FILE *mhe = NULL; #endif -#ifdef HESIOD - struct hes_postoffice *po; -#endif - done=inc_done; /* absolutely the first thing we do is save our privileges, @@ -291,11 +251,6 @@ main (int argc, char **argv) */ if ((MAILHOST_env_variable = getenv("MAILHOST")) != NULL) pophost = MAILHOST_env_variable; -# ifdef HESIOD - else if ((po = hes_getmailhost(getusername())) != NULL && - strcmp(po->po_type, "POP") == 0) - pophost = po->po_host; -# endif /* HESIOD */ /* * If there is a valid "pophost" entry in mts.conf, * then use it as the default host. @@ -307,8 +262,6 @@ main (int argc, char **argv) snoop++; #endif /* POP */ - rpop = 0; - while ((cp = *argp++)) { if (*cp == '-') { switch (smatch (++cp, switches)) { @@ -397,6 +350,12 @@ main (int argc, char **argv) if (!(host = *argp++) || *host == '-') adios (NULL, "missing argument to %s", argp[-2]); continue; + + case PORTSW: + if (!(host = *argp++) || *port == '-') + adios (NULL, "missing argument to %s", argp[-2]); + continue; + case USERSW: if (!(user = *argp++) || *user == '-') adios (NULL, "missing argument to %s", argp[-2]); @@ -417,24 +376,6 @@ main (int argc, char **argv) #endif /* POP */ continue; - case APOPSW: - rpop = -1; - continue; - case NAPOPSW: - rpop = 0; - continue; - - case RPOPSW: - rpop = 1; - continue; - case NRPOPSW: - rpop = 0; - continue; - - case KPOPSW: - kpop = 1; - continue; - case SNOOPSW: snoop++; continue; @@ -469,8 +410,6 @@ main (int argc, char **argv) #ifdef POP if (host && !*host) host = NULL; - if (from || !host || rpop <= 0) - DROPUSERPRIVS(); #endif /* POP */ /* guarantee dropping group priveleges; we might not have done so earlier */ @@ -496,10 +435,7 @@ main (int argc, char **argv) if (inc_type == INC_POP) { if (user == NULL) user = getusername (); - if ( strcmp( POPSERVICE, "kpop" ) == 0 ) { - kpop = 1; - } - if (kpop || sasl || ( rpop > 0)) + if (sasl) pass = getusername (); else ruserpass (host, &user, &pass); @@ -507,16 +443,14 @@ main (int argc, char **argv) /* * initialize POP connection */ - if (pop_init (host, user, pass, proxy, snoop, kpop ? 1 : rpop, kpop, - sasl, saslmech) == NOTOK) + if (pop_init (host, port, user, pass, proxy, snoop, sasl, + saslmech) == NOTOK) adios (NULL, "%s", response); /* Check if there are any messages */ if (pop_stat (&nmsgs, &nbytes) == NOTOK) adios (NULL, "%s", response); - if (rpop > 0) - DROPUSERPRIVS(); if (nmsgs == 0) { pop_quit(); adios (NULL, "no mail to incorporate"); @@ -620,10 +554,9 @@ go_to_it: #ifdef POP fprintf (aud, from ? "<> %s -ms %s\n" - : host ? "<> %s -host %s -user %s%s\n" + : host ? "<> %s -host %s -user %s\n" : "<> %s\n", - dtimenow (0), from ? from : host, user, - rpop < 0 ? " -apop" : rpop > 0 ? " -rpop" : ""); + dtimenow (0), from ? from : host, user); #else /* POP */ fprintf (aud, from ? "<> %s -ms %s\n" : "<> %s\n", dtimenow (0), from); diff --git a/uip/msgchk.c b/uip/msgchk.c index e052b42..fa2336f 100644 --- a/uip/msgchk.c +++ b/uip/msgchk.c @@ -16,34 +16,12 @@ # include #endif -#ifdef HESIOD -# include -#endif - #ifndef POP # define POPminc(a) (a) #else # define POPminc(a) 0 #endif -#ifndef RPOP -# define RPOPminc(a) (a) -#else -# define RPOPminc(a) 0 -#endif - -#ifndef APOP -# define APOPminc(a) (a) -#else -# define APOPminc(a) 0 -#endif - -#ifndef KPOP -# define KPOPminc(a) (a) -#else -# define KPOPminc(a) 0 -#endif - #ifndef CYRUS_SASL # define SASLminc(a) (a) #else @@ -63,22 +41,14 @@ static struct swit switches[] = { { "host hostname", POPminc (-4) }, #define USERSW 5 { "user username", POPminc (-4) }, -#define APOPSW 6 - { "apop", APOPminc (-4) }, -#define NAPOPSW 7 - { "noapop", APOPminc (-6) }, -#define RPOPSW 8 - { "rpop", RPOPminc (-4) }, -#define NRPOPSW 9 - { "norpop", RPOPminc (-6) }, +#define PORTSW 8 + { "port name/number", POPminc(-4) }, #define VERSIONSW 10 { "version", 0 }, #define HELPSW 11 { "help", 0 }, #define SNOOPSW 12 { "snoop", -5 }, -#define KPOPSW 13 - { "kpop", KPOPminc (-4) }, #define SASLSW 14 { "sasl", SASLminc(-4) }, #define SASLMECHSW 15 @@ -115,7 +85,8 @@ static int donote (char *, int); static int checkmail (char *, char *, int, int, int); #ifdef POP -static int remotemail (char *, char *, char *, int, int, int, int, int, int, char *); +static int remotemail (char *, char *, char *, char *, int, int, int, int, + char *); #endif @@ -123,11 +94,10 @@ int main (int argc, char **argv) { int datesw = 1, notifysw = NT_ALL; - int rpop, status = 0; - int kpop = 0, sasl = 0; + int status = 0, sasl = 0; int snoop = 0, vecp = 0; uid_t uid; - char *cp, *host = NULL, *user, *proxy = NULL; + char *cp, *host = NULL, *port = NULL, *user, *proxy = NULL; char buf[BUFSIZ], *saslmech = NULL; char **argp, **arguments, *vec[MAXVEC]; struct passwd *pw; @@ -157,8 +127,6 @@ main (int argc, char **argv) snoop++; #endif - rpop = 0; - while ((cp = *argp++)) { if (*cp == '-') { switch (smatch (++cp, switches)) { @@ -199,6 +167,12 @@ main (int argc, char **argv) if (!(host = *argp++) || *host == '-') adios (NULL, "missing argument to %s", argp[-2]); continue; + + case PORTSW: + if (!(port = *argp++) || *port == '-') + adios (NULL, "missing argument to %s", argp[-2]); + continue; + case USERSW: if (!(cp = *argp++) || *cp == '-') adios (NULL, "missing argument to %s", argp[-2]); @@ -208,24 +182,6 @@ main (int argc, char **argv) vec[vecp++] = cp; continue; - case APOPSW: - rpop = -1; - continue; - case NAPOPSW: - rpop = 0; - continue; - - case RPOPSW: - rpop = 1; - continue; - case NRPOPSW: - rpop = 0; - continue; - - case KPOPSW: - kpop = 1; - continue; - case SNOOPSW: snoop++; continue; @@ -256,20 +212,6 @@ main (int argc, char **argv) * If -host is not specified by user */ if (!host || !*host) { -# ifdef HESIOD - /* - * Scheme is: - * use MAILHOST environment variable if present, - * else try Hesiod. - * If that fails, use the default (if any) - * provided by mts.conf in mts_init() - */ - if ((tmphost = getenv("MAILHOST")) != NULL) - pophost = tmphost; - else if ((po = hes_getmailhost(vecp ? vec[0] : user)) != NULL && - strcmp(po->po_type, "POP") == 0) - pophost = po->po_host; -# endif /* HESIOD */ /* * If "pophost" is specified in mts.conf, * use it as default value. @@ -279,8 +221,6 @@ main (int argc, char **argv) } if (!host || !*host) host = NULL; - if (!host || rpop <= 0) - setuid (uid); #endif /* POP */ if (vecp != 0) @@ -288,16 +228,13 @@ main (int argc, char **argv) #ifdef POP if (host) { - if ( strcmp( POPSERVICE, "kpop" ) == 0 ) { - kpop = 1; - } if (vecp == 0) { - status = remotemail (host, user, proxy, rpop, kpop, notifysw, 1, + status = remotemail (host, port, user, proxy, notifysw, 1, snoop, sasl, saslmech); } else { for (vecp = 0; vec[vecp]; vecp++) - status += remotemail (host, vec[vecp], proxy, rpop, kpop, - notifysw, 0, snoop, sasl, saslmech); + status += remotemail (host, port, vec[vecp], proxy, notifysw, 0, + snoop, sasl, saslmech); } } else { #endif /* POP */ @@ -418,21 +355,21 @@ checkmail (char *user, char *home, int datesw, int notifysw, int personal) extern char response[]; static int -remotemail (char *host, char *user, char *proxy, int rpop, int kpop, int notifysw, int personal, int snoop, int sasl, char *saslmech) +remotemail (char *host, char *port, char *user, char *proxy, int notifysw, + int personal, int snoop, int sasl, char *saslmech) { int nmsgs, nbytes, status; char *pass = NULL; if (user == NULL) user = getusername (); - if (kpop || sasl || (rpop > 0)) + if (sasl) pass = getusername (); else ruserpass (host, &user, &pass); /* open the POP connection */ - if (pop_init (host, user, pass, proxy, snoop, kpop ? 1 : rpop, kpop, - sasl, saslmech) == NOTOK + if (pop_init (host, user, port, pass, proxy, snoop, sasl, saslmech) == NOTOK || pop_stat (&nmsgs, &nbytes) == NOTOK /* check for messages */ || pop_quit () == NOTOK) { /* quit POP connection */ advise (NULL, "%s", response); diff --git a/uip/msh.c b/uip/msh.c index aed4bc7..c2d4e1a 100644 --- a/uip/msh.c +++ b/uip/msh.c @@ -118,11 +118,6 @@ static int windows[NWIN + 1]; static jmp_buf peerenv; -#ifdef BPOP -int pmsh = 0; /* BPOP enabled */ -extern char response[]; -#endif /* BPOP */ - /* * PARENT */ @@ -193,14 +188,6 @@ static void msh (int); static int read_map (char *, long); static int read_file (long, int); -#ifdef BPOP -# ifdef NNTP -static int pop_statmsg (char *); -# endif /* NNTP */ -static int read_pop (void); -static int pop_action (char *); -#endif /* BPOP */ - static void m_gMsgs (int); FILE *msh_ready (int, int); static int check_folder (int); @@ -240,9 +227,6 @@ main (int argc, char **argv) int id = 0, scansw = 0, vmh1 = 0, vmh2 = 0; char *cp, *file = NULL, *folder = NULL; char **argp, **arguments, buf[BUFSIZ]; -#ifdef BPOP - int pmsh1 = 0, pmsh2 = 0; -#endif #ifdef LOCALE setlocale(LC_ALL, ""); @@ -324,18 +308,10 @@ main (int argc, char **argv) case PREADSW: if (!(cp = *argp++) || *cp == '-') adios (NULL, "missing argument to %s", argp[-2]); -#ifdef BPOP - if ((pmsh1 = atoi (cp)) < 1) - adios (NULL, "bad argument %s %s", argp[-2], cp); -#endif /* BPOP */ continue; case PWRITSW: if (!(cp = *argp++) || *cp == '-') adios (NULL, "missing argument to %s", argp[-2]); -#ifdef BPOP - if ((pmsh2 = atoi (cp)) < 1) - adios (NULL, "bad argument %s %s", argp[-2], cp); -#endif /* BPOP */ continue; case TCURSW: @@ -386,20 +362,6 @@ main (int argc, char **argv) #endif /* SIGTSTP */ } -#ifdef BPOP - if (pmsh = pmsh1 && pmsh2) { - cp = getenv ("MHPOPDEBUG"); -#ifdef NNTP - if (pop_set (pmsh1, pmsh2, cp && *cp, myname) == NOTOK) -#else /* NNTP */ - if (pop_set (pmsh1, pmsh2, cp && *cp) == NOTOK) -#endif /* NNTP */ - padios (NULL, "%s", response); - if (folder) - file = folder, folder = NULL; - } -#endif /* BPOP */ - if (folder) fsetup (folder); else @@ -725,19 +687,6 @@ setup (char *file) { int i, msgp; struct stat st; -#ifdef BPOP - char tmpfil[BUFSIZ]; -#endif - -#ifdef BPOP - if (pmsh) { - char *tfile = m_mktemp2(NULL, invo_name, NULL, &fp); - if (tfile == NULL) padios("msh", "unable to create temporary file"); - unlink(tfile); - strncpy(tmpfil, tfile, sizeof(tmpfil)); - } - else -#endif /* BPOP */ if ((fp = fopen (file, "r")) == NULL) padios (file, "unable to read"); #ifdef FIOCLEX @@ -768,41 +717,13 @@ setup (char *file) mp->foldpath = getcpy (myname ? myname : file); clear_folder_flags (mp); -#ifdef BPOP - if (pmsh) - set_readonly (mp); - else { -#endif /* BPOP */ stat (file, &st); if (st.st_uid != getuid () || access (file, W_OK) == NOTOK) set_readonly (mp); -#ifdef BPOP - } -#endif /* BPOP */ mp->lowoff = 1; mp->hghoff = mp->hghmsg + 1; -#ifdef BPOP - if (pmsh) { -#ifndef NNTP - for (i = mp->lowmsg; i <= mp->hghmsg; i++) { - Msgs[i].m_top = i; - clear_msg_flags (mp, i); - set_exists (mp, i); - set_virtual (mp, i); - } -#else /* NNTP */ - for (i = mp->lowmsg; i <= mp->hghmsg; i++) { - if (Msgs[i].m_top) /* set in read_pop() */ - clear_msg_flags (mp, i); - set_exists (mp, i); - set_virtual (mp, i); - } -#endif /* NNTP */ - } - else -#endif /* BPOP */ for (i = mp->lowmsg; i <= mp->hghmsg; i++) { clear_msg_flags (mp, i); set_exists (mp, i); @@ -827,11 +748,6 @@ read_map (char *file, long size) register struct drop *dp, *mp; struct drop *rp; -#ifdef BPOP - if (pmsh) - return read_pop (); -#endif /* BPOP */ - if ((i = map_read (file, size, &rp, 1)) == 0) return 0; @@ -859,11 +775,6 @@ read_file (long pos, int msgp) register struct drop *dp, *mp; struct drop *rp; -#ifdef BPOP - if (pmsh) - return (msgp - 1); -#endif /* BPOP */ - if ((i = mbx_read (fp, pos, &rp, 1)) <= 0) return (msgp - 1); @@ -883,47 +794,6 @@ read_file (long pos, int msgp) } -#ifdef BPOP -#ifdef NNTP -static int pop_base = 0; - -static int -pop_statmsg (char *s) -{ - register int i, n; - - n = (i = atoi (s)) - pop_base; /* s="nnn header-line..." */ - Msgs[n].m_top = Msgs[n].m_bboard_id = i; -} - -#endif /* NNTP */ - -static int -read_pop (void) -{ - int nmsgs, nbytes; - - if (pop_stat (&nmsgs, &nbytes) == NOTOK) - padios (NULL, "%s", response); - - m_gMsgs (nmsgs); - -#ifdef NNTP /* this makes read_pop() do some real work... */ - pop_base = nbytes - 1; /* nmsgs=last-first+1, nbytes=first */ - pop_exists (pop_statmsg); -#endif /* NNTP */ - return nmsgs; -} - - -static int -pop_action (char *s) -{ - fprintf (yp, "%s\n", s); -} -#endif /* BPOP */ - - static void m_gMsgs (int n) { @@ -954,10 +824,6 @@ msh_ready (int msgnum, int full) register int msgp; int fd; char *cp; -#ifdef BPOP - char tmpfil[BUFSIZ]; - long pos1, pos2; -#endif if (yp) { fclose (yp); @@ -989,50 +855,6 @@ msh_ready (int msgnum, int full) return yp; } -#ifdef BPOP - if (pmsh && is_virtual (mp, msgnum)) { - if (Msgs[msgnum].m_top == 0) - padios (NULL, "msh_ready (%d, %d) botch", msgnum, full); - if (!full) { - char *tfile = m_mktemp2(NULL, invo_name, NULL, &yp); - if (tfile == NULL) padios("msh", "unable to create temporary file"); - unlink(tfile); - strncpy(tmpfil, tfile, sizeof(tmpfil)); - - if (pop_top (Msgs[msgnum].m_top, 4, pop_action) == NOTOK) - padios (NULL, "%s", response); - - m_eomsbr ((int (*)()) 0); /* XXX */ - msg_style = MS_DEFAULT; /* .. */ - fseek (yp, 0L, SEEK_SET); - return yp; - } - - fseek (fp, 0L, SEEK_END); - fwrite (mmdlm1, 1, strlen (mmdlm1), fp); - if (fflush (fp)) - padios ("temporary file", "write error on"); - fseek (fp, 0L, SEEK_END); - pos1 = ftell (fp); - - yp = fp; - if (pop_retr (Msgs[msgnum].m_top, pop_action) == NOTOK) - padios (NULL, "%s", response); - yp = NULL; - - fseek (fp, 0L, SEEK_END); - pos2 = ftell (fp); - fwrite (mmdlm2, 1, strlen (mmdlm2), fp); - if (fflush (fp)) - padios ("temporary file", "write error on"); - - Msgs[msgnum].m_start = pos1; - Msgs[msgnum].m_stop = pos2; - - unset_virtual (mp, msgnum); - } -#endif /* BPOP */ - m_eomsbr ((int (*)()) 0); /* XXX */ fseek (fp, Msgs[msgnum].m_start, SEEK_SET); return fp; @@ -1045,11 +867,6 @@ check_folder (int scansw) int seqnum, i, low, hgh, msgp; struct stat st; -#ifdef BPOP - if (pmsh) - return 0; -#endif /* BPOP */ - if (fmsh) { if (stat (mp->foldpath, &st) == NOTOK) padios (mp->foldpath, "unable to stat"); @@ -1202,21 +1019,9 @@ readid (int msgnum) int i, state; char *bp, buf[BUFSIZ], name[NAMESZ]; register FILE *zp; -#ifdef BPOP - int arg1, arg2, arg3; -#endif if (Msgs[msgnum].m_bboard_id) return Msgs[msgnum].m_bboard_id; -#ifdef BPOP - if (pmsh) { - if (Msgs[msgnum].m_top == 0) - padios (NULL, "readid (%d) botch", msgnum); - if (pop_list (Msgs[msgnum].m_top, (int *) 0, &arg1, &arg2, &arg3) == OK - && arg3 > 0) - return (Msgs[msgnum].m_bboard_id = arg3); - } -#endif /* BPOP */ zp = msh_ready (msgnum, 0); for (state = FLD;;) @@ -1798,12 +1603,6 @@ m_reset (void) write_ids (); folder_free (mp); /* free folder/message structure */ myname = NULL; -#ifdef BPOP - if (pmsh) { - pop_done (); - pmsh = 0; - } -#endif /* BPOP */ } diff --git a/uip/mshcmds.c b/uip/mshcmds.c index 0190bee..3bd4db3 100644 --- a/uip/mshcmds.c +++ b/uip/mshcmds.c @@ -27,17 +27,6 @@ static char delim3[] = "-------"; /* from burst.c */ static int mhlnum; static FILE *mhlfp; -#if defined(NNTP) && defined(MPOP) -# undef MPOP -#endif - -#ifdef MPOP -# ifdef BPOP -extern int pmsh; -extern char response[]; -# endif -#endif /* MPOP */ - /* * Type for a compare function for qsort. This keeps * the compiler happy. @@ -1999,12 +1988,6 @@ rmm (void) if (is_selected (mp, msgnum)) { set_deleted (mp, msgnum); unset_exists (mp, msgnum); -#ifdef MPOP -#ifdef BPOP - if (pmsh && pop_dele (msgnum) != OK) - fprintf (stderr, "%s", response); -#endif -#endif /* MPOP */ } if ((mp->nummsg -= mp->numsel) <= 0) { @@ -2063,11 +2046,6 @@ scancmd (char **args) char *cp, *form = NULL, *format = NULL; char buf[BUFSIZ], *nfs, *msgs[MAXARGS]; register FILE *zp; -#ifdef MPOP -#ifdef BPOP - static int p_optim = 0; -#endif -#endif /* MPOP */ static int s_optim = 0; static char *s_form = NULL, *s_format = NULL; @@ -2148,79 +2126,10 @@ scancmd (char **args) s_form = form ? getcpy (form) : NULL; s_format = format ? getcpy (format) : NULL; -#ifdef MPOP -#ifdef BPOP - if (pmsh) { - int i; - char *dp, *ep, *fp; - - if (width == 0) - width = sc_width (); - - for (dp = nfs, i = 0; *dp; dp++, i++) - if (*dp == '\\' || *dp == '"' || *dp == '\n') - i++; - i++; - ep = mh_xmalloc ((unsigned) i); - for (dp = nfs, fp = ep; *dp; dp++) { - if (*dp == '\n') { - *fp++ = '\\', *fp++ = 'n'; - continue; - } - if (*dp == '"' || *dp == '\\') - *fp++ = '\\'; - *fp++ = *dp; - } - *fp = NULL; - - if (pop_command ("XTND SCAN %d \"%s\"", width, ep) == OK) - p_optim = 1; - - free (ep); - } -#endif -#endif /* MPOP */ } else optim = equiv (s_form, form) && equiv (s_format, format); -#ifdef MPOP -#ifdef BPOP - if (p_optim && optim) { - for (msgnum = mp->lowmsg; msgnum <= mp->hghmsg; msgnum++) - if (!is_selected(mp, msgnum) || Msgs[msgnum].m_scanl) - break; - if (msgnum > mp->hghmsg && pop_command ("LIST") == OK) { - fprintf (stderr, "Stand-by..."); - fflush (stderr); - - for (;;) { - int size; - - switch (pop_multiline ()) { - case NOTOK: - fprintf (stderr, "%s", response); - /* and fall... */ - case DONE: - fprintf (stderr,"\n"); - break; - - case OK: - if (sscanf (response, "%d %d", &msgnum, &size) == 2 - && mp->lowmsg <= msgnum - && msgnum <= mp->hghmsg - && (cp = strchr(response, '#')) - && *++cp) - Msgs[msgnum].m_scanl = concat (cp, "\n", NULL); - continue; - } - break; - } - } - } -#endif -#endif /* MPOP */ - interrupted = 0; for (msgnum = mp->lowsel; msgnum <= mp->hghsel && !interrupted; @@ -2229,20 +2138,6 @@ scancmd (char **args) if (optim && Msgs[msgnum].m_scanl) printf ("%s", Msgs[msgnum].m_scanl); else { -#ifdef MPOP -#ifdef BPOP - if (p_optim - && optim - && is_virtual (mp, msgnum) - && pop_command ("LIST %d", msgnum) == OK - && (cp = strchr(response, '#')) - && *++cp) { - Msgs[msgnum].m_scanl = concat (cp, "\n", NULL); - printf ("%s", Msgs[msgnum].m_scanl); - continue; - } -#endif -#endif /* MPOP */ zp = msh_ready (msgnum, 0); switch (state = scan (zp, msgnum, 0, nfs, width, diff --git a/uip/popsbr.c b/uip/popsbr.c index 3ac88be..2d03efd 100644 --- a/uip/popsbr.c +++ b/uip/popsbr.c @@ -9,18 +9,6 @@ #include #include -#if defined(NNTP) && !defined(PSHSBR) -# undef NNTP -#endif - -#ifdef NNTP /* building pshsbr.o from popsbr.c */ -# include -#endif /* NNTP */ - -#if !defined(NNTP) && defined(APOP) -# include -#endif - #ifdef CYRUS_SASL # include # include @@ -42,21 +30,6 @@ char response[BUFSIZ]; static FILE *input; static FILE *output; -#define targ_t char * - -#if !defined(NNTP) && defined(MPOP) -# define command pop_command -# define multiline pop_multiline -#endif - -#ifdef NNTP -# ifdef BPOP /* stupid */ -static int xtnd_last = -1; -static int xtnd_first = 0; -static char xtnd_name[512]; /* INCREDIBLE HACK!! */ -# endif -#endif /* NNTP */ - #ifdef CYRUS_SASL static sasl_conn_t *conn; /* SASL connection state */ static int sasl_complete = 0; /* Has sasl authentication succeeded? */ @@ -86,15 +59,9 @@ static sasl_callback_t callbacks[] = { /* * static prototypes */ -#if !defined(NNTP) && defined(APOP) -static char *pop_auth (char *, char *); -#endif -#if defined(NNTP) || !defined(MPOP) -/* otherwise they are not static functions */ static int command(const char *, ...); static int multiline(void); -#endif #ifdef CYRUS_SASL static int pop_auth_sasl(char *, char *, char *); @@ -107,50 +74,6 @@ static int sasl_getline (char *, int, FILE *); static int putline (char *, FILE *); -#if !defined(NNTP) && defined(APOP) -static char * -pop_auth (char *user, char *pass) -{ - int len, buflen; - char *cp, *lp; - unsigned char *dp, *ep, digest[16]; - MD5_CTX mdContext; - static char buffer[BUFSIZ]; - - if ((cp = strchr (response, '<')) == NULL - || (lp = strchr (cp, '>')) == NULL) { - snprintf (buffer, sizeof(buffer), "APOP not available: %s", response); - strncpy (response, buffer, sizeof(response)); - return NULL; - } - - *(++lp) = '\0'; - snprintf (buffer, sizeof(buffer), "%s%s", cp, pass); - - MD5Init (&mdContext); - MD5Update (&mdContext, (unsigned char *) buffer, - (unsigned int) strlen (buffer)); - MD5Final (digest, &mdContext); - - cp = buffer; - buflen = sizeof(buffer); - - snprintf (cp, buflen, "%s ", user); - len = strlen (cp); - cp += len; - buflen -= len; - - for (ep = (dp = digest) + sizeof(digest) / sizeof(digest[0]); dp < ep; ) { - snprintf (cp, buflen, "%02x", *dp++ & 0xff); - cp += 2; - buflen -= 2; - } - *cp = '\0'; - - return buffer; -} -#endif /* !NNTP && APOP */ - #ifdef CYRUS_SASL /* * This function implements the AUTH command for various SASL mechanisms @@ -490,19 +413,12 @@ parse_proxy(char *proxy, char *host) } int -pop_init (char *host, char *user, char *pass, char *proxy, int snoop, - int rpop, int kpop, int sasl, char *mech) +pop_init (char *host, char *port, char *user, char *pass, char *proxy, + int snoop, int sasl, char *mech) { int fd1, fd2; char buffer[BUFSIZ]; -#ifdef APOP - int apop; - - if ((apop = rpop) < 0) - rpop = 0; -#endif - if (proxy && *proxy) { int pid; int inpipe[2]; /* for reading from the server */ @@ -546,32 +462,15 @@ pop_init (char *host, char *user, char *pass, char *proxy, int snoop, /* we read on fd1 */ fd1=inpipe[0]; - /* and write on fd2 */ fd2=outpipe[1]; } else { -#ifndef NNTP - if ( kpop ) { -# ifdef KPOP - snprintf (buffer, sizeof(buffer), "%s/%s", KPOP_PRINCIPAL, "kpop"); - if ((fd1 = client (host, "tcp", buffer, 0, response, sizeof(response))) == NOTOK) { - return NOTOK; - } -# else /* KPOP */ - snprintf (response, sizeof(response), "this version of nmh compiled without KPOP support"); + if ((fd1 = client (host, port ? port : "pop3", response, + sizeof(response), snoop)) == NOTOK) { return NOTOK; -# endif /* KPOP */ - } else { - if ((fd1 = client (host, POPSERVICE, response, sizeof(response), snoop)) == NOTOK) { - return NOTOK; - } } -#else /* NNTP */ - if ((fd1 = client (host, "nntp", response, sizeof(response), snoop)) == NOTOK) - return NOTOK; -#endif if ((fd2 = dup (fd1)) == NOTOK) { char *s; @@ -586,11 +485,7 @@ pop_init (char *host, char *user, char *pass, char *proxy, int snoop, return NOTOK; } } -#ifndef NNTP if (pop_set (fd1, fd2, snoop) == NOTOK) -#else /* NNTP */ - if (pop_set (fd1, fd2, snoop, (char *)0) == NOTOK) -#endif /* NNTP */ return NOTOK; SIGNAL (SIGPIPE, SIG_IGN); @@ -599,18 +494,7 @@ pop_init (char *host, char *user, char *pass, char *proxy, int snoop, case OK: if (poprint) fprintf (stderr, "<--- %s\n", response); -#ifndef NNTP if (*response == '+') { -# ifndef KPOP -# ifdef APOP - if (apop < 0) { - char *cp = pop_auth (user, pass); - - if (cp && command ("APOP %s", cp) != NOTOK) - return OK; - } - else -# endif /* APOP */ # ifdef CYRUS_SASL if (sasl) { if (pop_auth_sasl(user, host, mech) != NOTOK) @@ -618,21 +502,10 @@ pop_init (char *host, char *user, char *pass, char *proxy, int snoop, } else # endif /* CYRUS_SASL */ if (command ("USER %s", user) != NOTOK - && command ("%s %s", rpop ? "RPOP" : (pophack++, "PASS"), + && command ("%s %s", (pophack++, "PASS"), pass) != NOTOK) return OK; -# else /* KPOP */ - if (command ("USER %s", user) != NOTOK - && command ("PASS %s", pass) != NOTOK) - return OK; -# endif } -#else /* NNTP */ - if (*response < CHAR_ERR) { - command ("MODE READER"); - return OK; - } -#endif strncpy (buffer, response, sizeof(buffer)); command ("QUIT"); strncpy (response, buffer, sizeof(response)); @@ -650,22 +523,10 @@ pop_init (char *host, char *user, char *pass, char *proxy, int snoop, return NOTOK; /* NOTREACHED */ } -#ifdef NNTP -int -pop_set (int in, int out, int snoop, char *myname) -#else int pop_set (int in, int out, int snoop) -#endif { -#ifdef NNTP - if (myname && *myname) { - /* interface from bbc to msh */ - strncpy (xtnd_name, myname, sizeof(xtnd_name)); - } -#endif /* NNTP */ - if ((input = fdopen (in, "r")) == NULL || (output = fdopen (out, "w")) == NULL) { strncpy (response, "fdopen failed on connection descriptor", sizeof(response)); @@ -700,69 +561,24 @@ pop_fd (char *in, int inlen, char *out, int outlen) int pop_stat (int *nmsgs, int *nbytes) { -#ifdef NNTP - char **ap; -#endif /* NNTP */ -#ifndef NNTP if (command ("STAT") == NOTOK) return NOTOK; *nmsgs = *nbytes = 0; sscanf (response, "+OK %d %d", nmsgs, nbytes); -#else /* NNTP */ - if (xtnd_last < 0) { /* in msh, xtnd_name is set from myname */ - if (command("GROUP %s", xtnd_name) == NOTOK) - return NOTOK; - - ap = brkstring (response, " ", "\n"); /* "211 nart first last ggg" */ - xtnd_first = atoi (ap[2]); - xtnd_last = atoi (ap[3]); - } - - /* nmsgs is not the real nart, but an incredible simuation */ - if (xtnd_last > 0) - *nmsgs = xtnd_last - xtnd_first + 1; /* because of holes... */ - else - *nmsgs = 0; - *nbytes = xtnd_first; /* for subtracting offset in msh() */ -#endif /* NNTP */ - return OK; } -#ifdef NNTP -int -pop_exists (int (*action)()) -{ -#ifdef XMSGS /* hacked into NNTP 1.5 */ - if (traverse (action, "XMSGS %d-%d", (targ_t) xtnd_first, (targ_t) xtnd_last) == OK) - return OK; -#endif - /* provided by INN 1.4 */ - if (traverse (action, "LISTGROUP") == OK) - return OK; - return traverse (action, "XHDR NONAME %d-%d", (targ_t) xtnd_first, (targ_t) xtnd_last); -} -#endif /* NNTP */ - -#ifdef BPOP -int -pop_list (int msgno, int *nmsgs, int *msgs, int *bytes, int *ids) -#else int pop_list (int msgno, int *nmsgs, int *msgs, int *bytes) -#endif { int i; -#ifndef BPOP int *ids = NULL; -#endif if (msgno) { -#ifndef NNTP if (command ("LIST %d", msgno) == NOTOK) return NOTOK; *msgs = *bytes = 0; @@ -772,18 +588,9 @@ pop_list (int msgno, int *nmsgs, int *msgs, int *bytes) } else sscanf (response, "+OK %d %d", msgs, bytes); -#else /* NNTP */ - *msgs = *bytes = 0; - if (command ("STAT %d", msgno) == NOTOK) - return NOTOK; - if (ids) { - *ids = msgno; - } -#endif /* NNTP */ return OK; } -#ifndef NNTP if (command ("LIST") == NOTOK) return NOTOK; @@ -814,20 +621,13 @@ pop_list (int msgno, int *nmsgs, int *msgs, int *bytes) case OK: break; } -#else /* NNTP */ - return NOTOK; -#endif /* NNTP */ } int pop_retr (int msgno, int (*action)(char *)) { -#ifndef NNTP - return traverse (action, "RETR %d", (targ_t) msgno); -#else /* NNTP */ - return traverse (action, "ARTICLE %d", (targ_t) msgno); -#endif /* NNTP */ + return traverse (action, "RETR %d", msgno); } @@ -876,15 +676,6 @@ pop_noop (void) } -#if defined(MPOP) && !defined(NNTP) -int -pop_last (void) -{ - return command ("LAST"); -} -#endif - - int pop_rset (void) { @@ -895,74 +686,8 @@ pop_rset (void) int pop_top (int msgno, int lines, int (*action)(char *)) { -#ifndef NNTP - return traverse (action, "TOP %d %d", (targ_t) msgno, (targ_t) lines); -#else /* NNTP */ - return traverse (action, "HEAD %d", (targ_t) msgno); -#endif /* NNTP */ -} - - -#ifdef BPOP -int -pop_xtnd (int (*action)(), char *fmt, ...) -{ - int result; - va_list ap; - char buffer[BUFSIZ]; - -#ifdef NNTP - char **ap; -#endif - - va_start(ap, fmt); -#ifndef NNTP - /* needs to be fixed... va_end needs to be added */ - snprintf (buffer, sizeof(buffer), "XTND %s", fmt); - result = traverse (action, buffer, a, b, c, d); - va_end(ap); - return result; -#else /* NNTP */ - snprintf (buffer, sizeof(buffer), fmt, a, b, c, d); - ap = brkstring (buffer, " ", "\n"); /* a hack, i know... */ - - if (!mh_strcasecmp(ap[0], "x-bboards")) { /* XTND "X-BBOARDS group */ - /* most of these parameters are meaningless under NNTP. - * bbc.c was modified to set AKA and LEADERS as appropriate, - * the rest are left blank. - */ - return OK; - } - if (!mh_strcasecmp (ap[0], "archive") && ap[1]) { - snprintf (xtnd_name, sizeof(xtnd_name), "%s", ap[1]); /* save the name */ - xtnd_last = 0; - xtnd_first = 1; /* setup to fail in pop_stat */ - return OK; - } - if (!mh_strcasecmp (ap[0], "bboards")) { - - if (ap[1]) { /* XTND "BBOARDS group" */ - snprintf (xtnd_name, sizeof(xtnd_name), "%s", ap[1]); /* save the name */ - if (command("GROUP %s", xtnd_name) == NOTOK) - return NOTOK; - - /* action must ignore extra args */ - strncpy (buffer, response, sizeof(buffer)); - ap = brkstring (response, " ", "\n");/* "211 nart first last g" */ - xtnd_first = atoi (ap[2]); - xtnd_last = atoi (ap[3]); - - (*action) (buffer); - return OK; - - } else { /* XTND "BBOARDS" */ - return traverse (action, "LIST", a, b, c, d); - } - } - return NOTOK; /* unknown XTND command */ -#endif /* NNTP */ + return traverse (action, "TOP %d %d", msgno, lines); } -#endif /* BPOP */ int @@ -991,9 +716,6 @@ pop_done (void) } -#if !defined(MPOP) || defined(NNTP) -static -#endif int command(const char *fmt, ...) { @@ -1043,11 +765,7 @@ vcommand (const char *fmt, va_list ap) case OK: if (poprint) fprintf (stderr, "<--- %s\n", response); -#ifndef NNTP return (*response == '+' ? OK : NOTOK); -#else /* NNTP */ - return (*response < CHAR_ERR ? OK : NOTOK); -#endif /* NNTP */ case NOTOK: case DONE: @@ -1060,13 +778,8 @@ vcommand (const char *fmt, va_list ap) } -#if defined(MPOP) && !defined(NNTP) int multiline (void) -#else -static int -multiline (void) -#endif { char buffer[BUFSIZ + TRMLEN]; -- 1.7.10.4