diff --git a/appl/popper/pop_dele.c b/appl/popper/pop_dele.c index ebe50fddc..5b5a3fd93 100644 --- a/appl/popper/pop_dele.c +++ b/appl/popper/pop_dele.c @@ -4,7 +4,7 @@ * specifies the terms and conditions for redistribution. */ -#ifndef lint +#if 0 static char copyright[] = "Copyright (c) 1990 Regents of the University of California.\nAll rights reserved.\n"; static char SccsId[] = "@(#)@(#)pop_dele.c 2.1 2.1 3/18/91"; #endif /* not lint */ @@ -14,7 +14,8 @@ static char SccsId[] = "@(#)@(#)pop_dele.c 2.1 2.1 3/18/91"; /* * dele: Delete a message from the POP maildrop */ -int pop_dele (POP *p) +int +pop_dele (POP *p) { MsgInfoList * mp; /* Pointer to message info list */ int msg_num; diff --git a/appl/popper/pop_dropcopy.c b/appl/popper/pop_dropcopy.c index 7e5a9b78c..b2494addb 100644 --- a/appl/popper/pop_dropcopy.c +++ b/appl/popper/pop_dropcopy.c @@ -4,7 +4,7 @@ * specifies the terms and conditions for redistribution. */ -#ifndef lint +#if 0 static char copyright[] = "Copyright (c) 1990 Regents of the University of California.\nAll rights reserved.\n"; static char SccsId[] = "@(#)@(#)pop_dropcopy.c 2.6 2.6 4/3/91"; #endif /* not lint */ diff --git a/appl/popper/pop_dropinfo.c b/appl/popper/pop_dropinfo.c index 5b53f7c53..4c25913c2 100644 --- a/appl/popper/pop_dropinfo.c +++ b/appl/popper/pop_dropinfo.c @@ -4,7 +4,7 @@ * specifies the terms and conditions for redistribution. */ -#ifndef lint +#if 0 static char copyright[] = "Copyright (c) 1990 Regents of the University of California.\nAll rights reserved.\n"; static char SccsId[] = "@(#)@(#)pop_dropinfo.c 2.1 2.1 3/18/91"; #endif /* not lint */ diff --git a/appl/popper/pop_get_command.c b/appl/popper/pop_get_command.c index 9d3107b18..89f50c9b8 100644 --- a/appl/popper/pop_get_command.c +++ b/appl/popper/pop_get_command.c @@ -4,7 +4,7 @@ * specifies the terms and conditions for redistribution. */ -#ifndef lint +#if 0 static char copyright[] = "Copyright (c) 1990 Regents of the University of California.\nAll rights reserved.\n"; static char SccsId[] = "@(#)@(#)pop_get_command.c 2.1 2.1 3/18/91"; #endif /* not lint */ diff --git a/appl/popper/pop_get_subcommand.c b/appl/popper/pop_get_subcommand.c index ca3e2dfa2..1012a88e9 100644 --- a/appl/popper/pop_get_subcommand.c +++ b/appl/popper/pop_get_subcommand.c @@ -4,7 +4,7 @@ * specifies the terms and conditions for redistribution. */ -#ifndef lint +#if 0 static char copyright[] = "Copyright (c) 1990 Regents of the University of California.\nAll rights reserved.\n"; static char SccsId[] = "@(#)@(#)pop_get_subcommand.c 2.1 2.1 3/18/91"; #endif /* not lint */ diff --git a/appl/popper/pop_init.c b/appl/popper/pop_init.c index b7ad630a3..b38ebc6f3 100644 --- a/appl/popper/pop_init.c +++ b/appl/popper/pop_init.c @@ -4,7 +4,7 @@ * specifies the terms and conditions for redistribution. */ -#ifndef lint +#if 0 static char copyright[] = "Copyright (c) 1990 Regents of the University of California.\nAll rights reserved.\n"; static char SccsId[] = "@(#)@(#)pop_init.c 2.1 2.1 3/18/91"; #endif /* not lint */ @@ -21,6 +21,41 @@ AUTH_DAT kdata; extern int errno; +static +int +authenticate(POP *p, struct sockaddr_in *addr) +{ + +#ifdef KERBEROS + 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_get_err_text(auth)); + pop_log(p, POP_FAILURE, "%s: (%s.%s@%s) %s", p->client, + kdata.pname, kdata.pinst, kdata.prealm, krb_get_err_text(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 */ + +#endif /* KERBEROS */ + + return(POP_SUCCESS); +} + /* * init: Start a Post Office Protocol session */ @@ -190,37 +225,3 @@ pop_init(POP *p,int argcount,char **argmessage) return(authenticate(p, &cs)); } - -int -authenticate(POP *p, struct sockaddr_in *addr) -{ - -#ifdef KERBEROS - 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_get_err_text(auth)); - pop_log(p, POP_FAILURE, "%s: (%s.%s@%s) %s", p->client, - kdata.pname, kdata.pinst, kdata.prealm, krb_get_err_text(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 */ - -#endif /* KERBEROS */ - - return(POP_SUCCESS); -} diff --git a/appl/popper/pop_last.c b/appl/popper/pop_last.c index 2aede1ee6..a0ac4de4d 100644 --- a/appl/popper/pop_last.c +++ b/appl/popper/pop_last.c @@ -4,7 +4,7 @@ * specifies the terms and conditions for redistribution. */ -#ifndef lint +#if 0 static char copyright[] = "Copyright (c) 1990 Regents of the University of California.\nAll rights reserved.\n"; static char SccsId[] = "@(#)@(#)pop_last.c 2.1 2.1 3/18/91"; #endif /* not lint */ diff --git a/appl/popper/pop_list.c b/appl/popper/pop_list.c index 0ab382d10..3a1904361 100644 --- a/appl/popper/pop_list.c +++ b/appl/popper/pop_list.c @@ -4,7 +4,7 @@ * specifies the terms and conditions for redistribution. */ -#ifndef lint +#if 0 static char copyright[] = "Copyright (c) 1990 Regents of the University of California.\nAll rights reserved.\n"; static char SccsId[] = "@(#)@(#)pop_list.c 2.1 2.1 3/18/91"; #endif /* not lint */ @@ -51,7 +51,7 @@ pop_list (POP *p) /* 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); + (void)fprintf(p->output,"%u %lu\r\n",mp->number,mp->length); } /* "." signals the end of a multi-line transmission */ diff --git a/appl/popper/pop_log.c b/appl/popper/pop_log.c index c3b41d12d..05642d7be 100644 --- a/appl/popper/pop_log.c +++ b/appl/popper/pop_log.c @@ -4,7 +4,7 @@ * specifies the terms and conditions for redistribution. */ -#ifndef lint +#if 0 static char copyright[] = "Copyright (c) 1990 Regents of the University of California.\nAll rights reserved.\n"; static char SccsId[] = "@(#)@(#)pop_log.c 2.1 2.1 3/18/91"; #endif /* not lint */ diff --git a/appl/popper/pop_lower.c b/appl/popper/pop_lower.c index 578ff17e1..865c1fb81 100644 --- a/appl/popper/pop_lower.c +++ b/appl/popper/pop_lower.c @@ -4,7 +4,7 @@ * specifies the terms and conditions for redistribution. */ -#ifndef lint +#if 0 static char copyright[] = "Copyright (c) 1990 Regents of the University of California.\nAll rights reserved.\n"; static char SccsId[] = "@(#)@(#)pop_lower.c 2.1 2.1 3/18/91"; #endif /* not lint */ diff --git a/appl/popper/pop_msg.c b/appl/popper/pop_msg.c index 430ea6fce..f3eb58ce1 100644 --- a/appl/popper/pop_msg.c +++ b/appl/popper/pop_msg.c @@ -4,7 +4,7 @@ * specifies the terms and conditions for redistribution. */ -#ifndef lint +#if 0 static char copyright[] = "Copyright (c) 1990 Regents of the University of California.\nAll rights reserved.\n"; static char SccsId[] = "@(#)@(#)pop_msg.c 2.1 2.1 3/18/91"; #endif /* not lint */ diff --git a/appl/popper/pop_parse.c b/appl/popper/pop_parse.c index 5d5bed5c4..91980c02a 100644 --- a/appl/popper/pop_parse.c +++ b/appl/popper/pop_parse.c @@ -4,7 +4,7 @@ * specifies the terms and conditions for redistribution. */ -#ifndef lint +#if 0 static char copyright[] = "Copyright (c) 1990 Regents of the University of California.\nAll rights reserved.\n"; static char SccsId[] = "@(#)@(#)pop_parse.c 2.1 2.1 3/18/91"; #endif /* not lint */ diff --git a/appl/popper/pop_pass.c b/appl/popper/pop_pass.c index d3b3e8293..670c087e0 100644 --- a/appl/popper/pop_pass.c +++ b/appl/popper/pop_pass.c @@ -4,7 +4,7 @@ * specifies the terms and conditions for redistribution. */ -#ifndef lint +#if 0 static char copyright[] = "Copyright (c) 1990 Regents of the University of California.\nAll rights reserved.\n"; static char SccsId[] = "@(#)@(#)pop_pass.c 2.3 2.3 4/2/91"; #endif /* not lint */ diff --git a/appl/popper/pop_quit.c b/appl/popper/pop_quit.c index 85c621a20..f66f9758d 100644 --- a/appl/popper/pop_quit.c +++ b/appl/popper/pop_quit.c @@ -4,7 +4,7 @@ * specifies the terms and conditions for redistribution. */ -#ifndef lint +#if 0 static char copyright[] = "Copyright (c) 1990 Regents of the University of California.\nAll rights reserved.\n"; static char SccsId[] = "@(#)@(#)pop_quit.c 2.1 2.1 3/18/91"; #endif /* not lint */ diff --git a/appl/popper/pop_rset.c b/appl/popper/pop_rset.c index fd986095e..82a6f461d 100644 --- a/appl/popper/pop_rset.c +++ b/appl/popper/pop_rset.c @@ -4,7 +4,7 @@ * specifies the terms and conditions for redistribution. */ -#ifndef lint +#if 0 static char copyright[] = "Copyright (c) 1990 Regents of the University of California.\nAll rights reserved.\n"; static char SccsId[] = "@(#)@(#)pop_rset.c 2.1 2.1 3/18/91"; #endif /* not lint */ diff --git a/appl/popper/pop_send.c b/appl/popper/pop_send.c index 764fc66b1..abb20b74d 100644 --- a/appl/popper/pop_send.c +++ b/appl/popper/pop_send.c @@ -4,7 +4,7 @@ * specifies the terms and conditions for redistribution. */ -#ifndef lint +#if 0 static char copyright[] = "Copyright (c) 1990 Regents of the University of California.\nAll rights reserved.\n"; static char SccsId[] = "@(#)@(#)pop_send.c 2.1 2.1 3/18/91"; #endif /* not lint */ @@ -14,6 +14,7 @@ static char SccsId[] = "@(#)@(#)pop_send.c 2.1 2.1 3/18/91"; /* * sendline: Send a line of a multi-line response to a client. */ +static void pop_sendline(POP *p, char *buffer) { @@ -23,7 +24,7 @@ pop_sendline(POP *p, char *buffer) if (*buffer == POP_TERMINATE) (void)fputc(POP_TERMINATE,p->output); /* Look for a in the buffer */ - if (bp = strchr(buffer,NEWLINE)) *bp = 0; + if ((bp = strchr(buffer,NEWLINE))) *bp = 0; /* Send the line to the client */ (void)fputs(buffer,p->output); diff --git a/appl/popper/pop_stat.c b/appl/popper/pop_stat.c index a34719db4..a2fdb9053 100644 --- a/appl/popper/pop_stat.c +++ b/appl/popper/pop_stat.c @@ -4,7 +4,7 @@ * specifies the terms and conditions for redistribution. */ -#ifndef lint +#if 0 static char copyright[] = "Copyright (c) 1990 Regents of the University of California.\nAll rights reserved.\n"; static char SccsId[] = "@(#)@(#)pop_stat.c 2.2 2.2 3/18/91"; #endif /* not lint */ diff --git a/appl/popper/pop_updt.c b/appl/popper/pop_updt.c index 155ce96cb..52aa8bf6b 100644 --- a/appl/popper/pop_updt.c +++ b/appl/popper/pop_updt.c @@ -4,7 +4,7 @@ * specifies the terms and conditions for redistribution. */ -#ifndef lint +#if 0 static char copyright[] = "Copyright (c) 1990 Regents of the University of California.\nAll rights reserved.\n"; static char SccsId[] = "@(#)@(#)pop_updt.c 2.3 2.3 3/20/91"; #endif /* not lint */ diff --git a/appl/popper/pop_user.c b/appl/popper/pop_user.c index d7da4a732..eea0ec2ef 100644 --- a/appl/popper/pop_user.c +++ b/appl/popper/pop_user.c @@ -4,7 +4,7 @@ * specifies the terms and conditions for redistribution. */ -#ifndef lint +#if 0 static char copyright[] = "Copyright (c) 1990 Regents of the University of California.\nAll rights reserved.\n"; static char SccsId[] = "@(#)@(#)pop_user.c 2.1 2.1 3/18/91"; #endif /* not lint */ diff --git a/appl/popper/pop_xmit.c b/appl/popper/pop_xmit.c index 99d409800..f8d0f6ba6 100644 --- a/appl/popper/pop_xmit.c +++ b/appl/popper/pop_xmit.c @@ -4,7 +4,7 @@ * specifies the terms and conditions for redistribution. */ -#ifndef lint +#if 0 static char copyright[] = "Copyright (c) 1990 Regents of the University of California.\nAll rights reserved.\n"; static char SccsId[] = "@(#)@(#)pop_xmit.c 2.1 2.1 3/18/91"; #endif /* not lint */ diff --git a/appl/popper/pop_xtnd.c b/appl/popper/pop_xtnd.c index 73c214664..46a05d970 100644 --- a/appl/popper/pop_xtnd.c +++ b/appl/popper/pop_xtnd.c @@ -4,7 +4,7 @@ * specifies the terms and conditions for redistribution. */ -#ifndef lint +#if 0 static char copyright[] = "Copyright (c) 1990 Regents of the University of California.\nAll rights reserved.\n"; static char SccsId[] = "@(#)@(#)pop_xtnd.c 2.1 2.1 3/18/91"; #endif /* not lint */ @@ -15,8 +15,6 @@ static char SccsId[] = "@(#)@(#)pop_xtnd.c 2.1 2.1 3/18/91"; * xtnd: Handle extensions to the POP protocol suite */ -extern xtnd_table * pop_get_subcommand(); - int pop_xtnd (POP *p) { diff --git a/appl/popper/popper.c b/appl/popper/popper.c index d4e9bccc4..d6f99c72f 100644 --- a/appl/popper/popper.c +++ b/appl/popper/popper.c @@ -4,15 +4,13 @@ * specifies the terms and conditions for redistribution. */ -#ifndef lint +#if 0 static char copyright[] = "Copyright (c) 1990 Regents of the University of California.\nAll rights reserved.\n"; static char SccsId[] = "@(#)@(#)popper.c 2.1 2.1 3/18/91"; #endif /* not lint */ #include -extern state_table * pop_get_command(); - int hangup = FALSE ; static RETSIGTYPE diff --git a/appl/popper/popper.h b/appl/popper/popper.h index 68ef94dd8..e032766bd 100644 --- a/appl/popper/popper.h +++ b/appl/popper/popper.h @@ -223,16 +223,25 @@ typedef struct { /* POP parameter block */ 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(); +int pop_dele(POP *p); +int pop_dropcopy(POP *p, struct passwd *pwp); +int pop_dropinfo(POP *p); +int pop_init(POP *p,int argcount,char **argmessage); +int pop_last(POP *p); +int pop_list(POP *p); +int pop_parse(POP *p, char *buf); +int pop_pass(POP *p); +int pop_quit(POP *p); +int pop_rset(POP *p); +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); +state_table *pop_get_command(POP *p, char *mp); +void pop_lower(char *buf); +xtnd_table *pop_get_subcommand(POP *p); +int pop_log __P((POP *p, int stat, char *format, ...)); +int pop_msg __P((POP *p, int stat, char *format, ...));