From: Theodore Tso Date: Tue, 19 Nov 1996 01:53:48 +0000 (+0000) Subject: Removing old POP applications X-Git-Tag: krb5-1.0-freeze1~2 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=cd0acd07fca64e3a3e56a11830b15896f756ad8a;p=krb5.git Removing old POP applications git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@9427 dc483132-0cff-0310-8789-dd5450dbe970 --- diff --git a/src/appl/mailquery/.Sanitize b/src/appl/mailquery/.Sanitize deleted file mode 100644 index d58a60ee5..000000000 --- a/src/appl/mailquery/.Sanitize +++ /dev/null @@ -1,40 +0,0 @@ -# Sanitize.in for Kerberos V5 - -# Each directory to survive it's way into a release will need a file -# like this one called "./.Sanitize". All keyword lines must exist, -# and must exist in the order specified by this file. Each directory -# in the tree will be processed, top down, in the following order. - -# Hash started lines like this one are comments and will be deleted -# before anything else is done. Blank lines will also be squashed -# out. - -# The lines between the "Do-first:" line and the "Things-to-keep:" -# line are executed as a /bin/sh shell script before anything else is -# done in this - -Do-first: - -# All files listed between the "Things-to-keep:" line and the -# "Files-to-sed:" line will be kept. All other files will be removed. -# Directories listed in this section will have their own Sanitize -# called. Directories not listed will be removed in their entirety -# with rm -rf. - -Things-to-keep: - -.cvsignore -ChangeLog -Makefile.in -configure -configure.in -mailquery.M -mailquery.c -pop.h -poplib.c - -Things-to-lose: - -Do-last: - -# End of file. diff --git a/src/appl/mailquery/ChangeLog b/src/appl/mailquery/ChangeLog deleted file mode 100644 index 7d6322905..000000000 --- a/src/appl/mailquery/ChangeLog +++ /dev/null @@ -1,114 +0,0 @@ -Fri Nov 8 17:01:28 1996 Theodore Ts'o - - * poplib.c: - * mailquery.c: Cleaned up gcc -Wall warnings. - -Thu Nov 7 15:20:25 1996 Theodore Ts'o - - * poplib.c (reserved;): Check the error return from - krb5_init_context(), and print an error message if - necessary. - -Tue Sep 10 14:08:06 1996 Tom Yu - - * mailquery.M: remove ".so man1/header.doc" - -Fri Jul 7 15:43:24 EDT 1995 Paul Park (pjpark@mit.edu) - * Makefile.in - Remove all explicit library handling. - * configure.in - Add KRB5_LIBRARIES. - -Tue Jun 20 14:29:23 1995 Tom Yu (tlyu@dragons-lair) - - * poplib.c: HAS_STDLIB_H -> HAVE_STDLIB_H - -Thu Jun 15 17:36:11 EDT 1995 Paul Park (pjpark@mit.edu) - * Makefile.in - Change explicit library names to -l form, and - change target link line to use $(LD) and associated flags. - * configure.in - Add shared library usage check. - -Sat Jun 10 22:57:11 1995 Tom Yu (tlyu@dragons-lair) - - * poplib.c: krb5_auth_context redefinitions - -Fri Jun 9 18:27:03 1995 - - * configure.in: Remove standardized set of autoconf macros, which - are now handled by CONFIG_RULES. - -Tue May 9 10:29:44 1995 Ezra Peisach - - * configure.in: Check for stdlib.h - - * poplib.c: Include . Include if present or - define malloc(). - -Mon Mar 27 07:56:26 1995 Chris Provenzano (proven@mit.edu) - - * poplib.c (pop_init()): Use new calling convention for krb5_sendauth(). - -Thu Mar 2 12:28:20 1995 Theodore Y. Ts'o - - * Makefile.in (ISODELIB): Remove reference to $(ISODELIB). - -Wed Mar 1 11:55:43 1995 Theodore Y. Ts'o - - * configure.in: Replace check for -lsocket and -lnsl with - WITH_NETLIB check. - -Tue Feb 28 01:52:34 1995 John Gilmore (gnu at toad.com) - - * poplib.c: Avoid includes. - -Tue Feb 14 15:30:55 1995 Chris Provenzano (proven@mit.edu) - - * poplib.c (pop_init): Call krb5_sendauth() with new calling convention - -Fri Jan 13 15:23:47 1995 Chris Provenzano (proven@mit.edu) - - * Added krb5_context to all krb5_routines - -Mon Jan 2 14:41:14 1995 Richard Basch (probe@tardis) - - * mailquery.c - Issue QUIT pop command, when done retrieving messages. - -Wed Nov 2 21:08:04 1994 Theodore Y. Ts'o (tytso@dcl) - - * poplib.c (getline, multiline): NULL should not be used as a - character assignment value. Use '\0' instead. - -Mon Oct 3 19:17:31 1994 Theodore Y. Ts'o (tytso@dcl) - - * Makefile.in: Use $(srcdir) to find manual page for make install. - -Thu Sep 29 22:53:17 1994 Theodore Y. Ts'o (tytso@dcl) - - * Makefile.in: Relink executables if libraries change - -Thu Sep 15 11:34:46 1994 Theodore Y. Ts'o (tytso@dcl) - - * configure.in: Moved CONFIG_RULES before AC_HAVE_LIBRARY() rules, - so that they work. - -Thu Aug 18 16:15:36 1994 Theodore Y. Ts'o (tytso@dcl) - - * Makefile.in: Added missing $(LIBS) to link line. - -Thu Aug 18 13:43:07 1994 Theodore Y. Ts'o (tytso at tsx-11) - - * mailquery.c: Move usage() before main() to solve redeclaration - error. - - * mailquery.c: Add #include to fix compiler kvetching. - -Tue Aug 9 16:45:53 1994 Tom Yu (tlyu@dragons-lair) - - * poplib.c: fix stupid sterror bug - - * Makefile.in: - * configure.in: make install fixes - - * poplib.c: Ultrix cpp doesn't like '#error' - - * Makefile.in: oops forgot about $(COMERRLIB) - diff --git a/src/appl/mailquery/Makefile.in b/src/appl/mailquery/Makefile.in deleted file mode 100644 index eb740403e..000000000 --- a/src/appl/mailquery/Makefile.in +++ /dev/null @@ -1,23 +0,0 @@ -CFLAGS = $(CCOPTS) -DKPOP -DKRB5 $(DEFS) $(LOCALINCLUDE) - -all:: - -HESIODLIB = -LOCAL_LIBRARIES = $(HESIODLIB) -DEPLOCAL_LIBRARIES = $(HESIODLIB) - -mailquery: mailquery.o poplib.o $(DEPLIBS) - $(LD) $(LDFLAGS) $(LDARGS) -o mailquery mailquery.o poplib.o $(LIBS) - -mailquery.o: $(srcdir)/mailquery.c -poplib.o: $(srcdir)/poplib.c - -all:: mailquery - -clean:: - $(RM) mailquery.o poplib.o mailquery - -install:: - $(INSTALL_PROGRAM) mailquery ${DESTDIR}$(CLIENT_BINDIR)/mailquery - $(INSTALL_DATA) $(srcdir)/mailquery.M ${DESTDIR}$(CLIENT_MANDIR)/mailquery.1 - diff --git a/src/appl/mailquery/configure.in b/src/appl/mailquery/configure.in deleted file mode 100644 index c93e62d34..000000000 --- a/src/appl/mailquery/configure.in +++ /dev/null @@ -1,8 +0,0 @@ -AC_INIT(mailquery.c) -CONFIG_RULES -AC_PROG_INSTALL -AC_HAVE_HEADERS(unistd.h stdlib.h) -AC_FUNC_CHECK(strerror,AC_DEFINE(HAS_STRERROR)) -KRB5_LIBRARIES -V5_USE_SHARED_LIB -V5_AC_OUTPUT_MAKEFILE diff --git a/src/appl/mailquery/mailquery.M b/src/appl/mailquery/mailquery.M deleted file mode 100644 index 113146f40..000000000 --- a/src/appl/mailquery/mailquery.M +++ /dev/null @@ -1,41 +0,0 @@ -.\" -.\" (c) Copyright 1994 HEWLETT-PACKARD COMPANY -.\" -.\" To anyone who acknowledges that this file is provided -.\" "AS IS" without any express or implied warranty: -.\" permission to use, copy, modify, and distribute this -.\" file for any purpose is hereby granted without fee, -.\" provided that the above copyright notice and this -.\" notice appears in all copies, and that the name of -.\" Hewlett-Packard Company not be used in advertising or -.\" publicity pertaining to distribution of the software -.\" without specific, written prior permission. Hewlett- -.\" Packard Company makes no representations about the -.\" suitability of this software for any purpose. -.\" -.\" $Id -.\" -.TH mailquery 1 -.SH NAME -mailquery \- queries a pop server about how much mail is available -.SH SYNTAX -.B mailquery -[-\fId\fR\|] -[-\fIv\fR\|] -[\fI user\fR[@\fIhost\fR\|]] -.SH DESCRIPTION -The -.PN mailquery -command queries a POP server for information about how much mail a user -has. The program will exit with status = 0 if there is mail, and with -status = 1 if there is no mail. The -v flag can be used to get a more -verbose report. The -d flag can be used to turn on debugging output -in the pop library code. The pop server can be specified either by -setting the environment variable MAILHOST, or on the command line. -If no user is specified, user is set to the person who ran the program. -.SH OPTIONS - -.SH BUGS/LIMITATIONS - -.SH SEE ALSO -popper(8) diff --git a/src/appl/mailquery/mailquery.c b/src/appl/mailquery/mailquery.c deleted file mode 100644 index a2946f484..000000000 --- a/src/appl/mailquery/mailquery.c +++ /dev/null @@ -1,181 +0,0 @@ -/* - * (c) Copyright 1994 HEWLETT-PACKARD COMPANY - * - * To anyone who acknowledges that this file is provided - * "AS IS" without any express or implied warranty: - * permission to use, copy, modify, and distribute this - * file for any purpose is hereby granted without fee, - * provided that the above copyright notice and this - * notice appears in all copies, and that the name of - * Hewlett-Packard Company not be used in advertising or - * publicity pertaining to distribution of the software - * without specific, written prior permission. Hewlett- - * Packard Company makes no representations about the - * suitability of this software for any purpose. - */ -/* - * Mailquery - contact the POP mail host an see if a user has - * mail. By default the result if reflected in the - * exit status. - * - * Usage: mailquery [-dv] [-e ] - * -d - debug - * -v - print result - * -e - exec this command if there is mail. - */ -#include -#ifdef HAVE_UNISTD_H -#include -#endif -#ifdef HAVE_STDLIB_H -#include -#endif -#include -#include -#include -#include -#ifdef HESIOD -#include -#endif -#include "pop.h" - -extern int pop_debug; -int verbose = 0; -char *exec_cmd; - -int mailquery(); - -void usage() -{ - fprintf(stderr, "usage: mailquery [-d] [-v] [-e cmd] [user[@host]]\n"); -} - -int main(argc, argv) - int argc; - char *argv[]; -{ - extern char *getenv(); - int nbytes; - char *mhost = NULL, *mhp; - char *user = 0; - struct passwd * pwd; - char c; - extern int optind; - extern char *optarg; -#ifdef HESIOD - struct hes_postoffice *p; -#endif /* HESIOD */ - - while ((c = getopt(argc, argv, "dve:")) != EOF) { - switch (c) { - case 'd': - pop_debug = 1; - break; - - case 'e': - exec_cmd = optarg; - break; - - case 'v': - verbose = 1; - break; - - case '?': - usage(); - exit(1); - } - } - - argc -= optind; - argv += optind; - - if (argc > 0) { - user = argv[0]; - if ((mhost = strchr(argv[0], '@')) != NULL) { - *mhost = '\0'; - mhost++; - } -#ifndef HESIOD - else { - mhost = DEFMAILHOST; - } -#endif - } - - if (user == (char *) 0 || *user == '\0') { - if ((pwd = getpwuid(getuid())) == NULL) { - perror("getpwuid"); - exit(1); - } - user = pwd->pw_name; - } - - if ((mhost == NULL) && - (mhp = getenv("MAILHOST"))) - mhost = mhp; - -#ifdef HESIOD - if (mhost == NULL) { - p = hes_getmailhost(user); - if (p != NULL && strcmp(p->po_type, "POP") == 0) - mhost = p->po_host; - else { - fprintf(stderr,"no POP server listed in Hesiod for %s\n", user); - exit(1); - } - } -#endif /* HESIOD */ - - if (mhost == NULL) { - mhost = DEFMAILHOST; - } - - nbytes = mailquery(mhost, user); - - if ((nbytes > 0) && (exec_cmd != 0)) { - if (pop_debug) - fprintf(stderr, "about to execute %s\n", exec_cmd); - system(exec_cmd); - } - - exit(nbytes == 0); - -} - -int mailquery(mhost, user) - char *mhost; - char *user; -{ - int nbytes, nmsgs; - - if (pop_init(mhost, 0) == NOTOK) { - error(Errmsg); - exit(1); - } - -#ifdef KPOP - if (pop_command("USER %s", user) == NOTOK || - pop_command("PASS %s", user) == NOTOK) { -#else /* !KPOP */ - if (pop_command("USER %s", user) == NOTOK || - pop_command("RPOP %s", user) == NOTOK) { -#endif /* KPOP */ - error(Errmsg); - (void) pop_command("QUIT"); - exit (1); - } - - if (pop_stat(&nmsgs, &nbytes) == NOTOK) { - error(Errmsg); - (void) pop_command("QUIT"); - exit (1); - } - - (void) pop_command("QUIT"); - - if (verbose) - printf("%d messages (%d bytes) on host %s\n", nmsgs, nbytes, mhost); - - return nbytes; -} - diff --git a/src/appl/mailquery/pop.h b/src/appl/mailquery/pop.h deleted file mode 100644 index d2f9071a3..000000000 --- a/src/appl/mailquery/pop.h +++ /dev/null @@ -1,35 +0,0 @@ -/* - * (c) Copyright 1994 HEWLETT-PACKARD COMPANY - * - * To anyone who acknowledges that this file is provided - * "AS IS" without any express or implied warranty: - * permission to use, copy, modify, and distribute this - * file for any purpose is hereby granted without fee, - * provided that the above copyright notice and this - * notice appears in all copies, and that the name of - * Hewlett-Packard Company not be used in advertising or - * publicity pertaining to distribution of the software - * without specific, written prior permission. Hewlett- - * Packard Company makes no representations about the - * suitability of this software for any purpose. - * - */ - -/* defines for pop library */ - -#define NOTOK (-1) -#define OK 0 -#define DONE 1 - -#define DEFMAILHOST "mailhost" - -int pop_init(), pop_getline(); -char *get_errmsg(); -int pop_command(); -int pop_stat(); -int pop_retr(); -int pop_query(); -char *concat(); -void fatal(), error(), pfatal_with_name(); - -extern char Errmsg[]; diff --git a/src/appl/mailquery/poplib.c b/src/appl/mailquery/poplib.c deleted file mode 100644 index fe54ba54d..000000000 --- a/src/appl/mailquery/poplib.c +++ /dev/null @@ -1,498 +0,0 @@ -/* - * (c) Copyright 1994 HEWLETT-PACKARD COMPANY - * - * To anyone who acknowledges that this file is provided - * "AS IS" without any express or implied warranty: - * permission to use, copy, modify, and distribute this - * file for any purpose is hereby granted without fee, - * provided that the above copyright notice and this - * notice appears in all copies, and that the name of - * Hewlett-Packard Company not be used in advertising or - * publicity pertaining to distribution of the software - * without specific, written prior permission. Hewlett- - * Packard Company makes no representations about the - * suitability of this software for any purpose. - */ - -/* - * Poplib - library routines for speaking POP - */ -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#if defined(KRB4) && defined(KRB5) -error You cannot define both KRB4 and KRB5 -#endif -#ifndef KPOP_SERVICE -#define KPOP_SERVICE "kpop" -#endif -#ifdef KPOP -#ifdef KRB4 -#include -#endif -#ifdef KRB5 -#include "krb5.h" -#include "com_err.h" -#include -#endif -#endif - -#ifdef HAVE_STDLIB_H -#include -#else -extern char *malloc(); -#endif - -#include "pop.h" - -void *xmalloc(); -int getline(), multiline(), putline(); - -char Errmsg[80]; /* to return error messages */ -int pop_debug; - -static FILE *sfi = 0; -static FILE *sfo = 0; - -int pop_init(host, reserved) -char *host; -int reserved; -{ - register struct hostent *hp; - register struct servent *sp; -#ifndef KPOP - int lport = IPPORT_RESERVED - 1; -#endif - struct sockaddr_in sin; - int s; - char *get_errmsg(); - char response[1024]; - char *routine; -#ifdef KPOP -#ifdef KRB4 - CREDENTIALS cred; - KTEXT ticket = (KTEXT)NULL; - int rem; -#endif -#ifdef KRB5 - krb5_error_code retval; - krb5_context context; - krb5_ccache ccdef; - krb5_principal client = NULL, server = NULL; - krb5_error *err_ret = NULL; - krb5_auth_context auth_context; -#endif -#endif - - if (sfi && sfo) { - return OK; /* guessing at this -- eichin -- XXX */ - } - - hp = gethostbyname(host); - if (hp == NULL) { - sprintf(Errmsg, "MAILHOST unknown: %s", host); - return(NOTOK); - } - -#ifdef KPOP - sp = getservbyname(KPOP_SERVICE, "tcp"); - if (sp == 0) { - (void) strcpy(Errmsg, "tcp/kpop: unknown service"); - return(NOTOK); - } -#else /* !KPOP */ - sp = getservbyname("pop", "tcp"); - if (sp == 0) { - (void) strcpy(Errmsg, "tcp/pop: unknown service"); - return(NOTOK); - } -#endif /* KPOP */ - if (sp == 0) { - strcpy(Errmsg, "tcp/pop: unknown service"); - return(NOTOK); - } - - sin.sin_family = hp->h_addrtype; - memcpy((char *)&sin.sin_addr, hp->h_addr, hp->h_length); - sin.sin_port = sp->s_port; -#ifdef KPOP - s = socket(AF_INET, SOCK_STREAM, 0); -#else /* !KPOP */ - if (reserved) - s = rresvport(&lport); - else - s = socket(AF_INET, SOCK_STREAM, 0); -#endif /* KPOP */ - - if (s < 0) { - sprintf(Errmsg, "error creating socket: %s", get_errmsg()); - return(NOTOK); - } - - if (connect(s, (struct sockaddr *)&sin, sizeof sin) < 0) { - sprintf(Errmsg, "error during connect: %s", get_errmsg()); - close(s); - return(NOTOK); - } - -#ifdef KPOP -#ifdef KRB4 - /* Get tgt creds from ticket file. This is used to calculate the - * lifetime for the pop ticket so that it expires with the - * tgt */ - rem = krb_get_cred("krbtgt", krb_realmofhost(hp->h_name), krb_realmofhost(hp->h_name), &cred); - if (rem == KSUCCESS) { - long lifetime; - lifetime = ((cred.issue_date + ((unsigned char)cred.lifetime * 5 * 60)) - time(0)) / (5 * 60); - if (lifetime > 0) - krb_set_lifetime(lifetime); - } - ticket = (KTEXT)malloc( sizeof(KTEXT_ST) ); - rem = krb_sendauth(0L, s, ticket, "pop", hp->h_name, (char *)0, - 0, (MSG_DAT *) 0, (CREDENTIALS *) 0, - (bit_64 *) 0, (struct sockaddr_in *)0, - (struct sockaddr_in *)0,"ZMAIL0.0"); - if (rem != KSUCCESS) { - (void) sprintf(Errmsg, "kerberos error: %s",krb_err_txt[rem]); - (void) close(s); - return(NOTOK); - } -#endif /* KRB4 */ -#ifdef KRB5 - retval = krb5_init_context(&context); - if (retval) { - com_err("pop_init", retval, "while initializing krb5"); - close(s); - return(NOTOK); - } - routine = "krb5_cc_default"; - if ((retval = krb5_cc_default(context, &ccdef))) { - krb5error: - sprintf(Errmsg, "%s: krb5 error: %s", routine, error_message(retval)); - close(s); - return(NOTOK); - } - routine = "krb5_cc_get_principal"; - if ((retval = krb5_cc_get_principal(context, ccdef, &client))) { - goto krb5error; - } - - routine = "krb5_sname_to_principal"; - if ((retval = krb5_sname_to_principal(context, hp->h_name, "pop", - KRB5_NT_UNKNOWN, &server))) { - goto krb5error; - } - - retval = krb5_sendauth(context, &auth_context, (krb5_pointer) &s, - "KPOPV1.0", client, server, - AP_OPTS_MUTUAL_REQUIRED, - NULL, /* no data to checksum */ - 0, /* no creds, use ccache instead */ - ccdef, - &err_ret, 0, - NULL); /* don't need reply */ - krb5_free_principal(context, server); - if (retval) { - if (err_ret && err_ret->text.length) { - sprintf(Errmsg, "krb5 error: %s [server says '%*s'] ", - error_message(retval), - err_ret->text.length, - err_ret->text.data); - krb5_free_error(context, err_ret); - } else - sprintf(Errmsg, "krb5_sendauth: krb5 error: %s", error_message(retval)); - close(s); - return(NOTOK); - } -#endif /* KRB5 */ -#endif /* KPOP */ - - sfi = fdopen(s, "r"); - sfo = fdopen(s, "w"); - if (sfi == NULL || sfo == NULL) { - sprintf(Errmsg, "error in fdopen: %s", get_errmsg()); - close(s); - return(NOTOK); - } - - if (getline(response, sizeof response, sfi) != OK) { - error(response); - return(NOTOK); - } - if (pop_debug) - fprintf(stderr, "<--- %s\n", response); - - return(OK); -} - -int pop_command(fmt, a, b, c, d) -char *fmt; -char *a, *b, *c, *d; -{ - char buf[1024]; - - sprintf(buf, fmt, a, b, c, d); - - if (pop_debug) fprintf(stderr, "---> %s\n", buf); - if (putline(buf, Errmsg, sfo) == NOTOK) return(NOTOK); - - if (getline(buf, sizeof buf, sfi) != OK) { - strcpy(Errmsg, buf); - return(NOTOK); - } - - if (pop_debug) fprintf(stderr, "<--- %s\n", buf); - if (*buf != '+') { - strcpy(Errmsg, buf); - return(NOTOK); - } else { - return(OK); - } -} - -int pop_query(nbytes, user) - int *nbytes; - char *user; -{ - char buf[1024]; - - if (strlen(user) > 120) { - if (pop_debug) fprintf(stderr, "username %s too long\n", user); - return NOTOK; - } - - sprintf(buf, "QUERY %s", user); - if (pop_debug) fprintf(stderr, "---> %s\n", buf); - if (putline(buf, Errmsg, sfo) == NOTOK) return (NOTOK); - - if (getline(buf, sizeof buf, sfi) != OK) { - strcpy(Errmsg, buf); - return NOTOK; - } - - if (pop_debug) fprintf(stderr, "<--- %s\n", buf); - if (*buf != '+') { - strcpy(Errmsg, buf); - return NOTOK; - } else { - sscanf(buf, "+OK %d", nbytes); - return OK; - } -} - -int pop_stat(nmsgs, nbytes) -int *nmsgs, *nbytes; -{ - char buf[1024]; - - if (pop_debug) fprintf(stderr, "---> STAT\n"); - if (putline("STAT", Errmsg, sfo) == NOTOK) return(NOTOK); - - if (getline(buf, sizeof buf, sfi) != OK) { - strcpy(Errmsg, buf); - return(NOTOK); - } - - if (pop_debug) fprintf(stderr, "<--- %s\n", buf); - if (*buf != '+') { - strcpy(Errmsg, buf); - return(NOTOK); - } else { - sscanf(buf, "+OK %d %d", nmsgs, nbytes); - return(OK); - } -} - -int pop_retr(msgno, action, arg) -int msgno; -int (*action)(); -char *arg; /* is this always FILE*??? -- XXX */ -{ - char buf[1024]; - int nbytes = 0; - - sprintf(buf, "RETR %d", msgno); - - if (pop_debug) - fprintf(stderr, "---> %s\n", buf); - - if (putline(buf, Errmsg, sfo) == NOTOK) return(NOTOK); - - if (getline(buf, sizeof buf, sfi) != OK) { - strcpy(Errmsg, buf); - return(NOTOK); - } - if (pop_debug) - fprintf(stderr, "<--- %s\n", buf); - - sscanf(buf, "+OK %d", &nbytes); - - while (1) { - switch (multiline(buf, sizeof buf, sfi)) { - case OK: - if ((*action)(buf, arg, nbytes) < 0) { - strcat(Errmsg, get_errmsg()); - return (DONE); /* Some error occured in action */ - } - break; - case DONE: - return (OK); - case NOTOK: - strcpy(Errmsg, buf); - return (NOTOK); - } - } -} - -int pop_getline(buf, n) - char *buf; - int n; -{ - return getline(buf, n, sfi); -} - -int getline(buf, n, f) -char *buf; -register int n; -FILE *f; -{ - register char *p; - int c; - - p = buf; - while (--n > 0 && (c = fgetc(f)) != EOF) - if ((*p++ = c) == '\n') break; - - if (ferror(f)) { - strcpy(buf, "error on connection"); - return (NOTOK); - } - - if (c == EOF && p == buf) { - strcpy(buf, "connection closed by foreign host"); - return (DONE); - } - - *p = '\0'; - if (*--p == '\n') *p = '\0'; - if (*--p == '\r') *p = '\0'; - return(OK); -} - -int multiline(buf, n, f) -char *buf; -register int n; -FILE *f; -{ - if (getline(buf, n, f) != OK) return (NOTOK); - if (*buf == '.') { - if (*(buf+1) == '\0') { - return (DONE); - } else { - strcpy(buf, buf+1); - } - } - return(OK); -} - -#ifndef HAS_STRERROR -char * -strerror(e) - int e; -{ - extern int errno, sys_nerr; - extern char *sys_errlist[]; - - if (errno < sys_nerr) - return sys_errlist[errno]; - else - return "unknown error"; -} -#endif - -char * -get_errmsg() -{ - char *s = strerror(errno); - - return(s); -} - -int putline(buf, err, f) -char *buf; -char *err; -FILE *f; -{ - fprintf(f, "%s\r\n", buf); - fflush(f); - if (ferror(f)) { - strcpy(err, "lost connection"); - return(NOTOK); - } - return(OK); -} - - -/* Print error message and exit. */ - -void fatal (s1, s2) - char *s1, *s2; -{ - error (s1, s2); - exit (1); -} - -/* Print error message. `s1' is printf control string, `s2' is arg for it. */ - -void error (s1, s2, s3) - char *s1, *s2, *s3; -{ - printf ("poplib: "); - printf (s1, s2, s3); - printf ("\n"); -} - -void pfatal_with_name (name) - char *name; -{ - char *s = concat ("", strerror(errno), " for %s"); - - fatal (s, name); -} - -/* Return a newly-allocated string whose contents concatenate those of s1, s2, s3. */ - -char * -concat (s1, s2, s3) - char *s1, *s2, *s3; -{ - int len1 = strlen (s1), len2 = strlen (s2), len3 = strlen (s3); - char *result = (char *) xmalloc (len1 + len2 + len3 + 1); - - strcpy (result, s1); - strcpy (result + len1, s2); - strcpy (result + len1 + len2, s3); - *(result + len1 + len2 + len3) = 0; - - return result; -} - -/* Like malloc but get fatal error if memory is exhausted. */ - -void * -xmalloc (size) - int size; -{ - void *result = (void *)malloc (size); - if (!result) - fatal ("virtual memory exhausted", 0); - return result; -} diff --git a/src/appl/movemail/.Sanitize b/src/appl/movemail/.Sanitize deleted file mode 100644 index 7146ae17d..000000000 --- a/src/appl/movemail/.Sanitize +++ /dev/null @@ -1,37 +0,0 @@ -# Sanitize.in for Kerberos V5 - -# Each directory to survive it's way into a release will need a file -# like this one called "./.Sanitize". All keyword lines must exist, -# and must exist in the order specified by this file. Each directory -# in the tree will be processed, top down, in the following order. - -# Hash started lines like this one are comments and will be deleted -# before anything else is done. Blank lines will also be squashed -# out. - -# The lines between the "Do-first:" line and the "Things-to-keep:" -# line are executed as a /bin/sh shell script before anything else is -# done in this - -Do-first: - -# All files listed between the "Things-to-keep:" line and the -# "Files-to-sed:" line will be kept. All other files will be removed. -# Directories listed in this section will have their own Sanitize -# called. Directories not listed will be removed in their entirety -# with rm -rf. - -Things-to-keep: - -.cvsignore -ChangeLog -Makefile.in -configure -configure.in -movemail.c - -Things-to-lose: - -Do-last: - -# End of file. diff --git a/src/appl/movemail/ChangeLog b/src/appl/movemail/ChangeLog deleted file mode 100644 index 959c65b44..000000000 --- a/src/appl/movemail/ChangeLog +++ /dev/null @@ -1,86 +0,0 @@ -Thu Nov 7 15:21:13 1996 Theodore Ts'o - - * movemail.c (main): Check the error return from - krb5_init_context(), and print an error message if - necessary. - Cleaned up gcc -Wall warnings. - -Sat Jun 15 04:23:36 1996 Ezra Peisach - - * movemail.c: Initialize auth_context to NULL. - -Fri Jul 7 15:44:13 EDT 1995 Paul Park (pjpark@mit.edu) - * Makefile.in - Remove all explicit library handling and LDFLAGS. - * configure.in - add KRB5_LIBRARIES. - -Tue Jun 20 13:09:51 1995 Tom Yu (tlyu@dragons-lair) - - * movemail.c: USE_STRING_H -> HAVE_STRING_H; fix HAVE_STLIB_H to - dtrt. - * configure.in: added missing tests for string.h and stdlib.h - -Thu Jun 15 17:37:08 EDT 1995 Paul Park (pjpark@mit.edu) - * Makefile.in - Change explicit library names to -l form, and - change target link line to use $(LD) and associated flags. - * configure.in - Add shared library usage check. - -Sat Jun 10 22:57:39 1995 Tom Yu (tlyu@dragons-lair) - - * movemail.c: krb5_auth_context redefinitions - -Fri Jun 9 18:27:12 1995 - - * configure.in: Remove standardized set of autoconf macros, which - are now handled by CONFIG_RULES. - -Fri Mar 31 21:24:48 1995 Theodore Y. Ts'o (tytso@dcl) - - * configure.in, movemail.c: Use configure to see if unistd.h needs - to be included. Remove leftover hair from emacs config. - -Mon Mar 27 09:17:06 1995 Chris Provenzano (proven@mit.edu) - - * movemail.c: Fixups to get movemail to compile. - -Thu Mar 2 12:28:04 1995 Theodore Y. Ts'o - - * Makefile.in (ISODELIB): Remove reference to $(ISODELIB). - -Wed Mar 1 11:56:05 1995 Theodore Y. Ts'o - - * movemail.c: Add proper #ifdef's to #include the appropriate - system header files. - - * configure.in: Replace check for -lsocket and -lnsl with - WITH_NETLIB check. - -Tue Feb 28 01:53:27 1995 John Gilmore (gnu at toad.com) - - * movemail.c: Avoid includes. - -Tue Feb 14 15:30:55 1995 Chris Provenzano (proven@mit.edu) - - * movemail.c Call krb5_sendauth() with new calling convention. - -Fri Jan 13 15:23:47 1995 Chris Provenzano (proven@mit.edu) - - * Added krb5_context to all krb5_routines - -Thu Sep 29 22:52:50 1994 Theodore Y. Ts'o (tytso@dcl) - - * Makefile.in: Relink executables if libraries change - -Thu Aug 18 14:54:33 1994 Theodore Y. Ts'o (tytso@dcl) - - * configure.in: - * movemail.c: Add NEED_SYS_FCNTL_H - - * Makefile.in: Add $(LIBS) declaration on link line. - -Tue Aug 9 21:11:54 1994 Tom Yu (tlyu@dragons-lair) - - * Makefile.in: - * configure.in: make install fixes - - * movemail.c: fix spelling error - diff --git a/src/appl/movemail/Makefile.in b/src/appl/movemail/Makefile.in deleted file mode 100644 index 838b42d00..000000000 --- a/src/appl/movemail/Makefile.in +++ /dev/null @@ -1,23 +0,0 @@ -CFLAGS = $(CCOPTS) -DKERBEROS -DKRB5 -DMAIL_USE_POP $(DEFS) $(LOCALINCLUDE) - -OBJS = movemail.o movemail-mmdf.o - -all:: - -HESIODLIB = -LOCAL_LIBRARIES = $(HESIODLIB) -DEPLOCAL_LIBRARIES = $(HESIODLIB) - -movemail: movemail.o $(DEPLIBS) - $(LD) $(LDFLAGS) $(LDARGS) -o movemail movemail.o $(LIBS) - -all:: movemail - -clean:: - $(RM) movemail - -install:: - $(INSTALL_PROGRAM) movemail ${DESTDIR}$(CLIENT_BINDIR)/movemail - -movemail.o: $(srcdir)/movemail.c - diff --git a/src/appl/movemail/configure.in b/src/appl/movemail/configure.in deleted file mode 100644 index 19711245a..000000000 --- a/src/appl/movemail/configure.in +++ /dev/null @@ -1,7 +0,0 @@ -AC_INIT(movemail.c) -CONFIG_RULES -AC_PROG_INSTALL -AC_HAVE_HEADERS(stdlib.h string.h unistd.h) -KRB5_LIBRARIES -V5_USE_SHARED_LIB -V5_AC_OUTPUT_MAKEFILE diff --git a/src/appl/movemail/movemail.c b/src/appl/movemail/movemail.c deleted file mode 100644 index 66ee4d3da..000000000 --- a/src/appl/movemail/movemail.c +++ /dev/null @@ -1,843 +0,0 @@ -/* movemail foo bar -- move file foo to file bar, - locking file foo the way /bin/mail respects. - Copyright (C) 1986 Free Software Foundation, Inc. - -This file is part of GNU Emacs. - -GNU Emacs is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 1, or (at your option) -any later version. - -GNU Emacs is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with GNU Emacs; see the file COPYING. If not, write to -the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */ - -/* - * Modified January, 1986 by Michael R. Gretzinger (Project Athena) - * - * Added POP (Post Office Protocol) service. When compiled -DPOP - * movemail will accept input filename arguments of the form - * "po:username". This will cause movemail to open a connection to - * a pop server running on $MAILHOST (environment variable). Movemail - * must be setuid to root in order to work with POP. - * - * New module: popmail.c - * Modified routines: - * main - added code within #ifdef MAIL_USE_POP; added setuid(getuid()) - * after POP code. - * New routines in movemail.c: - * get_errmsg - return pointer to system error message - * - * Modified November, 1990 by Jonathan I. Kamens (Project Athena) - * - * Added KPOP (Kerberized POP) service to POP code. If KERBEROS is - * defined, then: - * - * 1. The "kpop" service is used instead of the "pop" service. - * 2. Kerberos authorization data is sent to the server upon start-up. - * 3. Instead of sending USER and RPOP, USER and PASS are sent, both - * containing the username of the user retrieving mail. - * - * Added HESIOD support. If HESIOD is defined, then an attempt will - * be made to look up the user's mailhost in the hesiod nameserver - * database if the MAILHOST environment variable is not set. - * - */ - -#include -#include -#include -#include -#include -#include -#include - -#define NO_SHORTNAMES /* Tell config not to load remap.h */ -/* #include "../src/config.h" */ - -#ifdef KERBEROS -#ifdef KRB5 -/* these need to be here to declare the functions which are used by - non-kerberos specific code */ -#include "krb5.h" -#endif -#endif - -#include -#ifdef HAVE_UNISTD_H -#include -#endif -#ifndef F_OK -#define F_OK 0 -#define X_OK 1 -#define W_OK 2 -#define R_OK 4 -#endif - -#ifdef XENIX -#include -#endif - -#ifdef HAVE_STDLIB_H -#include -#else -extern char *malloc(), *realloc(), *calloc(); -extern char *getenv(); -#endif /* HAVE_STDLIB_H */ - -#ifdef HAVE_STRING_H -#include -#else -#include -#endif - -char *concat (); -void fatal(), error(), pfatal_with_name(); -void mbx_write(), mbx_delimit_begin(), mbx_delimit_end(); -int pop_init(), popmail(), pop_command(), pop_stat(), pop_retr(); -int getline(), multiline(), putline(); - -extern int errno; - -/* Nonzero means this is name of a lock file to delete on fatal error. */ -char *delete_lockname; - -int main (argc, argv) - int argc; - char **argv; -{ - char *inname, *outname; - int indesc, outdesc; - char buf[1024]; - int nread; - -#ifndef MAIL_USE_FLOCK - struct stat st; - long now; - int tem; - char *lockname, *p; - char tempname[40]; - int desc; -#endif /* not MAIL_USE_FLOCK */ - - delete_lockname = 0; - - if (argc < 3) - fatal ("two arguments required"); - - inname = argv[1]; - outname = argv[2]; - - /* Check access to output file. */ - if (access (outname, F_OK) == 0 && access (outname, W_OK) != 0) - pfatal_with_name (outname); - - /* Also check that outname's directory is writeable to the real uid. */ - { - char *buf = (char *) malloc (strlen (outname) + 1); - char *p; - strcpy (buf, outname); - p = buf + strlen (buf); - while (p > buf && p[-1] != '/') - *--p = 0; - if (p == buf) - *p++ = '.'; - if (access (buf, W_OK) != 0) - pfatal_with_name (buf); - free (buf); - } - -#ifdef MAIL_USE_POP - if (!memcmp (inname, "po:", 3)) - { - int status; char *user; - - user = (char *) strrchr (inname, ':') + 1; - status = popmail (user, outname); - exit (status); - } - - setuid (getuid()); -#endif /* MAIL_USE_POP */ - - /* Check access to input file. */ - if (access (inname, R_OK | W_OK) != 0) - pfatal_with_name (inname); - -#ifndef MAIL_USE_FLOCK - /* Use a lock file named /usr/spool/mail/$USER.lock: - If it exists, the mail file is locked. */ - lockname = concat (inname, ".lock", ""); - strcpy (tempname, inname); - p = tempname + strlen (tempname); - while (p != tempname && p[-1] != '/') - p--; - *p = 0; - strcpy (p, "EXXXXXX"); - mktemp (tempname); - (void) unlink (tempname); - - while (1) - { - /* Create the lock file, but not under the lock file name. */ - /* Give up if cannot do that. */ - desc = open (tempname, O_WRONLY | O_CREAT, 0666); - if (desc < 0) - pfatal_with_name (concat ("temporary file \"", tempname, "\"")); - close (desc); - - tem = link (tempname, lockname); - (void) unlink (tempname); - if (tem >= 0) - break; - sleep (1); - - /* If lock file is a minute old, unlock it. */ - if (stat (lockname, &st) >= 0) - { - now = time (0); - if (st.st_ctime < now - 60) - (void) unlink (lockname); - } - } - - delete_lockname = lockname; -#endif /* not MAIL_USE_FLOCK */ - -#ifdef MAIL_USE_FLOCK - indesc = open (inname, O_RDWR); -#else /* if not MAIL_USE_FLOCK */ - indesc = open (inname, O_RDONLY); -#endif /* not MAIL_USE_FLOCK */ - if (indesc < 0) - pfatal_with_name (inname); - -#if defined(BSD) || defined(XENIX) - /* In case movemail is setuid to root, make sure the user can - read the output file. */ - /* This is desirable for all systems - but I don't want to assume all have the umask system call */ - umask (umask (0) & 0333); -#endif /* BSD or Xenix */ - outdesc = open (outname, O_WRONLY | O_CREAT | O_EXCL, 0666); - if (outdesc < 0) - pfatal_with_name (outname); -#ifdef MAIL_USE_FLOCK -#ifdef XENIX - if (locking (indesc, LK_RLCK, 0L) < 0) pfatal_with_name (inname); -#else - flock (indesc, LOCK_EX); -#endif -#endif /* MAIL_USE_FLOCK */ - - while (1) - { - nread = read (indesc, buf, sizeof buf); - if (nread != write (outdesc, buf, nread)) - { - int saved_errno = errno; - (void) unlink (outname); - errno = saved_errno; - pfatal_with_name (outname); - } - if (nread < sizeof buf) - break; - } - -#ifdef BSD - fsync (outdesc); -#endif - - /* Check to make sure no errors before we zap the inbox. */ - if (close (outdesc) != 0) - { - int saved_errno = errno; - (void) unlink (outname); - errno = saved_errno; - pfatal_with_name (outname); - } - -#ifdef MAIL_USE_FLOCK -#if defined(STRIDE) || defined(XENIX) - /* Stride, xenix have file locking, but no ftruncate. This mess will do. */ - (void) close (open (inname, O_CREAT | O_TRUNC | O_RDWR, 0666)); -#else - (void) ftruncate (indesc, 0L); -#endif /* STRIDE or XENIX */ -#endif /* MAIL_USE_FLOCK */ - close (indesc); - -#ifndef MAIL_USE_FLOCK - /* Delete the input file; if we can't, at least get rid of its contents. */ - if (unlink (inname) < 0) - if (errno != ENOENT) - creat (inname, 0666); - (void) unlink (lockname); -#endif /* not MAIL_USE_FLOCK */ - exit (0); -} - -/* Print error message and exit. */ - -void fatal (s1, s2) - char *s1, *s2; -{ - if (delete_lockname) - unlink (delete_lockname); - error (s1, s2); - exit (1); -} - -/* Print error message. `s1' is printf control string, `s2' is arg for it. */ - -void error (s1, s2, s3) - char *s1, *s2, *s3; -{ - printf ("movemail: "); - printf (s1, s2, s3); - printf ("\n"); -} - -void pfatal_with_name (name) - char *name; -{ - char *s; - - s = concat ("", strerror(errno), " for %s"); - fatal (s, name); -} - -/* Return a newly-allocated string whose contents concatenate those of s1, s2, s3. */ - -char * -concat (s1, s2, s3) - char *s1, *s2, *s3; -{ - int len1 = strlen (s1), len2 = strlen (s2), len3 = strlen (s3); - char *xmalloc(); - char *result = (char *) xmalloc (len1 + len2 + len3 + 1); - - strcpy (result, s1); - strcpy (result + len1, s2); - strcpy (result + len1 + len2, s3); - *(result + len1 + len2 + len3) = 0; - - return result; -} - -/* Like malloc but get fatal error if memory is exhausted. */ - -char * -xmalloc (size) - int size; -{ - char *result = malloc (size); - if (!result) - fatal ("virtual memory exhausted", 0); - return result; -} - -/* This is the guts of the interface to the Post Office Protocol. */ - -#ifdef MAIL_USE_POP - -#include -#include -#include -#ifdef KERBEROS -#ifndef POP_SNAME -#define POP_SNAME "pop" -#endif -#ifndef KPOP_SERVICE -#define KPOP_SERVICE "kpop" -#endif -#ifdef KRB4 -#ifdef KRB5 - #error can only use one of KRB4 or KRB5 -#endif -#include -#include -#endif /* KRB4 */ -#ifdef KRB5 -#include "krb5.h" -#include "com_err.h" -#include -#endif /* KRB5 */ -#endif /* KERBEROS */ -#ifdef HESIOD -#include -#endif - -#define NOTOK (-1) -#define OK 0 -#define DONE 1 - -char *progname; -FILE *sfi; -FILE *sfo; -char Errmsg[80]; - -static int debug = 0; - -int popmail(user, outfile) -char *user; -char *outfile; -{ - char *host; - int nmsgs, nbytes; - char response[128]; - register int i; - int mbfi; - FILE *mbf; - char *getenv(); - char *get_errmsg(); -#ifdef HESIOD - struct hes_postoffice *p; -#endif - - host = getenv("MAILHOST"); -#ifdef HESIOD - if (host == NULL) { - p = hes_getmailhost(user); - if (p != NULL && strcmp(p->po_type, "POP") == 0) - host = p->po_host; - else - fatal("no POP server listed in Hesiod"); - } -#endif /* HESIOD */ - if (host == NULL) { - fatal("no MAILHOST defined"); - } - - if (pop_init(host) == NOTOK) { - error(Errmsg); - return(1); - } - - if (getline(response, sizeof response, sfi) != OK) { - error(response); - return(1); - } - -#ifdef KERBEROS - if (pop_command("USER %s", user) == NOTOK || - pop_command("PASS %s", user) == NOTOK) -#else - if (pop_command("USER %s", user) == NOTOK || - pop_command("RPOP %s", user) == NOTOK) -#endif - { - error(Errmsg); - pop_command("QUIT"); - return(1); - } - - if (pop_stat(&nmsgs, &nbytes) == NOTOK) { - error(Errmsg); - pop_command("QUIT"); - return(1); - } - - if (!nmsgs) - { - pop_command("QUIT"); - return(0); - } - - mbfi = open (outfile, O_WRONLY | O_CREAT | O_EXCL, 0666); - if (mbfi < 0) - { - pop_command("QUIT"); - error("Error in open: %s, %s", get_errmsg(), outfile); - return(1); - } - fchown(mbfi, getuid(), -1); - - if ((mbf = fdopen(mbfi, "w")) == NULL) - { - pop_command("QUIT"); - error("Error in fdopen: %s", get_errmsg()); - close(mbfi); - unlink(outfile); - return(1); - } - - for (i = 1; i <= nmsgs; i++) { - mbx_delimit_begin(mbf); - if (pop_retr(i, mbx_write, mbf) != OK) { - error(Errmsg); - pop_command("QUIT"); - close(mbfi); - return(1); - } - mbx_delimit_end(mbf); - fflush(mbf); - if (ferror(mbf)) { - error("Error in fflush: %s", get_errmsg()); - pop_command("QUIT"); - close(mbfi); - return(1); - } - } - - /* On AFS, a call to write() only modifies the file in the local - workstation's AFS cache. The changes are not written to the server - until a call to fsync() or close() is made. Users with AFS home - directories have lost mail when over quota because these checks were - not made in previous versions of movemail. */ - - if (fsync(mbfi) < 0) { - error("Error in fsync: %s", get_errmsg()); - pop_command("QUIT"); - return(1); - } - - if (close(mbfi) == -1) { - error("Error in close: %s", get_errmsg()); - pop_command("QUIT"); - return(1); - } - - for (i = 1; i <= nmsgs; i++) { - if (pop_command("DELE %d", i) == NOTOK) { - error(Errmsg); - pop_command("QUIT"); - close(mbfi); - return(1); - } - } - - pop_command("QUIT"); - return(0); -} - -int pop_init(host) -char *host; -{ - register struct hostent *hp; - register struct servent *sp; -#ifndef KERBEROS - int lport = IPPORT_RESERVED - 1; -#endif - struct sockaddr_in sin; - int s; - char *get_errmsg(); -#ifdef KERBEROS -#ifdef KRB4 - KTEXT ticket; - MSG_DAT msg_data; - CREDENTIALS cred; - Key_schedule schedule; - int rem; -#endif /* KRB4 */ -#ifdef KRB5 - krb5_error_code retval; - krb5_ccache ccdef; - krb5_context context; - krb5_principal client, server; - krb5_error *err_ret = NULL; - krb5_auth_context auth_context = NULL; - char *hostname; -#endif /* KRB5 */ -#endif /* KERBEROS */ - hp = gethostbyname(host); - if (hp == NULL) { - sprintf(Errmsg, "MAILHOST unknown: %s", host); - return(NOTOK); - } - -#ifdef KERBEROS - hostname = malloc(strlen(hp->h_name)+1); - if (!hostname) { - sprintf(Errmsg, "Couldn't allocate space for hostname"); - return(NOTOK); - } - strcpy(hostname, hp->h_name); - sp = getservbyname(KPOP_SERVICE, "tcp"); -#else - sp = getservbyname("pop", "tcp"); -#endif - if (sp == 0) { -#ifdef KERBEROS - strcpy(Errmsg, "tcp/kpop: unknown service"); -#else - strcpy(Errmsg, "tcp/pop: unknown service"); -#endif - return(NOTOK); - } - - sin.sin_family = hp->h_addrtype; - memcpy((char *)&sin.sin_addr, hp->h_addr, hp->h_length); - sin.sin_port = sp->s_port; -#ifdef KERBEROS - s = socket(AF_INET, SOCK_STREAM, 0); -#else - s = rresvport(&lport); -#endif - - if (s < 0) { - sprintf(Errmsg, "error creating socket: %s", get_errmsg()); - return(NOTOK); - } - - if (connect(s, (struct sockaddr *)&sin, sizeof sin) < 0) { - sprintf(Errmsg, "error during connect: %s", get_errmsg()); - close(s); - return(NOTOK); - } - -#ifdef KERBEROS -#ifdef KRB4 - ticket = (KTEXT) malloc(sizeof(KTEXT_ST)); - rem = krb_sendauth(0L, s, ticket, POP_SNAME, hostname, - (char *) krb_realmofhost(hostname), - (unsigned long)0, &msg_data, &cred, schedule, - (struct sockaddr_in *)0, - (struct sockaddr_in *)0, - "KPOPV0.1"); - if (rem != KSUCCESS) { - sprintf(Errmsg, "kerberos error: %s", krb_err_txt[rem]); - close(s); - return(NOTOK); - } -#endif /* KRB4 */ -#ifdef KRB5 - retval = krb5_init_context(&context); - if (retval) { - com_err("movemail", retval, "while initializing krb5"); - exit(1); - } - - if ((retval = krb5_cc_default(context, &ccdef))) { - krb5error: - sprintf(Errmsg, "krb5 error: %s", error_message(retval)); - close(s); - return(NOTOK); - } - if ((retval = krb5_cc_get_principal(context, ccdef, &client))) { - goto krb5error; - } - - if ((retval = krb5_sname_to_principal(context, hostname, POP_SNAME, - KRB5_NT_SRV_HST, &server))) { - goto krb5error; - } - - retval = krb5_sendauth(context, &auth_context, (krb5_pointer) &s, - "KPOPV1.0", client, server, - AP_OPTS_MUTUAL_REQUIRED, - NULL, /* no data to checksum */ - 0, /* no creds, use ccache instead */ - ccdef, - &err_ret, 0, - NULL); /* don't need reply */ - krb5_free_principal(context, server); - krb5_auth_con_free(context, auth_context); - if (retval) { - if (err_ret && err_ret->text.length) { - sprintf(Errmsg, "krb5 error: %s [server says '%*s'] ", - error_message(retval), - err_ret->text.length, - err_ret->text.data); - krb5_free_error(context, err_ret); - } else - sprintf(Errmsg, "krb5 error: %s", error_message(retval)); - close(s); - return(NOTOK); - } -#endif /* KRB5 */ - free(hostname); -#endif /* KERBEROS */ - - sfi = fdopen(s, "r"); - sfo = fdopen(s, "w"); - if (sfi == NULL || sfo == NULL) { - sprintf(Errmsg, "error in fdopen: %s", get_errmsg()); - close(s); - return(NOTOK); - } - - return(OK); -} - -int pop_command(fmt, a, b, c, d) -char *fmt; -char *a, *b, *c, *d; -{ - char buf[128]; - - sprintf(buf, fmt, a, b, c, d); - - if (debug) fprintf(stderr, "---> %s\n", buf); - if (putline(buf, Errmsg, sfo) == NOTOK) return(NOTOK); - - if (getline(buf, sizeof buf, sfi) != OK) { - strcpy(Errmsg, buf); - return(NOTOK); - } - - if (debug) fprintf(stderr, "<--- %s\n", buf); - if (*buf != '+') { - strcpy(Errmsg, buf); - return(NOTOK); - } else { - return(OK); - } -} - - -int pop_stat(nmsgs, nbytes) -int *nmsgs, *nbytes; -{ - char buf[128]; - - if (debug) fprintf(stderr, "---> STAT\n"); - if (putline("STAT", Errmsg, sfo) == NOTOK) return(NOTOK); - - if (getline(buf, sizeof buf, sfi) != OK) { - strcpy(Errmsg, buf); - return(NOTOK); - } - - if (debug) fprintf(stderr, "<--- %s\n", buf); - if (*buf != '+') { - strcpy(Errmsg, buf); - return(NOTOK); - } else { - sscanf(buf, "+OK %d %d", nmsgs, nbytes); - return(OK); - } -} - -int pop_retr(msgno, action, arg) -int msgno; -void (*action)(); -void* arg; /* may always be FILE* -- eichin -- XXX */ -{ - char buf[1024]; - - sprintf(buf, "RETR %d", msgno); - if (debug) fprintf(stderr, "%s\n", buf); - if (putline(buf, Errmsg, sfo) == NOTOK) return(NOTOK); - - if (getline(buf, sizeof buf, sfi) != OK) { - strcpy(Errmsg, buf); - return(NOTOK); - } - - while (1) { - switch (multiline(buf, sizeof buf, sfi)) { - case OK: - (*action)(buf, arg); - break; - case DONE: - return (OK); - case NOTOK: - strcpy(Errmsg, buf); - return (NOTOK); - } - } -} - -int getline(buf, n, f) -char *buf; -register int n; -FILE *f; -{ - register char *p; - int c; - - p = buf; - while (--n > 0 && (c = fgetc(f)) != EOF) - if ((*p++ = c) == '\n') break; - - if (ferror(f)) { - strcpy(buf, "error on connection"); - return (NOTOK); - } - - if (c == EOF && p == buf) { - strcpy(buf, "connection closed by foreign host"); - return (DONE); - } - - *p = '\0'; - if (*--p == '\n') *p = '\0'; - if (*--p == '\r') *p = '\0'; - return(OK); -} - -int multiline(buf, n, f) -char *buf; -register int n; -FILE *f; -{ - if (getline(buf, n, f) != OK) return (NOTOK); - if (*buf == '.') { - if (buf[1] == '\0') { - return (DONE); - } else { - strcpy(buf, buf+1); - } - } - return(OK); -} - -char * -get_errmsg() -{ - char *s; - - s = strerror(errno); - return(s); -} - -int putline(buf, err, f) -char *buf; -char *err; -FILE *f; -{ - fprintf(f, "%s\r\n", buf); - fflush(f); - if (ferror(f)) { - strcpy(err, "lost connection"); - return(NOTOK); - } - return(OK); -} - -void mbx_write(line, mbf) -char *line; -FILE *mbf; -{ - fputs(line, mbf); - fputc(0x0a, mbf); -} - -void mbx_delimit_begin(mbf) -FILE *mbf; -{ -#ifdef OUTPUT_MMDF_FORMAT - fputs("\n", mbf); -#else - fputs("\f\n0, unseen,,\n", mbf); -#endif -} - -void mbx_delimit_end(mbf) -FILE *mbf; -{ -#ifdef OUTPUT_MMDF_FORMAT - fputs("\n", mbf); -#else - putc('\037', mbf); -#endif -} - -#endif /* MAIL_USE_POP */ diff --git a/src/appl/popper/.Sanitize b/src/appl/popper/.Sanitize deleted file mode 100644 index 112edef27..000000000 --- a/src/appl/popper/.Sanitize +++ /dev/null @@ -1,70 +0,0 @@ -# Sanitize.in for Kerberos V5 - -# Each directory to survive it's way into a release will need a file -# like this one called "./.Sanitize". All keyword lines must exist, -# and must exist in the order specified by this file. Each directory -# in the tree will be processed, top down, in the following order. - -# Hash started lines like this one are comments and will be deleted -# before anything else is done. Blank lines will also be squashed -# out. - -# The lines between the "Do-first:" line and the "Things-to-keep:" -# line are executed as a /bin/sh shell script before anything else is -# done in this - -Do-first: - -# All files listed between the "Things-to-keep:" line and the -# "Files-to-sed:" line will be kept. All other files will be removed. -# Directories listed in this section will have their own Sanitize -# called. Directories not listed will be removed in their entirety -# with rm -rf. - -Things-to-keep: - -.cvsignore -.rconf -ChangeLog -Makefile.in -README -Release.Notes -configure -configure.in -mh-6.8.patch -orig-makefiles -pop3.rfc1081 -pop3e.rfc1082 -pop_dele.c -pop_dropcopy.c -pop_dropinfo.c -pop_enter.c -pop_get_command.c -pop_get_subcommand.c -pop_init.c -pop_last.c -pop_list.c -pop_log.c -pop_lower.c -pop_msg.c -pop_parse.c -pop_pass.c -pop_quit.c -pop_rset.c -pop_send.c -pop_stat.c -pop_updt.c -pop_user.c -pop_xmit.c -pop_xtnd.c -popper.M -popper.c -popper.h -syslog_levels -version.h - -Things-to-lose: - -Do-last: - -# End of file. diff --git a/src/appl/popper/.rconf b/src/appl/popper/.rconf deleted file mode 100644 index ca39b0959..000000000 --- a/src/appl/popper/.rconf +++ /dev/null @@ -1,5 +0,0 @@ -ignore README -ignore pop3.rfc1081 -ignore pop3e.rfc1082 -ignore orig-makefiles -ignore syslog_levels diff --git a/src/appl/popper/ChangeLog b/src/appl/popper/ChangeLog deleted file mode 100644 index 6babb5e55..000000000 --- a/src/appl/popper/ChangeLog +++ /dev/null @@ -1,150 +0,0 @@ -Fri Nov 8 17:21:17 1996 Theodore Ts'o - - * pop_init.c (pop_init): Check the error return from - krb5_init_context(), and print an error message if - necessary. - -Tue Sep 10 14:08:36 1996 Tom Yu - - * popper.M: remove ".so man1/header.doc" - -Wed Aug 21 19:39:11 1996 Sam Hartman - - * mh-6.8.patch: Ken Hornstein contributed - replacement patch that uses Beta-6 calling conventions. - -Thu Aug 15 22:16:20 1996 Sam Hartman - - * pop_init.c (authenticate): Patch from Ken Hornstein - to make sure we actually look at the - client name. - -Sat Mar 16 07:11:06 1996 Ezra Peisach - - * configure.in: pop_init.c authenticate() needs USE_ANAME. - -Tue Jan 2 19:23:52 1996 Mark Eichin - - * pop_pass.c (our_getpwnam): the code here is unused and probably - wrong, but the hpux case should at least check __hpux as well. - -Sat Jul 29 04:38:30 1995 Tom Yu - - * configure.in: Don't link with -lkadm. - -Fri Jul 7 15:44:56 EDT 1995 Paul Park (pjpark@mit.edu) - * Makefile.in - Remove all explicit library handling. - * configure.in - add USE_KADM_LIBRARY and KRB5_LIBRARIES. - -Wed Nov 15 20:36:33 1995 Mark Eichin - - * pop_updt.c (pop_updt): initialize lock_arg to a copy of a static - (thus zero) struct flock, to avoid panic'ing sunos 4.1.4. - -Wed Nov 15 20:35:19 1995 Mark Eichin - - * pop_dropcopy.c (pop_dropcopy): initialize lock_arg to a copy of - a static (thus zero) struct flock, to avoid panic'ing sunos 4.1.4. - -Thu Jun 15 17:38:06 EDT 1995 Paul Park (pjpark@mit.edu) - * Makefile.in - Change explicit library names to -l form, and - change target link line to use $(LD) and associated flags. - Also, remove DBMLIB, it was not used. - * configure.in - Remove dbm library checks, these are no longer needed - with the Berkeley database code. Also, add shared library - usage check. - -Sat Jun 10 22:57:55 1995 Tom Yu (tlyu@dragons-lair) - - * pop_init.c: krb5_auth_context redefinitions - -Fri Jun 9 18:27:22 1995 - - * configure.in: Remove standardized set of autoconf macros, which - are now handled by CONFIG_RULES. - -Wed May 03 03:30:51 1995 Chris Provenzano (proven@mit.edu) - - * pop_init.c: (krb5_recvauth()): No longer needs the rc_type arg. - -Mon Mar 27 16:52:48 1995 - - * pop_init.c (pop_init): Put in a type cast to shut up the - compiler. Popper is still using gethostbyname()'s static - data wrong; this should be fixed eventually. - -Mon Mar 27 07:56:26 1995 Chris Provenzano (proven@mit.edu) - - * pop_init.c Use new calling conventions for krb5_recvauth(). - -Tue Mar 14 16:54:41 1995 - - * Makefile.in: Delete definitions defined in pre/config.in. - -Thu Mar 2 12:28:37 1995 Theodore Y. Ts'o - - * Makefile.in (ISODELIB): Remove reference to $(ISODELIB). - -Wed Mar 1 11:56:31 1995 Theodore Y. Ts'o - - * configure.in: Remove ISODE_INCLUDE, replace check for -lsocket - and -lnsl with WITH_NETLIB check. - -Tue Feb 28 01:54:56 1995 John Gilmore (gnu at toad.com) - - * pop_init.c, pop_pass.c, pop_user.c, mh-6.8.patch: Avoid - includes. - -Fri Jan 13 15:23:47 1995 Chris Provenzano (proven@mit.edu) - - * Added krb5_context to all krb5_routines - -Fri Nov 18 01:15:58 1994 Mark Eichin - - * configure.in: use KRB5_POSIX_LOCKS (from epeisach). - -Fri Nov 18 00:20:24 1994 Mark Eichin - - * pop_send.c (pop_send): Only update last_msg if executing a RETR. - From John Brezak . - -Wed Nov 2 21:09:38 1994 Theodore Y. Ts'o (tytso@dcl) - - * popper.h: NULL should not be used as a character assignment - value. Use '\0' instead. - -Wed Oct 26 15:00:13 1994 (tytso@rsx-11) - - * Makefile.in (CFLAGS): Control -g/-O via $(CCOPTS) - -Mon Oct 3 19:17:15 1994 Theodore Y. Ts'o (tytso@dcl) - - * Makefile.in: Use $(srcdir) to find manual page for make install. - -Thu Sep 29 22:52:35 1994 Theodore Y. Ts'o (tytso@dcl) - - * Makefile.in: Relink executables if libraries change - -Thu Sep 22 20:47:25 1994 Theodore Y. Ts'o (tytso@dcl) - - * configure.in: Fix order of configure so that cc can be found. - -Thu Aug 18 19:07:38 1994 Theodore Y. Ts'o (tytso at tsx-11) - - * configure.in: - * pop_xmit.c: Added #ifdef NEED_SYS_FCNTL_H around - -Wed Aug 10 12:46:12 1994 Theodore Y. Ts'o (tytso at tsx-11) - - * pop_dropcopy.c (pop_dropcopy): Change L_XTND to SEEK_END. - -Tue Aug 9 16:50:08 1994 Tom Yu (tlyu@dragons-lair) - - * configure.in: check for dbm as well as ndbm - - * pop_init.c: kill static version string that depended on ANSI - string splicing - - * Makefile.in: - * configure.in: fix $(ISODELIB), also fix make install - diff --git a/src/appl/popper/Makefile.in b/src/appl/popper/Makefile.in deleted file mode 100644 index 5d36a0172..000000000 --- a/src/appl/popper/Makefile.in +++ /dev/null @@ -1,56 +0,0 @@ -# -# Compile options: -# -DMMDF : Use for MMDF style mail drops -# -DKPOP_SERVICE : define the name of service (defaults to kpop) -# -DPOP_PVT_PASSWD : use a private passwd file for users of the POP mail service -# -DMAILDIR : Set to site specific other than default. -# -CFLAGS = $(CCOPTS) -DMAILDIR=\"/usr/spool/pop\" -DKERBEROS -DKRB5 -DDEBUG $(DEFS) $(LOCALINCLUDE) - -SERVER_MANSUFFIX = 8 - -all:: - -OBJS = pop_dele.o pop_dropcopy.o pop_dropinfo.o \ - pop_get_command.o pop_get_subcommand.o pop_init.o \ - pop_last.o pop_list.o pop_log.o pop_lower.o \ - pop_msg.o pop_parse.o pop_pass.o pop_quit.o \ - pop_rset.o pop_send.o pop_stat.o pop_updt.o \ - pop_user.o pop_xtnd.o pop_xmit.o popper.o - -popper: $(OBJS) $(DEPLIBS) - $(LD) $(LDFLAGS) $(LDARGS) -o popper $(OBJS) $(LIBS) - -all:: popper - -$(OBJS): popper.h -pop_dele.o: $(srcdir)/pop_dele.c -pop_dropcopy.o: $(srcdir)/pop_dropcopy.c -pop_dropinfo.o: $(srcdir)/pop_dropinfo.c -pop_enter.o: $(srcdir)/pop_enter.c -pop_get_command.o: $(srcdir)/pop_get_command.c -pop_get_subcommand.o: $(srcdir)/pop_get_subcommand.c -pop_init.o: $(srcdir)/pop_init.c -pop_last.o: $(srcdir)/pop_last.c -pop_list.o: $(srcdir)/pop_list.c -pop_log.o: $(srcdir)/pop_log.c -pop_lower.o: $(srcdir)/pop_lower.c -pop_msg.o: $(srcdir)/pop_msg.c -pop_parse.o: $(srcdir)/pop_parse.c -pop_pass.o: $(srcdir)/pop_pass.c -pop_quit.o: $(srcdir)/pop_quit.c -pop_rset.o: $(srcdir)/pop_rset.c -pop_send.o: $(srcdir)/pop_send.c -pop_stat.o: $(srcdir)/pop_stat.c -pop_updt.o: $(srcdir)/pop_updt.c -pop_user.o: $(srcdir)/pop_user.c -pop_xmit.o: $(srcdir)/pop_xmit.c -pop_xtnd.o: $(srcdir)/pop_xtnd.c -popper.o: $(srcdir)/popper.c - -clean:: - $(RM) popper - -install:: - $(INSTALL_PROGRAM) popper ${DESTDIR}$(SERVER_BINDIR)/popper - $(INSTALL_DATA) $(srcdir)/popper.M ${DESTDIR}$(SERVER_MANDIR)/popper.$(SERVER_MANSUFFIX) diff --git a/src/appl/popper/README b/src/appl/popper/README deleted file mode 100644 index 0735fdd56..000000000 --- a/src/appl/popper/README +++ /dev/null @@ -1,381 +0,0 @@ -@(#)@(#)README 2.6 2.6 4/2/91 - - -The Post Office Protocol Server: Installation Guide - - - -Introduction - -The Post Office Protocol server runs on a variety of Unix[1] computers -to manage electronic mail for Macintosh and MS-DOS computers. The -server was developed at the University of California at Berkeley and -conforms fully to the specifications in RFC 1081[2] and RFC 1082[3]. -The Berkeley server also has extensions to send electronic mail on -behalf of a client. - -This guide explains how to install the POP server on your Unix -computer. It assumes that you are not only familiar with Unix but also -capable of performing Unix system administration. - - -How to Obtain the Server - -The POP server is available via anonymous ftp from ftp.CC.Berkeley.EDU -(128.32.136.9, 128.32.206.12). It is in two files in the pub directory: -a compressed tar file popper-version.tar.Z and a Macintosh StuffIt archive -in BinHex format called MacPOP.sit.hqx. - - -Contents of the Distribution - -The distribution contains the following: - -+ All of the C source necessary to create the server program. - -+ A visual representation of how the POP system works. - -+ Reprints of RFC 1081 and RFC 1082. - -+ A HyperCard stack POP client implementation using MacTCP. - -+ A man page for the popper daemon. - -+ This guide. - - -Compatibility - -The Berkeley POP server has been successfully tested on the following -Unix operating systems: - -+ Berkeley Systems Distribution 4.3 - -+ Sun Microsystems Operating System versions 3.5 and 4.0 - -+ Ultrix version 2.3 - -The following POP clients operate correctly with the Berkeley POP server: - -+ The Berkeley HyperMail HyperCard stack for the Apple Macintosh - (distributed with the server). - -+ The Stanford University Macintosh Internet Protocol MacMH program. - -+ The Stanford University Personal Computer Internet Protocol MH - program. - -+ The mh version 6.0 programs for Unix. - - -Support - -The Berkeley POP server is not officially supported and is without any -warranty, explicit or implied. However, we are interested in your -experiences using the server. Bugs, comments and suggestions should be -sent electronically to netinfo@garnet.Berkeley.EDU. - - -Operational Characteristics - -The POP Transaction Cycle - -The Berkeley POP server is a single program (called popper) that is -launched by inetd when it gets a service request on the POP TCP port. -(The official port number specified in RFC 1081 for POP version 3 is -port 110. However, some POP3 clients attempt to contact the server at -port 109, the POP version 2 port. Unless you are running both POP2 and -POP3 servers, you can simply define both ports for use by the POP3 -server. This is explained in the installation instructions later on.) -The popper program initializes and verifies that the peer IP address is -registered in the local domain, logging a warning message when a -connection is made to a client whose IP address does not have a -canonical name. For systems using BSD 4.3 bind, it also checks to see -if a cannonical name lookup for the client returns the same peer IP -address, logging a warning message if it does not. The the server -enters the authorization state, during which the client must correctly -identify itself by providing a valid Unix userid and password on the -server's host machine. No other exchanges are allowed during this -state (other than a request to quit.) If authentication fails, a -warning message is logged and the session ends. Once the user is -identified, popper changes its user and group ids to match that of the -user and enters the transaction state. The server makes a temporary -copy of the user's maildrop (ordinarily in /usr/spool/mail) which is -used for all subsequent transactions. These include the bulk of POP -commands to retrieve mail, delete mail, undelete mail, and so forth. A -Berkeley extension also allows the user to submit a mail parcel to the -server who mails it using the sendmail program (this extension is -supported in the HyperMail client distributed with the server). When -the client quits, the server enters the final update state during which -the network connection is terminated and the user's maildrop is updated -with the (possibly) modified temporary maildrop. - - -Logging - -The POP server uses syslog to keep a record of its activities. On -systems with BSD 4.3 syslogging, the server logs (by default) to the -"local0" facility at priority "notice" for all messages except -debugging which is logged at priority "debug". The default log file is -/usr/spool/mqueue/POPlog. These can be changed, if desired. On -systems with 4.2 syslogging all messages are logged to the local log -file, usually /usr/spool/mqueue/syslog. - -Problems - -If the filesystem which holds the /usr/spool/mail fills up users will -experience difficulties. The filesystem must have enough space to hold -(approximately) two copies of the largest mail box. Popper (v1.81 and -above) is designed to be robust in the face of this problem, but you may -end up with a situation where some of the user's mail is in - - /usr/spool/mail/.userid.pop - -and some of the mail is in - - /usr/spool/mail/userid - -If this happens the System Administrator should clear enough disk space -so that the filesystem has at least as much free disk as both mailboxes -hold and probably a little more. Then the user should initiate a POP -session, and do nothing but quit. If the POP session ends without an -error the user can then use POP or another mail program to clean up his/her -mailbox. - -Alternatively, the System Administrator can combine the two files (but -popper will do this for you if there is enough disk space). - - -Debugging - -The popper program will log debugging information when the -d parameter -is specified after its invocation in the inetd.conf file. Care should -be exercised in using this option since it generates considerable -output in the syslog file. Alternatively, the "-t " option -will place debugging information into file "" using fprintf -instead of syslog. (To enable debugging, you must edit the Makefile -to add -DDEBUG to the compiler options.) - -For SunOS version 3.5, the popper program is launched by inetd from -/etc/servers. This file does not allow you to specify command line -arguments. Therefore, if you want to enable debugging, you can specify -a shell script in /etc/servers to be launched instead of popper and in -this script call popper with the desired arguments. - - -Installation - -1. Examine this file for the latest information, warnings, etc. - -2. Check the Makefile for conformity with your system. - -3. Issue the make command in the directory containing the popper - source. - -4. Issue the make install command in the directory containing the - popper source to copy the program to /usr/etc. - -5. Enable syslogging: - - + For systems with 4.3 syslogging: - - Add the following line to the /etc/syslog.conf file: - - local0.notice;local0.debug /usr/spool/mqueue/POPlog - - Create the empty file /usr/spool/mqueue/POPlog. - - Kill and restart the syslogd daemon. - - + For systems with 4.2 syslogging: - - Be sure that you are logging messages of priority 7 and higher. - For example: - - 7/usr/spool/mqueue/syslog - 9/dev/null - -6. Update /etc/services: - - Add the following line to the /etc/services file: - - pop 110/tcp - - Note: This is the official port number for version 3 of the - Post Office Protocol as defined in RFC 1081. However, some - POP3 clients use port 109, the port number for the previous - version (2) of POP. Therefore you may also want to add the - following line to the /etc/services file: - - pop2 109/tcp - - For Sun systems running yp, also do the following: - - + Change to the /var/yp directory. - - + Issue the make services command. - -7. Update the inetd daemon configuration. Include the second line ONLY if you - are running the server at both ports. - - + On BSD 4.3 and SunOS 4.0 systems, add the following line to the - /etc/inetd.conf file: - - pop stream tcp nowait root /usr/etc/popper popper - pop2 stream tcp nowait root /usr/etc/popper popper - - + On Ultrix systems, add the following line to the - /etc/inetd.conf file: - - pop stream tcp nowait /usr/etc/popper popper - pop2 stream tcp nowait /usr/etc/popper popper - - + On SunOS 3.5 systems, add the following line to the - /etc/servers file: - - pop tcp /usr/etc/popper - pop2 tcp /usr/etc/popper - - Kill and restart the inetd daemon. - -You can confirm that the POP server is running on Unix by telneting to -port 110 (or 109 if you set it up that way). For example: - -%telnet myhost 110 -Trying... -Connected to myhost.berkeley.edu. -Escape character is '^]'. -+OK UCB Pop server (version 1.6) at myhost starting. -quit -Connection closed by foreign host. - - -Release Notes - -1.83 Make sure that everything we do as root is non-destructive. - -1.82 Make the /usr/spool/mail/.userid.pop file owned by the user rather - than owned by root. - -1.81 There were two versions of 1.7 floating around, 1.7b4 and 1.7b5. - The difference is that 1.7b5 attempted to save disk space on - /usr/spool/mail by deleting the users permanent maildrop after - making the temporary copy. Unfortunately, if compiled with - -DDEBUG, this version could easily wipe out a users' mail file. - This is now fixed. - - This version also fixes a security hole for systems that have - /usr/spool/mail writeable by all users. - - With this version we go to all new SCCS IDs for all files. This - is unfortunate, and we hope it is not too much of a problem. - - Thanks to Steve Dorner of UIUC for pointing out the major problem. - -1.7 Extensive re-write of the maildrop processing code contributed by - Viktor Dukhovni that greatly reduces the - possibility that the maildrop can be corrupted as the result of - simultaneous access by two or more processes. - - Added "pop_dropcopy" module to create a temporary maildrop from - the existing, standard maildrop as root before the setuid and - setgid for the user is done. This allows the temporary maildrop - to be created in a mail spool area that is not world read-writable. - - This version does *not* send the sendmail "From " delimiter line - in response to a TOP or RETR command. - - Encased all debugging code in #ifdef DEBUG constructs. This code can - be included by specifying the DEGUG compiler flag. Note: You still - need to use the -d or -t option to obtain debugging output. - -1.6 Corrects a bug that causes the server to crash on SunOS - 4.0 systems. - - Uses varargs and vsprintf (if available) in pop_log and - pop_msg. This is enabled by the "HAVE_VSPRINTF" - compiler flag. - - For systems with BSD 4.3 bind, performs a cannonical - name lookup and searches the returned address(es) for - the client's address, logging a warning message if it - is not located. This is enabled by the "BIND43" - comiler flag. - - Removed all the includes from popper.h and distributed - them throughout the porgrams files, as needed. - - Reformatted the source to convert tabs to spaces and - shorten lines for display on 80-column terminals. - -1.5 Creates the temporary maildrop with mode "600" and - immediately unlinks it. - - Uses client's IP address in lieu of a canonical name if - the latter cannot be obtained. - - Added "-t " option. The presence of this - option causes debugging output to be placed in the file - "file-name" using fprintf instead of the system log - file using syslog. - - Corrected maildrop parsing problem. - -1.4 Copies user's mail into a temporary maildrop on which - all subsequent activity is performed. - - Added "pop_log" function and replaced "syslog" calls - throughout the code with it. - -1.3 Corrected updating of Status: header line. - - Added strncasecmp for systems that do not have one. - Used strncasecmp in all appropriate places. This is - enabled by the STRNCASECMP compiler flag. - -1.2 Support for version 4.2 syslogging added. This is - enabled by the SYSLOG42 compiler flag. - -1.1 Several bugs fixed. - -1.0 Original version. - - -Limitations - -+ The POP server copies the user's entire maildrop to /tmp and - then operates on that copy. If the maildrop is particularly - large, or inadequate space is available in /tmp, then the - server will refuse to continue and terminate the connection. - -+ Simultaneous modification of a single maildrop can result in - confusing results. For example, manipulating messages in a - maildrop using the Unix /usr/ucb/mail command while a copy of - it is being processed by the POP server can cause the changes - made by one program to be lost when the other terminates. This - problem is being worked on and will be fixed in a later - release. - - -Credits - -The POP server was written by Edward Moy and Austin Shelton with -contributions from Robert Campbell (U.C. Berkeley) and Viktor Dukhovni -(Princeton University). Edward Moy wrote the HyperMail stack and drew -the POP operation diagram. This installation guide was written by -Austin Shelton. - - -Footnotes - -[1] Copyright (c) 1990 Regents of the University of California. - All rights reserved. The Berkeley software License Agreement - specifies the terms and conditions for redistribution. Unix is - a registered trademark of AT&T corporation. HyperCard and - Macintosh are registered trademarks of Apple Corporation. - -[2] M. Rose, Post Office Protocol - Version 3. RFC 1081, NIC, - November 1988. - -[3] M. Rose, Post Office Protocol - Version 3 Extended Service - Offerings. RFC 1082, NIC, November 1988. diff --git a/src/appl/popper/Release.Notes b/src/appl/popper/Release.Notes deleted file mode 100644 index c0b313ecd..000000000 --- a/src/appl/popper/Release.Notes +++ /dev/null @@ -1,45 +0,0 @@ -Release Notes: - -popper-1.831beta is no longer beta 30 July 91 - Removed popper-1.7.tar.Z - -popper-1.831beta.tar.Z 03 April 91 - Changed mkstemp to mktemp for Ultrix. Sigh. - -popper-1.83beta.tar.Z 02 April 91 - - This version makes certain that while running as root we do nothing - at all destructive. - -popper-1.82beta.tar.Z 27 March 91 - - This version fixes problems on Encore MultiMax and some Sun releases - which wouldn't allow a user to ftruncate() a file from an open - file descripter unless the user owns the file. Now the user - owns the /usr/spool/mail/.userid.pop file. Thanks to Ben Levy - of FTP Software and Henry Holtzman of Apple. - -popper-1.81beta.tar.Z 20 March 91 - - This version of popper is supposed to fix three problems reported - with various versions of popper (all called 1.7 or 1.7something). - - 1) Dropped network connections meant lost mail files. Some 1.7 - versions also risked corrupting mail files. - - 2) Some versions of 1.7 created temporary drop files with world - read and write permissions. - - 3) Some versions of 1.7 were not careful about opening the temporary - drop file. - -popper-1.7.tar.Z 09 September 90 (updated 20 March 91) - - This version will exhibit the first problem listed above if it is - compiled with -DDEBUG and run without the "-d" (debug) flag. - - If it is compiled without -DDEBUG it will exhibit only the second - and third bug listed above. - -Cliff Frost poptest@nettlesome.berkeley.edu -UC Berkeley diff --git a/src/appl/popper/configure.in b/src/appl/popper/configure.in deleted file mode 100644 index 23cd5f8f2..000000000 --- a/src/appl/popper/configure.in +++ /dev/null @@ -1,16 +0,0 @@ -AC_INIT(popper.c) -CONFIG_RULES -AC_PROG_INSTALL -AC_FUNC_CHECK(vsprintf,AC_DEFINE(HAS_VSPRINTF)) -AC_CHECK_LIB(BSD,main) -CHECK_WAIT_TYPE -KRB5_POSIX_LOCKS - -AC_HAVE_HEADERS(strings.h) -AC_HEADER_CHECK(unistd.h,AC_DEFINE(HAS_UNISTD_H)) -AC_HEADER_CHECK(paths.h,AC_DEFINE(HAS_PATHS_H)) - -USE_ANAME -KRB5_LIBRARIES -V5_USE_SHARED_LIB -V5_AC_OUTPUT_MAKEFILE diff --git a/src/appl/popper/mh-6.8.patch b/src/appl/popper/mh-6.8.patch deleted file mode 100644 index ef4090aa2..000000000 --- a/src/appl/popper/mh-6.8.patch +++ /dev/null @@ -1,303 +0,0 @@ - ---- zotnet/mts/client.c.orig Mon Aug 12 00:26:34 1996 -+++ zotnet/mts/client.c Mon Aug 12 01:36:12 1996 -@@ -26,6 +26,22 @@ - #include - #endif - -+#if defined(KPOP) && defined(K5POP) -+#error "You cannot define both KPOP and K5POP" -+#endif -+#ifdef K5POP -+#include "krb5.h" -+/* #include */ -+/* #include */ -+#include "com_err.h" -+#include -+ -+static krb5_error_code retval; -+static krb5_ccache ccdef; -+static krb5_principal kclient = NULL, kserver = NULL; -+static krb5_context context; -+#endif -+ - #ifdef KPOP - #include - #include -@@ -76,6 +92,9 @@ - static struct addrent *he, *hz; - static struct addrent hosts[MAXHOSTS]; - -+#ifdef K5POP -+static char *kservice; /* "pop" if using kpop */ -+#endif - #ifdef KPOP - char krb_realm[REALM_SZ]; - char *PrincipalHostname(); -@@ -122,7 +141,7 @@ - register struct netent *np; - #endif - register struct servent *sp; --#ifdef KPOP -+#if defined(KPOP) || defined(K5POP) - char *cp; - - if (cp = index (kservice = service, '/')) { /* "pop/kpop" */ -@@ -131,12 +150,12 @@ - } - else - kservice = NULL; /* not using KERBEROS */ --#endif /* KPOP */ -+#endif /* KPOP || K5POP */ - - - if ((sp = getservbyname (service, protocol)) == NULL) { - #ifdef HESIOD -- if ((sp = hes_getservbyname (service, protocol)) == NULL) { -+ if ((sp = (struct servent *) hes_getservbyname (service, protocol)) == NULL) { - (void) sprintf (response, "%s/%s: unknown service", - protocol, service); - return NOTOK; -@@ -219,9 +238,9 @@ - register struct addrent *ap; - struct sockaddr_in in_socket; - register struct sockaddr_in *isock = &in_socket; --#ifdef KPOP -+#if defined(KPOP) || defined(K5POP) - int rem; --#endif /* KPOP */ -+#endif /* KPOP || K5POP */ - - for (ap = nets; ap < ne; ap++) - if (ap -> a_addrtype == hp -> h_addrtype && inet (hp, ap -> a_net)) -@@ -265,6 +284,65 @@ - return NOTOK; - } - -+#ifdef K5POP -+ if (kservice) { /* "pop" */ -+ krb5_error *err_ret = NULL; -+ krb5_auth_context auth_context = NULL; -+ -+ krb5_init_context(&context); -+ krb5_init_ets(context); -+ -+ if (retval = krb5_cc_default(context, &ccdef)) { -+ sprintf(response, "Post office refused connection: krb5_cc_default: %s", -+ error_message(retval)); -+ close(sd); -+ return OOPS2; -+ } -+ if (retval = krb5_cc_get_principal(context, ccdef, &kclient)) { -+ sprintf(response, "Post office refused connection: krb5_cc_get_principal: %s", -+ error_message(retval)); -+ close(sd); -+ return OOPS2; -+ } -+ -+ if (retval = krb5_sname_to_principal(context, hp->h_name, kservice, -+ KRB5_NT_SRV_HST, -+ &kserver)) { -+ sprintf(response, "Post office refused connection: krb5_sname_to_principal: %s", -+ error_message(retval)); -+ close(sd); -+ return OOPS2; -+ } -+ -+ retval = krb5_sendauth(context, &auth_context, (krb5_pointer) &sd, -+ "KPOPV1.0", kclient, kserver, -+ AP_OPTS_MUTUAL_REQUIRED, -+ 0, /* no checksum */ -+ 0, /* no creds, use ccache instead */ -+ ccdef, -+ &err_ret, -+ 0, -+ 0); /* don't need reply */ -+ krb5_free_principal(context, kserver); -+ if (auth_context) -+ krb5_auth_con_free(context, auth_context); -+ if (retval) { -+ if (err_ret && err_ret->text.length) { -+ sprintf(response, "Post office refused connection: %s [server says '%*s'] ", -+ error_message(retval), -+ err_ret->text.length, -+ err_ret->text.data); -+ krb5_free_error(context, err_ret); -+ } else -+ sprintf(response, "Post office refused connection: %s", -+ error_message(retval)); -+ close(sd); -+ krb5_free_context(context); -+ return OOPS2; -+ } -+ krb5_free_context(context); -+ } -+#endif /* K5POP */ - #ifdef KPOP - if (kservice) { /* "pop" */ - ticket = (KTEXT)malloc( sizeof(KTEXT_ST) ); -@@ -311,10 +389,10 @@ - : "unknown error"); - return NOTOK; - } --#ifdef KPOP -+#if defined(KPOP) || defined(K5POP) - if (kservice) /* "pop" */ - return(sd); --#endif /* KPOP */ -+#endif /* KPOP || K5POP */ - if (!rproto) - return sd; - ---- uip/popsbr.c.orig Mon Aug 12 00:27:00 1996 -+++ uip/popsbr.c Mon Aug 12 01:20:50 1996 -@@ -15,6 +15,7 @@ - #endif /* NNTP */ - #include - #include -+#include - - #ifndef POPSERVICE - #define POPSERVICE "pop" -@@ -144,10 +145,15 @@ - #endif /* APOP */ - - #ifndef NNTP --#ifndef KPOP -+#if !defined(KPOP) && !defined(K5POP) - if ((fd1 = client (host, "tcp", POPSERVICE, rpop, response)) == NOTOK) - #else /* KPOP */ -+#ifdef K5POP - (void) sprintf (buffer, "%s/%s", POPSERVICE, "kpop"); -+#endif -+#ifdef KPOP -+ (void) sprintf (buffer, "%s/%s", POPSERVICE, "kpop"); -+#endif - if ((fd1 = client (host, "tcp", buffer, rpop, response)) == NOTOK) - #endif - #else /* NNTP */ -@@ -177,7 +183,7 @@ - fprintf (stderr, "<--- %s\n", response); - #ifndef NNTP - if (*response == '+') { --#ifndef KPOP -+#if !defined(KPOP) && !defined(K5POP) - #ifdef APOP - if (apop < 0) { - char *cp = pop_auth (user, pass); -@@ -191,7 +197,7 @@ - && command ("%s %s", rpop ? "RPOP" : (pophack++, "PASS"), - pass) != NOTOK) - return OK; --#else /* KPOP */ -+#else /* KPOP || K5POP */ - if (command ("USER %s", user) != NOTOK - && command ("PASS %s", pass) != NOTOK) - return OK; ---- uip/inc.c.orig Mon Aug 12 00:27:08 1996 -+++ uip/inc.c Mon Aug 12 00:28:27 1996 -@@ -19,9 +19,6 @@ - #ifdef POP - #include "../h/dropsbr.h" - #endif --#ifdef KPOP --#include --#endif - #ifdef HESIOD - #include - #endif ---- conf/mhconfig.c.orig Sat Aug 10 00:13:00 1996 -+++ conf/mhconfig.c Mon Aug 12 00:28:29 1996 -@@ -134,6 +134,7 @@ - "BSD43", 0, /* sgid ttys */ - "BSD44", 0, /* manual headings */ - "KPOP", 0, /* KERBEROS pop */ -+ "K5POP", 0, /* KERBEROS5 pop */ - "HESIOD", 0, - "MIME", 0, /* multi-media extensions */ - "MPOP", 0, /* mobile pop */ ---- conf/makefiles/uip.orig Tue Nov 30 23:00:23 1993 -+++ conf/makefiles/uip Tue Aug 13 14:44:56 1996 -@@ -84,6 +84,8 @@ - @BEGIN: KPOP - KRBLIB = -lkrb -ldes - @END: KPOP -+@BEGIN: K5POP -+KRBLIB = -lkrb5 -lcrypto -lcom_err - @END: POP - @BEGIN: BPOP - PSHLIB = popsbr.o -@@ -328,7 +330,7 @@ - bbc: xbbc - - xbbc: bbc.o $(PSHLIB) $(LIBES) -- $(LD) $(LDFLAGS) -o $@ bbc.o $(PSHLIB) $(LDLIBS) -+ $(LD) $(LDFLAGS) -o $@ bbc.o $(KRBLIB) $(PSHLIB) $(LDLIBS) - - l-bbc:; $(LINT) $(LFLAGS) bbc.c $(PSHLLIBS) $(LLIBS) - -@@ -640,7 +642,7 @@ - xmhl: mhl.o \ - mhlsbr.o trmsbr.o $(LIBES) - $(LD) $(LDFLAGS) -o $@ mhl.o \ -- mhlsbr.o trmsbr.o $(LDLIBS) $(LDCURSES) -+ mhlsbr.o trmsbr.o $(KRBLIB) $(LDLIBS) $(LDCURSES) - - l-mhl:; $(LINT) $(LFLAGS) mhl.c \ - mhlsbr.c trmsbr.c $(LLIBS) -@@ -676,7 +678,7 @@ - - xmhn: mhn.o ftpsbr.o trmsbr.o $(LIBES) - $(LD) $(LDFLAGS) -o $@ mhn.o ftpsbr.o trmsbr.o \ -- $(LDLIBS) $(LDCURSES) -+ $(KRBLIB) $(LDLIBS) $(LDCURSES) - - l-mhn:; $(LINT) $(LFLAGS) mhn.c ftpsbr.c trmsbr.c $(LLIBS) - -@@ -756,7 +758,7 @@ - $(PSHLIB) $(LIBES) - $(LD) $(LDFLAGS) -o $@ msh.o mshcmds.o vmhsbr.o \ - picksbr.o scansbr.o dropsbr.o mhlsbr.o trmsbr.o \ -- $(PSHLIB) $(LDLIBS) $(LDCURSES) -+ $(PSHLIB) $(KRBLIB) $(LDLIBS) $(LDCURSES) - - l-msh:; $(LINT) $(LFLAGS) msh.c mshcmds.c vmhsbr.c \ - picksbr.c scansbr.c dropsbr.c mhlsbr.c trmsbr.c \ -@@ -809,8 +811,8 @@ - popi: xpopi - - xpopi: popi.o $(POPLIB) trmsbr.o $(LIBES) -- $(LD) $(LDFLAGS) -o $@ popi.o $(POPLIB) trmsbr.o $(LDLIBS) \ -- $(LDCURSES) -+ $(LD) $(LDFLAGS) -o $@ popi.o $(POPLIB) trmsbr.o $(KRBLIB) \ -+ $(LDLIBS) $(LDCURSES) - - l-popi:; $(LINT) $(LFLAGS) popi.c $(POPLLIBS) trmsbr.c $(LLIBS) - -@@ -835,7 +837,7 @@ - - xpost: post.o \ - aliasbr.o $(MTSBRS) $(TMALIB) $(LIBES) -- $(LD) $(LDFLAGS) -o $@ post.o \ -+ $(LD) $(KRBLIB) $(LDFLAGS) -o $@ post.o \ - aliasbr.o $(MTSBRS) $(TMALIB) $(LDLIBS) - - l-post:; $(LINT) $(LFLAGS) post.c \ -@@ -1096,7 +1098,7 @@ - xshow: show.o \ - mhlsbr.o trmsbr.o $(LIBES) - $(LD) $(LDFLAGS) -o $@ show.o \ -- mhlsbr.o trmsbr.o $(LDLIBS) $(LDCURSES) -+ mhlsbr.o trmsbr.o $(KRBLIB) $(LDLIBS) $(LDCURSES) - - l-show:; $(LINT) $(LFLAGS) show.c \ - mhlsbr.c trmsbr.c $(LLIBS) -@@ -1121,7 +1123,7 @@ - sbboards: xsbboards - - xsbboards: sbboards.o dropsbr.o $(LIBES) -- $(LD) $(LDFLAGS) -o $@ sbboards.o dropsbr.o $(LDLIBS) -+ $(LD) $(LDFLAGS) -o $@ sbboards.o dropsbr.o $(KRBLIB) $(LDLIBS) - - l-sbboards:; $(LINT) $(LFLAGS) sbboards.c dropsbr.c $(LLIBS) - diff --git a/src/appl/popper/orig-makefiles/.Sanitize b/src/appl/popper/orig-makefiles/.Sanitize deleted file mode 100644 index 9030cf5e3..000000000 --- a/src/appl/popper/orig-makefiles/.Sanitize +++ /dev/null @@ -1,33 +0,0 @@ -# Sanitize.in for Kerberos V5 - -# Each directory to survive it's way into a release will need a file -# like this one called "./.Sanitize". All keyword lines must exist, -# and must exist in the order specified by this file. Each directory -# in the tree will be processed, top down, in the following order. - -# Hash started lines like this one are comments and will be deleted -# before anything else is done. Blank lines will also be squashed -# out. - -# The lines between the "Do-first:" line and the "Things-to-keep:" -# line are executed as a /bin/sh shell script before anything else is -# done in this - -Do-first: - -# All files listed between the "Things-to-keep:" line and the -# "Files-to-sed:" line will be kept. All other files will be removed. -# Directories listed in this section will have their own Sanitize -# called. Directories not listed will be removed in their entirety -# with rm -rf. - -Things-to-keep: - -Makefile -Makefile.krb_passwd_hack - -Things-to-lose: - -Do-last: - -# End of file. diff --git a/src/appl/popper/orig-makefiles/Makefile b/src/appl/popper/orig-makefiles/Makefile deleted file mode 100644 index 3d4770c38..000000000 --- a/src/appl/popper/orig-makefiles/Makefile +++ /dev/null @@ -1,111 +0,0 @@ -CSRCS = pop_dele.c pop_dropcopy.c pop_dropinfo.c \ - pop_get_command.c pop_get_subcommand.c pop_init.c \ - pop_last.c pop_list.c pop_log.c pop_lower.c \ - pop_msg.c pop_parse.c pop_pass.c pop_quit.c \ - pop_rset.c pop_send.c pop_stat.c pop_updt.c \ - pop_user.c pop_xtnd.c pop_xmit.c popper.c - -OBJS = pop_dele.o pop_dropcopy.o pop_dropinfo.o \ - pop_get_command.o pop_get_subcommand.o pop_init.o \ - pop_last.o pop_list.o pop_log.o pop_lower.o \ - pop_msg.o pop_parse.o pop_pass.o pop_quit.o \ - pop_rset.o pop_send.o pop_stat.o pop_updt.o \ - pop_user.o pop_xtnd.o pop_xmit.o popper.o \ - ../../slave/sendauth.o - -SP_SRCS = pop_enter.c -SP_OBJS = pop_enter.o - -DOCS = README pop3.rfc1081 pop3e.rfc1082 popper.8 - -INCLUDES = popper.h version.h - -SRCS = ${CSRCS} ${INCLUDES} - -SCCS = /usr/ucb/sccs - -REL = - -MAKEFILE = Makefile - -# Options are: -# BIND43 - If you are using BSD 4.3 domain -# name service. -# DEBUG - Include the debugging code. Note: You -# still have to use the -d or -t flag to -# enable debugging. -# HAVE_VSPRINTF - If the vsprintf functions are available -# on your system. -# SYSLOG42 - For BSD 4.2 syslog (default is BSD 4.3 -# syslog). -# STRNCASECMP - If you do not have strncasecmp() -# KERBEROS - If you want authentication vis Kerberos -# (tom) -# KERBEROS_PASSWD_HSCK - Use popper as passwd server - -CFLAGS = -g -DBIND43 -DKERBEROS -DKRB5 -DNOSTATUS -DDEBUG $(INCS) - -INCS = -I../../include - -TARGET = popper - -TAR = ${TARGET}.tar - -INSTALLDIR = /usr/etc - -MANPAGE = popper.8 - -CATPAGE = popper.0 - -MANDIR = /usr/local/man/cat8 - -LIBS = -L../.././lib -lkrb5 -lmd4 -ldes5 -los -lcrc32 -L/mit/isode/isode-6.8/@sys/lib -lisode -lcom_err -ldbm - -all: ${TARGET} - -spop: ${SP_OBJS} - cc ${SP_OBJS} -o spop ${LIBS} - -${TARGET}: ${OBJS} - cc ${OBJS} -o ${TARGET} ${LIBS} - -tar: ${SRCS} ${DOCS} ${MAKEFILE} - rm -f ${TAR} *.Z* - tar -cvf ${TAR} ${SRCS} ${DOCS} ${MAKEFILE} - compress ${TAR} - uuencode ${TAR}.Z ${TAR}.Z > ${TAR}.Z.uuencoded - split -300 ${TAR}.Z.uuencoded - mv xaa ${TAR}.Z.uuencoded.xaa - mv xab ${TAR}.Z.uuencoded.xab - mv xac ${TAR}.Z.uuencoded.xac - mv xad ${TAR}.Z.uuencoded.xad - mv xae ${TAR}.Z.uuencoded.xae - -clean: - rm -f core *~ *.o *.Z* -# ${SCCS} clean - -install: ${TARGET} - install -c -m 700 -o root -g staff ${TARGET} ${INSTALLDIR} - -installman: - rm -f ${CATPAGE} - nroff -man ${MANPAGE} > ${CATPAGE} - install -c -m 644 -o root -g staff ${CATPAGE} ${MANDIR} - -edit: - ${SCCS} edit ${REL} ${SRCS} - -admin: - ${SCCS} admin -ft"Copyright (c) 1990 Regents of the University of California.\nAll rights reserved.\n" ${SRCS} - -sources: ${SRCS} - -${SRCS}: - ${SCCS} get ${REL} $@ -p | expand -4 > $@ - -${DOCS}: - ${SCCS} get README -p | expand -4 > README - ${SCCS} get popper.8 -p | expand -4 > popper.8 - -${OBJS}: popper.h version.h diff --git a/src/appl/popper/orig-makefiles/Makefile.krb_passwd_hack b/src/appl/popper/orig-makefiles/Makefile.krb_passwd_hack deleted file mode 100644 index c8a5c5c87..000000000 --- a/src/appl/popper/orig-makefiles/Makefile.krb_passwd_hack +++ /dev/null @@ -1,107 +0,0 @@ -CSRCS = pop_dele.c pop_dropcopy.c pop_dropinfo.c \ - pop_get_command.c pop_get_subcommand.c pop_init.c \ - pop_last.c pop_list.c pop_log.c pop_lower.c \ - pop_msg.c pop_parse.c pop_pass.c pop_quit.c \ - pop_rset.c pop_send.c pop_stat.c pop_updt.c \ - pop_user.c pop_xtnd.c pop_xmit.c popper.c - -OBJS = pop_dele.o pop_dropcopy.o pop_dropinfo.o \ - pop_get_command.o pop_get_subcommand.o pop_init.o \ - pop_last.o pop_list.o pop_log.o pop_lower.o \ - pop_msg.o pop_parse.o pop_pass.o pop_quit.o \ - pop_rset.o pop_send.o pop_stat.o pop_updt.o \ - pop_user.o pop_xtnd.o pop_xmit.o popper.o - -SP_SRCS = pop_enter.c -SP_OBJS = pop_enter.o - -DOCS = README pop3.rfc1081 pop3e.rfc1082 popper.8 - -INCLUDES = popper.h version.h - -SRCS = ${CSRCS} ${INCLUDES} - -SCCS = /usr/ucb/sccs - -REL = - -MAKEFILE = Makefile - -# Options are: -# BIND43 - If you are using BSD 4.3 domain -# name service. -# DEBUG - Include the debugging code. Note: You -# still have to use the -d or -t flag to -# enable debugging. -# HAVE_VSPRINTF - If the vsprintf functions are available -# on your system. -# SYSLOG42 - For BSD 4.2 syslog (default is BSD 4.3 -# syslog). -# STRNCASECMP - If you do not have strncasecmp() -# KERBEROS - If you want authentication vis Kerberos -# (tm) - -CFLAGS = -O -DBIND43 -DKERBEROS_PASSWD_HACK - -TARGET = popper - -TAR = ${TARGET}.tar - -INSTALLDIR = /usr/etc - -MANPAGE = popper.8 - -CATPAGE = popper.0 - -MANDIR = /usr/local/man/cat8 - -LIBS = -lkrb -ldes - -all: ${TARGET} spop - -spop: ${SP_OBJS} - cc ${SP_OBJS} -o spop ${LIBS} - -${TARGET}: ${OBJS} - cc ${OBJS} -o ${TARGET} ${LIBS} - -tar: ${SRCS} ${DOCS} ${MAKEFILE} - rm -f ${TAR} *.Z* - tar -cvf ${TAR} ${SRCS} ${DOCS} ${MAKEFILE} - compress ${TAR} - uuencode ${TAR}.Z ${TAR}.Z > ${TAR}.Z.uuencoded - split -300 ${TAR}.Z.uuencoded - mv xaa ${TAR}.Z.uuencoded.xaa - mv xab ${TAR}.Z.uuencoded.xab - mv xac ${TAR}.Z.uuencoded.xac - mv xad ${TAR}.Z.uuencoded.xad - mv xae ${TAR}.Z.uuencoded.xae - -clean: - rm -f core *.o *.Z* - ${SCCS} clean - -install: ${TARGET} - install -c -m 700 -o root -g staff ${TARGET} ${INSTALLDIR} - -installman: - rm -f ${CATPAGE} - nroff -man ${MANPAGE} > ${CATPAGE} - install -c -m 644 -o root -g staff ${CATPAGE} ${MANDIR} - -edit: - ${SCCS} edit ${REL} ${SRCS} - -admin: - ${SCCS} admin -ft"Copyright (c) 1990 Regents of the University of California.\nAll rights reserved.\n" ${SRCS} - -sources: ${SRCS} - -${SRCS}: - ${SCCS} get ${REL} $@ -p | expand -4 > $@ - -${DOCS}: - ${SCCS} get README -p | expand -4 > README - ${SCCS} get popper.8 -p | expand -4 > popper.8 - -${OBJS}: popper.h version.h diff --git a/src/appl/popper/pop3.rfc1081 b/src/appl/popper/pop3.rfc1081 deleted file mode 100644 index 08ea6dd14..000000000 --- a/src/appl/popper/pop3.rfc1081 +++ /dev/null @@ -1,898 +0,0 @@ - - - - - - -Network Working Group M. Rose -Request for Comments: 1081 TWG - November 1988 - - Post Office Protocol - Version 3 - - -Status of this Memo - - This memo suggests a simple method for workstations to dynamically - access mail from a mailbox server. This RFC specifies a proposed - protocol for the Internet community, and requests discussion and - suggestions for improvements. Distribution of this memo is - unlimited. - - This memo is based on RFC 918 (since revised as RFC 937). Although - similar in form to the original Post Office Protocol (POP) proposed - for the Internet community, the protocol discussed in this memo is - similar in spirit to the ideas investigated by the MZnet project at - the University of California, Irvine. - - Further, substantial work was done on examining POP in a PC-based - environment. This work, which resulted in additional functionality - in this protocol, was performed by the ACIS Networking Systems Group - at Stanford University. The author gratefully acknowledges their - interest. - -Introduction - - On certain types of smaller nodes in the Internet it is often - impractical to maintain a message transport system (MTS). For - example, a workstation may not have sufficient resources (cycles, - disk space) in order to permit a SMTP server and associated local - mail delivery system to be kept resident and continuously running. - Similarly, it may be expensive (or impossible) to keep a personal - computer interconnected to an IP-style network for long amounts of - time (the node is lacking the resource known as "connectivity"). - - Despite this, it is often very useful to be able to manage mail on - these smaller nodes, and they often support a user agent (UA) to aid - the tasks of mail handling. To solve this problem, a node which can - support an MTS entity offers a maildrop service to these less endowed - nodes. The Post Office Protocol - Version 3 (POP3) is intended to - permit a workstation to dynamically access a maildrop on a server - host in a useful fashion. Usually, this means that the POP3 is used - to allow a workstation to retrieve mail that the server is holding - for it. - - - - -Rose [Page 1] - -RFC 1081 POP3 November 1988 - - - For the remainder of this memo, the term "client host" refers to a - host making use of the POP3 service, while the term "server host" - refers to a host which offers the POP3 service. - -A Short Digression - - This memo does not specify how a client host enters mail into the - transport system, although a method consistent with the philosophy of - this memo is presented here: - - When the user agent on a client host wishes to enter a message - into the transport system, it establishes an SMTP connection to - its relay host (this relay host could be, but need not be, the - POP3 server host for the client host). - - If this method is followed, then the client host appears to the MTS - as a user agent, and should NOT be regarded as a "trusted" MTS entity - in any sense whatsoever. This concept, along with the role of the - POP3 as a part of a split-UA model is discussed later in this memo. - - Initially, the server host starts the POP3 service by listening on - TCP port 110. When a client host wishes to make use of the service, - it establishes a TCP connection with the server host. When the - connection is established, the POP3 server sends a greeting. The - client and POP3 server then exchange commands and responses - (respectively) until the connection is closed or aborted. - - Commands in the POP3 consist of a keyword possibly followed by an - argument. All commands are terminated by a CRLF pair. - - Responses in the POP3 consist of a success indicator and a keyword - possibly followed by additional information. All responses are - terminated by a CRLF pair. There are currently two success - indicators: positive ("+OK") and negative ("-ERR"). - - Responses to certain commands are multi-line. In these cases, which - are clearly indicated below, after sending the first line of the - response and a CRLF, any additional lines are sent, each terminated - by a CRLF pair. When all lines of the response have been sent, a - final line is sent, consisting of a termination octet (decimal code - 046, ".") and a CRLF pair. If any line of the multi-line response - begins with the termination octet, the line is "byte-stuffed" by - pre-pending the termination octet to that line of the response. - Hence a multi-line response is terminated with the five octets - "CRLF.CRLF". When examining a multi-line response, the client checks - to see if the line begins with the termination octet. If so and if - octets other than CRLF follow, the the first octet of the line (the - termination octet) is stripped away. If so and if CRLF immediately - - - -Rose [Page 2] - -RFC 1081 POP3 November 1988 - - - follows the termination character, then the response from the POP - server is ended and the line containing ".CRLF" is not considered - part of the multi-line response. - - A POP3 session progresses through a number of states during its - lifetime. Once the TCP connection has been opened and the POP3 - server has sent the greeting, the session enters the AUTHORIZATION - state. In this state, the client must identify itself to the POP3 - server. Once the client has successfully done this, the server - acquires resources associated with the client's maildrop, and the - session enters the TRANSACTION state. In this state, the client - requests actions on the part of the POP3 server. When the client has - finished its transactions, the session enters the UPDATE state. In - this state, the POP3 server releases any resources acquired during - the TRANSACTION state and says goodbye. The TCP connection is then - closed. - -The AUTHORIZATION State - - Once the TCP connection has been opened by a POP3 client, the POP3 - server issues a one line greeting. This can be any string terminated - by CRLF. An example might be: - - S. +OK dewey POP3 server ready (Comments to: PostMaster@UDEL.EDU) - - Note that this greeting is a POP3 reply. The POP3 server should - always give a positive response as the greeting. - - The POP3 session is now in the AUTHORIZATION state. The client must - now issue the USER command. If the POP3 server responds with a - positive success indicator ("+OK"), then the client may issue either - the PASS command to complete the authorization, or the QUIT command - to terminate the POP3 session. If the POP3 server responds with a - negative success indicator ("-ERR") to the USER command, then the - client may either issue a new USER command or may issue the QUIT - command. - - When the client issues the PASS command, the POP3 server uses the - argument pair from the USER and PASS commands to determine if the - client should be given access to the appropriate maildrop. If so, - the POP3 server then acquires an exclusive-access lock on the - maildrop. If the lock is successfully acquired, the POP3 server - parses the maildrop into individual messages (read note below), - determines the last message (if any) present in the maildrop that was - referenced by the RETR command, and responds with a positive success - indicator. The POP3 session now enters the TRANSACTION state. If - the lock can not be acquired or the client should is denied access to - the appropriate maildrop or the maildrop can't be parsed for some - - - -Rose [Page 3] - -RFC 1081 POP3 November 1988 - - - reason, the POP3 server responds with a negative success indicator. - (If a lock was acquired but the POP3 server intends to respond with a - negative success indicator, the POP3 server must release the lock - prior to rejecting the command.) At this point, the client may - either issue a new USER command and start again, or the client may - issue the QUIT command. - - NOTE: Minimal implementations of the POP3 need only be - able to break a maildrop into its component messages; - they need NOT be able to parse individual messages. - More advanced implementations may wish to have this - capability, for reasons discussed later. - - After the POP3 server has parsed the maildrop into individual - messages, it assigns a message-id to each message, and notes the size - of the message in octets. The first message in the maildrop is - assigned a message-id of "1", the second is assigned "2", and so on, - so that the n'th message in a maildrop is assigned a message-id of - "n". In POP3 commands and responses, all message-id's and message - sizes are expressed in base-10 (i.e., decimal). - - It sets the "highest number accessed" to be that of the last message - referenced by the RETR command. - - Here are summaries for the three POP3 commands discussed thus far: - - USER name - Arguments: a server specific user-id (required) - Restrictions: may only be given in the AUTHORIZATION - state after the POP3 greeting or after an - unsuccessful USER or PASS command - Possible Responses: - +OK name is welcome here - -ERR never heard of name - Examples: - C: USER mrose - S: +OK mrose is a real hoopy frood - ... - C: USER frated - S: -ERR sorry, frated doesn't get his mail here - - PASS string - Arguments: a server/user-id specific password (required) - Restrictions: may only be given in the AUTHORIZATION - state after a successful USER command - Possible Responses: - +OK maildrop locked and ready - -ERR invalid password - - - -Rose [Page 4] - -RFC 1081 POP3 November 1988 - - - -ERR unable to lock maildrop - Examples: - C: USER mrose - S: +OK mrose is a real hoopy frood - C: PASS secret - S: +OK mrose's maildrop has 2 messages - (320 octets) - ... - C: USER mrose - S: +OK mrose is a real hoopy frood - C: PASS secret - S: -ERR unable to lock mrose's maildrop, file - already locked - - QUIT - Arguments: none - Restrictions: none - Possible Responses: - +OK - Examples: - C: QUIT - S: +OK dewey POP3 server signing off - - -The TRANSACTION State - - Once the client has successfully identified itself to the POP3 server - and the POP3 server has locked and burst the appropriate maildrop, - the POP3 session is now in the TRANSACTION state. The client may now - issue any of the following POP3 commands repeatedly. After each - command, the POP3 server issues a response. Eventually, the client - issues the QUIT command and the POP3 session enters the UPDATE state. - - Here are the POP3 commands valid in the TRANSACTION state: - - STAT - Arguments: none - Restrictions: may only be given in the TRANSACTION state. - Discussion: - - The POP3 server issues a positive response with a line - containing information for the maildrop. This line is - called a "drop listing" for that maildrop. - - In order to simplify parsing, all POP3 servers are - required to use a certain format for drop listings. - The first octets present must indicate the number of - messages in the maildrop. Following this is the size - - - -Rose [Page 5] - -RFC 1081 POP3 November 1988 - - - of the maildrop in octets. This memo makes no - requirement on what follows the maildrop size. - Minimal implementations should just end that line of - the response with a CRLF pair. More advanced - implementations may include other information. - - NOTE: This memo STRONGLY discourages - implementations from supplying additional - information in the drop listing. Other, - optional, facilities are discussed later on - which permit the client to parse the messages - in the maildrop. - - Note that messages marked as deleted are not counted in - either total. - - Possible Responses: - +OK nn mm - Examples: - C: STAT - S: +OK 2 320 - - LIST [msg] - Arguments: a message-id (optionally) If a message-id is - given, it may NOT refer to a message marked as - deleted. - Restrictions: may only be given in the TRANSACTION state. - Discussion: - - If an argument was given and the POP3 server issues a - positive response with a line containing information - for that message. This line is called a "scan listing" - for that message. - - If no argument was given and the POP3 server issues a - positive response, then the response given is - multi-line. After the initial +OK, for each message - in the maildrop, the POP3 server responds with a line - containing information for that message. This line - is called a "scan listing" for that message. - - In order to simplify parsing, all POP3 servers are - required to use a certain format for scan listings. - The first octets present must be the message-id of - the message. Following the message-id is the size of - the message in octets. This memo makes no requirement - on what follows the message size in the scan listing. - Minimal implementations should just end that line of - - - -Rose [Page 6] - -RFC 1081 POP3 November 1988 - - - the response with a CRLF pair. More advanced - implementations may include other information, as - parsed from the message. - - NOTE: This memo STRONGLY discourages - implementations from supplying additional - information in the scan listing. Other, optional, - facilities are discussed later on which permit - the client to parse the messages in the maildrop. - - Note that messages marked as deleted are not listed. - - Possible Responses: - +OK scan listing follows - -ERR no such message - Examples: - C: LIST - S: +OK 2 messages (320 octets) - S: 1 120 - S: 2 200 - S: . - ... - C: LIST 2 - S: +OK 2 200 - ... - C: LIST 3 - S: -ERR no such message, only 2 messages in - maildrop - - RETR msg - Arguments: a message-id (required) This message-id may - NOT refer to a message marked as deleted. - Restrictions: may only be given in the TRANSACTION state. - Discussion: - - If the POP3 server issues a positive response, then the - response given is multi-line. After the initial +OK, - the POP3 server sends the message corresponding to the - given message-id, being careful to byte-stuff the - termination character (as with all multi-line - responses). - - If the number associated with this message is higher - than the "highest number accessed" in the maildrop, the - POP3 server updates the "highest number accessed" to - the number associated with this message. - - - - - -Rose [Page 7] - -RFC 1081 POP3 November 1988 - - - Possible Responses: - +OK message follows - -ERR no such message - Examples: - C: RETR 1 - S: +OK 120 octets - S: - S: . - - DELE msg - Arguments: a message-id (required) This message-id - may NOT refer to a message marked as deleted. - Restrictions: may only be given in the TRANSACTION state. - Discussion: - - The POP3 server marks the message as deleted. Any - future reference to the message-id associated with the - message in a POP3 command generates an error. The POP3 - server does not actually delete the message until the - POP3 session enters the UPDATE state. - - If the number associated with this message is higher - than the "highest number accessed" in the maildrop, - the POP3 server updates the "highest number accessed" - to the number associated with this message. - - Possible Responses: - +OK message deleted - -ERR no such message - Examples: - C: DELE 1 - S: +OK message 1 deleted - ... - C: DELE 2 - S: -ERR message 2 already deleted - - NOOP - Arguments: none - Restrictions: may only be given in the TRANSACTION state. - Discussion: - - The POP3 server does nothing, it merely replies with a - positive response. - - Possible Responses: - +OK - - - - - -Rose [Page 8] - -RFC 1081 POP3 November 1988 - - - Examples: - C: NOOP - S: +OK - - LAST - Arguments: none - Restrictions: may only be issued in the TRANSACTION state. - Discussion: - - The POP3 server issues a positive response with a line - containing the highest message number which accessed. - Zero is returned in case no message in the maildrop has - been accessed during previous transactions. A client - may thereafter infer that messages, if any, numbered - greater than the response to the LAST command are - messages not yet accessed by the client. - - Possible Response: - +OK nn - - Examples: - C: STAT - S: +OK 4 320 - C: LAST - S: +OK 1 - C: RETR 3 - S: +OK 120 octets - S: - S: . - C: LAST - S: +OK 3 - C: DELE 2 - S: +OK message 2 deleted - C: LAST - S: +OK 3 - C: RSET - S: +OK - C: LAST - S: +OK 1 - - RSET - Arguments: none - Restrictions: may only be given in the TRANSACTION - state. - Discussion: - - If any messages have been marked as deleted by the POP3 - - - -Rose [Page 9] - -RFC 1081 POP3 November 1988 - - - server, they are unmarked. The POP3 server then - replies with a positive response. In addition, the - "highest number accessed" is also reset to the value - determined at the beginning of the POP3 session. - - Possible Responses: - +OK - Examples: - C: RSET - S: +OK maildrop has 2 messages (320 octets) - - - -The UPDATE State - - When the client issues the QUIT command from the TRANSACTION state, - the POP3 session enters the UPDATE state. (Note that if the client - issues the QUIT command from the AUTHORIZATION state, the POP3 - session terminates but does NOT enter the UPDATE state.) - - QUIT - Arguments: none - Restrictions: none - Discussion: - - The POP3 server removes all messages marked as deleted - from the maildrop. It then releases the - exclusive-access lock on the maildrop and replies as - to the success of - these operations. The TCP connection is then closed. - - Possible Responses: - +OK - Examples: - C: QUIT - S: +OK dewey POP3 server signing off (maildrop - empty) - ... - C: QUIT - S: +OK dewey POP3 server signing off (2 messages - left) - ... - - -Optional POP3 Commands - - The POP3 commands discussed above must be supported by all minimal - implementations of POP3 servers. - - - -Rose [Page 10] - -RFC 1081 POP3 November 1988 - - - The optional POP3 commands described below permit a POP3 client - greater freedom in message handling, while preserving a simple POP3 - server implementation. - - NOTE: This memo STRONGLY encourages implementations to - support these commands in lieu of developing augmented - drop and scan listings. In short, the philosophy of - this memo is to put intelligence in the part of the - POP3 client and not the POP3 server. - - TOP msg n - Arguments: a message-id (required) and a number. This - message-id may NOT refer to a message marked as - deleted. - Restrictions: may only be given in the TRANSACTION state. - Discussion: - - If the POP3 server issues a positive response, then - the response given is multi-line. After the initial - +OK, the POP3 server sends the headers of the message, - the blank line separating the headers from the body, - and then the number of lines indicated message's body, - being careful to byte-stuff the termination character - (as with all multi-line responses). - - Note that if the number of lines requested by the POP3 - client is greater than than the number of lines in the - body, then the POP3 server sends the entire message. - - Possible Responses: - +OK top of message follows - -ERR no such message - Examples: - C: TOP 10 - S: +OK - S: - S: . - ... - C: TOP 100 - S: -ERR no such message - - RPOP user - Arguments: a client specific user-id (required) - Restrictions: may only be given in the AUTHORIZATION - state after a successful USER command; in addition, - may only be given if the client used a reserved - - - -Rose [Page 11] - -RFC 1081 POP3 November 1988 - - - (privileged) TCP port to connect to the server. - Discussion: - - The RPOP command may be used instead of the PASS - command to authenticate access to the maildrop. In - order for this command to be successful, the POP3 - client must use a reserved TCP port (port < 1024) to - connect tothe server. The POP3 server uses the - argument pair from the USER and RPOP commands to - determine if the client should be given access to - the appropriate maildrop. Unlike the PASS command - however, the POP3 server considers if the remote user - specified by the RPOP command who resides on the POP3 - client host is allowed to access the maildrop for the - user specified by the USER command (e.g., on Berkeley - UNIX, the .rhosts mechanism is used). With the - exception of this differing in authentication, this - command is identical to the PASS command. - - Note that the use of this feature has allowed much wider - penetration into numerous hosts on local networks (and - sometimes remote networks) by those who gain illegal - access to computers by guessing passwords or otherwise - breaking into the system. - - Possible Responses: - +OK maildrop locked and ready - -ERR permission denied - Examples: - C: USER mrose - S: +OK mrose is a real hoopy frood - C: RPOP mrose - S: +OK mrose's maildrop has 2 messages (320 - octets) - - Minimal POP3 Commands: - USER name valid in the AUTHORIZATION state - PASS string - QUIT - - STAT valid in the TRANSACTION state - LIST [msg] - RETR msg - DELE msg - NOOP - LAST - RSET - - - - -Rose [Page 12] - -RFC 1081 POP3 November 1988 - - - QUIT valid in the UPDATE state - - Optional POP3 Commands: - RPOP user valid in the AUTHORIZATION state - - TOP msg n valid in the TRANSACTION state - - POP3 Replies: - +OK - -ERR - - Note that with the exception of the STAT command, the reply given - by the POP3 server to any command is significant only to "+OK" - and "-ERR". Any text occurring after this reply may be ignored - by the client. - -Example POP3 Session - - S: - ... - C: - S: +OK dewey POP3 server ready (Comments to: PostMaster@UDEL.EDU) - C: USER mrose - S: +OK mrose is a real hoopy frood - C: PASS secret - S: +OK mrose's maildrop has 2 messages (320 octets) - C: STAT - S: +OK 2 320 - C: LIST - S: +OK 2 messages (320 octets) - S: 1 120 - S: 2 200 - S: . - C: RETR 1 - S: +OK 120 octets - S: - S: . - C: DELE 1 - S: +OK message 1 deleted - C: RETR 2 - S: +OK 200 octets - S: - S: . - C: DELE 2 - S: +OK message 2 deleted - C: QUIT - - - - - -Rose [Page 13] - -RFC 1081 POP3 November 1988 - - - S: +OK dewey POP3 server signing off (maildrop empty) - C: - S: - -Message Format - - All messages transmitted during a POP3 session are assumed to conform - to the standard for the format of Internet text messages [RFC822]. - - It is important to note that the byte count for a message on the - server host may differ from the octet count assigned to that message - due to local conventions for designating end-of-line. Usually, - during the AUTHORIZATION state of the POP3 session, the POP3 client - can calculate the size of each message in octets when it parses the - maildrop into messages. For example, if the POP3 server host - internally represents end-of-line as a single character, then the - POP3 server simply counts each occurrence of this character in a - message as two octets. Note that lines in the message which start - with the termination octet need not be counted twice, since the POP3 - client will remove all byte-stuffed termination characters when it - receives a multi-line response. - -The POP and the Split-UA model - - The underlying paradigm in which the POP3 functions is that of a - split-UA model. The POP3 client host, being a remote PC based - workstation, acts solely as a client to the message transport system. - It does not provide delivery/authentication services to others. - Hence, it is acting as a UA, on behalf of the person using the - workstation. Furthermore, the workstation uses SMTP to enter mail - into the MTS. - - In this sense, we have two UA functions which interface to the - message transport system: Posting (SMTP) and Retrieval (POP3). The - entity which supports this type of environment is called a split-UA - (since the user agent is split between two hosts which must - interoperate to provide these functions). - - ASIDE: Others might term this a remote-UA instead. - There are arguments supporting the use of both terms. - - This memo has explicitly referenced TCP as the underlying transport - agent for the POP3. This need not be the case. In the MZnet split- - UA, for example, personal micro-computer systems are used which do - not have IP-style networking capability. To connect to the POP3 - server host, a PC establishes a terminal connection using some simple - protocol (PhoneNet). A program on the PC drives the connection, - first establishing a login session as a normal user. The login shell - - - -Rose [Page 14] - -RFC 1081 POP3 November 1988 - - - for this pseudo-user is a program which drives the other half of the - terminal protocol and communicates with one of two servers. Although - MZnet can support several PCs, a single pseudo-user login is present - on the server host. The user-id and password for this pseudo-user - login is known to all members of MZnet. Hence, the first action of - the login shell, after starting the terminal protocol, is to demand a - USER/PASS authorization pair from the PC. This second level of - authorization is used to ascertain who is interacting with the MTS. - Although the server host is deemed to support a "trusted" MTS entity, - PCs in MZnet are not. Naturally, the USER/PASS authorization pair - for a PC is known only to the owner of the PC (in theory, at least). - - After successfully verifying the identity of the client, a modified - SMTP server is started, and the PC posts mail with the server host. - After the QUIT command is given to the SMTP server and it terminates, - a modified POP3 server is started, and the PC retrieves mail from the - server host. After the QUIT command is given to the POP3 server and - it terminates, the login shell for the pseudo-user terminates the - terminal protocol and logs the job out. The PC then closes the - terminal connection to the server host. - - The SMTP server used by MZnet is modified in the sense that it knows - that it's talking to a user agent and not a "trusted" entity in the - message transport system. Hence, it does performs the validation - activities normally performed by an entity in the MTS when it accepts - a message from a UA. - - The POP3 server used by MZnet is modified in the sense that it does - not require a USER/PASS combination before entering the TRANSACTION - state. The reason for this (of course) is that the PC has already - identified itself during the second-level authorization step - described above. - - NOTE: Truth in advertising laws require that the author - of this memo state that MZnet has not actually been - fully implemented. The concepts presented and proven - by the project led to the notion of the MZnet - split-slot model. This notion has inspired the - split-UA concept described in this memo, led to the - author's interest in the POP, and heavily influenced - the the description of the POP3 herein. - - In fact, some UAs present in the Internet already support the notion - of posting directly to an SMTP server and retrieving mail directly - from a POP server, even if the POP server and client resided on the - same host! - - ASIDE: this discussion raises an issue which this memo - - - -Rose [Page 15] - -RFC 1081 POP3 November 1988 - - - purposedly avoids: how does SMTP know that it's talking - to a "trusted" MTS entity? - -References - - [MZnet] Stefferud, E., J. Sweet, and T. Domae, "MZnet: Mail - Service for Personal Micro-Computer Systems", - Proceedings, IFIP 6.5 International Conference on - Computer Message Systems, Nottingham, U.K., May 1984. - - [RFC821] Postel, J., "Simple Mail Transfer Protocol", - USC/Information Sciences Institute, August 1982. - - [RFC822] Crocker, D., "Standard for the Format of ARPA-Internet - Text Messages", University of Delaware, August 1982. - - [RFC937] Butler, M., J. Postel, D. Chase, J. Goldberger, and J. - Reynolds, "Post Office Protocol - Version 2", RFC 937, - USC/Information Sciences Institute, February 1985. - - [RFC1010] Reynolds, J., and J. Postel, "Assigned Numbers", RFC - 1010, USC/Information Sciences Institute, May 1987. - -Author's Address: - - - Marshall Rose - The Wollongong Group - 1129 San Antonio Rd. - Palo Alto, California 94303 - - Phone: (415) 962-7100 - - Email: MRose@TWG.COM - - - - - - - - - - - - - - - - - -Rose [Page 16] diff --git a/src/appl/popper/pop3e.rfc1082 b/src/appl/popper/pop3e.rfc1082 deleted file mode 100644 index 36deae545..000000000 --- a/src/appl/popper/pop3e.rfc1082 +++ /dev/null @@ -1,619 +0,0 @@ - - - - - - -Network Working Group M. Rose -Request for Comments: 1082 TWG - November 1988 - - - - Post Office Protocol - Version 3 - Extended Service Offerings - -Status of This Memo - - This memo suggests a simple method for workstations to dynamically - access mail from a discussion group server, as an extension to an - earlier memo which dealt with dynamically accessing mail from a - mailbox server using the Post Office Protocol - Version 3 (POP3). - This RFC specifies a proposed protocol for the Internet community, - and requests discussion and suggestions for improvements. All of the - extensions described in this memo to the POP3 are OPTIONAL. - Distribution of this memo is unlimited. - -Introduction and Motivation - - It is assumed that the reader is familiar with RFC 1081 that - discusses the Post Office Protocol - Version 3 (POP3) [RFC1081]. - This memo describes extensions to the POP3 which enhance the service - it offers to clients. This additional service permits a client host - to access discussion group mail, which is often kept in a separate - spool area, using the general POP3 facilities. - - The next section describes the evolution of discussion groups and the - technologies currently used to implement them. To summarize: - - o An exploder is used to map from a single address to - a list of addresses which subscribe to the list, and redirects - any subsequent error reports associated with the delivery of - each message. This has two primary advantages: - - Subscribers need know only a single address - - Responsible parties get the error reports and not - the subscribers - - - - - - - - - - - - -Rose [Page 1] - -RFC 1082 POP3 Extended Service November 1988 - - - o Typically, each subscription address is not a person's private - maildrop, but a system-wide maildrop, which can be accessed - by more than one user. This has several advantages: - - Only a single copy of each message need traverse the - net for a given site (which may contain several local - hosts). This conserves bandwidth and cycles. - - Only a single copy of each message need reside on each - subscribing host. This conserves disk space. - - The private maildrop for each user is not cluttered - with discussion group mail. - - Despite this optimization of resources, further economy can be - achieved at sites with more than one host. Typically, sites with - more than one host either: - - 1. Replicate discussion group mail on each host. This - results in literally gigabytes of disk space committed to - unnecessarily store redundant information. - - 2. Keep discussion group mail on one host and give all users a - login on that host (in addition to any other logins they may - have). This is usually a gross inconvenience for users who - work on other hosts, or a burden to users who are forced to - work on that host. - - As discussed in [RFC1081], the problem of giving workstations dynamic - access to mail from a mailbox server has been explored in great - detail (originally there was [RFC918], this prompted the author to - write [RFC1081], independently of this [RFC918] was upgraded to - [RFC937]). A natural solution to the problem outlined above is to - keep discussion group mail on a mailbox server at each site and - permit different hosts at that site to employ the POP3 to access - discussion group mail. If implemented properly, this avoids the - problems of both strategies outlined above. - - ASIDE: It might be noted that a good distributed filesystem - could also solve this problem. Sadly, "good" - distributed filesystems, which do not suffer - unacceptable response time for interactive use, are - few and far between these days! - - Given this motivation, now let's consider discussion groups, both in - general and from the point of view of a user agent. Following this, - extensions to the POP3 defined in [RFC1081] are presented. Finally, - some additional policy details are discussed along with some initial - experiences. - - - - - -Rose [Page 2] - -RFC 1082 POP3 Extended Service November 1988 - - -What's in a Discussion Group - - Since mailers and user agents first crawled out of the primordial - ARPAnet, the value of discussion groups have been appreciated, - (though their implementation has not always been well-understood). - - Described simply, a discussion group is composed of a number of - subscribers with a common interest. These subscribers post mail to a - single address, known as a distribution address. From this - distribution address, a copy of the message is sent to each - subscriber. Each group has a moderator, which is the person that - administrates the group. The moderator can usually be reached at a - special address, known as a request address. Usually, the - responsibilities of the moderator are quite simple, since the mail - system handles the distribution to subscribers automatically. In - some cases, the interest group, instead of being distributed directly - to its subscribers, is put into a digest format by the moderator and - then sent to the subscribers. Although this requires more work on - the part of the moderator, such groups tend to be better organized. - - Unfortunately, there are a few problems with the scheme outlined - above. First, if two users on the same host subscribe to the same - interest group, two copies of the message get delivered. This is - wasteful of both processor and disk resources. - - Second, some of these groups carry a lot of traffic. Although - subscription to an group does indicate interest on the part of a - subscriber, it is usually not interesting to get 50 messages or so - delivered to the user's private maildrop each day, interspersed with - personal mail, that is likely to be of a much more important and - timely nature. - - Third, if a subscriber on the distribution list for a group becomes - "bad" somehow, the originator of the message and not the moderator of - the group is notified. It is not uncommon for a large list to have - 10 or so bogus addresses present. This results in the originator - being flooded with "error messages" from mailers across the Internet - stating that a given address on the list was bad. Needless to say, - the originator usually could not care less if the bogus addresses got - a copy of the message or not. The originator is merely interested in - posting a message to the group at large. Furthermore, the moderator - of the group does care if there are bogus addresses on the list, but - ironically does not receive notification. - - There are various approaches which can be used to solve some or all - of these problems. Usually these involve placing an exploder agent - at the distribution source of the discussion group, which expands the - name of the group into the list of subscription addresses for the - - - -Rose [Page 3] - -RFC 1082 POP3 Extended Service November 1988 - - - group. In the process, the exploder will also change the address - that receives error notifications to be the request address or other - responsible party. - - A complementary approach, used in order to cut down on resource - utilization of all kinds, replaces all the subscribers at a single - host (or group of hosts under a single administration) with a single - address at that host. This address maps to a file on the host, - usually in a spool area, which all users can access. (Advanced - implementations can also implement private discussion groups this - way, in which a single copy of each message is kept, but is - accessible to only a select number of users on the host.) - - The two approaches can be combined to avoid all of the problems - described above. - - Finally, a third approach can be taken, which can be used to aid user - agents processing mail for the discussion group: In order to speed - querying of the maildrop which contains the local host's copy of the - discussion group, two other items are usually associated with the - discussion group, on a local basis. These are the maxima and the - last-date. Each time a message is received for the group on the - local host, the maxima is increased by at least one. Furthermore, - when a new maxima is generated, the current date is determined. This - is called the last date. As the message is entered into the local - maildrop, it is given the current maxima and last-date. This permits - the user agent to quickly determine if new messages are present in - the maildrop. - - NOTE: The maxima may be characterized as a monotonically - increasing quanity. Although sucessive values of the - maxima need not be consecutive, any maxima assigned - is always greater than any previously assigned value. - -Definition of Terms - - To formalize these notions somewhat, consider the following 7 - parameters which describe a given discussion group from the - perspective of the user agent (the syntax given is from [RFC822]): - - - - - - - - - - - - -Rose [Page 4] - -RFC 1082 POP3 Extended Service November 1988 - - - NAME Meaning: the name of the discussion group - Syntax: TOKEN (ALPHA *[ ALPHA / DIGIT / "-" ]) - (case-insensitive recognition) - Example: unix-wizards - - ALIASES Meaning: alternates names for the group, which - are locally meaningful; these are - typically used to shorten user typein - Syntax: TOKEN (case-insensitive recognition) - Example: uwiz - - ADDRESS Meaning: the primary source of the group - Syntax: 822 address - Example: Unix-Wizards@BRL.MIL - - REQUEST Meaning: the primary moderator of the group - Syntax: 822 address - Example: Unix-Wizards-Request@BRL.MIL - - FLAGS Meaning: locally meaningful flags associated - with the discussion group; this memo - leaves interpretation of this - parameter to each POP3 implementation - Syntax: octal number - Example: 01 - - MAXIMA Meaning: the magic cookie associated with the - last message locally received for the - group; it is the property of the magic - cookie that it's value NEVER - decreases, and increases by at least - one each time a message is locally - received - Syntax: decimal number - Example: 1004 - - LASTDATE Meaning: the date that the last message was - locally received - Syntax: 822 date - Example: Thu, 19 Dec 85 10:26:48 -0800 - - Note that the last two values are locally determined for the maildrop - associated with the discussion group and with each message in that - maildrop. Note however that the last message in the maildrop have a - different MAXIMA and LASTDATE than the discussion group. This often - occurs when the maildrop has been archived. - - - - - -Rose [Page 5] - -RFC 1082 POP3 Extended Service November 1988 - - - Finally, some local systems provide mechanisms for automatically - archiving discussion group mail. In some cases, a two-level archive - scheme is used: current mail is kept in the standard maildrop, - recent mail is kept in an archive maildrop, and older mail is kept - off-line. With this scheme, in addition to having a "standard" - maildrop for each discussion group, an "archive" maildrop may also be - available. This permits a user agent to examine the most recent - archive using the same mechanisms as those used on the current mail. - -The XTND Command - - The following commands are valid only in the TRANSACTION state of the - POP3. This implies that the POP3 server has already opened the - user's maildrop (which may be empty). This maildrop is called the - "default maildrop". The phrase "closes the current maildrop" has two - meanings, depending on whether the current maildrop is the default - maildrop or is a maildrop associated with a discussion group. - - In the former context, when the current maildrop is closed any - messages marked as deleted are removed from the maildrop currently in - use. The exclusive-access lock on the maildrop is then released - along with any implementation-specific resources (e.g., file- - descriptors). - - In the latter context, a maildrop associated with a discussion group - is considered to be read-only to the POP3 client. In this case, the - phrase "closes the current maildrop" merely means that any - implementation-specific resources are released. (Hence, the POP3 - command DELE is a no-op.) - - All the new facilities are introduced via a single POP3 command, - XTND. All positive reponses to the XTND command are multi-line. - - The most common multi-line response to the commands contains a - "discussion group listing" which presents the name of the discussion - group along with it's maxima. In order to simplify parsing all POP3 - servers are required to use a certain format for discussion group - listings: - - NAME SP MAXIMA - - This memo makes no requirement on what follows the maxima in the - listing. Minimal implementations should just end that line of the - response with a CRLF pair. More advanced implementations may include - other information, as parsed from the message. - - NOTE: This memo STRONGLY discourages implementations from - supplying additional information in the listing. - - - -Rose [Page 6] - -RFC 1082 POP3 Extended Service November 1988 - - - XTND BBOARDS [name] - Arguments: the name of a discussion group (optionally) - Restrictions: may only be given in the TRANSACTION state. - Discussion: - - If an argument was given, the POP3 server closes the current - maildrop. The POP3 server then validates the argument as the name of - a discussion group. If this is successful, it opens the maildrop - associated with the group, and returns a multi-line response - containing the discussion group listing. If the discussion group - named is not valid, or the associated archive maildrop is not - readable by the user, then an error response is returned. - - If no argument was given, the POP3 server issues a multi-line - response. After the initial +OK, for each discussion group known, - the POP3 server responds with a line containing the listing for that - discussion group. Note that only world-readable discussion groups - are included in the multi-line response. - - In order to aid user agents, this memo requires an extension to the - scan listing when an "XTND BBOARDS" command has been given. - Normally, a scan listing, as generated by the LIST, takes the form: - - MSGNO SIZE - - where MSGNO is the number of the message being listed and SIZE is the - size of the message in octets. When reading a maildrop accessed via - "XTND BBOARDS", the scan listing takes the form - - MSGNO SIZE MAXIMA - - where MAXIMA is the maxima that was assigned to the message when it - was placed in the BBoard. - - Possible Responses: - +OK XTND - -ERR no such bboard - Examples: - C: XTND BBOARDS - S: +OK XTND - S: system 10 - S: mh-users 100 - S: . - C: XTND BBOARDS system - S: + OK XTND - S: system 10 - S: . - - - - -Rose [Page 7] - -RFC 1082 POP3 Extended Service November 1988 - - - XTND ARCHIVE name - Arguments: the name of a discussion group (required) - Restrictions: may only be given in the TRANSACTION state. - Discussion: - - The POP3 server closes the current maildrop. The POP3 server then - validates the argument as the name of a discussion group. If this is - successful, it opens the archive maildrop associated with the group, - and returns a multi-line response containing the discussion group - listing. If the discussion group named is not valid, or the - associated archive maildrop is not readable by the user, then an - error response is returned. - - In addition, the scan listing generated by the LIST command is - augmented (as described above). - - Possible Responses: - +OK XTND - -ERR no such bboard Examples: - C: XTND ARCHIVE system - S: + OK XTND - S: system 3 - S: . - - XTND X-BBOARDS name - Arguments: the name of a discussion group (required) - Restrictions: may only be given in the TRANSACTION state. - Discussion: - - The POP3 server validates the argument as the name of a - discussion group. If this is unsuccessful, then an error - response is returned. Otherwise a multi-line response is - returned. The first 14 lines of this response (after the - initial +OK) are defined in this memo. Minimal implementations - need not include other information (and may omit certain - information, outputing a bare CRLF pair). More advanced - implementations may include other information. - - Line Information (refer to "Definition of Terms") - ---- ----------- - 1 NAME - 2 ALIASES, separated by SP - 3 system-specific: maildrop - 4 system-specific: archive maildrop - 5 system-specific: information - 6 system-specific: maildrop map - 7 system-specific: encrypted password - 8 system-specific: local leaders, separated by SP - - - -Rose [Page 8] - -RFC 1082 POP3 Extended Service November 1988 - - - 9 ADDRESS - 10 REQUEST - 11 system-specific: incoming feed - 12 system-specific: outgoing feeds - 13 FLAGS SP MAXIMA - 14 LASTDATE - - Most of this information is entirely too specific to the UCI Version - of the Rand MH Message Handling System [MRose85]. Nevertheless, - lines 1, 2, 9, 10, 13, and 14 are of general interest, regardless of - the implementation. - - Possible Responses: - +OK XTND - -ERR no such bboard - Examples: - C: XTND X-BBOARDS system - S: + OK XTND - S: system - S: local general - S: /usr/bboards/system.mbox - S: /usr/bboards/archive/system.mbox - S: /usr/bboards/.system.cnt - S: /usr/bboards/.system.map - S: * - S: mother - S: system@nrtc.northrop.com - S: system-request@nrtc.northrop.com - S: - S: dist-system@nrtc-gremlin.northrop.com - S: 01 10 - S: Thu, 19 Dec 85 00:08:49 -0800 - S: . - -Policy Notes - - Depending on the particular entity administrating the POP3 service - host, two additional policies might be implemented: - - 1. Private Discussion Groups - - In the general case, discussion groups are world-readable, any user, - once logged in (via a terminal, terminal server, or POP3, etc.), is - able to read the maildrop for each discussion group known to the POP3 - service host. Nevertheless, it is desirable, usually for privacy - reasons, to implement private discussion groups as well. - - Support of this is consistent with the extensions outlined in this - - - -Rose [Page 9] - -RFC 1082 POP3 Extended Service November 1988 - - - memo. Once the AUTHORIZATION state has successfully concluded, the - POP3 server grants the user access to exactly those discussion groups - the POP3 service host permits the authenticated user to access. As a - "security" feature, discussion groups associated with unreadable - maildrops should not be listed in a positive response to the XTND - BBOARDS command. - - 2. Anonymous POP3 Users - - In order to minimize the authentication problem, a policy permitting - "anonymous" access to the world-readable maildrops for discussion - groups on the POP3 server may be implemented. - - Support of this is consistent with the extensions outlined in this - memo. The POP3 server can be modified to accept a USER command for a - well-known pseudonym (i.e., "anonymous") which is valid with any PASS - command. As a "security" feature, it is advisable to limit this kind - of access to only hosts at the local site, or to hosts named in an - access list. - -Experiences and Conclusions - - All of the facilities described in this memo and in [RFC1081] have - been implemented in MH #6.1. Initial experiences have been, on the - whole, very positive. - - After the first implementation, some performance tuning was required. - This consisted primarily of caching the datastructures which describe - discussion groups in the POP3 server. A second optimization - pertained to the client: the program most commonly used to read - BBoards in MH was modified to retrieve messages only when needed. - Two schemes are used: - - o If only the headers (and the first few lines of the body) of - the message are required (e.g., for a scan listing), then only - these are retrieved. The resulting output is then cached, on - a per-message basis. - - o If the entire message is required, then it is retrieved intact, - and cached locally. - - With these optimizations, response time is quite adequate when the - POP3 server and client are connected via a high-speed local area - network. In fact, the author uses this mechanism to access certain - private discussion groups over the Internet. In this case, response - is still good. When a 9.6Kbps modem is inserted in the path, - response went from good to almost tolerable (fortunately the author - only reads a few discussion groups in this fashion). - - - -Rose [Page 10] - -RFC 1082 POP3 Extended Service November 1988 - - - To conclude: the POP3 is a good thing, not only for personal mail but - for discussion group mail as well. - - -References - - [RFC1081] Rose, M., "Post Office Protocol - Verison 3 (POP3)", RFC - 1081, TWG, November 1988. - - [MRose85] Rose, M., and J. Romine, "The Rand MH Message Handling - System: User's Manual", University of California, Irvine, - November 1985. - - [RFC822] Crocker, D., "Standard for the Format of ARPA-Internet - Text Messages", RFC 822, University of Delaware, August - 1982. - - [RFC918] Reynolds, J., "Post Office Protocol", RFC 918, - USC/Information Sciences Institute, October 1984. - - [RFC937] Butler, M., J. Postel, D. Chase, J. Goldberger, and J. - Reynolds, "Post Office Protocol - Version 2", RFC 937, - USC/Information Sciences Institute, February 1985. - -Author's Address: - - - Marshall Rose - The Wollongong Group - 1129 San Antonio Rd. - Palo Alto, California 94303 - - Phone: (415) 962-7100 - - Email: MRose@TWG.COM - - - - - - - - - - - - - - - - -Rose [Page 11] - \ No newline at end of file diff --git a/src/appl/popper/pop_dele.c b/src/appl/popper/pop_dele.c deleted file mode 100644 index ee3af9b2b..000000000 --- a/src/appl/popper/pop_dele.c +++ /dev/null @@ -1,59 +0,0 @@ -/* - * Copyright (c) 1989 Regents of the University of California. - * All rights reserved. The Berkeley software License Agreement - * specifies the terms and conditions for redistribution. - */ - -#ifndef lint -static char copyright[] = "Copyright (c) 1990 Regents of the University of California.\nAll rights reserved.\n"; -/* based on @(#)pop_dele.c 2.1 3/18/91 */ -#endif - -#include -#include -#include -#include "popper.h" - -/* - * dele: Delete a message from the POP maildrop - */ -pop_dele (p) -POP * p; -{ - MsgInfoList * mp; /* Pointer to message info list */ - int msg_num; - - /* Convert the message number parameter to an integer */ - msg_num = atoi(p->pop_parm[1]); - - /* Is requested message out of range? */ - if ((msg_num < 1) || (msg_num > p->msg_count)) - return (pop_msg (p,POP_FAILURE,"Message %d does not exist.",msg_num)); - - /* Get a pointer to the message in the message list */ - mp = &(p->mlp[msg_num-1]); - - /* Is the message already flagged for deletion? */ - if (mp->del_flag) - return (pop_msg (p,POP_FAILURE,"Message %d has already been deleted.", - msg_num)); - - /* Flag the message for deletion */ - mp->del_flag = TRUE; - -#ifdef DEBUG - if(p->debug) - pop_log(p,POP_DEBUG,"Deleting message %u at offset %u of length %u\n", - mp->number,mp->offset,mp->length); -#endif - - /* Update the messages_deleted and bytes_deleted counters */ - p->msgs_deleted++; - p->bytes_deleted += mp->length; - - /* Update the last-message-accessed number if it is lower than - the deleted message */ - if (p->last_msg < msg_num) p->last_msg = msg_num; - - return (pop_msg (p,POP_SUCCESS,"Message %d has been deleted.",msg_num)); -} diff --git a/src/appl/popper/pop_dropcopy.c b/src/appl/popper/pop_dropcopy.c deleted file mode 100644 index e745db902..000000000 --- a/src/appl/popper/pop_dropcopy.c +++ /dev/null @@ -1,205 +0,0 @@ -/* - * Copyright (c) 1989 Regents of the University of California. - * All rights reserved. The Berkeley software License Agreement - * specifies the terms and conditions for redistribution. - */ - -#ifndef lint -static char copyright[] = "Copyright (c) 1990 Regents of the University of California.\nAll rights reserved.\n"; -/* based on @(#)pop_dropcopy.c 2.6 4/3/91 */ -#endif - -#include -#include -#ifdef HAS_UNISTD_H -#include -#endif -#ifdef POSIX_FILE_LOCKS -#include -#endif -#include -#ifdef HAVE_STRINGS_H -#include -#else -#include -#endif -#include -#include -#include "popper.h" - -/* - * dropcopy: Make a temporary copy of the user's mail drop and - * save a stream pointer for it. - */ - -pop_dropcopy(p,pwp) -POP * p; -struct passwd * pwp; -{ - int mfd; /* File descriptor for - the user's maildrop */ - int dfd; /* File descriptor for - the SERVER maildrop */ - FILE *tf; /* The temp file */ - char *template; /* Temp name holder */ - char buffer[BUFSIZ]; /* Read buffer */ - off_t offset; /* Old/New boundary */ - int nchar; /* Bytes written/read */ -#ifdef POSIX_FILE_LOCKS - static struct flock flock_zero; - struct flock lock_arg; - - lock_arg = flock_zero; -#endif - - /* Create a temporary maildrop into which to copy the updated maildrop */ - (void)sprintf(p->temp_drop,"%s/.%s.temp",MAILDIR,p->user); - -#ifdef DEBUG - if(p->debug) - pop_log(p,POP_DEBUG,"Creating temporary maildrop '%s'", - p->temp_drop); -#endif - - /* Here we work to make sure the user doesn't cause us to remove or - * write over existing files by limiting how much work we do while - * running as root. - */ - - /* First create a unique file. Would prefer mkstemp, but Ultrix...*/ - template = tempnam(MAILDIR, "tmpXXXXXX"); - if ( (tf=fopen(template,"w+")) == NULL ) { /* failure, bail out */ - pop_log(p,POP_PRIORITY, - "Unable to create temporary temporary maildrop '%s': %s",template, - strerror(errno)) ; - return pop_msg(p,POP_FAILURE, - "System error, can't create temporary file."); - } - - /* Now give this file to the user */ -#ifndef KERBEROS - (void) chown(template,pwp->pw_uid, pwp->pw_gid); -#endif - (void) chmod(template,0600); - - /* Now link this file to the temporary maildrop. If this fails it - * is probably because the temporary maildrop already exists. If so, - * this is ok. We can just go on our way, because by the time we try - * to write into the file we will be running as the user. - */ - (void) link(template,p->temp_drop); - (void) fclose(tf); - (void) unlink(template); - free(template); - -#ifndef KERBEROS - /* Now we run as the user. */ - (void) setuid(pwp->pw_uid); - (void) setgid(pwp->pw_gid); -#endif - -#ifdef DEBUG - if(p->debug)pop_log(p,POP_DEBUG,"uid = %d, gid = %d",getuid(),getgid()); -#endif - - /* Open for append, this solves the crash recovery problem */ - if ((dfd = open(p->temp_drop,O_RDWR|O_APPEND|O_CREAT,0600)) == -1){ - pop_log(p,POP_PRIORITY, - "Unable to open temporary maildrop '%s': %s",p->temp_drop, - strerror(errno)) ; - return pop_msg(p,POP_FAILURE, - "System error, can't open temporary file, do you own it?"); - } - - /* Lock the temporary maildrop */ -#ifdef POSIX_FILE_LOCKS - lock_arg.l_type = F_WRLCK; - lock_arg.l_whence = 0; - lock_arg.l_start = 0; - lock_arg.l_len = 0; - if ( fcntl (dfd, F_SETLK, &lock_arg) == -1) - switch(errno) { - case EAGAIN: - case EACCES: - return pop_msg(p,POP_FAILURE, - "Maildrop lock busy! Is another session active?"); - /* NOTREACHED */ - default: - return pop_msg(p,POP_FAILURE,"fcntl(F_SETLK|F_WRLCK): '%s': %s", p->temp_drop, - strerror(errno)); - /* NOTREACHED */ - } -#else - if ( flock (dfd, LOCK_EX|LOCK_NB) == -1 ) - switch(errno) { - case EWOULDBLOCK: - return pop_msg(p,POP_FAILURE, - "Maildrop lock busy! Is another session active?"); - /* NOTREACHED */ - default: - return pop_msg(p,POP_FAILURE,"flock: '%s': %s", p->temp_drop, - strerror(errno)); - /* NOTREACHED */ - } -#endif - - /* May have grown or shrunk between open and lock! */ - offset = lseek(dfd,(off_t)0,SEEK_END); - - /* Open the user's maildrop, If this fails, no harm in assuming empty */ - if ((mfd = open(p->drop_name,O_RDWR)) > 0) { - - /* Lock the maildrop */ -#ifdef POSIX_FILE_LOCKS - lock_arg.l_type = F_WRLCK; - lock_arg.l_whence = 0; - lock_arg.l_start = 0; - lock_arg.l_len = 0; - if (fcntl (mfd, F_SETLKW, &lock_arg) == -1) { - (void)close(mfd) ; - return pop_msg(p,POP_FAILURE, "fcntl(F_SETLW|F_WRLCK): '%s': %s", p->temp_drop, - strerror(errno)); - } -#else - if (flock (mfd,LOCK_EX) == -1) { - (void)close(mfd) ; - return pop_msg(p,POP_FAILURE, "flock: '%s': %s", p->temp_drop, - strerror(errno)); - } -#endif - /* Copy the actual mail drop into the temporary mail drop */ - while ( (nchar=read(mfd,buffer,BUFSIZ)) > 0 ) - if ( nchar != write(dfd,buffer,nchar) ) { - nchar = -1 ; - break ; - } - - if ( nchar != 0 ) { - /* Error adding new mail. Truncate to original size, - and leave the maildrop as is. The user will not - see the new mail until the error goes away. - Should let them process the current backlog, in case - the error is a quota problem requiring deletions! */ - (void)ftruncate(dfd,offset) ; - } else { - /* Mail transferred! Zero the mail drop NOW, that we - do not have to do gymnastics to figure out what's new - and what is old later */ - (void)ftruncate(mfd,0) ; - } - - /* Close the actual mail drop */ - (void)close (mfd); - } - - /* Acquire a stream pointer for the temporary maildrop */ - if ( (p->drop = fdopen(dfd,"a+")) == NULL ) { - (void)close(dfd) ; - return pop_msg(p,POP_FAILURE,"Cannot assign stream for %s", - p->temp_drop); - } - - rewind (p->drop); - - return(POP_SUCCESS); -} diff --git a/src/appl/popper/pop_dropinfo.c b/src/appl/popper/pop_dropinfo.c deleted file mode 100644 index 6c4a64649..000000000 --- a/src/appl/popper/pop_dropinfo.c +++ /dev/null @@ -1,125 +0,0 @@ -/* - * Copyright (c) 1989 Regents of the University of California. - * All rights reserved. The Berkeley software License Agreement - * specifies the terms and conditions for redistribution. - */ - -#ifndef lint -static char copyright[] = "Copyright (c) 1990 Regents of the University of California.\nAll rights reserved.\n"; -/* based on @(#)pop_dropinfo.c 2.1 3/18/91 */ -#endif - -#include -#include -#include -#ifdef HAVE_STRINGS_H -#include -#else -#include -#endif -#include -#include -#include "popper.h" - -/* - * dropinfo: Extract information about the POP maildrop and store - * it for use by the other POP routines. - */ - -pop_dropinfo(p) -POP * p; -{ - char buffer[BUFSIZ]; /* Read buffer */ - MsgInfoList * mp; /* Pointer to message - info list */ - register int msg_num; /* Current message - counter */ - int nchar; /* Bytes written/read */ - int end; /* eom */ - - /* Initialize maildrop status variables in the POP parameter block */ - p->msg_count = 0; - p->msgs_deleted = 0; - p->last_msg = 0; - p->bytes_deleted = 0; - p->drop_size = 0; - end = 1; - - /* Allocate memory for message information structures */ - p->msg_count = ALLOC_MSGS; - p->mlp = (MsgInfoList *)calloc((unsigned)p->msg_count,sizeof(MsgInfoList)); - if (p->mlp == NULL){ - (void)fclose (p->drop); - p->msg_count = 0; - return pop_msg (p,POP_FAILURE, - "Can't build message list for '%s': Out of memory", p->user); - } - - rewind (p->drop); - - /* Scan the file, loading the message information list with - information about each message */ - - for (msg_num = p->drop_size = 0, mp = p->mlp - 1; - fgets(buffer,MAXMSGLINELEN,p->drop);) { - - nchar = strlen(buffer); -#ifdef MMDF - if((strncmp(buffer,"\001\001\001\001",4) == 0) && (end == 0)) { - end = 1; - continue; - } - - if (is_msg_boundary(buffer)) { - end = 0; -#else - if (strncmp(buffer,"From ",5) == 0) { -#endif - if (++msg_num > p->msg_count) { - p->mlp=(MsgInfoList *) realloc(p->mlp, - (p->msg_count+=ALLOC_MSGS)*sizeof(MsgInfoList)); - if (p->mlp == NULL){ - (void)fclose (p->drop); - p->msg_count = 0; - return pop_msg (p,POP_FAILURE, - "Can't build message list for '%s': Out of memory", - p->user); - } - mp = p->mlp + msg_num - 2; - } -#ifdef DEBUG - if(p->debug) - pop_log(p,POP_DEBUG, - "Msg %d at offset %d is %d octets long and has %u lines.", - mp->number,mp->offset,mp->length,mp->lines); -#endif - ++mp; - mp->number = msg_num; - mp->length = 0; - mp->lines = 0; - mp->offset = ftell(p->drop) - nchar; - mp->del_flag = FALSE; - mp->retr_flag = FALSE; -#ifdef DEBUG - if(p->debug) - pop_log(p,POP_DEBUG, "Msg %d being added to list", mp->number); -#endif - } - mp->length += nchar; - p->drop_size += nchar; - mp->lines++; - } - p->msg_count = msg_num; - -#ifdef DEBUG - if(p->debug && msg_num > 0) { - register i; - for (i = 0, mp = p->mlp; i < p->msg_count; i++, mp++) - pop_log(p,POP_DEBUG, - "Msg %d at offset %d is %d octets long and has %u lines.", - mp->number,mp->offset,mp->length,mp->lines); - } -#endif - - return(POP_SUCCESS); -} diff --git a/src/appl/popper/pop_enter.c b/src/appl/popper/pop_enter.c deleted file mode 100644 index 3601c74d9..000000000 --- a/src/appl/popper/pop_enter.c +++ /dev/null @@ -1,188 +0,0 @@ - -/* - * - */ - -#include -#include -#include -#ifdef HAVE_STRINGS_H -#include -#else -#include -#endif -#include -#include -#include - -#ifdef ZEPHYR -#include - -char *Zsignature = "Your friendly neighborhood post office."; -#endif ZEPHYR - -void notify_recipient(); - -char buffer[BUFSIZ]; -char xtmpfile[512]; /* tmp file */ -int newmail; /* fd for temp message */ -int maildrop; /* file descriptor for drop */ - -extern int errno; -extern int sys_nerr; -extern char *sys_errlist[]; - - -main (argc, argv) - int argc; - char **argv; -{ - int status = 0; - int i = 1; /* argument counter */ - - if(get_message() < 0) - exit(1); - - while (--argc > 0) - { - if(open_drop(argv[i]) < 0) - { - lseek(newmail, (off_t)0, SEEK_SET); - if(new_message(maildrop, newmail) < 0) - status = 1; - if(close(maildrop) < 0) - { - status = 1; - sprintf(buffer, "%s: error on close", argv[i]); - error(buffer, errno); - } - notify_recipient(argv[i]); - } - else - status = 1; - ++i; - } - - close(newmail); - unlink(xtmpfile); - exit(status); -} - - - -int -get_message() -{ - int nchar; - - sprintf(xtmpfile, "/tmp/tpop.%d", getpid()); - if((newmail = open(xtmpfile, O_RDWR|O_CREAT, 0600)) == -1) - { - fprintf(stderr, "unable to open temporary file, \"%s\".\n", xtmpfile); - return(-1); - } - - while(nchar = read(0, buffer, sizeof(buffer))) - write(newmail, buffer, nchar); - - return(0); -} - - - -int -open_drop(name) - char *name; -{ - char dropfile[512]; - - sprintf(dropfile, "%s/%s", MAILDIR, name); - if ((maildrop = open(dropfile, O_RDWR|O_CREAT,0600)) == -1) - { - fprintf(stderr, "unable to open \"%s\": %s.\n", - dropfile, (errno < sys_nerr) ? sys_errlist[errno] : ""); - return(-1); - } - - /* Lock the user's real mail drop */ - - if (flock(maildrop, LOCK_EX) == -1) - { - fprintf(stderr, - "unable to lock \"%s\" (service unavailable... the sequel): %s.\n", - dropfile, (errno < sys_nerr) ? - sys_errlist[errno] : ""); - return(-1); - } - - lseek(maildrop, (off_t)0, SEEK_END); - return(0); -} - - - -new_message(to, from) - int to, from; -{ - int cc; - - cc = time(0); - sprintf(buffer, "From popper %s\n", ctime(&cc)); - write(to, buffer, strlen(buffer) * sizeof(char)); - while(cc = read(from, buffer, sizeof(buffer))) - write(to, buffer, cc); - write(to, "\n", 1); -} - - - -void -notify_recipient(name) - char *name; - -{ - char *message = "You have new mail"; - -#ifdef ZEPHYR - static int init = 0; - ZNotice_t notice; /* Zephyr notice */ - int ret; /* return value, length */ - - if(init) - if ((ret = ZInitialize()) == ZERR_NONE) - init = 0; - - memset(¬ice, 0, sizeof(notice)); - notice.z_kind = UNSAFE; - notice.z_class = "message"; - notice.z_class_inst = "pop"; - notice.z_recipient = name; - - zsend(¬ice, &message, 1, 1); -#endif ZEPHYR -} - - - -#ifdef ZEPHYR -zsend(notice, items, nitems, auth) - ZNotice_t *notice; - char **items; - int nitems; - int auth; -{ - int ret; - - if ((ret = ZSendList(notice, items, nitems, auth ? ZAUTH:ZNOAUTH)) != - ZERR_NONE) - { /* syslog */ - if(auth) - return(zsend(notice, items, nitems, 0)); - else - return(-1); - } -} - -#endif ZEPHYR - - diff --git a/src/appl/popper/pop_get_command.c b/src/appl/popper/pop_get_command.c deleted file mode 100644 index 1d227a4c7..000000000 --- a/src/appl/popper/pop_get_command.c +++ /dev/null @@ -1,100 +0,0 @@ -/* - * Copyright (c) 1989 Regents of the University of California. - * All rights reserved. The Berkeley software License Agreement - * specifies the terms and conditions for redistribution. - */ - -#ifndef lint -static char copyright[] = "Copyright (c) 1990 Regents of the University of California.\nAll rights reserved.\n"; -/* based on @(#)pop_get_command.c 2.1 3/18/91 */ -#endif - -#include -#include -#ifdef HAVE_STRINGS_H -#include -#else -#include -#endif -#include "popper.h" - -/* - * get_command: Extract the command from an input line form a POP client - */ - -static state_table states[] = { - auth1, "user", 1, 1, pop_user, {auth1, auth2}, - auth2, "pass", 1, 1, pop_pass, {auth1, trans}, -#ifdef RPOP - auth2, "rpop", 1, 1, pop_rpop, {auth1, trans}, -#endif - auth1, "quit", 0, 0, pop_quit, {halt, halt}, - auth2, "quit", 0, 0, pop_quit, {halt, halt}, - trans, "stat", 0, 0, pop_stat, {trans, trans}, - trans, "list", 0, 1, pop_list, {trans, trans}, - trans, "retr", 1, 1, pop_send, {trans, trans}, - trans, "dele", 1, 1, pop_dele, {trans, trans}, - trans, "noop", 0, 0, NULL, {trans, trans}, - trans, "rset", 0, 0, pop_rset, {trans, trans}, - trans, "top", 2, 2, pop_send, {trans, trans}, - trans, "last", 0, 0, pop_last, {trans, trans}, - trans, "xtnd", 1, 99, pop_xtnd, {trans, trans}, - trans, "quit", 0, 0, pop_updt, {halt, halt}, - (state) 0, NULL, 0, 0, NULL, {halt, halt}, -}; - -state_table *pop_get_command(p,mp) -POP * p; -register char * mp; /* Pointer to unparsed line - received from the client */ -{ - state_table * s; - char buf[MAXMSGLINELEN]; - - /* Save a copy of the original client line */ -#ifdef DEBUG - if(p->debug) strcpy (buf,mp); -#endif - - /* Parse the message into the parameter array */ - if ((p->parm_count = pop_parse(p,mp)) < 0) return(NULL); - - /* Do not log cleartext passwords */ -#ifdef DEBUG - if(p->debug){ - if(strcmp(p->pop_command,"pass") == 0) - pop_log(p,POP_DEBUG,"Received: \"%s xxxxxxxxx\"",p->pop_command); - else { - /* Remove trailing */ - buf[strlen(buf)-2] = '\0'; - pop_log(p,POP_DEBUG,"Received: \"%s\"",buf); - } - } -#endif - - /* Search for the POP command in the command/state table */ - for (s = states; s->command; s++) { - - /* Is this a valid command for the current operating state? */ - if (strcmp(s->command,p->pop_command) == 0 - && s->ValidCurrentState == p->CurrentState) { - - /* Were too few parameters passed to the command? */ - if (p->parm_count < s->min_parms) - return((state_table *)pop_msg(p,POP_FAILURE, - "Too few arguments for the %s command.",p->pop_command)); - - /* Were too many parameters passed to the command? */ - if (p->parm_count > s->max_parms) - return((state_table *)pop_msg(p,POP_FAILURE, - "Too many arguments for the %s command.",p->pop_command)); - - /* Return a pointer to the entry for this command in - the command/state table */ - return (s); - } - } - /* The client command was not located in the command/state table */ - return((state_table *)pop_msg(p,POP_FAILURE, - "Unknown command: \"%s\".",p->pop_command)); -} diff --git a/src/appl/popper/pop_get_subcommand.c b/src/appl/popper/pop_get_subcommand.c deleted file mode 100644 index 13bb99f3a..000000000 --- a/src/appl/popper/pop_get_subcommand.c +++ /dev/null @@ -1,60 +0,0 @@ -/* - * Copyright (c) 1989 Regents of the University of California. - * All rights reserved. The Berkeley software License Agreement - * specifies the terms and conditions for redistribution. - */ - -#ifndef lint -static char copyright[] = "Copyright (c) 1990 Regents of the University of California.\nAll rights reserved.\n"; -/* based on @(#)pop_get_subcommand.c 2.1 3/18/91 */ -#endif - -#include -#include -#ifdef HAVE_STRINGS_H -#include -#else -#include -#endif -#include "popper.h" - -/* - * get_subcommand: Extract a POP XTND subcommand from a client input line - */ - -static xtnd_table subcommands[] = { - "xmit", 0, 0, pop_xmit, - NULL -}; - -xtnd_table *pop_get_subcommand(p) -POP * p; -{ - xtnd_table * s; - - /* Search for the POP command in the command/state table */ - for (s = subcommands; s->subcommand; s++) { - - if (strcmp(s->subcommand,p->pop_subcommand) == 0) { - - /* Were too few parameters passed to the subcommand? */ - if ((p->parm_count-1) < s->min_parms) - return((xtnd_table *)pop_msg(p,POP_FAILURE, - "Too few arguments for the %s %s command.", - p->pop_command,p->pop_subcommand)); - - /* Were too many parameters passed to the subcommand? */ - if ((p->parm_count-1) > s->max_parms) - return((xtnd_table *)pop_msg(p,POP_FAILURE, - "Too many arguments for the %s %s command.", - p->pop_command,p->pop_subcommand)); - - /* Return a pointer to the entry for this subcommand - in the XTND command table */ - return (s); - } - } - /* The client subcommand was not located in the XTND command table */ - return((xtnd_table *)pop_msg(p,POP_FAILURE, - "Unknown command: \"%s %s\".",p->pop_command,p->pop_subcommand)); -} diff --git a/src/appl/popper/pop_init.c b/src/appl/popper/pop_init.c deleted file mode 100644 index b5f05c690..000000000 --- a/src/appl/popper/pop_init.c +++ /dev/null @@ -1,358 +0,0 @@ -/* - * Copyright (c) 1989 Regents of the University of California. - * All rights reserved. The Berkeley software License Agreement - * specifies the terms and conditions for redistribution. - */ - -#include -#include -#include -#include -#include -#include -#include -#include "popper.h" - -#ifdef KERBEROS -#ifdef KRB4 -#ifdef KRB5 - #error you can only use one of KRB4, KRB5 -#endif -#include -AUTH_DAT kdata; -#endif /* KRB4 */ -#ifdef KRB5 -#include "krb5.h" -#include "com_err.h" -#include -krb5_principal ext_client; -krb5_context pop_context; -char *client_name; -#endif /* KRB5 */ -#endif /* KERBEROS */ - -/* - * init: Start a Post Office Protocol session - */ - -pop_init(p,argcount,argmessage) -POP * p; -int argcount; -char ** argmessage; -{ - - struct sockaddr_in cs; /* Communication parameters */ - struct hostent * ch; /* Client host information */ - int errflag = 0; - int c; - int len; - extern char * optarg; - int options = 0; - int sp = 0; /* Socket pointer */ - char * trace_file_name; - int standalone = 0; - - /* Initialize the POP parameter block */ - memset ((char *)p, 0, (int)sizeof(POP)); - - /* Save my name in a global variable */ - p->myname = argmessage[0]; - - /* Get the name of our host */ - (void)gethostname(p->myhost,MAXHOSTNAMELEN); - - /* Open the log file */ -#ifdef SYSLOG42 - (void)openlog(p->myname,0); -#else - (void)openlog(p->myname,POP_LOGOPTS,POP_FACILITY); -#endif - - /* Process command line arguments */ - while ((c = getopt(argcount,argmessage,"dt:s")) != EOF) - switch (c) { - - /* Debugging requested */ - case 'd': - p->debug++; - options |= SO_DEBUG; - break; - - /* Debugging trace file specified */ - case 't': - p->debug++; - if ((p->trace = fopen(optarg,"a+")) == NULL) { - pop_log(p,POP_PRIORITY, - "Unable to open trace file \"%s\", err = %d", - optarg,errno); - exit(-1); - } - trace_file_name = optarg; - break; - - /* Standalone operation */ - case 's': - standalone++; - break; - - /* Unknown option received */ - default: - errflag++; - } - - /* Exit if bad options specified */ - if (errflag) { - (void)fprintf(stderr,"Usage: %s [-d]\n",argmessage[0]); - exit(-1); - } - - if (standalone) { - int acc, sock; - struct sockaddr_in sin; - struct servent *spr; - - if ((sock = socket(PF_INET, SOCK_STREAM, 0)) < 0) { - syslog(LOG_ERR, "socket: %m"); - exit(3); - } - - sin.sin_family = AF_INET; - sin.sin_addr.s_addr = 0; - -#ifdef KERBEROS -#ifndef KPOP_SERVICE -#define KPOP_SERVICE "kpop" -#endif - if (!(spr = getservbyname(KPOP_SERVICE, "tcp"))) { - syslog(LOG_ERR, "%s/tcp: unknown service", KPOP_SERVICE); - exit(3); - } -#else - if (!(spr = getservbyname("pop", "tcp"))) { - syslog(LOG_ERR, "pop/tcp: unknown service"); - exit(3); - } -#endif - sin.sin_port = spr->s_port; - if (bind(sock, (struct sockaddr *)&sin, sizeof(sin))) { - syslog(LOG_ERR, "bind: %m"); - exit(3); - } - if (listen(sock, 1) == -1) { - syslog(LOG_ERR, "listen: %m"); - exit(3); - } - len = sizeof(cs); - if ((acc = accept(sock, (struct sockaddr *)&cs, &len)) == -1) { - syslog(LOG_ERR, "accept: %m"); - exit(3); - } - dup2(acc, sp); - close(sock); - close(acc); - } - - /* Get the address and socket of the client to whom I am speaking */ - len = sizeof(cs); - if (getpeername(sp,(struct sockaddr *)&cs,&len) < 0){ - pop_log(p,POP_PRIORITY, - "Unable to obtain socket and address of client, err = %d",errno); - exit(-1); - } - - /* Save the dotted decimal form of the client's IP address - in the POP parameter block */ - p->ipaddr = inet_ntoa(cs.sin_addr); - - /* Save the client's port */ - p->ipport = ntohs(cs.sin_port); - - /* Get the canonical name of the host to whom I am speaking */ - ch = gethostbyaddr((char *) &cs.sin_addr, sizeof(cs.sin_addr), AF_INET); - if (ch == NULL){ - pop_log(p,POP_PRIORITY, - "Unable to get canonical name of client, err = %d",errno); - p->client = p->ipaddr; - } - /* Save the cannonical name of the client host in - the POP parameter block */ - else { - -#ifndef BIND43 - p->client = (char *) ch->h_name; -#else -# include -# include - - /* Distrust distant nameservers */ -#if (__RES < 19931104) - extern struct state _res; -#endif - struct hostent * ch_again; - char * * addrp; - - /* We already have a fully-qualified name */ - _res.options &= ~RES_DEFNAMES; - - /* See if the name obtained for the client's IP - address returns an address */ - if ((ch_again = gethostbyname(ch->h_name)) == NULL) { - pop_log(p,POP_PRIORITY, - "Client at \"%s\" resolves to an unknown host name \"%s\"", - p->ipaddr,ch->h_name); - p->client = p->ipaddr; - } - else { - /* Save the host name (the previous value was - destroyed by gethostbyname) */ - p->client = ch_again->h_name; - - /* Look for the client's IP address in the list returned - for its name */ - for (addrp=ch_again->h_addr_list; *addrp; ++addrp) - if (memcmp(*addrp,&(cs.sin_addr),sizeof(cs.sin_addr)) == 0) break; - - if (!*addrp) { - pop_log (p,POP_PRIORITY, - "Client address \"%s\" not listed for its host name \"%s\"", - p->ipaddr,ch->h_name); - p->client = p->ipaddr; - } - } -#endif - } - - /* Create input file stream for TCP/IP communication */ - if ((p->input = fdopen(sp,"r")) == NULL){ - pop_log(p,POP_PRIORITY, - "Unable to open communication stream for input, err = %d",errno); - exit (-1); - } - - /* Create output file stream for TCP/IP communication */ - if ((p->output = fdopen(sp,"w")) == NULL){ - pop_log(p,POP_PRIORITY, - "Unable to open communication stream for output, err = %d",errno); - exit (-1); - } - - pop_log(p,POP_PRIORITY, - "(v%s) Servicing request from \"%s\" at %s\n", - VERSION,p->client,p->ipaddr); - -#ifdef DEBUG - if (p->trace) - pop_log(p,POP_PRIORITY, - "Tracing session and debugging information in file \"%s\"", - trace_file_name); - else if (p->debug) - pop_log(p,POP_PRIORITY,"Debugging turned on"); -#endif - - return(authenticate(p, &cs)); -} - -authenticate(p, addr) - POP *p; - struct sockaddr_in *addr; -{ - -#ifdef KERBEROS -#ifdef KRB4 - Key_schedule schedule; - KTEXT_ST ticket; - char instance[INST_SZ]; - char version[9]; - int auth; - - strcpy(instance, "*"); - auth = krb_recvauth(0L, 0, &ticket, "pop", instance, - addr, (struct sockaddr_in *) NULL, - &kdata, "", schedule, version); - - if (auth != KSUCCESS) { - pop_msg(p, POP_FAILURE, "Kerberos authentication failure: %s", - krb_err_txt[auth]); - pop_log(p, POP_WARNING, "%s: (%s.%s@%s) %s", p->client, - kdata.pname, kdata.pinst, kdata.prealm, krb_err_txt[auth]); - exit(-1); - } - -#ifdef DEBUG - pop_log(p, POP_DEBUG, "%s.%s@%s (%s): ok", kdata.pname, - kdata.pinst, kdata.prealm, inet_ntoa(addr->sin_addr)); -#endif /* DEBUG */ - - strcpy(p->user, kdata.pname); -#endif - -#ifdef KRB5 - krb5_auth_context auth_context = NULL; - krb5_error_code retval; - krb5_principal server; - krb5_ticket *ticket; - int sock = 0; - - retval = krb5_init_context(&pop_context); - if (retval) { - com_err("pop_authenticate", retval, "while initializing krb5"); - exit(1); - } - - if (retval = krb5_sname_to_principal(pop_context, p->myhost, "pop", - KRB5_NT_SRV_HST, &server)) { - pop_msg(p, POP_FAILURE, - "server '%s' mis-configured, can't get principal--%s", - p->myhost, error_message(retval)); - pop_log(p, POP_WARNING, "%s: mis-configured, can't get principal--%s", - p->client, error_message(retval)); - exit(-1); - } - - if (retval = krb5_recvauth(pop_context, &auth_context, (krb5_pointer)&sock, - "KPOPV1.0", server, - 0, /* no flags */ - NULL, /* default keytab */ - &ticket /* need ticket for client name */ - )) { - pop_msg(p, POP_FAILURE, "recvauth failed--%s", error_message(retval)); - pop_log(p, POP_WARNING, "%s: recvauth failed--%s", - p->client, error_message(retval)); - exit(-1); - } - krb5_free_principal(pop_context, server); - krb5_auth_con_free(pop_context, auth_context); - if (retval = krb5_copy_principal(pop_context, ticket->enc_part2->client, - &ext_client)) { - pop_msg(p, POP_FAILURE, "unable to copy principal--%s", - error_message(retval)); - pop_msg(p, POP_FAILURE, "unable to copy principal (%s)", - inet_ntoa(addr->sin_addr)); - exit(-1); - } - krb5_free_ticket(pop_context, ticket); - if (retval = krb5_unparse_name(pop_context, ext_client, &client_name)) { - pop_msg(p, POP_FAILURE, "name not parsable--%s", - error_message(retval)); - pop_log(p, POP_DEBUG, "name not parsable (%s)", - inet_ntoa(addr->sin_addr)); - exit(-1); - } -#ifdef DEBUG - pop_log(p, POP_DEBUG, "%s (%s): ok", client_name, inet_ntoa(addr->sin_addr)); -#endif /* DEBUG */ - - if (retval= krb5_aname_to_localname(pop_context, ext_client, - sizeof(p->user), p->user)) { - pop_msg(p, POP_FAILURE, "unable to convert aname(%s) to localname --%s", - client_name, - error_message(retval)); - pop_log(p, POP_DEBUG, "unable to convert aname to localname (%s)", - client_name); - exit(-1); - } -#endif /* KRB5 */ -#endif /* KERBEROS */ - - return(POP_SUCCESS); -} diff --git a/src/appl/popper/pop_last.c b/src/appl/popper/pop_last.c deleted file mode 100644 index 2d754bb99..000000000 --- a/src/appl/popper/pop_last.c +++ /dev/null @@ -1,24 +0,0 @@ -/* - * Copyright (c) 1989 Regents of the University of California. - * All rights reserved. The Berkeley software License Agreement - * specifies the terms and conditions for redistribution. - */ - -#ifndef lint -static char copyright[] = "Copyright (c) 1990 Regents of the University of California.\nAll rights reserved.\n"; -/* based on @(#)pop_last.c 2.1 3/18/91 */ -#endif - -#include -#include -#include "popper.h" - -/* - * last: Display the last message touched in a POP session - */ - -int pop_last (p) -POP * p; -{ - return (pop_msg(p,POP_SUCCESS,"%u is the last message seen.",p->last_msg)); -} diff --git a/src/appl/popper/pop_list.c b/src/appl/popper/pop_list.c deleted file mode 100644 index 8b90f9317..000000000 --- a/src/appl/popper/pop_list.c +++ /dev/null @@ -1,64 +0,0 @@ -/* - * Copyright (c) 1989 Regents of the University of California. - * All rights reserved. The Berkeley software License Agreement - * specifies the terms and conditions for redistribution. - */ - -#ifndef lint -static char copyright[] = "Copyright (c) 1990 Regents of the University of California.\nAll rights reserved.\n"; -/* based on @(#)pop_list.c 2.1 3/18/91 */ -#endif - -#include -#include -#include "popper.h" - -/* - * list: List the contents of a POP maildrop - */ - -int pop_list (p) -POP * p; -{ - MsgInfoList * mp; /* Pointer to message info list */ - register int i; - register int msg_num; - - /* Was a message number provided? */ - if (p->parm_count > 0) { - msg_num = atoi(p->pop_parm[1]); - - /* Is requested message out of range? */ - if ((msg_num < 1) || (msg_num > p->msg_count)) - return (pop_msg (p,POP_FAILURE, - "Message %d does not exist.",msg_num)); - - /* Get a pointer to the message in the message list */ - mp = &p->mlp[msg_num-1]; - - /* Is the message already flagged for deletion? */ - if (mp->del_flag) - return (pop_msg (p,POP_FAILURE, - "Message %d has been deleted.",msg_num)); - - /* Display message information */ - return (pop_msg(p,POP_SUCCESS,"%u %u",msg_num,mp->length)); - } - - /* Display the entire list of messages */ - pop_msg(p,POP_SUCCESS, - "%u messages (%u octets)", - p->msg_count-p->msgs_deleted,p->drop_size-p->bytes_deleted); - - /* Loop through the message information list. Skip deleted messages */ - for (i = p->msg_count, mp = p->mlp; i > 0; i--, mp++) { - if (!mp->del_flag) - (void)fprintf(p->output,"%u %u\r\n",mp->number,mp->length); - } - - /* "." signals the end of a multi-line transmission */ - (void)fprintf(p->output,".\r\n"); - (void)fflush(p->output); - - return(POP_SUCCESS); -} diff --git a/src/appl/popper/pop_log.c b/src/appl/popper/pop_log.c deleted file mode 100644 index 575dda795..000000000 --- a/src/appl/popper/pop_log.c +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Copyright (c) 1989 Regents of the University of California. - * All rights reserved. The Berkeley software License Agreement - * specifies the terms and conditions for redistribution. - */ - -#ifndef lint -static char copyright[] = "Copyright (c) 1990 Regents of the University of California.\nAll rights reserved.\n"; -/* based on @(#)pop_log.c 2.1 3/18/91 */ -#endif - -#include -#include -#include -#include "popper.h" - -/* - * log: Make a log entry - */ - -static char msgbuf[MAXLINELEN]; - -pop_log(va_alist) -va_dcl -{ - va_list ap; - POP * p; - int stat; - char * format; - - va_start(ap); - p = va_arg(ap,POP *); - stat = va_arg(ap,int); - format = va_arg(ap,char *); - va_end(ap); - -#ifdef HAS_VSPRINTF - vsprintf(msgbuf,format,ap); -#else - (void)sprintf (msgbuf,format,((int *)ap)[0],((int *)ap)[1],((int *)ap)[2], - ((int *)ap)[3],((int *)ap)[4],((int *)ap)[5]); -#endif /* HAS_VSPRINTF */ - - if (p->debug && p->trace) { - (void)fprintf(p->trace,"%s\n",msgbuf); - (void)fflush(p->trace); - } - else { - syslog (stat,"%s",msgbuf); - } - - return(stat); -} diff --git a/src/appl/popper/pop_lower.c b/src/appl/popper/pop_lower.c deleted file mode 100644 index 84984d569..000000000 --- a/src/appl/popper/pop_lower.c +++ /dev/null @@ -1,27 +0,0 @@ -/* - * Copyright (c) 1989 Regents of the University of California. - * All rights reserved. The Berkeley software License Agreement - * specifies the terms and conditions for redistribution. - */ - -#ifndef lint -static char copyright[] = "Copyright (c) 1990 Regents of the University of California.\nAll rights reserved.\n"; -/* based on @(#)pop_lower.c 2.1 3/18/91 */ -#endif - -#include -#include -#include - -/* - * lower: Convert a string to lowercase - */ - -pop_lower (buf) -char * buf; -{ - char * mp; - - for (mp = buf; *mp; mp++) - if (isupper(*mp) && isupper(*mp)) *mp = (char)tolower((int)*mp); -} diff --git a/src/appl/popper/pop_msg.c b/src/appl/popper/pop_msg.c deleted file mode 100644 index 413729895..000000000 --- a/src/appl/popper/pop_msg.c +++ /dev/null @@ -1,81 +0,0 @@ -/* - * Copyright (c) 1989 Regents of the University of California. - * All rights reserved. The Berkeley software License Agreement - * specifies the terms and conditions for redistribution. - */ - -#ifndef lint -static char copyright[] = "Copyright (c) 1990 Regents of the University of California.\nAll rights reserved.\n"; -/* based on @(#)pop_msg.c 2.1 3/18/91 */ -#endif - -#include -#include -#ifdef HAVE_STRINGS_H -#include -#else -#include -#endif -#include -#include "popper.h" - -/* - * msg: Send a formatted line to the POP client - */ - -pop_msg(va_alist) -va_dcl -{ - POP * p; - int stat; /* POP status indicator */ - char * format; /* Format string for the message */ - va_list ap; - register char * mp; - char message[MAXLINELEN]; - - va_start(ap); - p = va_arg(ap, POP *); - stat = va_arg(ap, int); - format = va_arg(ap, char *); - va_end(ap); - - /* Point to the message buffer */ - mp = message; - - /* Format the POP status code at the beginning of the message */ - if (stat == POP_SUCCESS) - (void)sprintf (mp,"%s ",POP_OK); - else - (void)sprintf (mp,"%s ",POP_ERR); - - /* Point past the POP status indicator in the message message */ - mp += strlen(mp); - - /* Append the message (formatted, if necessary) */ - if (format) -#ifdef HAS_VSPRINTF - vsprintf(mp,format,ap); -#else - (void)sprintf(mp,format,((int *)ap)[0],((int *)ap)[1],((int *)ap)[2], - ((int *)ap)[3],((int *)ap)[4]); -#endif /* HAS_VSPRINTF */ - - /* Log the message if debugging is turned on */ -#ifdef DEBUG - if (p->debug && stat == POP_SUCCESS) - pop_log(p,POP_DEBUG,"%s",message); -#endif - - /* Log the message if a failure occurred */ - if (stat != POP_SUCCESS) - pop_log(p,POP_PRIORITY,"%s",message); - - /* Append the */ - (void)strcat(message, "\r\n"); - - /* Send the message to the client */ - (void)fputs(message,p->output); - (void)fflush(p->output); - - return(stat); -} diff --git a/src/appl/popper/pop_parse.c b/src/appl/popper/pop_parse.c deleted file mode 100644 index 7e632b40b..000000000 --- a/src/appl/popper/pop_parse.c +++ /dev/null @@ -1,64 +0,0 @@ -/* - * Copyright (c) 1989 Regents of the University of California. - * All rights reserved. The Berkeley software License Agreement - * specifies the terms and conditions for redistribution. - */ - -#ifndef lint -static char copyright[] = "Copyright (c) 1990 Regents of the University of California.\nAll rights reserved.\n"; -/* based on @(#)pop_parse.c 2.1 3/18/91 */ -#endif - -#include -#include -#include -#include "popper.h" - -/* - * parse: Parse a raw input line from a POP client - * into null-delimited tokens - */ - -pop_parse(p,buf) -POP * p; -char * buf; /* Pointer to a message containing - the line from the client */ -{ - char * mp; - register int i; - - /* Loop through the POP command array */ - for (mp = buf, i = 0; ; i++) { - - /* Skip leading spaces and tabs in the message */ - while (isspace(*mp))mp++; - - /* Are we at the end of the message? */ - if (*mp == 0) break; - - /* Have we already obtained the maximum allowable parameters? */ - if (i >= MAXPARMCOUNT) { - pop_msg(p,POP_FAILURE,"Too many arguments supplied."); - return(-1); - } - - /* Point to the start of the token */ - p->pop_parm[i] = mp; - - /* Search for the first space character (end of the token) */ - while (!isspace(*mp) && *mp) mp++; - - /* Delimit the token with a null */ - if (*mp) *mp++ = 0; - } - - /* Were any parameters passed at all? */ - if (i == 0) return (-1); - - /* Convert the first token (POP command) to lower case */ - pop_lower(p->pop_command); - - /* Return the number of tokens extracted minus the command itself */ - return (i-1); - -} diff --git a/src/appl/popper/pop_pass.c b/src/appl/popper/pop_pass.c deleted file mode 100644 index 30f6b6db9..000000000 --- a/src/appl/popper/pop_pass.c +++ /dev/null @@ -1,253 +0,0 @@ -/* - * Copyright (c) 1989 Regents of the University of California. - * All rights reserved. The Berkeley software License Agreement - * specifies the terms and conditions for redistribution. - */ - -#ifndef lint -static char copyright[] = "Copyright (c) 1990 Regents of the University of California.\nAll rights reserved.\n"; -/* based on @(#)pop_pass.c 2.3 4/2/91 */ -#endif - -#include -#include -#ifdef HAVE_STRINGS_H -#include -#else -#include -#endif -#include -#include "popper.h" - -#ifdef KERBEROS -#ifdef KRB4 -#ifdef KRB5 - #error you can only use one of KRB4, KRB5 -#endif -#include -extern AUTH_DAT kdata; -#endif /* KRB4 */ -#ifdef KRB5 -#include "krb5.h" -#include "com_err.h" -extern krb5_principal ext_client; -extern krb5_context pop_context; -extern char *client_name; -#endif /* KRB5 */ -#endif /* KERBEROS */ - -#ifdef POP_PASSFILE -struct passwd * our_getpwnam(); -#endif - -/* - * pass: Obtain the user password from a POP client - */ - -int pop_pass (p) -POP * p; -{ -#ifdef KERBEROS -#ifdef KRB4 - char lrealm[REALM_SZ]; - int status; -#endif /* KRB4 */ -#ifdef KRB5 - char *lrealm; - krb5_data *tmpdata; -#endif /* KRB5 */ -#else - register struct passwd * pw; - char *crypt(); -#endif /* KERBEROS */ - -#ifdef KERBEROS -#ifdef KRB4 - if ((status = krb_get_lrealm(lrealm,1)) == KFAILURE) { - pop_log(p, POP_WARNING, "%s: (%s.%s@%s) %s", p->client, kdata.pname, - kdata.pinst, kdata.prealm, krb_err_txt[status]); - return(pop_msg(p,POP_FAILURE, - "Kerberos error: \"%s\".", krb_err_txt[status])); - } - - if (strcmp(kdata.prealm,lrealm)) { - pop_log(p, POP_WARNING, "%s: (%s.%s@%s) realm not accepted.", - p->client, kdata.pname, kdata.pinst, kdata.prealm); - return(pop_msg(p,POP_FAILURE, - "Kerberos realm \"%s\" not accepted.", kdata.prealm)); - } - - if (strcmp(kdata.pinst,"")) { - pop_log(p, POP_WARNING, "%s: (%s.%s@%s) instance not accepted.", - p->client, kdata.pname, kdata.pinst, kdata.prealm); - return(pop_msg(p,POP_FAILURE, - "Must use null Kerberos(tm) instance - \"%s.%s\" not accepted.", - kdata.pname, kdata.pinst)); - } - -#endif /* KRB4 */ -#ifdef KRB5 -#ifdef NO_CROSSREALM - { - krb5_error_code retval; - - if (retval = krb5_get_default_realm(pop_context, &lrealm)) { - pop_log(p, POP_WARNING, "%s: (%s) %s", p->client, client_name, - error_message(retval)); - return(pop_msg(p,POP_FAILURE, - "Kerberos error: \"%s\".", error_message(retval))); - } - } - - tmpdata = krb5_princ_realm(pop_context, ext_client); - if (strncmp(tmpdata->data, lrealm, tmpdata->length)) { - pop_log(p, POP_WARNING, "%s: (%s) realm not accepted.", - p->client, client_name); - return(pop_msg(p,POP_FAILURE, - "Kerberos realm \"%*s\" not accepted.", - tmpdata->length, tmpdata->data)); - } -#endif - /* only accept one-component names, i.e. realm and name only */ - if (krb5_princ_size(pop_context, ext_client) > 1) { - pop_log(p, POP_WARNING, "%s: (%s) instance not accepted.", - p->client, client_name); - return(pop_msg(p,POP_FAILURE, - "Must use null Kerberos(tm) \"instance\" - \"%s\" not accepted.", - client_name)); - } - - /* - * be careful! we are assuming that the instance and realm have been - * checked already! I used to simply copy the pname into p->user - * but this causes too much confusion and assumes p->user will never - * change. This makes me feel more comfortable. - */ - tmpdata = krb5_princ_component(pop_context, ext_client, 0); - if(strncmp(p->user, tmpdata->data, tmpdata->length)) - { - pop_log(p, POP_WARNING, "%s: auth failed: %s vs %s", - p->client, client_name, p->user); - return(pop_msg(p,POP_FAILURE, - "Wrong username supplied (%*s vs. %s).\n", tmpdata->length, - tmpdata->data, - p->user)); - } -#endif /* KRB5 */ - - /* Build the name of the user's maildrop */ - (void)sprintf(p->drop_name,"%s/%s",MAILDIR,p->user); - - /* Make a temporary copy of the user's maildrop */ - if (pop_dropcopy(p, NULL) != POP_SUCCESS) return (POP_FAILURE); - -#else /* KERBEROS */ - - /* Look for the user in the password file */ -#ifdef POP_PASSFILE - our_setpwent(POP_PASSFILE); - - if ((pw = our_getpwnam(p->user)) == NULL) -#else - if ((pw = getpwnam(p->user)) == NULL) -#endif - return (pop_msg(p,POP_FAILURE, - "Password supplied for \"%s\" is incorrect.",p->user)); - - /* We don't accept connections from users with null passwords */ - if (pw->pw_passwd == NULL) - return (pop_msg(p,POP_FAILURE, - "Password supplied for \"%s\" is incorrect.",p->user)); - - /* Compare the supplied password with the password file entry */ - if (strcmp (crypt (p->pop_parm[1], pw->pw_passwd), pw->pw_passwd) != 0) - return (pop_msg(p,POP_FAILURE, - "Password supplied for \"%s\" is incorrect.",p->user)); - - /* Build the name of the user's maildrop */ - (void)sprintf(p->drop_name,"%s/%s",MAILDIR,p->user); - - /* Make a temporary copy of the user's maildrop */ - /* and set the group and user id */ - if (pop_dropcopy(p,pw) != POP_SUCCESS) return (POP_FAILURE); - -#endif /* KERBEROS */ - - /* Get information about the maildrop */ - if (pop_dropinfo(p) != POP_SUCCESS) return(POP_FAILURE); - - /* Initialize the last-message-accessed number */ - p->last_msg = 0; - - /* Authorization completed successfully */ - return (pop_msg (p,POP_SUCCESS, - "%s has %d message(s) (%d octets).", - p->user,p->msg_count,p->drop_size)); -} - -#ifdef POP_PASSFILE - -/* - * I'm getting myself deeper and deeper - */ - -static char *pwfile = "/etc/passwd"; - -our_setpwent(file) - char *file; -{ - if(file) - { - pwfile = (char *) malloc(strlen(file) + 1); - if(pwfile) - strcpy(pwfile, file); - else - return(-1); - return(0); - } - return(-1); -} - -struct passwd * -our_getpwnam(user) - char *user; -{ - FILE *fp; - char buf[BUFSIZ]; - register char *c; - register char *d; - static struct passwd p; - - if(!(fp = fopen(pwfile, "r"))) - return(NULL); - - memset(&p, 0, sizeof(p)); - while(fgets(buf, sizeof(buf), fp)) - { - if(!(c = (char *) strchr(buf, ':'))) - continue; - - *c++ = '\0'; - if(strcmp(buf, user)) - continue; - - p.pw_name = strdup(buf); - -#if defined(hpux) || defined(__hpux) - if (!(d = (char *) strchr(c, ':'))) - return(&p); -#else - if(!((d = (char *) strchr(c, ':')) && (c = (char *) strchr(++d, ':')) && - (d = (char *) strchr(++c, ':')))) - return(&p); -#endif - *d = '\0'; - - p.pw_passwd = strdup(c); - return(&p); - } - - return(NULL); -} - -#endif /* POP_PASSFILE */ diff --git a/src/appl/popper/pop_quit.c b/src/appl/popper/pop_quit.c deleted file mode 100644 index d28bf7a23..000000000 --- a/src/appl/popper/pop_quit.c +++ /dev/null @@ -1,27 +0,0 @@ -/* - * Copyright (c) 1989 Regents of the University of California. - * All rights reserved. The Berkeley software License Agreement - * specifies the terms and conditions for redistribution. - */ - -#ifndef lint -static char copyright[] = "Copyright (c) 1990 Regents of the University of California.\nAll rights reserved.\n"; -/* based on @(#)pop_quit.c 2.1 3/18/91 */ -#endif - -#include -#include -#include "popper.h" - -/* - * quit: Terminate a POP session - */ - -int pop_quit (p) -POP * p; -{ - /* Release the message information list */ - if (p->mlp) free ((char *)p->mlp); - - return(POP_SUCCESS); -} diff --git a/src/appl/popper/pop_rset.c b/src/appl/popper/pop_rset.c deleted file mode 100644 index 458c15482..000000000 --- a/src/appl/popper/pop_rset.c +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Copyright (c) 1989 Regents of the University of California. - * All rights reserved. The Berkeley software License Agreement - * specifies the terms and conditions for redistribution. - */ - -#ifndef lint -static char copyright[] = "Copyright (c) 1990 Regents of the University of California.\nAll rights reserved.\n"; -/* based on @(#)pop_rset.c 2.1 3/18/91 */ -#endif - -#include -#include -#include "popper.h" - -/* - * rset: Unflag all messages flagged for deletion in a POP maildrop - */ - -int pop_rset (p) -POP * p; -{ - MsgInfoList * mp; /* Pointer to the message info list */ - register int i; - - /* Unmark all the messages */ - for (i = p->msg_count, mp = p->mlp; i > 0; i--, mp++) - mp->del_flag = FALSE; - - /* Reset the messages-deleted and bytes-deleted counters */ - p->msgs_deleted = 0; - p->bytes_deleted = 0; - - /* Reset the last-message-access flag */ - p->last_msg = 0; - - return (pop_msg(p,POP_SUCCESS,"Maildrop has %u messages (%u octets)", - p->msg_count,p->drop_size)); -} diff --git a/src/appl/popper/pop_send.c b/src/appl/popper/pop_send.c deleted file mode 100644 index b92db7c0a..000000000 --- a/src/appl/popper/pop_send.c +++ /dev/null @@ -1,126 +0,0 @@ -/* - * Copyright (c) 1989 Regents of the University of California. - * All rights reserved. The Berkeley software License Agreement - * specifies the terms and conditions for redistribution. - */ - -#ifndef lint -static char copyright[] = "Copyright (c) 1990 Regents of the University of California.\nAll rights reserved.\n"; -/* based on @(#)pop_send.c 2.1 3/18/91 */ -#endif - -#include -#include -#ifdef HAVE_STRINGS_H -#include -#else -#include -#endif -#include "popper.h" - -/* - * send: Send the header and a specified number of lines - * from a mail message to a POP client. - */ - -pop_send(p) -POP * p; -{ - MsgInfoList * mp; /* Pointer to message info list */ - register int msg_num; - register int msg_lines; - char buffer[MAXMSGLINELEN]; - - /* Convert the first parameter into an integer */ - msg_num = atoi(p->pop_parm[1]); - - /* Is requested message out of range? */ - if ((msg_num < 1) || (msg_num > p->msg_count)) - return (pop_msg (p,POP_FAILURE,"Message %d does not exist.",msg_num)); - - /* Get a pointer to the message in the message list */ - mp = &p->mlp[msg_num-1]; - - /* Is the message flagged for deletion? */ - if (mp->del_flag) - return (pop_msg (p,POP_FAILURE, - "Message %d has been deleted.",msg_num)); - - /* If this is a TOP command, get the number of lines to send */ - if (strcmp(p->pop_command,"top") == 0) { - /* Convert the second parameter into an integer */ - msg_lines = atoi(p->pop_parm[2]); - } - else { - /* Assume that a RETR (retrieve) command was issued */ - msg_lines = -1; - /* Flag the message as retreived */ - mp->retr_flag = TRUE; - } - - /* Display the number of bytes in the message */ - pop_msg(p,POP_SUCCESS,"%u octets",mp->length); - - /* Position to the start of the message */ - (void)fseek(p->drop,mp->offset,0); - - /* Skip the first line (the sendmail "From" line) */ - (void)fgets (buffer,MAXMSGLINELEN,p->drop); - - /* Send the header of the message followed by a blank line */ - while (fgets(buffer,MAXMSGLINELEN,p->drop)) { - pop_sendline (p,buffer); - /* A single newline (blank line) signals the - end of the header. sendline() converts this to a NULL, - so that's what we look for. */ - if (*buffer == 0) break; - } - /* Send the message body */ - while (fgets(buffer,MAXMSGLINELEN,p->drop)) { - /* Look for the start of the next message */ -#ifdef MMDF - if (is_msg_boundary(buffer)) break; -#else - if (strncmp(buffer,"From ",5) == 0) break; -#endif - /* Decrement the lines sent (for a TOP command) */ - if (msg_lines >= 0 && msg_lines-- == 0) break; - pop_sendline(p,buffer); - } - /* "." signals the end of a multi-line transmission */ - (void)fputs(".\r\n",p->output); - (void)fflush(p->output); - - /* If retrieving, update the last-message-accessed number - if it is lower than the retrieved message */ - if ((mp->retr_flag == TRUE) && (p->last_msg < msg_num)) - p->last_msg = msg_num; - - return(POP_SUCCESS); -} - -/* - * sendline: Send a line of a multi-line response to a client. - */ -pop_sendline(p,buffer) -POP * p; -char * buffer; -{ - char * bp; - - /* Byte stuff lines that begin with the temirnation octet */ - if (*buffer == POP_TERMINATE) (void)fputc(POP_TERMINATE,p->output); - - /* Look for a in the buffer */ - if (bp = strchr(buffer,NEWLINE)) *bp = 0; - - /* Send the line to the client */ - (void)fputs(buffer,p->output); - -#ifdef DEBUG - if(p->debug)pop_log(p,POP_DEBUG,"Sending line \"%s\"",buffer); -#endif - - /* Put a if a newline was removed from the buffer */ - if (bp) (void)fputs ("\r\n",p->output); -} diff --git a/src/appl/popper/pop_stat.c b/src/appl/popper/pop_stat.c deleted file mode 100644 index bca92c6ed..000000000 --- a/src/appl/popper/pop_stat.c +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Copyright (c) 1989 Regents of the University of California. - * All rights reserved. The Berkeley software License Agreement - * specifies the terms and conditions for redistribution. - */ - -#ifndef lint -static char copyright[] = "Copyright (c) 1990 Regents of the University of California.\nAll rights reserved.\n"; -/* based on @(#)pop_stat.c 2.2 3/18/91 */ -#endif - -#include -#include -#include "popper.h" - -/* - * stat: Display the status of a POP maildrop to its client - */ - -int pop_stat (p) -POP * p; -{ -#ifdef DEBUG - if (p->debug) pop_log(p,POP_DEBUG,"%d message(s) (%d octets).",p->msg_count-p->msgs_deleted,p->drop_size-p->bytes_deleted); -#endif - return (pop_msg (p,POP_SUCCESS, - "%u %u",p->msg_count-p->msgs_deleted,p->drop_size-p->bytes_deleted)); -} diff --git a/src/appl/popper/pop_updt.c b/src/appl/popper/pop_updt.c deleted file mode 100644 index 190279342..000000000 --- a/src/appl/popper/pop_updt.c +++ /dev/null @@ -1,310 +0,0 @@ -/* - * Copyright (c) 1989 Regents of the University of California. - * All rights reserved. The Berkeley software License Agreement - * specifies the terms and conditions for redistribution. - */ - -#ifndef lint -static char copyright[] = "Copyright (c) 1990 Regents of the University of California.\nAll rights reserved.\n"; -/* based on @(#)pop_updt.c 2.3 3/20/91 */ -#endif - -#include -#include -#ifdef HAS_UNISTD_H -#include -#endif -#ifdef POSIX_FILE_LOCKS -#include -#endif -#include -#ifdef HAVE_STRINGS_H -#include -#else -#include -#endif -#include -#include -#include "popper.h" - -static char standard_error[] = - "Error error updating primary drop. Mailbox unchanged"; - -/* - * updt: Apply changes to a user's POP maildrop - */ - -int pop_updt (p) -POP * p; -{ - FILE * md; /* Stream pointer for - the user's maildrop */ - int mfd; /* File descriptor for - above */ - char buffer[BUFSIZ]; /* Read buffer */ - - MsgInfoList * mp; /* Pointer to message - info list */ - register int msg_num; /* Current message - counter */ - register int status_written; /* Status header field - written */ - int nchar; /* Bytes read/written */ - - off_t offset; /* New mail offset */ - - int begun; /* Sanity check */ -#ifdef POSIX_FILE_LOCKS - static struct flock flock_zero; - struct flock lock_arg; - - lock_arg = flock_zero; -#endif - -#ifdef DEBUG - if (p->debug) { - pop_log(p,POP_DEBUG,"Performing maildrop update..."); - pop_log(p,POP_DEBUG,"Checking to see if all messages were deleted"); - } -#endif - - if (p->msgs_deleted == p->msg_count) { - /* Truncate before close, to avoid race condition, DO NOT UNLINK! - Another process may have opened, and not yet tried to lock */ - (void)ftruncate ((int)fileno(p->drop),0); - (void)fclose(p->drop) ; - return (POP_SUCCESS); - } - -#ifdef DEBUG - if (p->debug) - pop_log(p,POP_DEBUG,"Opening mail drop \"%s\"",p->drop_name); -#endif - - /* Open the user's real maildrop */ - if ((mfd = open(p->drop_name,O_RDWR|O_CREAT,0600)) == -1 || - (md = fdopen(mfd,"r+")) == NULL) { - return pop_msg(p,POP_FAILURE,standard_error); - } - - /* Lock the user's real mail drop */ -#ifdef POSIX_FILE_LOCKS - lock_arg.l_type = F_WRLCK; - lock_arg.l_whence = 0; - lock_arg.l_start = 0; - lock_arg.l_len = 0; - if ( fcntl(mfd, F_SETLKW, &lock_arg) == -1) { - (void)fclose(md) ; - return pop_msg(p,POP_FAILURE, "lockf: '%s': %s", p->temp_drop, - strerror(errno)); - } -#else - if ( flock(mfd,LOCK_EX) == -1 ) { - (void)fclose(md) ; - return pop_msg(p,POP_FAILURE, "flock: '%s': %s", p->temp_drop, - strerror(errno)); - } -#endif - - /* Go to the right places */ - offset = lseek((int)fileno(p->drop),(off_t)0,SEEK_END) ; - - /* Append any messages that may have arrived during the session - to the temporary maildrop */ - while ((nchar=read(mfd,buffer,BUFSIZ)) > 0) - if ( nchar != write((int)fileno(p->drop),buffer,nchar) ) { - nchar = -1; - break ; - } - if ( nchar != 0 ) { - (void)fclose(md) ; - (void)ftruncate((int)fileno(p->drop),offset) ; - (void)fclose(p->drop) ; - return pop_msg(p,POP_FAILURE,standard_error); - } - - rewind(md); - (void)ftruncate(mfd,0) ; - - /* Synch stdio and the kernel for the POP drop */ - rewind(p->drop); - (void)lseek((int)fileno(p->drop),(off_t)0,SEEK_SET); - - /* Transfer messages not flagged for deletion from the temporary - maildrop to the new maildrop */ -#ifdef DEBUG - if (p->debug) - pop_log(p,POP_DEBUG,"Creating new maildrop \"%s\" from \"%s\"", - p->drop_name,p->temp_drop); -#endif - - for (msg_num = 0; msg_num < p->msg_count; ++msg_num) { - - int doing_body; - - /* Get a pointer to the message information list */ - mp = &p->mlp[msg_num]; - - if (mp->del_flag) { -#ifdef DEBUG - if(p->debug) - pop_log(p,POP_DEBUG, - "Message %d flagged for deletion.",mp->number); -#endif - continue; - } - - (void)fseek(p->drop,mp->offset,0); - -#ifdef DEBUG - if(p->debug) - pop_log(p,POP_DEBUG,"Copying message %d.",mp->number); -#endif - begun = 0; - - for(status_written = doing_body = 0 ; - fgets(buffer,MAXMSGLINELEN,p->drop);) { - - if (doing_body == 0) { /* Header */ - -#ifdef MMDF - /* panic, I'm tired and can't think contorted. */ - if(is_msg_boundary(buffer) && begun) { - pop_log(p, POP_ERROR, - "%s: mailbox detonation has begun!", p->user); - (void)ftruncate(mfd,0); - (void)fclose(md); - (void)fclose(p->drop); - return(pop_msg(p, POP_FAILURE, "Unable to close mailbox door. Contact the postmaster to repair it.")); - } - - begun = 1; -#endif - /* Update the message status */ - if (strncasecmp(buffer,"Status:",7) == 0) { - if (mp->retr_flag) - (void)fputs("Status: RO\n",md); - else - (void)fputs(buffer, md); - status_written++; - continue; - } - /* A blank line signals the end of the header. */ - if (*buffer == '\n') { - doing_body = 1; - if (status_written == 0) { - if (mp->retr_flag) - (void)fputs("Status: RO\n\n",md); - else - (void)fputs("Status: U\n\n",md); - } - else (void)fputs ("\n", md); - continue; - } - /* Save another header line */ - (void)fputs (buffer, md); - } - else { /* Body */ -#ifdef MMDF - if (strncmp(buffer,"\001\001\001\001",4) == 0) { - (void)fputs (buffer, md); - break; - } - if (is_msg_boundary(buffer)) break; -#else - if (strncmp(buffer,"From ",5) == 0) break; -#endif - (void)fputs (buffer, md); - } - } - } - - /* flush and check for errors now! The new mail will writen - without stdio, since we need not separate messages */ - - (void)fflush(md) ; - if (ferror(md)) { - (void)ftruncate(mfd,0) ; - (void)fclose(md) ; - (void)fclose(p->drop) ; - return pop_msg(p,POP_FAILURE,standard_error); - } - - /* Go to start of new mail if any */ - (void)lseek((int)fileno(p->drop),offset,SEEK_SET); - - while((nchar=read((int)fileno(p->drop),buffer,BUFSIZ)) > 0) - if ( nchar != write(mfd,buffer,nchar) ) { - nchar = -1; - break ; - } - if ( nchar != 0 ) { - (void)ftruncate(mfd,0) ; - (void)fclose(md) ; - (void)fclose(p->drop) ; - return pop_msg(p,POP_FAILURE,standard_error); - } - - /* Close the maildrop and empty temporary maildrop */ - (void)fclose(md); - (void)ftruncate((int)fileno(p->drop),0); - (void)fclose(p->drop); - - return(pop_quit(p)); -} - -#ifdef MMDF -is_msg_boundary(line) - char *line; -{ - if(strncmp(line, "\001\001\001\001", 4) == 0) - return(1); - - if(strncmp(line, "From ", 5) != 0) - return(0); - - line += 5; - while((*line != ' ') && (*line != '\0')) - ++line; - - if(*line++ != ' ') - return(0); - - /* - * check the line length but some timestamps do not include time zone - */ - - if(strlen(line) < 24) - return(0); - - /* Tue */ - line += 3; - if(*line++ != ' ') - return(0); - - /* Jan */ - line += 3; - if(*line++ != ' ') - return(0); - - /* 22 */ - line += 2; - if(*line++ != ' ') - return(0); - - /* 18:21:34 */ - line += 2; - if(*line++ != ':') - return(0); - - line += 2; - if(*line++ != ':') - return(0); - - line += 2; - if(*line++ != ' ') - return(0); - - return(1); -} -#endif diff --git a/src/appl/popper/pop_user.c b/src/appl/popper/pop_user.c deleted file mode 100644 index 38bbd243c..000000000 --- a/src/appl/popper/pop_user.c +++ /dev/null @@ -1,69 +0,0 @@ -/* - * Copyright (c) 1989 Regents of the University of California. - * All rights reserved. The Berkeley software License Agreement - * specifies the terms and conditions for redistribution. - */ - -#ifndef lint -static char copyright[] = "Copyright (c) 1990 Regents of the University of California.\nAll rights reserved.\n"; -/* based on @(#)pop_user.c 2.1 3/18/91 */ -#endif - -#include -#include -#ifdef HAVE_STRINGS_H -#include -#else -#include -#endif -#include "popper.h" - -#ifdef KERBEROS -#ifdef KRB4 -#ifdef KRB5 - #error you can only use one of KRB4, KRB5 -#endif -#include -extern AUTH_DAT kdata; -#endif /* KRB4 */ -#ifdef KRB5 -#include "krb5.h" -#include "com_err.h" -extern krb5_principal ext_client; -extern char *client_name; -#endif /* KRB5 */ -#endif /* KERBEROS */ - -/* - * user: Prompt for the user name at the start of a POP session - */ - -int pop_user (p) -POP * p; -{ -#ifndef KERBEROS - /* Save the user name */ - (void)strcpy(p->user, p->pop_parm[1]); - -#else /* KERBEROS */ - - if(strcmp(p->pop_parm[1], p->user)) - { -#ifdef KRB4 - pop_log(p, POP_WARNING, "%s: auth failed: %s.%s@@%s vs %s", - p->client, kdata.pname, kdata.pinst, kdata.prealm, - p->pop_parm[1]); -#else - pop_log(p, POP_WARNING, "%s: auth failed: %s vs %s", - p->client, p->user, p->pop_parm[1]); -#endif - return(pop_msg(p,POP_FAILURE, - "Wrong username supplied (%s vs. %s).\n", p->user, - p->pop_parm[1])); - } - -#endif /* KERBEROS */ - - /* Tell the user that the password is required */ - return (pop_msg(p,POP_SUCCESS,"Password required for %s.",p->user)); -} diff --git a/src/appl/popper/pop_xmit.c b/src/appl/popper/pop_xmit.c deleted file mode 100644 index ae3898f91..000000000 --- a/src/appl/popper/pop_xmit.c +++ /dev/null @@ -1,109 +0,0 @@ -/* - * Copyright (c) 1989 Regents of the University of California. - * All rights reserved. The Berkeley software License Agreement - * specifies the terms and conditions for redistribution. - */ - -#ifndef lint -static char copyright[] = "Copyright (c) 1990 Regents of the University of California.\nAll rights reserved.\n"; -/* based on @(#)pop_xmit.c 2.1 3/18/91 */ -#endif - -#include -#include -#include -#include -#include -#ifdef HAS_PATHS_H -#include -#endif -#include "popper.h" - -#ifndef _PATH_SENDMAIL -#define _PATH_SENDMAIL "/usr/lib/sendmail" -#endif - -/* - * xmit: POP XTND function to receive a message from - * a client and send it in the mail - */ - -pop_xmit (p) -POP * p; -{ - FILE * tmp; /* File descriptor for - temporary file */ - char buffer[MAXLINELEN]; /* Read buffer */ - char * temp_xmit; /* Name of the temporary - filedrop */ -#ifdef WAIT_USES_INT - int stat; -#else - union wait stat; -#endif - int id, pid; - - /* Create a temporary file into which to copy the user's message */ - temp_xmit = tempnam(NULL, "xmitXXXXXX"); -#ifdef DEBUG - if(p->debug) - pop_log(p,POP_DEBUG, - "Creating temporary file for sending a mail message \"%s\"\n", - temp_xmit); -#endif - if ((tmp = fopen(temp_xmit,"w+")) == NULL) - return (pop_msg(p,POP_FAILURE, - "Unable to create temporary message file \"%s\", errno = %d", - temp_xmit,errno)); - - /* Tell the client to start sending the message */ - pop_msg(p,POP_SUCCESS,"Start sending the message."); - - /* Receive the message */ -#ifdef DEBUG - if(p->debug)pop_log(p,POP_DEBUG,"Receiving mail message"); -#endif - while (fgets(buffer,MAXLINELEN,p->input)){ - /* Look for initial period */ -#ifdef DEBUG - if(p->debug)pop_log(p,POP_DEBUG,"Receiving: \"%s\"",buffer); -#endif - if (*buffer == '.') { - /* Exit on end of message */ - if (strcmp(buffer,".\r\n") == 0) break; - } - (void)fputs (buffer,tmp); - } - (void)fclose (tmp); - -#ifdef DEBUG - if(p->debug)pop_log(p,POP_DEBUG,"Forking for \"%s\"",_PATH_SENDMAIL); -#endif - /* Send the message */ - switch (pid = fork()) { - case 0: - (void)fclose (p->input); - (void)fclose (p->output); - (void)close(0); - if (open(temp_xmit,O_RDONLY,0) < 0) (void)_exit(1); - (void)execl (_PATH_SENDMAIL,"send-mail","-t","-oem",NULLCP); - (void)_exit(1); - case -1: -#ifdef DEBUG - if (!p->debug) (void)unlink (temp_xmit); -#endif - return (pop_msg(p,POP_FAILURE, - "Unable to execute \"%s\"",_PATH_SENDMAIL)); - default: - while((id = wait(&stat)) >=0 && id != pid); - if (!p->debug) (void)unlink (temp_xmit); -#ifdef WAIT_USES_INT - if (WEXITSTATUS(stat)) -#else - if (stat.w_retcode) -#endif - return (pop_msg(p,POP_FAILURE,"Unable to send message")); - return (pop_msg (p,POP_SUCCESS,"Message sent successfully")); - } - free(temp_xmit); -} diff --git a/src/appl/popper/pop_xtnd.c b/src/appl/popper/pop_xtnd.c deleted file mode 100644 index 47ff3a4a1..000000000 --- a/src/appl/popper/pop_xtnd.c +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Copyright (c) 1989 Regents of the University of California. - * All rights reserved. The Berkeley software License Agreement - * specifies the terms and conditions for redistribution. - */ - -#ifndef lint -static char copyright[] = "Copyright (c) 1990 Regents of the University of California.\nAll rights reserved.\n"; -/* based on @(#)pop_xtnd.c 2.1 3/18/91 */ -#endif - -#include -#include -#include "popper.h" - -/* - * xtnd: Handle extensions to the POP protocol suite - */ - -extern xtnd_table * pop_get_subcommand(); - -int pop_xtnd (p) -POP * p; -{ - xtnd_table * x; - - /* Convert the XTND subcommand to lower case */ - pop_lower(p->pop_subcommand); - - /* Search for the subcommand in the XTND command table */ - if ((x = pop_get_subcommand(p)) == NULL) return(POP_FAILURE); - - /* Call the function associated with this subcommand */ - if (x->function) return((*x->function)(p)); - - /* Otherwise assume NOOP */ - return (pop_msg(p,POP_SUCCESS,NULL)); -} diff --git a/src/appl/popper/popper.M b/src/appl/popper/popper.M deleted file mode 100644 index b8802fa27..000000000 --- a/src/appl/popper/popper.M +++ /dev/null @@ -1,153 +0,0 @@ -.\" Copyright (c) 1980 Regents of the University of California. -.\" All rights reserved. -.\" -.\" Redistribution and use in source and binary forms are permitted -.\" provided that this notice is preserved and that due credit is given -.\" to the University of California at Berkeley. The name of the University -.\" may not be used to endorse or promote products derived from this -.\" software without specific prior written permission. This software -.\" is provided ``as is'' without express or implied warranty. -.\" -.\" @(#)@(#)popper.8 2.3 2.3 (CCS) 4/2/91 Copyright (c) 1990 Regents of the University of California.\nAll rights reserved.\n -.\" " -.TH popper 8 -.UC 6 -.ad -.SH NAME -popper \- pop 3 server -.SH SYNOPSIS -.B /usr/etc/popper -[ -d ] -[ -t trace-file] -.SH DESCRIPTION -.I Popper -is an implementation of the Post Office Protocol server that runs on a -variety of Unix computers to manage electronic mail for Macintosh and -MS-DOS computers. The server was developed at the University of -California at Berkeley and conforms fully to the specifications in RFC -1081 and RFC 1082. The Berkeley server also has extensions to send -electronic mail on behalf of a client. -.PP -The -.B \-d -flag sets the socket to debugging and turns on debugging. All debugging -information is saved using syslog(8). The -.B \-t trace\-file -flag turns on debugging and saves the trace information in -.I trace\-file -using fprintf(s). -.SH HOW TO OBTAIN THE SERVER -.PP -The POP server is available via anonymous ftp from ftp.CC.Berkeley.EDU -(128.32.136.9, 128.32.206.12). It is in two files in the pub directory: -a compressed tar file popper.tar.Z and a Macintosh StuffIt archive in -BinHex format called MacPOP.sit.hqx. -.SH THE POP TRANSACTION CYCLE -.PP -The Berkeley POP server is a single program (called popper) that is -launched by inetd when it gets a service request on the POP TCP port. -(The official port number specified in RFC 1081 for POP version 3 is -port 110. However, some POP3 clients attempt to contact the server at -port 109, the POP version 2 port. Unless you are running both POP2 and -POP3 servers, you can simply define both ports for use by the POP3 -server. This is explained in the installation instructions later on.) -The popper program initializes and verifies that the peer IP address is -registered in the local domain, logging a warning message when a -connection is made to a client whose IP address does not have a -canonical name. For systems using BSD 4.3 bind, it also checks to see -if a cannonical name lookup for the client returns the same peer IP -address, logging a warning message if it does not. The the server -enters the authorization state, during which the client must correctly -identify itself by providing a valid Unix userid and password on the -server's host machine. No other exchanges are allowed during this state -(other than a request to quit.) If authentication fails, a warning -message is logged and the session ends. Once the user is identified, -popper changes its user and group ids to match that of the user and -enters the transaction state. The server makes a temporary copy of the -user's maildrop (ordinarily in /usr/spool/mail) which is used for all -subsequent transactions. These include the bulk of POP commands to -retrieve mail, delete mail, undelete mail, and so forth. A Berkeley -extension also allows the user to submit a mail parcel to the server who -mails it using the sendmail program (this extension is supported in the -HyperMail client distributed with the server). When the client quits, -the server enters the final update state during which the network -connection is terminated and the user's maildrop is updated with the -(possibly) modified temporary maildrop. -.SH LOGGING -.PP -The POP server uses syslog to keep a record of its activities. On -systems with BSD 4.3 syslogging, the server logs (by default) to the -"local0" facility at priority "notice" for all messages except debugging -which is logged at priority "debug". The default log file is -/usr/spool/mqueue/POPlog. These can be changed, if desired. On systems -with 4.2 syslogging all messages are logged to the local log file, -usually /usr/spool/mqueue/syslog. -.SH DEBUGGING -.PP -The popper program will log debugging information when the -d parameter -is specified after its invocation in the inetd.conf file. Care should -be exercised in using this option since it generates considerable output -in the syslog file. Alternatively, the "-t " option will -place debugging information into file "" using fprintf -instead of syslog. -.PP -For SunOS version 3.5, the popper program is launched by inetd from -/etc/servers. This file does not allow you to specify command line -arguments. Therefore, if you want to enable debugging, you can specify -a shell script in /etc/servers to be launched instead of popper and in -this script call popper with the desired arguments. -.PP -You can confirm that the POP server is running on Unix by telneting to -port 110 (or 109 if you set it up that way). For example: -.PP -.nf -%telnet myhost 110 -Trying... -Connected to myhost.berkeley.edu. -Escape character is '^]'. -+OK UCB Pop server (version 1.6) at myhost starting. -quit -Connection closed by foreign host. -.fi -.SH VERSION 1.7 RELEASE NOTES -Extensive re-write of the maildrop processing code contributed by Viktor -Dukhovni that greatly reduces the -possibility that the maildrop can be corrupted as the result of -simultaneous access by two or more processes. -.PP -Added "pop_dropcopy" module to create a temporary maildrop from the -existing, standard maildrop as root before the setuid and setgid for the -user is done. This allows the temporary maildrop to be created in a -mail spool area that is not world read-writable. -.PP -This version does *not* send the sendmail "From " delimiter line in -response to a TOP or RETR command. -.PP -Encased all debugging code in #ifdef DEBUG constructs. This code can be -included by specifying the DEGUG compiler flag. Note: You still need -to use the -d or -t option to obtain debugging output. -.SH LIMITATIONS -The POP server copies the user's entire maildrop to /tmp and then -operates on that copy. If the maildrop is particularly large, or -inadequate space is available in /tmp, then the server will refuse to -continue and terminate the connection. -.PP -Simultaneous modification of a single maildrop can result in confusing -results. For example, manipulating messages in a maildrop using the -Unix /usr/ucb/mail command while a copy of it is being processed by the -POP server can cause the changes made by one program to be lost when the -other terminates. This problem is being worked on and will be fixed in -a later release. -.SH FILES -.nf -/usr/spool/mail mail files -/etc/inetd.conf pop program invocation -/etc/syslog.conf logging specifications -.fi -.SH "SEE ALSO" -inetd(8), -RFC1081, -RFC1082 -.SH AUTHORS -Bob Campbell, Edward Moy, Austin Shelton, Marshall T Rose, and cast of -thousands at Rand, UDel, UCI, and elsewhere diff --git a/src/appl/popper/popper.c b/src/appl/popper/popper.c deleted file mode 100644 index 2c980f3f6..000000000 --- a/src/appl/popper/popper.c +++ /dev/null @@ -1,113 +0,0 @@ -/* - * Copyright (c) 1989 Regents of the University of California. - * All rights reserved. The Berkeley software License Agreement - * specifies the terms and conditions for redistribution. - */ - -#ifndef lint -static char copyright[] = "Copyright (c) 1990 Regents of the University of California.\nAll rights reserved.\n"; -/* based on @(#)popper.c 2.1 3/18/91 */ -#endif - -#include -#include -#include "popper.h" - -extern state_table * pop_get_command(); - -/* - * popper: Handle a Post Office Protocol version 3 session - */ -main (argc, argv) -int argc; -char ** argv; -{ - POP p; - state_table * s; - char message[MAXLINELEN]; - - /* Start things rolling */ - pop_init(&p,argc,argv); - - /* Tell the user that we are listenting */ - pop_msg(&p,POP_SUCCESS, -#ifdef KERBEROS -#ifdef KRB4 - "UCB Pop server (version %s) with Kerberos (TM) at %s starting.", -#else -#ifdef KRB5 - "UCB Pop server (version %s) with Kerberos (TM) V5 at %s starting.", -#endif /* KRB5 */ -#endif /* KRB4 */ -#else /* !KERBEROS */ - "UCB Pop server (version %s) at %s starting.", -#endif /* KERBEROS */ - VERSION,p.myhost); - - /* State loop. The POP server is always in a particular state in - which a specific suite of commands can be executed. The following - loop reads a line from the client, gets the command, and processes - it in the current context (if allowed) or rejects it. This continues - until the client quits or an error occurs. */ - - for (p.CurrentState=auth1;p.CurrentState!=halt&&p.CurrentState!=error;) { - - /* Obtain a line from the client */ - if (fgets(message,MAXLINELEN,p.input) == NULL) { - p.CurrentState = error; - pop_msg(&p,POP_FAILURE,"POP server at %s signing off.",p.myhost); - } - else { - /* Search for the command in the command/state table */ - if ((s = pop_get_command(&p,message)) == NULL) continue; - - /* Call the function associated with this command in - the current state */ - if (s->function) p.CurrentState = s->result[(*s->function)(&p)]; - - /* Otherwise assume NOOP and send an OK message to the client */ - else { - p.CurrentState = s->success_state; - pop_msg(&p,POP_SUCCESS,NULL); - } - } - } - - /* Say goodbye to the client */ - pop_msg(&p,POP_SUCCESS,"Pop server at %s signing off.",p.myhost); - - /* Log the end of activity */ - pop_log(&p,POP_PRIORITY, - "(v%s) Ending request from \"%s\" at %s\n",VERSION,p.user,p.ipaddr); - - /* Stop logging */ - closelog(); - - return(0); -} - -#ifdef STRNCASECMP -/* - * Perform a case-insensitive string comparision - */ -#include -strncasecmp(str1,str2,len) -register char * str1; -register char * str2; -register int len; -{ - register int i; - char a, - b; - - for (i=len-1;i>=0;i--){ - a = str1[i]; - b = str2[i]; - if (isupper(a)) a = tolower(str1[i]); - if (isupper(b)) b = tolower(str2[i]); - if (a > b) return (1); - if (a < b) return(-1); - } - return(0); -} -#endif diff --git a/src/appl/popper/popper.h b/src/appl/popper/popper.h deleted file mode 100644 index 300f7ab60..000000000 --- a/src/appl/popper/popper.h +++ /dev/null @@ -1,183 +0,0 @@ -/* - * Copyright (c) 1989 Regents of the University of California. - * All rights reserved. The Berkeley software License Agreement - * specifies the terms and conditions for redistribution. - * - * static char copyright[] = "Copyright (c) 1990 Regents of the University of California.\nAll rights reserved.\n"; - * based on @(#)popper.h 2.2 4/2/91 - * - */ - -/* LINTLIBRARY */ - -/* - * Header file for the POP programs - */ - -#include -#include "version.h" - -#define NULLCP ((char *) 0) -#define SPACE 32 -#define TAB 9 -#define TRUE 1 -#define FALSE 0 -#define NEWLINE '\n' - -#ifndef MAXHOSTNAMELEN -#define MAXHOSTNAMELEN 256 -#endif -#define MAXUSERNAMELEN 65 -#define MAXDROPLEN 64 -#define MAXLINELEN 1024 -#define MAXMSGLINELEN 1024 -#define MAXCMDLEN 4 -#define MAXPARMCOUNT 5 -#define MAXPARMLEN 10 -#define ALLOC_MSGS 20 - -#define POP_FACILITY LOG_LOCAL0 -#define POP_ERROR LOG_ERR -#define POP_WARNING LOG_WARNING -#define POP_PRIORITY LOG_NOTICE -#define POP_INFO LOG_INFO -#define POP_DEBUG LOG_DEBUG -#define POP_LOGOPTS 0 - -#ifdef POP_PVT_PASSWD -#ifndef POP_PASSFILE -#define POP_PASSFILE "/usr/spool/pop/POP" -#endif /* POP_PASSFILE */ -#endif - -#ifndef MAILDIR -#ifdef BSD -#if BSD < 199103 -#define MAILDIR "/usr/spool/mail" -#else -#define MAILDIR "/var/mail" -#endif -#else -#define MAILDIR "/usr/mail" -#endif -#endif - -#define POP_OK "+OK" -#define POP_ERR "-ERR" -#define POP_SUCCESS 1 -#define POP_FAILURE 0 -#define POP_TERMINATE '.' - -extern int errno; - -#define pop_command pop_parm[0] /* POP command is first token */ -#define pop_subcommand pop_parm[1] /* POP XTND subcommand is the - second token */ - -typedef enum { /* POP processing states */ - auth1, /* Authorization: waiting for - USER command */ - auth2, /* Authorization: waiting for - PASS command */ - trans, /* Transaction */ - update, /* Update: session ended, - process maildrop changes */ - halt, /* (Halt): stop processing - and exit */ - error /* (Error): something really - bad happened */ -} state; - -typedef struct { /* State information for - each POP command */ - state ValidCurrentState; /* The operating state of - the command */ - char * command; /* The POP command */ - int min_parms; /* Minimum number of parms - for the command */ - int max_parms; /* Maximum number of parms - for the command */ - int (*function) (); /* The function that process - the command */ - state result[2]; /* The resulting state after - command processing */ -#define success_state result[0] /* State when a command - succeeds */ -} state_table; - -typedef struct { /* Table of extensions */ - char * subcommand; /* The POP XTND subcommand */ - int min_parms; /* Minimum number of parms for - the subcommand */ - int max_parms; /* Maximum number of parms for - the subcommand */ - int (*function) (); /* The function that processes - the subcommand */ -} xtnd_table; - -typedef struct { /* Message information */ - int number; /* Message number relative to - the beginning of list */ - long length; /* Length of message in - bytes */ - int lines; /* Number of (null-terminated) lines in the message */ - long offset; /* Offset from beginning of - file */ - int del_flag; /* Flag indicating if message - is marked for deletion */ - int retr_flag; /* Flag indicating if message - was retrieved */ -} MsgInfoList; - -typedef struct { /* POP parameter block */ - int debug; /* Debugging requested */ - char * myname; /* The name of this POP - daemon program */ - char myhost[MAXHOSTNAMELEN]; /* The name of our host - computer */ - char * client; /* Canonical name of client - computer */ - char * ipaddr; /* Dotted-notation format of - client IP address */ - unsigned short ipport; /* Client port for privileged - operations */ - char user[MAXUSERNAMELEN]; /* Name of the POP user */ - state CurrentState; /* The current POP operational state */ - MsgInfoList * mlp; /* Message information list */ - int msg_count; /* Number of messages in - the maildrop */ - int msgs_deleted; /* Number of messages flagged - for deletion */ - int last_msg; /* Last message touched by - the user */ - long bytes_deleted; /* Number of maildrop bytes - flagged for deletion */ - char drop_name[MAXDROPLEN]; /* The name of the user's - maildrop */ - char temp_drop[MAXDROPLEN]; /* The name of the user's - temporary maildrop */ - long drop_size; /* Size of the maildrop in - bytes */ - FILE * drop; /* (Temporary) mail drop */ - FILE * input; /* Input TCP/IP communication - stream */ - FILE * output; /* Output TCP/IP communication stream */ - FILE * trace; /* Debugging trace file */ - char * pop_parm[MAXPARMCOUNT]; /* Parse POP parameter list */ - int parm_count; /* Number of parameters in - parsed list */ -} POP; - -extern int pop_dele(); -extern int pop_last(); -extern int pop_list(); -extern int pop_pass(); -extern int pop_quit(); -extern int pop_rset(); -extern int pop_send(); -extern int pop_stat(); -extern int pop_updt(); -extern int pop_user(); -extern int pop_xtnd(); -extern int pop_xmit(); - diff --git a/src/appl/popper/syslog_levels b/src/appl/popper/syslog_levels deleted file mode 100644 index a6980fde5..000000000 --- a/src/appl/popper/syslog_levels +++ /dev/null @@ -1,5 +0,0 @@ -debug - debugging information -info - logs connections -notice - errors (ie: locked maildrop, broken pipe) -warning - authentication/authorization errors -error - bigger errors (ie: no resources) diff --git a/src/appl/popper/version.h b/src/appl/popper/version.h deleted file mode 100644 index 41ab5b365..000000000 --- a/src/appl/popper/version.h +++ /dev/null @@ -1,22 +0,0 @@ -/* - * Copyright (c) 1989 Regents of the University of California. - * All rights reserved. The Berkeley software License Agreement - * specifies the terms and conditions for redistribution. - * - * static char copyright[] = "Copyright (c) 1990 Regents of the University of California.\nAll rights reserved.\n"; - * based on @(#)version.h 2.6 4/3/91 - * - */ - -/* - * Current version of this POP implementation - */ -#ifdef KERBEROS -#ifdef KRB5 -#define VERSION "1.831beta Kerberos5" -#else -#define VERSION "1.831beta KerberosIV" -#endif -#else -#define VERSION "1.831beta" -#endif