# $Header$
#
#
# Sample code to do the glue between a TACACS protected system and a Enigma
# Logic database system using TokenCards. 
#
# Basically, we get called with 2 parameters: username and password.
# 
# NOTE: Since we get called using popen(), arguments get groked by the
#       shell. Not a big deal since these cards actually give alphanumeric
#	one-time passwords. (so a ps -xa or ps -ef snooping is not an issue)
#	but if they change the character set to include "(" or something,
#	we gotta change this then.
#
# NOTE: An equivalent for SecurID can be written as well, and one can even
#	support both.
#
#
# CFLAGS can be:
# -DDEBUG -DSYSV
#
# Use:
#	DEBUG 	if you want extensive debugging information
#	SYSV	if your system has funny ioctl(), no malloc(), etc
#	BSD43	if your system has a good setpwfile() and does not
#		use contiguous file descriptors.
#
#
MAN=	
MANEXT=	
BINDIR= /etc
MANDIR=	/usr/man/mann

CFLAGS= -g -DBSD43 -DDEBUG

LDFLAGS= idpb.a

OUT=	enigma
OBJS=	enigma.o custpb1.o

DIST= Makefile custpb.h enigma custf.h custpb1.c enigma.c idpb.a


all: ${OUT} 

${OUT}:	${OBJS}	Makefile
	@ uudecode idpb.a.uue
	@ ranlib idpb.a
	${CC} ${CFLAGS} ${OBJS} -o ${OUT} ${LDFLAGS}


clean:
	rm -f ${OUT} *.o *.s errs core a.out 

install: 
	install -s -m 711 ${OUT} ${BINDIR}

man:
	install -c ${MAN}.man  /usr/man/man$(MANEXT)/${MAN}.$(MANEXT)

shar:  enigma.shar
enigma.shar:  $(DIST)
	@-/bin/rm -f enigma.shar
	@ [ -d /var/tmp/t/enigma ] || mkdir /var/tmp/t /var/tmp/t/enigma
	@ cp $(DIST) /var/tmp/t/enigma
	@ cd /var/tmp/t ; shar -v -c enigma > enigma.shar
	@ mv /var/tmp/t/enigma.shar . ; ls -l enigma.shar
	@ /bin/rm -rf /var/tmp/t
	
tar:	enigma.tar.Z
enigma.tar.Z:  $(DIST)
	@ [ -d /var/tmp/t/enigma ] || mkdir /var/tmp/t /var/tmp/t/enigma
	@ cp $(DIST) /var/tmp/t/enigma
	@ cd /var/tmp/t ; tar cf - enigma | compress -c > enigma.tar.Z
	@ mv /var/tmp/t/enigma.tar.Z . ; ls -l enigma.tar.Z
	@ /bin/rm -rf /var/tmp/t
	@ zcat enigma.tar.Z | tar tf -

# DO NOT DELETE THIS LINE -- mkdep uses it.
# DO NOT PUT ANYTHING AFTER THIS LINE, IT WILL GO AWAY.

