all NNTP support (including bboards) and MPOP.
+2010-12-09 Ken Hornstein <kenh@pobox.com>
+
+ * 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 <levinedl@acm.org>
* uip/whatnowsbr.c: enforce requirement of at least one file
That change allowed mhstore to use the (file)name when
extracting attachments.
+2010-12-03 Ken Hornstein <kenh@pobox.com>
+
+ * Everything: remove RCS keywords from files, since they no longer
+ work after git migration.
+
+2010-12-02 Ken Hornstein <kenh@pobox.com>
+
+ * .cvsignore, .gitignore, autogen.sh, */.cvsignore: Update files
+ for git conversion.
+
+2010-12-19 Ken Hornstein <kenh@pobox.com>
+
+ * 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 <pmaydell@chiark.greenend.org.uk>
* man/slocal.man: fix formatting error that meant a
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]))
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,
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 --------------------
# 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
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;
+++ /dev/null
-/*
- * 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
* 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 *));
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
.RB [ \-nopack ]
.RB [ \-proxy
.IR command ]
-.RB [ \-apop " | " \-noapop ]
-.RB [ \-kpop ]
.RB [ \-sasl ]
.RB [ \-saslmech
.IR mechanism ]
.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
.RB [ \-pack
.IR file ]
.RB [ \-nopack ]
-.RB [ \-apop " | " \-noapop ]
-.RB [ \-kpop ]
.RB [ \-sasl ]
.RB [ \-saslmech
.IR mechanism ]
.IR hostname ]
.RB [ \-user
.IR username ]
-.RB [ \-apop " | " \-noapop ]
-.RB [ \-kpop ]
.RB [ \-sasl ]
.RB [ \-saslmech
.IR mechanism ]
\" 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
.IR hostname ]
.RB [ \-user
.IR username ]
-.RB [ \-apop " | " \-noapop ]
-.RB [ \-kpop ]
.RB [ \-sasl ]
.RB [ \-saslmech
.IR mechanism ]
.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
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@
sendmailpath = @sendmailpath@
COMPILE = $(CC) -c $(DEFS) $(INCLUDES) $(CFLAGS)
-COMPILE2 = $(CC) -c $(DEFS) $(CONFIGDEFS) $(INCLUDES) $(HESIOD_INCLUDES) $(CFLAGS)
+COMPILE2 = $(CC) -c $(DEFS) $(CONFIGDEFS) $(INCLUDES) $(CFLAGS)
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);
{ "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 },
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 ());
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 $@
# include <h/popsbr.h>
#endif
-#ifdef HESIOD
-# include <hesiod.h>
-#endif
-
#include <h/fmt_scan.h>
#include <h/scansbr.h>
#include <h/signals.h>
# 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
{ "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
{ "help", 0 },
#define SNOOPSW 22
{ "snoop", -5 },
-#define KPOPSW 23
- { "kpop", KPOPminc (-4) },
#define SASLSW 24
{ "sasl", SASLminc(-4) },
#define SASLMECHSW 25
#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;
{
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;
FILE *mhe = NULL;
#endif
-#ifdef HESIOD
- struct hes_postoffice *po;
-#endif
-
done=inc_done;
/* absolutely the first thing we do is save our privileges,
*/
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.
snoop++;
#endif /* POP */
- rpop = 0;
-
while ((cp = *argp++)) {
if (*cp == '-') {
switch (smatch (++cp, switches)) {
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]);
#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;
#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 */
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);
/*
* 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");
#ifdef POP
fprintf (aud, from ? "<<inc>> %s -ms %s\n"
- : host ? "<<inc>> %s -host %s -user %s%s\n"
+ : host ? "<<inc>> %s -host %s -user %s\n"
: "<<inc>> %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 ? "<<inc>> %s -ms %s\n" : "<<inc>> %s\n",
dtimenow (0), from);
# include <h/popsbr.h>
#endif
-#ifdef HESIOD
-# include <hesiod.h>
-#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
{ "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
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
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;
snoop++;
#endif
- rpop = 0;
-
while ((cp = *argp++)) {
if (*cp == '-') {
switch (smatch (++cp, switches)) {
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]);
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;
* 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.
}
if (!host || !*host)
host = NULL;
- if (!host || rpop <= 0)
- setuid (uid);
#endif /* POP */
if (vecp != 0)
#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 */
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);
static jmp_buf peerenv;
-#ifdef BPOP
-int pmsh = 0; /* BPOP enabled */
-extern char response[];
-#endif /* BPOP */
-
/*
* PARENT
*/
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);
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, "");
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:
#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
{
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
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);
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;
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);
}
-#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)
{
register int msgp;
int fd;
char *cp;
-#ifdef BPOP
- char tmpfil[BUFSIZ];
- long pos1, pos2;
-#endif
if (yp) {
fclose (yp);
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;
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");
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;;)
write_ids ();
folder_free (mp); /* free folder/message structure */
myname = NULL;
-#ifdef BPOP
- if (pmsh) {
- pop_done ();
- pmsh = 0;
- }
-#endif /* BPOP */
}
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.
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) {
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;
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;
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,
#include <h/mh.h>
#include <h/utils.h>
-#if defined(NNTP) && !defined(PSHSBR)
-# undef NNTP
-#endif
-
-#ifdef NNTP /* building pshsbr.o from popsbr.c */
-# include <h/nntp.h>
-#endif /* NNTP */
-
-#if !defined(NNTP) && defined(APOP)
-# include <h/md5.h>
-#endif
-
#ifdef CYRUS_SASL
# include <sasl/sasl.h>
# include <sasl/saslutil.h>
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? */
/*
* 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 *);
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
}
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 */
/* 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;
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);
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)
} 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));
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));
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;
}
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;
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);
}
}
-#if defined(MPOP) && !defined(NNTP)
-int
-pop_last (void)
-{
- return command ("LAST");
-}
-#endif
-
-
int
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
}
-#if !defined(MPOP) || defined(NNTP)
-static
-#endif
int
command(const char *fmt, ...)
{
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:
}
-#if defined(MPOP) && !defined(NNTP)
int
multiline (void)
-#else
-static int
-multiline (void)
-#endif
{
char buffer[BUFSIZ + TRMLEN];