From: mbeattie@sable.ox.ac.uk (Malcolm Beattie)
Subject: Re: popper under V3.0 enhanced security - anyone ported it?
Date: Mon, 7 Nov 94 14:17:37 GMT [thread overview]
Message-ID: <1994Nov7.141737.27364@inca.comlab.ox.ac.uk> (raw)
In-Reply-To: richard.782961495@exxilon
In article <richard.782961495@exxilon>,
Richard A. Muirden <richard@exxilon.xx.rmit.EDU.AU> wrote:
>Hi. I don't want to re-invent the wheel even though I know it is
>relatively trivial to do, but has anyone ported popper to OSF/1
>V3.0 with enhanced security (ie: using getprpwent etc)?
Here's what I did...
--Malcolm
--------------------------- cut here ---------------------------
*** popper.h.ORI Wed Aug 24 14:17:20 1994
--- popper.h Wed Aug 24 14:56:29 1994
***************
*** 24,29 ****
--- 24,32 ----
#define FALSE 0
#define NEWLINE '\n'
+ #ifdef MAXHOSTNAMELEN
+ #undef MAXHOSTNAMELEN
+ #endif /* MAXHOSTNAMELEN */
#define MAXHOSTNAMELEN 256
#define MAXUSERNAMELEN 65
#define MAXDROPLEN 64
***************
*** 33,51 ****
#define MAXPARMCOUNT 5
#define MAXPARMLEN 10
#define ALLOC_MSGS 20
! #define MAIL_COMMAND "/usr/lib/sendmail"
! #define POP_FACILITY LOG_LOCAL0
#define POP_PRIORITY LOG_NOTICE
#define POP_DEBUG LOG_DEBUG
#define POP_LOGOPTS 0
! #define POP_MAILDIR "/usr/spool/mail"
! #define POP_DROP "/usr/spool/mail/.%s.pop"
/* POP_TMPSIZE needs to be big enough to hold the string
* defined by POP_TMPDROP. POP_DROP and POP_TMPDROP
* must be in the same filesystem.
*/
! #define POP_TMPDROP "/usr/spool/mail/tmpXXXXXX"
#define POP_TMPSIZE 256
#define POP_TMPXMIT "/tmp/xmitXXXXXX"
#define POP_OK "+OK"
--- 36,54 ----
#define MAXPARMCOUNT 5
#define MAXPARMLEN 10
#define ALLOC_MSGS 20
! #define MAIL_COMMAND "/usr/sbin/sendmail"
! #define POP_FACILITY LOG_LOCAL2
#define POP_PRIORITY LOG_NOTICE
#define POP_DEBUG LOG_DEBUG
#define POP_LOGOPTS 0
! #define POP_MAILDIR "/var/spool/mail"
! #define POP_DROP "/var/spool/mail/.%s.pop"
/* POP_TMPSIZE needs to be big enough to hold the string
* defined by POP_TMPDROP. POP_DROP and POP_TMPDROP
* must be in the same filesystem.
*/
! #define POP_TMPDROP "/var/spool/mail/tmpXXXXXX"
#define POP_TMPSIZE 256
#define POP_TMPXMIT "/tmp/xmitXXXXXX"
#define POP_OK "+OK"
*** popper.c.ORI Wed Aug 24 12:48:06 1994
--- popper.c Fri Aug 26 15:14:58 1994
***************
*** 13,18 ****
--- 13,23 ----
#include <sys/types.h>
#include "popper.h"
+ #ifdef __osf__
+ /* Want prototype for set_auth_parameters */
+ #include <prot.h>
+ #endif /* __osf__ */
+
extern state_table * pop_get_command();
/*
***************
*** 26,33 ****
--- 31,47 ----
state_table * s;
char message[MAXLINELEN];
+ #ifdef __osf__
+ set_auth_parameters(argc, argv);
+ #endif /* __osf__ */
+
/* Start things rolling */
pop_init(&p,argc,argv);
+
+ #ifdef __osf__
+ fclose(stderr); /* workaround for OSF/1 T3.0-2 bug in */
+ /* sia_ses_authent */
+ #endif /* __osf __ */
/* Tell the user that we are listenting */
pop_msg(&p,POP_SUCCESS,
*** pop_pass.c.ORI Wed Aug 24 12:32:23 1994
--- pop_pass.c Wed Aug 24 13:41:07 1994
***************
*** 3,8 ****
--- 3,9 ----
* All rights reserved. The Berkeley software License Agreement
* specifies the terms and conditions for redistribution.
*/
+ /* Rewritten for OSF/1 C2 Enhanced Security. Malcolm Beattie 24 Aug 1994 */
#ifndef lint
static char copyright[] = "Copyright (c) 1990 Regents of the University of California.\nAll rights reserved.\n";
***************
*** 15,20 ****
--- 16,48 ----
#include <pwd.h>
#include "popper.h"
+ #include <sia.h>
+ #include <siad.h>
+ #include <string.h>
+
+ static char *sia_reason = NULL;
+
+ int sia_collect_cache(int timeout, int rendition, unsigned char *title,
+ int num_prompts, prompt_t *prompt)
+ {
+ size_t len;
+
+ if (rendition == SIAINFO || rendition == SIAWARNING)
+ {
+ if (sia_reason)
+ free(sia_reason);
+ sia_reason = strdup(prompt->prompt);
+ /* Truncate trailing newline if present */
+ if (sia_reason)
+ {
+ len = strlen(sia_reason);
+ if (len > 0 && sia_reason[len - 1] == '\n')
+ sia_reason[len - 1] = '\0';
+ }
+ }
+ return SIACOLSUCCESS;
+ }
+
/*
* pass: Obtain the user password from a POP client
*/
***************
*** 22,44 ****
int pop_pass (p)
POP * p;
{
! register struct passwd * pw;
! char *crypt();
! /* Look for the user in the password file */
if ((pw = getpwnam(p->user)) == NULL)
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",POP_MAILDIR,p->user);
--- 50,87 ----
int pop_pass (p)
POP * p;
{
! struct passwd *pw;
! SIAENTITY *entity = NULL;
! int sia_argc;
! char *sia_argv[3];
! sia_argc = 2;
! sia_argv[0] = "popper";
! sia_argv[1] = p->user;
! sia_argv[2] = NULL;
! if (sia_ses_init(&entity, sia_argc, sia_argv,
! NULL, p->user, NULL, FALSE, NULL) != SIASUCCESS)
! {
! pop_log(p, POP_PRIORITY, "sia_ses_init failed");
! return (pop_msg(p, POP_FAILURE,
! "System error, SIA authentication problem"));
! }
! if (sia_ses_authent(sia_collect_cache,
! p->pop_parm[1], entity) != SIASUCCESS)
! return (pop_msg(p,POP_FAILURE,
! sia_reason ? sia_reason : "Authentication error"));
! if (sia_ses_estab(sia_collect_cache, entity) != SIASUCCESS)
! return (pop_msg(p,POP_FAILURE,
! sia_reason ? sia_reason : "Authentication error"));
! if (sia_ses_release(&entity) != SIASUCCESS)
! pop_log(p, POP_PRIORITY, "sia_ses_release failed");
!
if ((pw = getpwnam(p->user)) == NULL)
+ {
+ pop_log(p, POP_PRIORITY, "getpwnam failed after sia_ses succeeded");
return (pop_msg(p,POP_FAILURE,
! "System error, SIA authentication problem"));
! }
/* Build the name of the user's maildrop */
(void)sprintf(p->drop_name,"%s/%s",POP_MAILDIR,p->user);
*** Makefile~ Wed Aug 24 14:29:08 1994
--- Makefile Wed Aug 24 15:07:42 1994
***************
*** 38,44 ****
# syslog).
# STRNCASECMP - If you do not have strncasecmp()
! CFLAGS = -O -DHAVE_VSPRINTF
TARGET = popper
--- 38,44 ----
# syslog).
# STRNCASECMP - If you do not have strncasecmp()
! CFLAGS = -O -DHAVE_VSPRINTF -D_BSD
TARGET = popper
***************
*** 55,61 ****
${TARGET}: ${OBJS}
! cc ${OBJS} -o ${TARGET}
tar: ${SRCS} ${DOCS} ${MAKEFILE}
rm -f ${TAR} *.Z*
--- 55,61 ----
${TARGET}: ${OBJS}
! cc ${OBJS} -o ${TARGET} -lsecurity -laud
tar: ${SRCS} ${DOCS} ${MAKEFILE}
rm -f ${TAR} *.Z*
--------------------------- cut here ---------------------------
--
Malcolm Beattie <mbeattie@sable.ox.ac.uk> (note new address)
Oxford University Computing Services
"Widget. It's got a widget. A lovely widget. A widget it has got." --Jack Dee
next prev parent reply other threads:[~1994-11-07 14:17 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
1994-10-24 1:18 popper under V3.0 enhanced security - anyone ported it? Richard A. Muirden
1994-11-07 14:17 ` Malcolm Beattie [this message]
1994-11-07 18:34 ` IMAP? (was:popper under V3.0 enhanced security) Bob Wier
1994-11-18 4:10 ` Mark Keppinger
read-only archive
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox