Remove XTND, and XTND XMIT. Rename XTND XOVER to XOVER.

git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@1779 ec53bebd-3082-4978-b11e-865c3cabbd6b
This commit is contained in:
Johan Danielsson
1997-05-25 18:50:57 +00:00
parent e40377974e
commit b4f396648e
6 changed files with 7 additions and 180 deletions

View File

@@ -34,22 +34,22 @@ OBJECTS = $(POPPER_OBJECTS) $(POP_DEBUG_OBJECTS)
POPPER_SOURCES = \
pop_dele.c pop_dropcopy.c pop_dropinfo.c \
pop_get_command.c pop_get_subcommand.c pop_init.c \
pop_get_command.c pop_init.c \
pop_last.c pop_list.c pop_log.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 pop_uidl.c pop_xover.c popper.c
pop_user.c pop_uidl.c pop_xover.c popper.c
POP_DEBUG_SOURCES = \
pop_debug.c
POPPER_OBJECTS = \
pop_dele.o pop_dropcopy.o pop_dropinfo.o \
pop_get_command.o pop_get_subcommand.o pop_init.o \
pop_get_command.o pop_init.o \
pop_last.o pop_list.o pop_log.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 pop_uidl.o pop_xover.o popper.o
pop_uidl.o pop_xover.o popper.o
POP_DEBUG_OBJECTS = \
pop_debug.o

View File

@@ -27,11 +27,13 @@ static state_table states[] = {
{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}},
{trans, "help", 0, 0, pop_help, {trans, trans}},
#ifdef UIDL
{trans, "uidl", 0, 1, pop_uidl, {trans, trans}},
#endif
#ifdef XOVER
{trans, "xover", 0, 0, pop_xover, {trans, trans}},
#endif
{(state) 0, NULL, 0, 0, NULL, {halt, halt}},
};

View File

@@ -1,57 +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 <popper.h>
RCSID("$Id$");
/*
* get_subcommand: Extract a POP XTND subcommand from a client input line
*/
static xtnd_table subcommands[] = {
{"xmit", 0, 0, pop_xmit},
#ifdef XOVER
{"xover", 0, 0, pop_xover},
#endif
{NULL}
};
xtnd_table *
pop_get_subcommand(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) {
pop_msg(p,POP_FAILURE,
"Too few arguments for the %s %s command.",
p->pop_command,p->pop_subcommand);
return NULL;
}
/* Were too many parameters passed to the subcommand? */
if ((p->parm_count-1) > s->max_parms) {
pop_msg(p,POP_FAILURE,
"Too many arguments for the %s %s command.",
p->pop_command,p->pop_subcommand);
return NULL;
}
/* 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 */
pop_msg(p,POP_FAILURE,
"Unknown command: \"%s %s\".",p->pop_command,p->pop_subcommand);
return NULL;
}

View File

@@ -1,85 +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 <popper.h>
RCSID("$Id$");
/*
* xmit: POP XTND function to receive a message from
* a client and send it in the mail
*/
int
pop_xmit (POP *p)
{
FILE * tmp; /* File descriptor for
temporary file */
char buffer[MAXLINELEN]; /* Read buffer */
char temp_xmit[MAXDROPLEN]; /* Name of the temporary
filedrop */
int stat;
int id, pid;
/* Create a temporary file into which to copy the user's message */
if ((tmp = fdopen(mkstemp(temp_xmit), "w+")) == NULL)
return (pop_msg(p, POP_FAILURE,
"Unable to create temporary message file \"%s\": %s",
temp_xmit,
strerror(errno)));
#ifdef DEBUG
if(p->debug)
pop_log(p, POP_DEBUG,
"Creating temporary file for sending a mail message \"%s\"\n",
temp_xmit);
#endif /* DEBUG */
/* 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 /* DEBUG */
while (fgets(buffer,MAXLINELEN,p->input)){
/* Look for initial period */
#ifdef DEBUG
if(p->debug)pop_log(p,POP_DEBUG,"Receiving: \"%s\"",buffer);
#endif /* DEBUG */
if (strcmp(buffer,".\r\n") == 0) break;
fputs (buffer,tmp);
}
fclose (tmp);
#ifdef DEBUG
if(p->debug)pop_log(p,POP_DEBUG,"Forking for \"%s\"",MAIL_COMMAND);
#endif /* DEBUG */
/* Send the message */
switch (pid = fork()) {
case 0:
fclose (p->input);
fclose (p->output);
close(0);
if (open(temp_xmit,O_RDONLY,0) < 0)
_exit(1);
execl (MAIL_COMMAND, "send-mail", "-t", "-oem", (char *)NULL);
_exit(1);
case -1:
#ifdef DEBUG
if (!p->debug) unlink (temp_xmit);
#endif /* DEBUG */
return (pop_msg(p,POP_FAILURE,
"Unable to execute \"%s\"",MAIL_COMMAND));
default:
while((id = wait(&stat)) >=0 && id != pid)
;
if (!p->debug)
unlink (temp_xmit);
if (WEXITSTATUS(stat) != 0)
return pop_msg(p,POP_FAILURE,"Unable to send message");
return pop_msg (p,POP_SUCCESS,"Message sent successfully");
}
}

View File

@@ -1,30 +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 <popper.h>
RCSID("$Id$");
/*
* xtnd: Handle extensions to the POP protocol suite
*/
int
pop_xtnd (POP *p)
{
xtnd_table * x;
/* Convert the XTND subcommand to lower case */
strlwr(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));
}

View File

@@ -288,8 +288,6 @@ int pop_send(POP *p);
int pop_stat(POP *p);
int pop_updt(POP *p);
int pop_user(POP *p);
int pop_xmit(POP *p);
int pop_xtnd(POP *p);
#ifdef UIDL
int pop_uidl(POP *p);
#endif
@@ -299,7 +297,6 @@ int pop_xover(POP *p);
int pop_help(POP *p);
state_table *pop_get_command(POP *p, char *mp);
void pop_lower(char *buf);
xtnd_table *pop_get_subcommand(POP *p);
int pop_log(POP *p, int stat, char *format, ...)
#ifdef __GNUC__