removed skey and added otp

git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@985 ec53bebd-3082-4978-b11e-865c3cabbd6b
This commit is contained in:
Assar Westerlund
1996-11-16 18:38:00 +00:00
parent 1c9b803c57
commit 79e290c37e
4 changed files with 24 additions and 37 deletions

View File

@@ -9,11 +9,10 @@ CC = @CC@
AR = ar AR = ar
RANLIB = @RANLIB@ RANLIB = @RANLIB@
DEFS = @DEFS@ DEFS = @DEFS@
CFLAGS = @CFLAGS@ @SKEYINCLUDE@ CFLAGS = @CFLAGS@
LD_FLAGS = @LD_FLAGS@ LD_FLAGS = @LD_FLAGS@
INSTALL = @INSTALL@ INSTALL = @INSTALL@
LIBS = @LIBS@ LIBS = @LIBS@
SKEYLIB = @SKEYLIB@
MKINSTALLDIRS = @top_srcdir@/mkinstalldirs MKINSTALLDIRS = @top_srcdir@/mkinstalldirs
prefix = @prefix@ prefix = @prefix@
@@ -76,8 +75,9 @@ dist: $(DISTFILES)
done done
KLIB=-L../../lib/krb -lkrb -L../../lib/des -ldes -L../../lib/roken -lroken KLIB=-L../../lib/krb -lkrb -L../../lib/des -ldes -L../../lib/roken -lroken
OTPLIB=-L../../lib/otp -lotp
popper: $(OBJECTS) popper: $(OBJECTS)
$(CC) $(LD_FLAGS) $(LDFLAGS) -o $@ $(OBJECTS) $(KLIB) $(LIBS) $(SKEYLIB) $(CC) $(LD_FLAGS) $(LDFLAGS) -o $@ $(OBJECTS) $(OTPLIB) $(KLIB) $(LIBS)
$(OBJECTS): ../../config.h $(OBJECTS): ../../config.h

View File

@@ -51,22 +51,19 @@ pop_pass (POP *p)
sprintf (tkt, TKT_ROOT "_popper.%d", (int)getpid()); sprintf (tkt, TKT_ROOT "_popper.%d", (int)getpid());
krb_set_tkt_string (tkt); krb_set_tkt_string (tkt);
#ifdef SKEY if (otp_verify_user (&p->otp_ctx, p->pop_parm[1]) == 0)
if (skeyverify (&p->sk, p->pop_parm[1]) == 0)
; ;
else if(!p->permit_passwd) else if(p->no_passwd)
return pop_msg(p, POP_FAILURE, return pop_msg(p, POP_FAILURE,
"Password supplied for \"%s\" is incorrect.", "Password supplied for \"%s\" is incorrect.",
p->user); p->user);
else else if (krb_verify_user(p->user, "", lrealm, p->pop_parm[1],
#endif 1, "pop") &&
unix_verify_user(p->user, p->pop_parm[1])) {
if (krb_verify_user(p->user, "", lrealm, p->pop_parm[1], 1, "pop") && dest_tkt ();
unix_verify_user(p->user, p->pop_parm[1])) { return (pop_msg(p,POP_FAILURE,
dest_tkt (); "Password supplied for \"%s\" is incorrect.",
return (pop_msg(p,POP_FAILURE, p->user));
"Password supplied for \"%s\" is incorrect.",
p->user));
} }
dest_tkt (); dest_tkt ();
} else { } else {

View File

@@ -14,23 +14,17 @@ RCSID("$Id$");
int int
pop_user (POP *p) pop_user (POP *p)
{ {
#ifdef SKEY char ss[256];
char ss[256], msg[256];
#endif
/* Save the user name */
strcpy(p->user, p->pop_parm[1]); strcpy(p->user, p->pop_parm[1]);
#ifdef SKEY if (otp_challenge (&p->otp_ctx, p->user, ss, sizeof(ss)) == 0) {
p->permit_passwd = skeyaccess(k_getpwnam (p->user), NULL, return pop_msg(p, POP_SUCCESS, "Password %s required for %s.",
p->client, NULL);
if (skeychallenge (&p->sk, p->user, ss) == 0) {
return pop_msg(p, POP_SUCCESS, "Password [%s] required for %s.",
ss, p->user); ss, p->user);
} else if (!p->permit_passwd) } else if (p->no_passwd) {
return pop_msg(p, POP_FAILURE, "Access unauthorized for %s.", char *s = otp_error(&p->otp_ctx);
p->user); return pop_msg(p, POP_FAILURE, "Permission denied%s%s",
#endif s ? ":" : "", s);
/* Tell the user that the password is required */ } else
return pop_msg(p, POP_SUCCESS, "Password required for %s.", p->user); return pop_msg(p, POP_SUCCESS, "Password required for %s.", p->user);
} }

View File

@@ -122,9 +122,7 @@
#include <maillock.h> #include <maillock.h>
#endif #endif
#if defined(SKEY) #include <otp.h>
#include <skey.h>
#endif
#if defined(KRB4_MAILDIR) #if defined(KRB4_MAILDIR)
#define POP_MAILDIR KRB4_MAILDIR #define POP_MAILDIR KRB4_MAILDIR
@@ -232,10 +230,8 @@ typedef struct { /* POP parameter block */
#ifdef KERBEROS #ifdef KERBEROS
AUTH_DAT kdata; AUTH_DAT kdata;
#endif #endif
#ifdef SKEY int no_passwd; /* Dont allow cleartext */
struct skey sk; /* Skey state */ OtpContext otp_ctx; /* OTP context */
int permit_passwd; /* allow cleartext pwd? */
#endif
} POP; } POP;
typedef struct { /* State information for typedef struct { /* State information for