summaryrefslogtreecommitdiffstats
path: root/contrib/opie
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/opie')
-rw-r--r--contrib/opie/config.h379
-rw-r--r--contrib/opie/ftpcmd.y13
-rw-r--r--contrib/opie/libmissing/alloca.c494
-rw-r--r--contrib/opie/libmissing/env.c141
-rw-r--r--contrib/opie/libmissing/getcwd.c23
-rw-r--r--contrib/opie/libmissing/getusershell.c67
-rw-r--r--contrib/opie/libmissing/initgroups.c129
-rw-r--r--contrib/opie/libmissing/memcmp.c25
-rw-r--r--contrib/opie/libmissing/memcpy.c25
-rw-r--r--contrib/opie/libmissing/memset.c21
-rw-r--r--contrib/opie/libmissing/sigaddset.c36
-rw-r--r--contrib/opie/libmissing/sigemptyset.c23
-rw-r--r--contrib/opie/libmissing/sigprocmask.c68
-rw-r--r--contrib/opie/libmissing/strchr.c24
-rw-r--r--contrib/opie/libmissing/strerror.c34
-rw-r--r--contrib/opie/libmissing/strncasecmp.c30
-rw-r--r--contrib/opie/libmissing/strrchr.c25
-rw-r--r--contrib/opie/libmissing/sysconf.c30
-rw-r--r--contrib/opie/libmissing/uname.c42
-rw-r--r--contrib/opie/libopie/challenge.c13
-rw-r--r--contrib/opie/libopie/generator.c366
-rw-r--r--contrib/opie/libopie/hash.c62
-rw-r--r--contrib/opie/libopie/hashlen.c79
-rw-r--r--contrib/opie/libopie/insecure.c33
-rw-r--r--contrib/opie/libopie/lock.c19
-rw-r--r--contrib/opie/libopie/newseed.c111
-rw-r--r--contrib/opie/logwtmp.c154
-rw-r--r--contrib/opie/opie.440
-rw-r--r--contrib/opie/opie.h189
-rw-r--r--contrib/opie/opie_cfg.h13
-rw-r--r--contrib/opie/opieaccess.511
-rw-r--r--contrib/opie/opieftpd.c50
-rw-r--r--contrib/opie/opieinfo.19
-rw-r--r--contrib/opie/opieinfo.c38
-rw-r--r--contrib/opie/opiekey.111
-rw-r--r--contrib/opie/opiekey.c38
-rw-r--r--contrib/opie/opiekeys.59
-rw-r--r--contrib/opie/opiepasswd.112
-rw-r--r--contrib/opie/opiepasswd.c30
-rw-r--r--contrib/opie/options.h85
40 files changed, 390 insertions, 2611 deletions
diff --git a/contrib/opie/config.h b/contrib/opie/config.h
deleted file mode 100644
index 0f6fd1c..0000000
--- a/contrib/opie/config.h
+++ /dev/null
@@ -1,379 +0,0 @@
-/* config.h. Generated automatically by configure. */
-/* config.h.in. Generated automatically from configure.in by autoheader. */
-
-/* Define if on AIX 3.
- System headers sometimes define this.
- We just want to avoid a redefinition error message. */
-#ifndef _ALL_SOURCE
-/* #undef _ALL_SOURCE */
-#endif
-
-/* Define if using alloca.c. */
-/* #undef C_ALLOCA */
-
-/* Define to empty if the keyword does not work. */
-/* #undef const */
-
-/* Define to one of _getb67, GETB67, getb67 for Cray-2 and Cray-YMP systems.
- This function is required for alloca.c support on those systems. */
-/* #undef CRAY_STACKSEG_END */
-
-/* Define if you have alloca, as a function or macro. */
-#define HAVE_ALLOCA 1
-
-/* Define if you have <alloca.h> and it should be used (not on Ultrix). */
-/* #undef HAVE_ALLOCA_H */
-
-/* Define if you have <sys/wait.h> that is POSIX.1 compatible. */
-#define HAVE_SYS_WAIT_H 1
-
-/* Define if on MINIX. */
-/* #undef _MINIX */
-
-/* Define if the system does not provide POSIX.1 features except
- with this defined. */
-/* #undef _POSIX_1_SOURCE */
-
-/* Define if you need to in order for stat and other things to work. */
-/* #undef _POSIX_SOURCE */
-
-/* Define as the return type of signal handlers (int or void). */
-#define RETSIGTYPE void
-
-/* If using the C implementation of alloca, define if you know the
- direction of stack growth for your system; otherwise it will be
- automatically deduced at run-time.
- STACK_DIRECTION > 0 => grows toward higher addresses
- STACK_DIRECTION < 0 => grows toward lower addresses
- STACK_DIRECTION = 0 => direction of growth unknown
- */
-/* #undef STACK_DIRECTION */
-
-/* Define if you want the FTP daemon to support anonymous logins. */
-/* #undef DOANONYMOUS */
-
-/* The default value of the PATH environment variable */
-#define DEFAULT_PATH "/usr/bin:/bin:/usr/sbin:/sbin:/usr/X11R6/bin"
-
-/* Defined if the file /etc/default/login exists
- (and, presumably, should be looked at by login) */
-/* #undef HAVE_ETC_DEFAULT_LOGIN */
-
-/* Defined to the name of a file that contains a list of files whose
- permissions and ownerships should be changed on login. */
-/* #undef HAVE_LOGIN_PERMFILE */
-
-/* Defined to the name of a file that contains a list of environment
- values that should be set on login. */
-/* #undef HAVE_LOGIN_ENVFILE */
-
-/* Defined if the file /etc/securetty exists
- (and, presumably, should be looked at by login) */
-/* #undef HAVE_SECURETTY */
-
-/* Defined if the file /etc/shadow exists
- (and, presumably, should be looked at for shadow passwords) */
-/* #undef HAVE_ETC_SHADOW */
-
-/* The path to the access file, if we're going to use it */
-/* #undef PATH_ACCESS_FILE */
-
-/* The path to the mail spool, if we know it */
-#define PATH_MAIL "/var/mail"
-
-/* The path to the utmp file, if we know it */
-#define PATH_UTMP_AC "/var/run/utmp"
-
-/* The path to the wtmp file, if we know it */
-#define PATH_WTMP_AC "/var/log/wtmp"
-
-/* The path to the wtmpx file, if we know it */
-/* #undef PATH_WTMPX_AC */
-
-/* Defined if the system's profile (/etc/profile) displays
- the motd file */
-/* #undef HAVE_MOTD_IN_PROFILE */
-
-/* Defined if the system's profile (/etc/profile) informs the
- user of new mail */
-/* #undef HAVE_MAILCHECK_IN_PROFILE */
-
-/* Define if you have a nonstandard gettimeofday() that takes one argument
- instead of two. */
-/* #undef HAVE_ONE_ARG_GETTIMEOFDAY */
-
-/* Define if the system has the getenv function */
-#define HAVE_GETENV 1
-
-/* Define if the system has the setenv function */
-#define HAVE_SETENV 1
-
-/* Define if the system has the /var/adm/sulog file */
-/* #undef HAVE_SULOG */
-
-/* Define if the system has the unsetenv function */
-#define HAVE_UNSETENV 1
-
-/* Define if the compiler can handle ANSI-style argument lists */
-#define HAVE_ANSIDECL 1
-
-/* Define if the compiler can handle ANSI-style prototypes */
-#define HAVE_ANSIPROTO 1
-
-/* Define if the system has an ANSI-style printf (returns int instead of char *) */
-#define HAVE_ANSISPRINTF 1
-
-/* Define if the compiler can handle ANSI-style variable argument lists */
-#define HAVE_ANSISTDARG 1
-
-/* Define if the compiler can handle void argument lists to functions */
-#define HAVE_VOIDARG 1
-
-/* Define if the compiler can handle void return "values" from functions */
-#define HAVE_VOIDRET 1
-
-/* Define if the compiler can handle void pointers to our liking */
-#define HAVE_VOIDPTR 1
-
-/* Define if the /bin/ls command seems to support the -g flag */
-/* #undef HAVE_LS_G_FLAG */
-
-/* Define if there is a ut_pid field in struct utmp */
-/* #undef HAVE_UT_PID */
-
-/* Define if there is a ut_type field in struct utmp */
-/* #undef HAVE_UT_TYPE */
-
-/* Define if there is a ut_name field in struct utmp */
-#define HAVE_UT_NAME 1
-
-/* Define if there is a ut_host field in struct utmp */
-#define HAVE_UT_HOST 1
-
-/* Define if the system has getutline() */
-/* #undef HAVE_GETUTLINE */
-
-/* Defined if the system has SunOS C2 security shadow passwords */
-/* #undef HAVE_SUNOS_C2_SHADOW */
-
-/* Defined if you want to disable utmp support */
-/* #undef DISABLE_UTMP */
-
-/* Defined if you want to allow users to override the insecure checks */
-/* #undef INSECURE_OVERRIDE */
-
-/* Defined to the default hash value, always defined */
-#define MDX 5
-
-/* Defined if new-style prompts are to be used */
-#define NEW_PROMPTS 1
-
-/* Defined to the path of the OPIE lock directory */
-#define OPIE_LOCK_DIR "/etc/opielocks"
-
-/* Defined if users are to be asked to re-type secret pass phrases */
-/* #undef RETYPE */
-
-/* Defined if su should not switch to disabled accounts */
-/* #undef SU_STAR_CHECK */
-
-/* Defined if user locking is to be used */
-#define USER_LOCKING 1
-
-/* Define if you have the bcopy function. */
-/* #undef HAVE_BCOPY */
-
-/* Define if you have the bzero function. */
-/* #undef HAVE_BZERO */
-
-/* Define if you have the endspent function. */
-/* #undef HAVE_ENDSPENT */
-
-/* Define if you have the fpurge function. */
-#define HAVE_FPURGE 1
-
-/* Define if you have the getdtablesize function. */
-/* #undef HAVE_GETDTABLESIZE */
-
-/* Define if you have the getgroups function. */
-#define HAVE_GETGROUPS 1
-
-/* Define if you have the gethostname function. */
-/* #undef HAVE_GETHOSTNAME */
-
-/* Define if you have the getspnam function. */
-/* #undef HAVE_GETSPNAM */
-
-/* Define if you have the gettimeofday function. */
-#define HAVE_GETTIMEOFDAY 1
-
-/* Define if you have the getttynam function. */
-#define HAVE_GETTTYNAM 1
-
-/* Define if you have the getusershell function. */
-#define HAVE_GETUSERSHELL 1
-
-/* Define if you have the getutxline function. */
-/* #undef HAVE_GETUTXLINE */
-
-/* Define if you have the getwd function. */
-/* #undef HAVE_GETWD */
-
-/* Define if you have the index function. */
-/* #undef HAVE_INDEX */
-
-/* Define if you have the lstat function. */
-#define HAVE_LSTAT 1
-
-/* Define if you have the on_exit function. */
-/* #undef HAVE_ON_EXIT */
-
-/* Define if you have the pututxline function. */
-/* #undef HAVE_PUTUTXLINE */
-
-/* Define if you have the rindex function. */
-/* #undef HAVE_RINDEX */
-
-/* Define if you have the setgroups function. */
-#define HAVE_SETGROUPS 1
-
-/* Define if you have the setlogin function. */
-#define HAVE_SETLOGIN 1
-
-/* Define if you have the setpriority function. */
-#define HAVE_SETPRIORITY 1
-
-/* Define if you have the setregid function. */
-/* #undef HAVE_SETREGID */
-
-/* Define if you have the setresgid function. */
-/* #undef HAVE_SETRESGID */
-
-/* Define if you have the setresuid function. */
-/* #undef HAVE_SETRESUID */
-
-/* Define if you have the setreuid function. */
-/* #undef HAVE_SETREUID */
-
-/* Define if you have the setvbuf function. */
-#define HAVE_SETVBUF 1
-
-/* Define if you have the sigaddset function. */
-#define HAVE_SIGADDSET 1
-
-/* Define if you have the sigblock function. */
-/* #undef HAVE_SIGBLOCK */
-
-/* Define if you have the sigemptyset function. */
-#define HAVE_SIGEMPTYSET 1
-
-/* Define if you have the sigsetmask function. */
-/* #undef HAVE_SIGSETMASK */
-
-/* Define if you have the socket function. */
-#define HAVE_SOCKET 1
-
-/* Define if you have the strerror function. */
-#define HAVE_STRERROR 1
-
-/* Define if you have the strftime function. */
-#define HAVE_STRFTIME 1
-
-/* Define if you have the strncasecmp function. */
-#define HAVE_STRNCASECMP 1
-
-/* Define if you have the strstr function. */
-#define HAVE_STRSTR 1
-
-/* Define if you have the ttyslot function. */
-#define HAVE_TTYSLOT 1
-
-/* Define if you have the usleep function. */
-#define HAVE_USLEEP 1
-
-/* Define if you have the <crypt.h> header file. */
-/* #undef HAVE_CRYPT_H */
-
-/* Define if you have the <dirent.h> header file. */
-#define HAVE_DIRENT_H 1
-
-/* Define if you have the <fcntl.h> header file. */
-#define HAVE_FCNTL_H 1
-
-/* Define if you have the <lastlog.h> header file. */
-/* #undef HAVE_LASTLOG_H */
-
-/* Define if you have the <limits.h> header file. */
-#define HAVE_LIMITS_H 1
-
-/* Define if you have the <ndir.h> header file. */
-/* #undef HAVE_NDIR_H */
-
-/* Define if you have the <paths.h> header file. */
-#define HAVE_PATHS_H 1
-
-/* Define if you have the <pwd.h> header file. */
-#define HAVE_PWD_H 1
-
-/* Define if you have the <shadow.h> header file. */
-/* #undef HAVE_SHADOW_H */
-
-/* Define if you have the <signal.h> header file. */
-#define HAVE_SIGNAL_H 1
-
-/* Define if you have the <stdlib.h> header file. */
-#define HAVE_STDLIB_H 1
-
-/* Define if you have the <string.h> header file. */
-#define HAVE_STRING_H 1
-
-/* Define if you have the <sys/dir.h> header file. */
-/* #undef HAVE_SYS_DIR_H */
-
-/* Define if you have the <sys/file.h> header file. */
-#define HAVE_SYS_FILE_H 1
-
-/* Define if you have the <sys/ioctl.h> header file. */
-#define HAVE_SYS_IOCTL_H 1
-
-/* Define if you have the <sys/ndir.h> header file. */
-/* #undef HAVE_SYS_NDIR_H */
-
-/* Define if you have the <sys/param.h> header file. */
-#define HAVE_SYS_PARAM_H 1
-
-/* Define if you have the <sys/select.h> header file. */
-#define HAVE_SYS_SELECT_H 1
-
-/* Define if you have the <sys/signal.h> header file. */
-#define HAVE_SYS_SIGNAL_H 1
-
-/* Define if you have the <sys/time.h> header file. */
-#define HAVE_SYS_TIME_H 1
-
-/* Define if you have the <sys/utsname.h> header file. */
-#define HAVE_SYS_UTSNAME_H 1
-
-/* Define if you have the <syslog.h> header file. */
-#define HAVE_SYSLOG_H 1
-
-/* Define if you have the <termios.h> header file. */
-#define HAVE_TERMIOS_H 1
-
-/* Define if you have the <unistd.h> header file. */
-#define HAVE_UNISTD_H 1
-
-/* Define if you have the <utmpx.h> header file. */
-/* #undef HAVE_UTMPX_H */
-
-/* Define if you have the crypt library (-lcrypt). */
-#define HAVE_LIBCRYPT 1
-
-/* Define if you have the nsl library (-lnsl). */
-/* #undef HAVE_LIBNSL */
-
-/* Define if you have the posix library (-lposix). */
-/* #undef HAVE_LIBPOSIX */
-
-/* Define if you have the socket library (-lsocket). */
-/* #undef HAVE_LIBSOCKET */
diff --git a/contrib/opie/ftpcmd.y b/contrib/opie/ftpcmd.y
index 5567c4a..ea5bb36 100644
--- a/contrib/opie/ftpcmd.y
+++ b/contrib/opie/ftpcmd.y
@@ -1,7 +1,7 @@
/* ftpcmd.y: yacc parser for the FTP daemon.
%%% portions-copyright-cmetz-96
-Portions of this software are Copyright 1996-1999 by Craig Metz, All Rights
+Portions of this software are Copyright 1996-1998 by Craig Metz, All Rights
Reserved. The Inner Net License Version 2 applies to these portions of
the software.
You should have received a copy of the license with this software. If
@@ -9,7 +9,6 @@ you didn't get a copy, you may request one from <license@inner.net>.
History:
- Modified by cmetz for OPIE 2.4. Use DOTITLE rather than SETPROCTITLE.
Modified by cmetz for OPIE 2.3. Moved LS_COMMAND here.
Modified by cmetz for OPIE 2.2. Fixed a *lot* of warnings.
Use FUNCTION declaration et al. Removed useless strings.
@@ -22,6 +21,8 @@ you didn't get a copy, you may request one from <license@inner.net>.
PORT attack fixes from Hobbit.
Modified at NRL for OPIE 2.0.
Originally from BSD.
+
+$FreeBSD$
*/
/*
* Copyright (c) 1985, 1988 Regents of the University of California.
@@ -566,8 +567,8 @@ cmd: USER SP username CRLF
struct tm *gmtime();
t = gmtime(&stbuf.st_mtime);
reply(213,
- "19%02d%02d%02d%02d%02d%02d",
- t->tm_year, t->tm_mon+1, t->tm_mday,
+ "%d%02d%02d%02d%02d%02d",
+ t->tm_year+1900, t->tm_mon+1, t->tm_mday,
t->tm_hour, t->tm_min, t->tm_sec);
}
}
@@ -963,10 +964,10 @@ int yylex FUNCTION_NOARGS
dologout(0);
}
(void) alarm(0);
-#if DOTITLE
+#ifdef SETPROCTITLE
if (strncasecmp(cbuf, "PASS", 4) != NULL)
setproctitle("%s: %s", proctitle, cbuf);
-#endif /* DOTITLE */
+#endif /* SETPROCTITLE */
if ((cp = strchr(cbuf, '\r'))) {
*cp++ = '\n';
*cp = '\0';
diff --git a/contrib/opie/libmissing/alloca.c b/contrib/opie/libmissing/alloca.c
deleted file mode 100644
index 61f2eeb..0000000
--- a/contrib/opie/libmissing/alloca.c
+++ /dev/null
@@ -1,494 +0,0 @@
-/* alloca.c -- allocate automatically reclaimed memory
- (Mostly) portable public-domain implementation -- D A Gwyn
-
- This implementation of the PWB library alloca function,
- which is used to allocate space off the run-time stack so
- that it is automatically reclaimed upon procedure exit,
- was inspired by discussions with J. Q. Johnson of Cornell.
- J.Otto Tennant <jot@cray.com> contributed the Cray support.
-
- There are some preprocessor constants that can
- be defined when compiling for your specific system, for
- improved efficiency; however, the defaults should be okay.
-
- The general concept of this implementation is to keep
- track of all alloca-allocated blocks, and reclaim any
- that are found to be deeper in the stack than the current
- invocation. This heuristic does not reclaim storage as
- soon as it becomes invalid, but it will do so eventually.
-
- As a special case, alloca(0) reclaims storage without
- allocating any. It is a good idea to use alloca(0) in
- your main control loop, etc. to force garbage collection. */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#ifdef emacs
-#include "blockinput.h"
-#endif
-
-/* If compiling with GCC 2, this file's not needed. */
-#if !defined (__GNUC__) || __GNUC__ < 2
-
-/* If someone has defined alloca as a macro,
- there must be some other way alloca is supposed to work. */
-#ifndef alloca
-
-#ifdef emacs
-#ifdef static
-/* actually, only want this if static is defined as ""
- -- this is for usg, in which emacs must undefine static
- in order to make unexec workable
- */
-#ifndef STACK_DIRECTION
-you
-lose
--- must know STACK_DIRECTION at compile-time
-#endif /* STACK_DIRECTION undefined */
-#endif /* static */
-#endif /* emacs */
-
-/* If your stack is a linked list of frames, you have to
- provide an "address metric" ADDRESS_FUNCTION macro. */
-
-#if defined (CRAY) && defined (CRAY_STACKSEG_END)
-long i00afunc ();
-#define ADDRESS_FUNCTION(arg) (char *) i00afunc (&(arg))
-#else
-#define ADDRESS_FUNCTION(arg) &(arg)
-#endif
-
-#if __STDC__
-typedef void *pointer;
-#else
-typedef char *pointer;
-#endif
-
-#define NULL 0
-
-/* Different portions of Emacs need to call different versions of
- malloc. The Emacs executable needs alloca to call xmalloc, because
- ordinary malloc isn't protected from input signals. On the other
- hand, the utilities in lib-src need alloca to call malloc; some of
- them are very simple, and don't have an xmalloc routine.
-
- Non-Emacs programs expect this to call use xmalloc.
-
- Callers below should use malloc. */
-
-#if 0
-#ifndef emacs
-#define malloc xmalloc
-#endif
-extern pointer malloc ();
-#endif /* 0 */
-
-/* Define STACK_DIRECTION if you know the direction of stack
- growth for your system; otherwise it will be automatically
- deduced at run-time.
-
- STACK_DIRECTION > 0 => grows toward higher addresses
- STACK_DIRECTION < 0 => grows toward lower addresses
- STACK_DIRECTION = 0 => direction of growth unknown */
-
-#ifndef STACK_DIRECTION
-#define STACK_DIRECTION 0 /* Direction unknown. */
-#endif
-
-#if STACK_DIRECTION != 0
-
-#define STACK_DIR STACK_DIRECTION /* Known at compile-time. */
-
-#else /* STACK_DIRECTION == 0; need run-time code. */
-
-static int stack_dir; /* 1 or -1 once known. */
-#define STACK_DIR stack_dir
-
-static void
-find_stack_direction ()
-{
- static char *addr = NULL; /* Address of first `dummy', once known. */
- auto char dummy; /* To get stack address. */
-
- if (addr == NULL)
- { /* Initial entry. */
- addr = ADDRESS_FUNCTION (dummy);
-
- find_stack_direction (); /* Recurse once. */
- }
- else
- {
- /* Second entry. */
- if (ADDRESS_FUNCTION (dummy) > addr)
- stack_dir = 1; /* Stack grew upward. */
- else
- stack_dir = -1; /* Stack grew downward. */
- }
-}
-
-#endif /* STACK_DIRECTION == 0 */
-
-/* An "alloca header" is used to:
- (a) chain together all alloca'ed blocks;
- (b) keep track of stack depth.
-
- It is very important that sizeof(header) agree with malloc
- alignment chunk size. The following default should work okay. */
-
-#ifndef ALIGN_SIZE
-#define ALIGN_SIZE sizeof(double)
-#endif
-
-typedef union hdr
-{
- char align[ALIGN_SIZE]; /* To force sizeof(header). */
- struct
- {
- union hdr *next; /* For chaining headers. */
- char *deep; /* For stack depth measure. */
- } h;
-} header;
-
-static header *last_alloca_header = NULL; /* -> last alloca header. */
-
-/* Return a pointer to at least SIZE bytes of storage,
- which will be automatically reclaimed upon exit from
- the procedure that called alloca. Originally, this space
- was supposed to be taken from the current stack frame of the
- caller, but that method cannot be made to work for some
- implementations of C, for example under Gould's UTX/32. */
-
-pointer
-alloca (size)
- unsigned size;
-{
- auto char probe; /* Probes stack depth: */
- register char *depth = ADDRESS_FUNCTION (probe);
-
-#if STACK_DIRECTION == 0
- if (STACK_DIR == 0) /* Unknown growth direction. */
- find_stack_direction ();
-#endif
-
- /* Reclaim garbage, defined as all alloca'd storage that
- was allocated from deeper in the stack than currently. */
-
- {
- register header *hp; /* Traverses linked list. */
-
-#ifdef emacs
- BLOCK_INPUT;
-#endif
-
- for (hp = last_alloca_header; hp != NULL;)
- if ((STACK_DIR > 0 && hp->h.deep > depth)
- || (STACK_DIR < 0 && hp->h.deep < depth))
- {
- register header *np = hp->h.next;
-
- free ((pointer) hp); /* Collect garbage. */
-
- hp = np; /* -> next header. */
- }
- else
- break; /* Rest are not deeper. */
-
- last_alloca_header = hp; /* -> last valid storage. */
-
-#ifdef emacs
- UNBLOCK_INPUT;
-#endif
- }
-
- if (size == 0)
- return NULL; /* No allocation required. */
-
- /* Allocate combined header + user data storage. */
-
- {
- register pointer new = malloc (sizeof (header) + size);
- /* Address of header. */
-
- ((header *) new)->h.next = last_alloca_header;
- ((header *) new)->h.deep = depth;
-
- last_alloca_header = (header *) new;
-
- /* User storage begins just after header. */
-
- return (pointer) ((char *) new + sizeof (header));
- }
-}
-
-#if defined (CRAY) && defined (CRAY_STACKSEG_END)
-
-#ifdef DEBUG_I00AFUNC
-#include <stdio.h>
-#endif
-
-#ifndef CRAY_STACK
-#define CRAY_STACK
-#ifndef CRAY2
-/* Stack structures for CRAY-1, CRAY X-MP, and CRAY Y-MP */
-struct stack_control_header
- {
- long shgrow:32; /* Number of times stack has grown. */
- long shaseg:32; /* Size of increments to stack. */
- long shhwm:32; /* High water mark of stack. */
- long shsize:32; /* Current size of stack (all segments). */
- };
-
-/* The stack segment linkage control information occurs at
- the high-address end of a stack segment. (The stack
- grows from low addresses to high addresses.) The initial
- part of the stack segment linkage control information is
- 0200 (octal) words. This provides for register storage
- for the routine which overflows the stack. */
-
-struct stack_segment_linkage
- {
- long ss[0200]; /* 0200 overflow words. */
- long sssize:32; /* Number of words in this segment. */
- long ssbase:32; /* Offset to stack base. */
- long:32;
- long sspseg:32; /* Offset to linkage control of previous
- segment of stack. */
- long:32;
- long sstcpt:32; /* Pointer to task common address block. */
- long sscsnm; /* Private control structure number for
- microtasking. */
- long ssusr1; /* Reserved for user. */
- long ssusr2; /* Reserved for user. */
- long sstpid; /* Process ID for pid based multi-tasking. */
- long ssgvup; /* Pointer to multitasking thread giveup. */
- long sscray[7]; /* Reserved for Cray Research. */
- long ssa0;
- long ssa1;
- long ssa2;
- long ssa3;
- long ssa4;
- long ssa5;
- long ssa6;
- long ssa7;
- long sss0;
- long sss1;
- long sss2;
- long sss3;
- long sss4;
- long sss5;
- long sss6;
- long sss7;
- };
-
-#else /* CRAY2 */
-/* The following structure defines the vector of words
- returned by the STKSTAT library routine. */
-struct stk_stat
- {
- long now; /* Current total stack size. */
- long maxc; /* Amount of contiguous space which would
- be required to satisfy the maximum
- stack demand to date. */
- long high_water; /* Stack high-water mark. */
- long overflows; /* Number of stack overflow ($STKOFEN) calls. */
- long hits; /* Number of internal buffer hits. */
- long extends; /* Number of block extensions. */
- long stko_mallocs; /* Block allocations by $STKOFEN. */
- long underflows; /* Number of stack underflow calls ($STKRETN). */
- long stko_free; /* Number of deallocations by $STKRETN. */
- long stkm_free; /* Number of deallocations by $STKMRET. */
- long segments; /* Current number of stack segments. */
- long maxs; /* Maximum number of stack segments so far. */
- long pad_size; /* Stack pad size. */
- long current_address; /* Current stack segment address. */
- long current_size; /* Current stack segment size. This
- number is actually corrupted by STKSTAT to
- include the fifteen word trailer area. */
- long initial_address; /* Address of initial segment. */
- long initial_size; /* Size of initial segment. */
- };
-
-/* The following structure describes the data structure which trails
- any stack segment. I think that the description in 'asdef' is
- out of date. I only describe the parts that I am sure about. */
-
-struct stk_trailer
- {
- long this_address; /* Address of this block. */
- long this_size; /* Size of this block (does not include
- this trailer). */
- long unknown2;
- long unknown3;
- long link; /* Address of trailer block of previous
- segment. */
- long unknown5;
- long unknown6;
- long unknown7;
- long unknown8;
- long unknown9;
- long unknown10;
- long unknown11;
- long unknown12;
- long unknown13;
- long unknown14;
- };
-
-#endif /* CRAY2 */
-#endif /* not CRAY_STACK */
-
-#ifdef CRAY2
-/* Determine a "stack measure" for an arbitrary ADDRESS.
- I doubt that "lint" will like this much. */
-
-static long
-i00afunc (long *address)
-{
- struct stk_stat status;
- struct stk_trailer *trailer;
- long *block, size;
- long result = 0;
-
- /* We want to iterate through all of the segments. The first
- step is to get the stack status structure. We could do this
- more quickly and more directly, perhaps, by referencing the
- $LM00 common block, but I know that this works. */
-
- STKSTAT (&status);
-
- /* Set up the iteration. */
-
- trailer = (struct stk_trailer *) (status.current_address
- + status.current_size
- - 15);
-
- /* There must be at least one stack segment. Therefore it is
- a fatal error if "trailer" is null. */
-
- if (trailer == 0)
- abort ();
-
- /* Discard segments that do not contain our argument address. */
-
- while (trailer != 0)
- {
- block = (long *) trailer->this_address;
- size = trailer->this_size;
- if (block == 0 || size == 0)
- abort ();
- trailer = (struct stk_trailer *) trailer->link;
- if ((block <= address) && (address < (block + size)))
- break;
- }
-
- /* Set the result to the offset in this segment and add the sizes
- of all predecessor segments. */
-
- result = address - block;
-
- if (trailer == 0)
- {
- return result;
- }
-
- do
- {
- if (trailer->this_size <= 0)
- abort ();
- result += trailer->this_size;
- trailer = (struct stk_trailer *) trailer->link;
- }
- while (trailer != 0);
-
- /* We are done. Note that if you present a bogus address (one
- not in any segment), you will get a different number back, formed
- from subtracting the address of the first block. This is probably
- not what you want. */
-
- return (result);
-}
-
-#else /* not CRAY2 */
-/* Stack address function for a CRAY-1, CRAY X-MP, or CRAY Y-MP.
- Determine the number of the cell within the stack,
- given the address of the cell. The purpose of this
- routine is to linearize, in some sense, stack addresses
- for alloca. */
-
-static long
-i00afunc (long address)
-{
- long stkl = 0;
-
- long size, pseg, this_segment, stack;
- long result = 0;
-
- struct stack_segment_linkage *ssptr;
-
- /* Register B67 contains the address of the end of the
- current stack segment. If you (as a subprogram) store
- your registers on the stack and find that you are past
- the contents of B67, you have overflowed the segment.
-
- B67 also points to the stack segment linkage control
- area, which is what we are really interested in. */
-
- stkl = CRAY_STACKSEG_END ();
- ssptr = (struct stack_segment_linkage *) stkl;
-
- /* If one subtracts 'size' from the end of the segment,
- one has the address of the first word of the segment.
-
- If this is not the first segment, 'pseg' will be
- nonzero. */
-
- pseg = ssptr->sspseg;
- size = ssptr->sssize;
-
- this_segment = stkl - size;
-
- /* It is possible that calling this routine itself caused
- a stack overflow. Discard stack segments which do not
- contain the target address. */
-
- while (!(this_segment <= address && address <= stkl))
- {
-#ifdef DEBUG_I00AFUNC
- fprintf (stderr, "%011o %011o %011o\n", this_segment, address, stkl);
-#endif
- if (pseg == 0)
- break;
- stkl = stkl - pseg;
- ssptr = (struct stack_segment_linkage *) stkl;
- size = ssptr->sssize;
- pseg = ssptr->sspseg;
- this_segment = stkl - size;
- }
-
- result = address - this_segment;
-
- /* If you subtract pseg from the current end of the stack,
- you get the address of the previous stack segment's end.
- This seems a little convoluted to me, but I'll bet you save
- a cycle somewhere. */
-
- while (pseg != 0)
- {
-#ifdef DEBUG_I00AFUNC
- fprintf (stderr, "%011o %011o\n", pseg, size);
-#endif
- stkl = stkl - pseg;
- ssptr = (struct stack_segment_linkage *) stkl;
- size = ssptr->sssize;
- pseg = ssptr->sspseg;
- result += size;
- }
- return (result);
-}
-
-#endif /* not CRAY2 */
-#endif /* CRAY */
-
-#endif /* no alloca */
-#endif /* not GCC version 2 */
diff --git a/contrib/opie/libmissing/env.c b/contrib/opie/libmissing/env.c
deleted file mode 100644
index 9a445a0..0000000
--- a/contrib/opie/libmissing/env.c
+++ /dev/null
@@ -1,141 +0,0 @@
-/* env.c: Replacement environment handling functions.
-
-%%% portions-copyright-cmetz
-Portions of this software are Copyright 1996 by Craig Metz, All Rights
-Reserved. The Inner Net License Version 2 applies to these portions of
-the software.
-You should have received a copy of the license with this software. If
-you didn't get a copy, you may request one from <license@inner.net>.
-
-Portions of this software are Copyright 1995 by Randall Atkinson and Dan
-McDonald, All Rights Reserved. All Rights under this copyright are assigned
-to the U.S. Naval Research Laboratory (NRL). The NRL Copyright Notice and
-License Agreement applies to this software.
-
- History:
-
- Modified by cmetz for OPIE 2.2. Changed ifdefs for libmissing.
- Combined all env functions and made _findenv static.
- Including headers is a good idea, though. Add more headers.
- Modified at NRL for OPIE 2.0.
- Originally from BSD.
-*/
-/*
- * Copyright (c) 1987 Regents of the University of California.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms are permitted
- * provided that the above copyright notice and this paragraph are
- * duplicated in all such forms and that any documentation,
- * advertising materials, and other materials related to such
- * distribution and use acknowledge that the software was developed
- * by the University of California, Berkeley. The name of the
- * University may not be used to endorse or promote products derived
- * from this software without specific prior written permission.
- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
- * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
- */
-
-#include "opie_cfg.h"
-#include <stdio.h>
-#if HAVE_UNISTD_H
-#include <unistd.h>
-#endif /* HAVE_UNISTD_H */
-#if HAVE_STDLIB_H
-#include <stdlib.h>
-#endif /* HAVE_STDLIB_H */
-#include "opie.h"
-
-static char *_findenv FUNCTION((name, offset), register char *name AND int *offset)
-{
- extern char **environ;
- register int len;
- register char **P, *C;
-
- for (C = name, len = 0; *C && *C != '='; ++C, ++len);
- for (P = environ; *P; ++P)
- if (!strncmp(*P, name, len))
- if (*(C = *P + len) == '=') {
- *offset = P - environ;
- return (++C);
- }
- return (NULL);
-}
-
-#if !HAVE_GETENV
-char *getenv FUNCTION((name), char *name)
-{
- int offset;
- char *_findenv();
-
- return (_findenv(name, &offset));
-}
-#endif /* !HAVE_GETENV */
-
-#if !HAVE_SETENV
-int setenv FUNCTION((name, value, rewrite), char *name AND char *value AND int rewrite)
-{
- extern char **environ;
- static int alloced; /* if allocated space before */
- register char *C;
- int l_value, offset;
-
- if (*value == '=') /* no `=' in value */
- ++value;
- l_value = strlen(value);
- if ((C = _findenv(name, &offset))) { /* find if already exists */
- if (!rewrite)
- return (0);
- if (strlen(C) >= l_value) { /* old larger; copy over */
- while (*C++ = *value++);
- return (0);
- }
- } else { /* create new slot */
- register int cnt;
- register char **P;
-
- for (P = environ, cnt = 0; *P; ++P, ++cnt);
- if (alloced) { /* just increase size */
- environ = (char **) realloc((char *) environ,
- (u_int) (sizeof(char *) * (cnt + 2)));
-
- if (!environ)
- return (-1);
- } else { /* get new space */
- alloced = 1; /* copy old entries into it */
- P = (char **) malloc((u_int) (sizeof(char *) *
- (cnt + 2)));
-
- if (!P)
- return (-1);
- strncpy(P, environ, cnt * sizeof(char *));
-
- environ = P;
- }
- environ[cnt + 1] = NULL;
- offset = cnt;
- }
- for (C = name; *C && *C != '='; ++C); /* no `=' in name */
- if (!(environ[offset] = /* name + `=' + value */
- malloc((u_int) ((int) (C - name) + l_value + 2))))
- return (-1);
- for (C = environ[offset]; (*C = *name++) && *C != '='; ++C);
- for (*C++ = '='; *C++ = *value++;);
- return (0);
-}
-#endif /* !HAVE_SETENV */
-
-#if !HAVE_UNSETENV
-VOIDRET unsetenv FUNCTION((name), char *name)
-{
- extern char **environ;
- register char **P;
- int offset;
-
- while (_findenv(name, &offset)) /* if set multiple times */
- for (P = &environ[offset];; ++P)
- if (!(*P = *(P + 1)))
- break;
-}
-#endif /* !HAVE_UNSETENV */
diff --git a/contrib/opie/libmissing/getcwd.c b/contrib/opie/libmissing/getcwd.c
deleted file mode 100644
index 30ccdc0..0000000
--- a/contrib/opie/libmissing/getcwd.c
+++ /dev/null
@@ -1,23 +0,0 @@
-/* getcwd.c: A replacement for the getcwd function
-
-%%% copyright-cmetz
-This software is Copyright 1996 by Craig Metz, All Rights Reserved.
-The Inner Net License Version 2 applies to this software.
-You should have received a copy of the license with this software. If
-you didn't get a copy, you may request one from <license@inner.net>.
-
- History:
-
- Created by cmetz for OPIE 2.3.
-*/
-#include "opie_cfg.h"
-#include "opie.h"
-
-char *getcwd FUNCTION((c, l), char *c AND int l)
-{
-#if HAVE_GETWD
- return getwd(c);
-#else /* HAVE_INDEX */
-#error Need getwd() to build a replacement getcwd()
-#endif /* HAVE_INDEX */
-}
diff --git a/contrib/opie/libmissing/getusershell.c b/contrib/opie/libmissing/getusershell.c
deleted file mode 100644
index 885aa04..0000000
--- a/contrib/opie/libmissing/getusershell.c
+++ /dev/null
@@ -1,67 +0,0 @@
-/* getusershell.c: minimal implementation of the getusershell() and
- endusershell() library routines for systems that don't have them.
-
-%%% portions-copyright-cmetz
-Portions of this software are Copyright 1996 by Craig Metz, All Rights
-Reserved. The Inner Net License Version 2 applies to these portions of
-the software.
-You should have received a copy of the license with this software. If
-you didn't get a copy, you may request one from <license@inner.net>.
-
-Portions of this software are Copyright 1995 by Randall Atkinson and Dan
-McDonald, All Rights Reserved. All Rights under this copyright are assigned
-to the U.S. Naval Research Laboratory (NRL). The NRL Copyright Notice and
-License Agreement applies to this software.
-
- History:
-
- Modified by cmetz for OPIE 2.2. Use FUNCTION declaration et al.
- Modified at NRL for OPIE 2.1. Remove trailing newlines from
- /etc/shells entries. Fixed infinite loop. Fixed a bug
- where second invocation on would fail.
- Written at NRL for OPIE 2.0.
-*/
-#include "opie_cfg.h"
-#include <stdio.h>
-#if HAVE_STRING_H
-#include <string.h>
-#endif /* HAVE_STRING_H */
-#include "opie.h"
-
-static FILE *fh = NULL;
-static char *internal[] = {"/bin/sh", "/bin/csh", NULL};
-static int i = 0;
-static char buffer[1024];
-
-char *getusershell FUNCTION_NOARGS
-{
- char *c;
-
- if (!fh)
- fh = fopen("/etc/shells", "r");
-
- if (fh) {
- if (fgets(buffer, sizeof(buffer), fh)) {
- if (c = strchr(buffer, '\n'))
- *c = 0;
- return buffer;
- } else {
- fclose(fh);
- return NULL;
- }
- } else {
- if (internal[i])
- return internal[i++];
- else
- return NULL;
- }
-}
-
-VOIDRET endusershell FUNCTION_NOARGS
-{
- if (fh) {
- fclose(fh);
- fh = NULL;
- }
- i = 0;
-}
diff --git a/contrib/opie/libmissing/initgroups.c b/contrib/opie/libmissing/initgroups.c
deleted file mode 100644
index 2306a0c..0000000
--- a/contrib/opie/libmissing/initgroups.c
+++ /dev/null
@@ -1,129 +0,0 @@
-/* initgroups.c: Replacement for the initgroups() function.
-
-%%% portions-copyright-cmetz
-Portions of this software are Copyright 1996 by Craig Metz, All Rights
-Reserved. The Inner Net License Version 2 applies to these portions of
-the software.
-You should have received a copy of the license with this software. If
-you didn't get a copy, you may request one from <license@inner.net>.
-
- History:
-
- Modified by cmetz for OPIE 2.2. Removed useless string.
- Ifdef around headers. Use FUNCTION declarations.
- Not everyone has multiple groups. Work around
- lack of NGROUPS.
- Originally from 4.3BSD Net/2.
-*/
-/*
- * Copyright (c) 1983 Regents of the University of California.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-/*
- * initgroups
- */
-#include "opie_cfg.h"
-
-#if HAVE_SYS_PARAM_H
-#include <sys/param.h>
-#endif /* HAVE_SYS_PARAM_H */
-#include <stdio.h>
-#if HAVE_STRING_H
-#include <string.h>
-#endif /* HAVE_STRING */
-#if HAVE_UNISTD_H
-#include <unistd.h>
-#endif /* HAVE_UNISTD_H */
-#include <grp.h>
-
-#include "opie.h"
-
-struct group *getgrent();
-
-int initgroups FUNCTION((uname, agroup), const char *uname AND int agroup)
-{
-#if HAVE_SETGROUPS && HAVE_GETGROUPS
-#if NGROUPS
- int groups[NGROUPS];
-#else /* NGROUPS */
-#define STARTING_NGROUPS 32
- int groups[STARTING_NGROUPS];
-#endif /* NGROUPS */
- int ngroups;
- register struct group *grp;
- register int i;
-
- /*
- * If installing primary group, duplicate it;
- * the first element of groups is the effective gid
- * and will be overwritten when a setgid file is executed.
- */
- if (agroup >= 0) {
- groups[ngroups++] = agroup;
- groups[ngroups++] = agroup;
- }
- setgrent();
- while (grp = getgrent()) {
- if (grp->gr_gid == agroup)
- continue;
- for (i = 0; grp->gr_mem[i]; i++)
- if (!strcmp(grp->gr_mem[i], uname)) {
-#if NGROUPS
- if (ngroups == NGROUPS) {
-#else /* NGROUPS */
- if (ngroups == STARTING_NGROUPS) {
-#endif /* NGROUPS */
-fprintf(stderr, "initgroups: %s is in too many groups\n", uname);
- goto toomany;
- }
- groups[ngroups++] = grp->gr_gid;
- }
- }
-toomany:
- endgrent();
-#if NGROUPS
- if (setgroups(ngroups, groups) < 0) {
- perror("setgroups");
- return (-1);
- }
-#else /* NGROUPS */
- ngroups++;
- do {
- if ((i = setgroups(--ngroups, groups) < 0) && (i != EINVAL)) {
- perror("setgroups");
- return (-1);
- }
- } while ((i < 0) && (ngroups > 0));
-#endif /* NGROUPS */
-#endif /* HAVE_SETGROUPS && HAVE_GETGROUPS */
- return (0);
-}
diff --git a/contrib/opie/libmissing/memcmp.c b/contrib/opie/libmissing/memcmp.c
deleted file mode 100644
index e19beaf..0000000
--- a/contrib/opie/libmissing/memcmp.c
+++ /dev/null
@@ -1,25 +0,0 @@
-/* strncasecmp.c: A replacement for the strncasecmp function
-
-%%% copyright-cmetz
-This software is Copyright 1996 by Craig Metz, All Rights Reserved.
-The Inner Net License Version 2 applies to this software.
-You should have received a copy of the license with this software. If
-you didn't get a copy, you may request one from <license@inner.net>.
-
- History:
-
- Created by cmetz for OPIE 2.2.
-*/
-#include "opie_cfg.h"
-#include "opie.h"
-
-int memcmp FUNCTION((s1, s2, n), unsigned char *s1 AND unsigned char *s2 AND int n)
-{
- while(n--) {
- if (*s1 != *s2)
- return (*s1 > *s2) ? 1 : -1;
- s1++;
- s2++;
- }
- return 0;
-}
diff --git a/contrib/opie/libmissing/memcpy.c b/contrib/opie/libmissing/memcpy.c
deleted file mode 100644
index 6d386c2..0000000
--- a/contrib/opie/libmissing/memcpy.c
+++ /dev/null
@@ -1,25 +0,0 @@
-/* memcpy.c: A replacement for the memcpy function
-
-%%% copyright-cmetz
-This software is Copyright 1996 by Craig Metz, All Rights Reserved.
-The Inner Net License Version 2 applies to this software.
-You should have received a copy of the license with this software. If
-you didn't get a copy, you may request one from <license@inner.net>.
-
- History:
-
- Created by cmetz for OPIE 2.2.
-*/
-#include "opie_cfg.h"
-#include "opie.h"
-
-VOIDPTR *memcpy FUNCTION((d, s, n), unsigned char *d AND unsigned char *s AND int n)
-{
-#if HAVE_BCOPY
- bcopy(s, d, n);
-#else /* HAVE_BCOPY */
- char *d2 = d;
- while(n--) (*d2++) = (*s++);
-#endif /* HAVE_BCOPY */
- return d;
-}
diff --git a/contrib/opie/libmissing/memset.c b/contrib/opie/libmissing/memset.c
deleted file mode 100644
index 678c441..0000000
--- a/contrib/opie/libmissing/memset.c
+++ /dev/null
@@ -1,21 +0,0 @@
-/* memcpy.c: A replacement for the memcpy function
-
-%%% copyright-cmetz
-This software is Copyright 1996 by Craig Metz, All Rights Reserved.
-The Inner Net License Version 2 applies to this software.
-You should have received a copy of the license with this software. If
-you didn't get a copy, you may request one from <license@inner.net>.
-
- History:
-
- Created by cmetz for OPIE 2.2.
-*/
-#include "opie_cfg.h"
-#include "opie.h"
-
-VOIDPTR *memset FUNCTION((d, v, n), unsigned char *d AND int v AND int n)
-{
- unsigned char *d2 = d;
- while(n--) (*d2++) = (unsigned char)v;
- return d;
-}
diff --git a/contrib/opie/libmissing/sigaddset.c b/contrib/opie/libmissing/sigaddset.c
deleted file mode 100644
index 56a613b..0000000
--- a/contrib/opie/libmissing/sigaddset.c
+++ /dev/null
@@ -1,36 +0,0 @@
-/* sigaddset.c: A replacement for the sigaddset function
-
-%%% copyright-cmetz
-This software is Copyright 1996 by Craig Metz, All Rights Reserved.
-The Inner Net License Version 2 applies to this software.
-You should have received a copy of the license with this software. If
-you didn't get a copy, you may request one from <license@inner.net>.
-
- History:
-
- Created by cmetz for OPIE 2.2.
-*/
-
-#include "opie_cfg.h"
-
-#ifndef _NSIG
-#ifdef NSIG
-#define _NSIG NSIG
-#else /* NSIG */
-#define _NSIG 32
-#endif /* NSIG */
-#endif /* _NSIG */
-
-#include "opie.h"
-
-int sigaddset FUNCTION((set, signum), sigset_t *set AND int signum)
-{
-#if sizeof(sigset_t) != sizeof(int)
-Sorry, we don't currently support your system.
-#else /* sizeof(sigset_t) != sizeof(int) */
- if (set && (signum > 0) && (signum < _NSIG))
- *set |= 1 << (signum - 1);
-#endif /* sizeof(sigset_t) != sizeof(int) */
-
- return 0;
-}
diff --git a/contrib/opie/libmissing/sigemptyset.c b/contrib/opie/libmissing/sigemptyset.c
deleted file mode 100644
index fc083f5..0000000
--- a/contrib/opie/libmissing/sigemptyset.c
+++ /dev/null
@@ -1,23 +0,0 @@
-/* sigemptyset.c: A replacement for the sigemptyset function
-
-%%% copyright-cmetz
-This software is Copyright 1996 by Craig Metz, All Rights Reserved.
-The Inner Net License Version 2 applies to this software.
-You should have received a copy of the license with this software. If
-you didn't get a copy, you may request one from <license@inner.net>.
-
- History:
-
- Created by cmetz for OPIE 2.2.
-*/
-
-#include "opie_cfg.h"
-#include "opie.h"
-
-int sigemptyset FUNCTION((set), sigset_t *set)
-{
- if (set)
- memset(set, 0, sizeof(sigset_t))
-
- return 0;
-}
diff --git a/contrib/opie/libmissing/sigprocmask.c b/contrib/opie/libmissing/sigprocmask.c
deleted file mode 100644
index 4af1559..0000000
--- a/contrib/opie/libmissing/sigprocmask.c
+++ /dev/null
@@ -1,68 +0,0 @@
-/* sigprocmask.c: A replacement for the sigprocmask() function
-
-%%% portions-copyright-cmetz
-Portions of this software are Copyright 1996 by Craig Metz, All Rights
-Reserved. The Inner Net License Version 2 applies to these portions of
-the software.
-You should have received a copy of the license with this software. If
-you didn't get a copy, you may request one from <license@inner.net>.
-
-Portions of this software are Copyright 1995 by Randall Atkinson and Dan
-McDonald, All Rights Reserved. All Rights under this copyright are assigned
-to the U.S. Naval Research Laboratory (NRL). The NRL Copyright Notice and
-License Agreement applies to this software.
-
- History:
-
- Created by cmetz for OPIE 2.2 from popen.c. Use FUNCTION
- declaration et al. Include opie.h.
-*/
-
-#include "opie_cfg.h"
-
-#include <sys/types.h>
-#if HAVE_SIGNAL_H
-#include <signal.h>
-#endif /* HAVE_SIGNAL_H */
-#if HAVE_SYS_SIGNAL_H
-#include <sys/signal.h>
-#endif /* HAVE_SYS_SIGNAL_H */
-
-#if !HAVE_SIGBLOCK || !HAVE_SIGSETMASK
-Without sigblock and sigsetmask, we can't build a replacement sigprocmask.
-#endif /* !HAVE_SIGBLOCK || !HAVE_SIGSETMASK */
-
-#include "opie.h"
-
-#ifndef sigset_t
-#define sigset_t int
-#endif /* sigset_t */
-
-int sigprocmask FUNCTION((how, set, oset), int how AND sigset_t *set AND sigset_t *oset)
-{
- int old, new;
-
- if (set && (set != (sigset_t *)SIG_IGN) && (set != (sigset_t *)SIG_ERR))
- new = *set;
- else
- new = 0;
-
- switch(how) {
- case SIG_BLOCK:
- old = sigblock(new);
- if (oset && (oset != (sigset_t *)SIG_IGN) && (oset != (sigset_t *)SIG_ERR))
- *oset = old;
- return 0;
-
- case SIG_SETMASK:
- old = sigsetmask(new);
- if (oset && (oset != (sigset_t *)SIG_IGN) && (oset != (sigset_t *)SIG_ERR))
- *oset = old;
- return 0;
-
- case SIG_UNBLOCK:
- /* not implemented */
- default:
- return 0;
- }
-}
diff --git a/contrib/opie/libmissing/strchr.c b/contrib/opie/libmissing/strchr.c
deleted file mode 100644
index 2903bc4..0000000
--- a/contrib/opie/libmissing/strchr.c
+++ /dev/null
@@ -1,24 +0,0 @@
-/* strchr.c: A replacement for the strchr function
-
-%%% copyright-cmetz
-This software is Copyright 1996 by Craig Metz, All Rights Reserved.
-The Inner Net License Version 2 applies to this software.
-You should have received a copy of the license with this software. If
-you didn't get a copy, you may request one from <license@inner.net>.
-
- History:
-
- Created by cmetz for OPIE 2.3.
-*/
-#include "opie_cfg.h"
-#include "opie.h"
-
-char *strchr FUNCTION((s, c), char *s AND int c)
-{
-#if HAVE_INDEX
- return index(s, c);
-#else /* HAVE_INDEX */
- while(*s && (*s != c)) s++;
- return *s ? s : (char *)0;
-#endif /* HAVE_INDEX */
-}
diff --git a/contrib/opie/libmissing/strerror.c b/contrib/opie/libmissing/strerror.c
deleted file mode 100644
index 89632f9..0000000
--- a/contrib/opie/libmissing/strerror.c
+++ /dev/null
@@ -1,34 +0,0 @@
-/* strerror.c: A replacement for the strerror function
-
-%%% copyright-cmetz
-This software is Copyright 1996 by Craig Metz, All Rights Reserved.
-The Inner Net License Version 2 applies to this software.
-You should have received a copy of the license with this software. If
-you didn't get a copy, you may request one from <license@inner.net>.
-
- History:
-
- Created by cmetz for OPIE 2.2.
-*/
-
-#include "opie_cfg.h"
-#include "opie.h"
-
-char *strerror FUNCTION((errnum), int errnum)
-{
-#if HAVE_SYS_ERRLIST
- extern char *sys_errlist[];
- return sys_errlist[errnum];
-#else /* NEED_STRERROR */
-#if HAVE__SYS_ERRLIST
- extern char *_sys_errlist[];
- return sys_errlist[errnum];
-#else /* HAVE__SYS_ERRLIST */
- static char hexdigits[] = "0123456789abcdef";
- static char buffer[] = "System error 0x42";
- buffer[15] = hexdigits[(errnum >> 4) & 0x0f];
- buffer[16] = hexdigits[errnum & 0x0f];
- return buffer;
-#endif /* HAVE__SYS_ERRLIST */
-#endif /* NEED_STRERROR */
-}
diff --git a/contrib/opie/libmissing/strncasecmp.c b/contrib/opie/libmissing/strncasecmp.c
deleted file mode 100644
index e90b4c0..0000000
--- a/contrib/opie/libmissing/strncasecmp.c
+++ /dev/null
@@ -1,30 +0,0 @@
-/* strncasecmp.c: A replacement for the strncasecmp function
-
-%%% copyright-cmetz
-This software is Copyright 1996 by Craig Metz, All Rights Reserved.
-The Inner Net License Version 2 applies to this software.
-You should have received a copy of the license with this software. If
-you didn't get a copy, you may request one from <license@inner.net>.
-
- History:
-
- Created by cmetz for OPIE 2.2.
-*/
-#include "opie_cfg.h"
-#include "opie.h"
-
-int strncasecmp FUNCTION((s1, s2, n), unsigned char *s1 AND unsigned char *s2 AND int n)
-{
- unsigned char c1, c2;
- while(*s1 && *s2 && n--) {
- c1 = ((*s1 >= 'A') && (*s1 <= 'Z')) ? (*s1++) + ('a' - 'A') : (*s1++);
- c2 = ((*s2 >= 'A') && (*s2 <= 'Z')) ? (*s2++) + ('a' - 'A') : (*s2++);
- if (c1 != c2)
- return (c1 > c2) ? 1 : -1;
- }
- if (*s1 && !*s2)
- return 1;
- if (!*s1 && *s2)
- return -1;
- return 0;
-}
diff --git a/contrib/opie/libmissing/strrchr.c b/contrib/opie/libmissing/strrchr.c
deleted file mode 100644
index 04d46ce..0000000
--- a/contrib/opie/libmissing/strrchr.c
+++ /dev/null
@@ -1,25 +0,0 @@
-/* strrchr.c: A replacement for the strrchr function
-
-%%% copyright-cmetz
-This software is Copyright 1996 by Craig Metz, All Rights Reserved.
-The Inner Net License Version 2 applies to this software.
-You should have received a copy of the license with this software. If
-you didn't get a copy, you may request one from <license@inner.net>.
-
- History:
-
- Created by cmetz for OPIE 2.3.
-*/
-#include "opie_cfg.h"
-#include "opie.h"
-
-char *strrchr FUNCTION((s, c), char *s AND int c)
-{
-#if HAVE_RINDEX
- return rindex(s, c);
-#else /* HAVE_RINDEX */
- char *s2 = (char *)0;
- while(*s) { if (*s == c) s2 = s; s++ };
- return s2;
-#endif /* HAVE_RINDEX */
-}
diff --git a/contrib/opie/libmissing/sysconf.c b/contrib/opie/libmissing/sysconf.c
deleted file mode 100644
index fb3a5bc..0000000
--- a/contrib/opie/libmissing/sysconf.c
+++ /dev/null
@@ -1,30 +0,0 @@
-/* sysconf.c: A (partial) replacement for the sysconf function
-
-%%% copyright-cmetz
-This software is Copyright 1996 by Craig Metz, All Rights Reserved.
-The Inner Net License Version 2 applies to this software.
-You should have received a copy of the license with this software. If
-you didn't get a copy, you may request one from <license@inner.net>.
-
- History:
-
- Created by cmetz for OPIE 2.3.
-*/
-#include "opie_cfg.h"
-#if HAVE_SYS_PARAM_H
-#include <sys/param.h>
-#endif /* HAVE_SYS_PARAM_H */
-#include "opie.h"
-
-long sysconf(int name)
-{
- switch(name) {
- case _SC_OPEN_MAX:
-#if HAVE_GETDTABLESIZE
- return getdtablesize();
-#else /* HAVE_GETDTABLESIZE */
-#error Need getdtablesize() to build a replacement sysconf()
-#endif /* HAVE_GETDTABLESIZE */
-
- return -1;
-}
diff --git a/contrib/opie/libmissing/uname.c b/contrib/opie/libmissing/uname.c
deleted file mode 100644
index 5b51fa5..0000000
--- a/contrib/opie/libmissing/uname.c
+++ /dev/null
@@ -1,42 +0,0 @@
-/* uname.c: A replacement for the uname function (sort of)
-
-%%% copyright-cmetz
-This software is Copyright 1996 by Craig Metz, All Rights Reserved.
-The Inner Net License Version 2 applies to this software.
-You should have received a copy of the license with this software. If
-you didn't get a copy, you may request one from <license@inner.net>.
-
- History:
-
- Modified by cmetz for OPIE 2.3. Ifdef around gethostname().
- Created by cmetz for OPIE 2.2.
-*/
-#include "opie_cfg.h"
-#if HAVE_SYS_PARAM_H
-#include <sys/param.h>
-#endif /* HAVE_SYS_PARAM_H */
-#include "opie.h"
-
-int uname FUNCTION(struct utsname *buf)
-{
-#if HAVE_GETHOSTNAME
- char hostname[MAXHOSTNAMELEN], *c;
-
- memset(buf, 0, sizeof(buf));
-
- if (gethostname(hostname, sizeof(hostname)-1) < 0)
- return -1;
-
- hostname[sizeof(hostname) - 1] = 0;
-
- if (c = strchr(hostname, '.')) {
- *c = 0;
- }
-
- strncpy(buf->nodename, hostname, sizeof(buf->nodename) - 1);
- return 0;
-#else /* HAVE_GETHOSTNAME */
- strncpy(buf->nodename, "unknown", sizeof(buf->nodename) - 1);
- return 0;
-#endif /* HAVE_GETHOSTNAME */
-}
diff --git a/contrib/opie/libopie/challenge.c b/contrib/opie/libopie/challenge.c
index 149403d..b931714 100644
--- a/contrib/opie/libopie/challenge.c
+++ b/contrib/opie/libopie/challenge.c
@@ -1,7 +1,7 @@
/* challenge.c: The opiechallenge() library function.
%%% portions-copyright-cmetz-96
-Portions of this software are Copyright 1996-1999 by Craig Metz, All Rights
+Portions of this software are Copyright 1996-1998 by Craig Metz, All Rights
Reserved. The Inner Net License Version 2 applies to these portions of
the software.
You should have received a copy of the license with this software. If
@@ -20,6 +20,9 @@ License Agreement applies to this software.
syslog. Add sha plumbing.
Modified by cmetz for OPIE 2.2. Use FUNCTION declaration et al.
Created at NRL for OPIE 2.2 from opiesubr2.c
+
+$FreeBSD$
+
*/
#include "opie_cfg.h"
#include <stdio.h>
@@ -52,8 +55,6 @@ int opiechallenge FUNCTION((mp, name, ss), struct opie *mp AND char *name AND ch
{
int rval = -1;
- memset(mp, 0, sizeof(*mp));
-
rval = opielookup(mp, name);
#if DEBUG
if (rval) syslog(LOG_DEBUG, "opiechallenge: opielookup(mp, name=%s) returned %d", name, rval);
@@ -66,11 +67,11 @@ int opiechallenge FUNCTION((mp, name, ss), struct opie *mp AND char *name AND ch
#endif /* DEBUG */
}
- if (rval ||
- (snprintf(ss, OPIE_CHALLENGE_MAX, "otp-%s %d %s ext", algids[MDX], mp->opie_n - 1, mp->opie_seed) >= OPIE_CHALLENGE_MAX)) {
+ if (rval) {
opierandomchallenge(ss);
memset(mp, 0, sizeof(*mp));
- }
+ } else
+ sprintf(ss, "otp-%s %d %s ext", algids[MDX], mp->opie_n - 1, mp->opie_seed);
return rval;
}
diff --git a/contrib/opie/libopie/generator.c b/contrib/opie/libopie/generator.c
index 24c6a73..eef7cac 100644
--- a/contrib/opie/libopie/generator.c
+++ b/contrib/opie/libopie/generator.c
@@ -1,7 +1,7 @@
/* generator.c: The opiegenerator() library function.
%%% portions-copyright-cmetz-96
-Portions of this software are Copyright 1996-1999 by Craig Metz, All Rights
+Portions of this software are Copyright 1996-1998 by Craig Metz, All Rights
Reserved. The Inner Net License Version 2 applies to these portions of
the software.
You should have received a copy of the license with this software. If
@@ -9,9 +9,6 @@ you didn't get a copy, you may request one from <license@inner.net>.
History:
- Modified by cmetz for OPIE 2.4. Added opieauto code based on
- previously released test code. Renamed buffer to challenge.
- Use struct opie_otpkey for keys.
Modified by cmetz for OPIE 2.32. If secret=NULL, always return
as if opieauto returned "get the secret". Renamed
_opieparsechallenge() to __opieparsechallenge(). Check
@@ -28,368 +25,81 @@ you didn't get a copy, you may request one from <license@inner.net>.
Modified by cmetz for OPIE 2.2. Use FUNCTION declaration et al.
Bug fixes.
Created at NRL for OPIE 2.2.
+
+$FreeBSD$
*/
#include "opie_cfg.h"
#if HAVE_STRING_H
#include <string.h>
#endif /* HAVE_STRING_H */
-#if OPIEAUTO
-#include <errno.h>
-#if HAVE_STDLIB_H
-#include <stdlib.h>
-#endif /* HAVE_STDLIB_H */
-#include <sys/stat.h>
-
-#include <sys/socket.h>
-#include <sys/un.h>
-#endif /* OPIEAUTO */
-#if DEBUG
-#include <syslog.h>
-#endif /* DEBUG */
#include "opie.h"
static char *algids[] = { NULL, NULL, NULL, "sha1", "md4", "md5" };
-#if OPIEAUTO
-#ifndef max
-#define max(x, y) (((x) > (y)) ? (x) : (y))
-#endif /* max */
-
-static int opieauto_connect FUNCTION_NOARGS
-{
- int s;
- struct sockaddr_un sun;
- char buffer[1024];
- char *c, *c2 ="/.opieauto";
- uid_t myuid = getuid(), myeuid = geteuid();
-
- if (!myuid || !myeuid || (myuid != myeuid)) {
-#if DEBUG
- syslog(LOG_DEBUG, "opieauto_connect: superuser and/or setuid not allowed");
-#endif /* DEBUG */
- return -1;
- };
-
- memset(&sun, 0, sizeof(struct sockaddr_un));
- sun.sun_family = AF_UNIX;
-
- if (!(c = getenv("HOME"))) {
-#if DEBUG
- syslog(LOG_DEBUG, "opieauto_connect: no HOME variable?");
-#endif /* DEBUG */
- return -1;
- };
-
- if (strlen(c) > (sizeof(sun.sun_path) - strlen(c2) - 1)) {
-#if DEBUG
- syslog(LOG_DEBUG, "opieauto_connect: HOME is too long: %s", c);
-#endif /* DEBUG */
- return -1;
- };
-
- strcpy(sun.sun_path, c);
- strcat(sun.sun_path, c2);
-
- if ((s = socket(PF_UNIX, SOCK_STREAM, 0)) < 0) {
-#if DEBUG
- syslog(LOG_DEBUG, "opieauto_connect: socket: %s(%d)", strerror(errno), errno);
-#endif /* DEBUG */
- return -1;
- };
-
- {
- struct stat st;
-
- if (stat(sun.sun_path, &st) < 0) {
-#if DEBUG
- syslog(LOG_DEBUG, "opieauto_connect: stat: %s(%d)\n", strerror(errno), errno);
-#endif /* DEBUG */
- goto ret;
- };
-
- if (connect(s, (struct sockaddr *)&sun, sizeof(struct sockaddr_un))) {
-#if DEBUG
- syslog(LOG_DEBUG, "opieauto_connect: connect: %s(%d)\n", strerror(errno), errno);
-#endif /* DEBUG */
- goto ret;
- };
-
- if ((st.st_uid != myuid) || (!S_ISSOCK(st.st_mode)) || ((st.st_mode & 07777) != 0600)) {
-#if DEBUG
- syslog(LOG_DEBUG, "opieauto_connect: something's fishy about the socket\n");
-#endif /* DEBUG */
- goto ret;
- };
- };
-
- return s;
-
-ret:
- close(s);
- return -1;
-};
-#endif /* OPIEAUTO */
-
-int opiegenerator FUNCTION((challenge, secret, response), char *challenge AND char *secret AND char *response)
+int opiegenerator FUNCTION((buffer, secret, response), char *buffer AND char *secret AND char *response)
{
int algorithm;
int sequence;
char *seed;
- struct opie_otpkey key;
+ char key[8];
int i;
int exts;
-#if OPIEAUTO
- int s;
- int window;
- char cmd[1+1+1+1+4+1+OPIE_SEED_MAX+1+4+1+4+1+4+1+4+1];
- char *c;
-#endif /* OPIEAUTO */
- if (!(challenge = strstr(challenge, "otp-")))
+ if (!(buffer = strstr(buffer, "otp-")))
return 1;
- challenge += 4;
+ buffer += 4;
- if (__opieparsechallenge(challenge, &algorithm, &sequence, &seed, &exts))
+ if (__opieparsechallenge(buffer, &algorithm, &sequence, &seed, &exts))
return 1;
if ((sequence < 2) || (sequence > 9999))
return 1;
- if (*secret) {
- if (opiepasscheck(secret))
- return -2;
-
- if (i = opiekeycrunch(algorithm, &key, seed, secret))
- return i;
-
- if (sequence <= OPIE_SEQUENCE_RESTRICT) {
- if (!(exts & 1))
- return 1;
-
- {
- char newseed[OPIE_SEED_MAX + 1];
- struct opie_otpkey newkey;
- char *c;
- char buf[OPIE_SEED_MAX + 48 + 1];
-
- while (sequence-- != 0)
- opiehash(&key, algorithm);
-
- if (opienewseed(strcpy(newseed, seed)) < 0)
- return -1;
-
- if (opiekeycrunch(algorithm, &newkey, newseed, secret))
- return -1;
-
- for (i = 0; i < 499; i++)
- opiehash(&newkey, algorithm);
-
- strcpy(response, "init-hex:");
- strcat(response, opiebtoh(buf, &key));
- if (snprintf(buf, sizeof(buf), ":%s 499 %s:", algids[algorithm],
- newseed) >= sizeof(buf)) {
-#ifdef DEBUG
- syslog(LOG_DEBUG, "opiegenerator: snprintf truncation at init-hex");
-#endif /* DEBUG */
- return -1;
- }
- strcat(response, buf);
- strcat(response, opiebtoh(buf, &newkey));
- };
- };
- };
-
-#if OPIEAUTO
- if ((s = opieauto_connect()) >= 0) {
- if ((i = read(s, cmd, sizeof(cmd)-1)) < 0) {
-#if DEBUG
- syslog(LOG_DEBUG, "opiegenerator: read: %s(%d)\n", strerror(errno), errno);
-#endif /* DEBUG */
- close(s);
- s = -1;
- goto l0;
- };
- cmd[i] = 0;
- if ((cmd[0] != 'C') || (cmd[1] != '+') || (cmd[2] != ' ')) {
-#if DEBUG
- syslog(LOG_DEBUG, "opiegenerator: got invalid/failing C+ response: %s\n", cmd);
-#endif /* DEBUG */
- close(s);
- s = -1;
- goto l0;
- };
-
- window = strtoul(&cmd[3], &c, 10);
- if (!window || (window >= (OPIE_SEQUENCE_MAX - OPIE_SEQUENCE_RESTRICT)) || !isspace(*c)) {
-#if DEBUG
- syslog(LOG_DEBUG, "opiegenerator: got bogus option response: %s\n", cmd);
-#endif /* DEBUG */
- close(s);
- s = -1;
- goto l0;
- };
- };
-
-l0:
- if (*secret) {
- int j;
+ if (!secret[0])
+ return 2;
- if (s < 0) {
- j = 0;
- goto l1;
- };
+ if (opiepasscheck(secret))
+ return -2;
- j = max(sequence - window + 1, OPIE_SEQUENCE_RESTRICT);
+ if (i = opiekeycrunch(algorithm, key, seed, secret))
+ return i;
- for (i = j; i > 0; i--)
- opiehash(&key, algorithm);
+ if (sequence < 10) {
+ if (!(exts & 1))
+ return 1;
{
- char buf[16+1];
+ char newseed[OPIE_SEED_MAX + 1];
+ char newkey[8];
+ char *c;
+ char buf[OPIE_SEED_MAX + 48 + 1];
- opiebtoa8(buf, &key);
+ while (sequence-- != 0)
+ opiehash(key, algorithm);
- if (snprintf(cmd, sizeof(cmd), "S= %d %d %s %s\n", algorithm, sequence,
- seed, buf) >= sizeof(cmd)) {
-#if DEBUG
- syslog(LOG_DEBUG, "opiegenerator: snprintf truncation at S=\n");
-#endif /* DEBUG */
- goto l1;
- }
- }
+ if (opienewseed(strcpy(newseed, seed)) < 0)
+ return -1;
- if (write(s, cmd, i = strlen(cmd)) != i) {
-#if DEBUG
- syslog(LOG_DEBUG, "opiegenerator: write: %s(%d)\n", strerror(errno), errno);
-#endif /* DEBUG */
- goto l1;
- };
+ if (opiekeycrunch(algorithm, newkey, newseed, secret))
+ return -1;
- if ((i = read(s, cmd, sizeof(cmd))) < 0) {
-#if DEBUG
- syslog(LOG_DEBUG, "opiegenerator: read: %s(%d)\n", strerror(errno), errno);
-#endif /* DEBUG */
- };
- close(s);
+ for (i = 0; i < 499; i++)
+ opiehash(newkey, algorithm);
- cmd[i] = 0;
- i = strlen(seed);
- if ((cmd[0] != 'S') || (cmd[1] != '+') || (cmd[2] != ' ') || (strtoul(&cmd[3], &c, 10) != algorithm) || (strtoul(c + 1, &c, 10) != sequence) || strncmp(++c, seed, i) || (*(c + i) != '\n')) {
-#if DEBUG
- syslog(LOG_DEBUG, "opiegenerator: got invalid/failing S+ response: %s\n", cmd);
-#endif /* DEBUG */
+ strcpy(response, "init-hex:");
+ strcat(response, opiebtoh(buf, key));
+ sprintf(buf, ":%s 499 %s:", algids[algorithm], newseed);
+ strcat(response, buf);
+ strcat(response, opiebtoh(buf, newkey));
};
-
-l1:
- for (i = sequence - j; i > 0; i--)
- opiehash(&key, algorithm);
-
- opiebtoh(response, &key);
} else {
- if (s < 0)
- goto l2;
-
- if ((snprintf(cmd, sizeof(cmd), "s= %d %d %s\n", algorithm, sequence,
- seed) >= sizeof(cmd))) {
-#if DEBUG
- syslog(LOG_DEBUG, "opiegenerator: snprintf truncation at s=\n");
-#endif /* DEBUG */
- goto l2;
- }
-
- if (write(s, cmd, i = strlen(cmd)) != i) {
-#if DEBUG
- syslog(LOG_DEBUG, "opiegenerator: write: %s(%d)\n", strerror(errno), errno);
-#endif /* DEBUG */
- goto l2;
- };
-
- if ((i = read(s, cmd, sizeof(cmd))) < 0) {
-#if DEBUG
- syslog(LOG_DEBUG, "opiegenerator: read: %s(%d)\n", strerror(errno), errno);
-#endif /* DEBUG */
- goto l2;
- };
- close(s);
-
- i = strlen(seed);
-
- if ((cmd[0] != 's') || (cmd[2] != ' ') || (strtoul(&cmd[3], &c, 10) != algorithm) || (strtoul(c + 1, &c, 10) != sequence) || strncmp(++c, seed, i)) {
-#if DEBUG
- if (c)
- *c = 0;
- else
- cmd[3] = 0;
-
- syslog(LOG_DEBUG, "opiegenerator: got bogus/invalid s response: %s\n", cmd);
-#endif /* DEBUG */
- goto l2;
- };
-
- c += i;
-
- if (cmd[1] == '-') {
-#if DEBUG
- if (*c != '\n') {
- *c = 0;
- syslog(LOG_DEBUG, "opiegenerator: got invalid s- response: %s\n", cmd);
- };
-#endif /* DEBUG */
- goto l2;
- };
-
- if (cmd[1] != '+') {
-#if DEBUG
- *c = 0;
- syslog(LOG_DEBUG, "opiegenerator: got invalid s response: %s\n", cmd);
-#endif /* DEBUG */
- goto l2;
- };
-
- {
- char *c2;
-
- if (!(c2 = strchr(++c, '\n'))) {
-#if DEBUG
- *c = 0;
- syslog(LOG_DEBUG, "opiegenerator: got invalid s+ response: %s\n", cmd);
-#endif /* DEBUG */
- goto l2;
- };
-
- *c2++ = 0;
- };
-
- if (!opieatob8(&key, c))
- goto l2;
-
- opiebtoh(response, &key);
- };
-
- if (s >= 0)
- close(s);
-#else /* OPIEAUTO */
- if (*secret) {
while (sequence-- != 0)
- opiehash(&key, algorithm);
+ opiehash(key, algorithm);
- opiebtoh(response, &key);
- } else
- return -2;
-#endif /* OPIEAUTO */
+ opiebtoh(response, key);
+ }
return 0;
-
-#if OPIEAUTO
-l2:
-#if DEBUG
- syslog(LOG_DEBUG, "opiegenerator: no opieauto response available.\n");
-#endif /* DEBUG */
- if (s >= 0)
- close(s);
-
- return -2;
-#endif /* OPIEAUTO */
-};
+}
diff --git a/contrib/opie/libopie/hash.c b/contrib/opie/libopie/hash.c
index e89508c..0edbdd1 100644
--- a/contrib/opie/libopie/hash.c
+++ b/contrib/opie/libopie/hash.c
@@ -1,68 +1,66 @@
/* hash.c: The opiehash() library function.
%%% copyright-cmetz-96
-This software is Copyright 1996-2001 by Craig Metz, All Rights Reserved.
-The Inner Net License Version 3 applies to this software.
+This software is Copyright 1996-1998 by Craig Metz, All Rights Reserved.
+The Inner Net License Version 2 applies to this software.
You should have received a copy of the license with this software. If
you didn't get a copy, you may request one from <license@inner.net>.
History:
- Modified by cmetz for OPIE 2.4. Use struct opie_otpkey for binary arg.
- Modified by cmetz for OPIE 2.31. Added SHA support (which may
+ Updated by cmetz for OPIE 2.31. Added SHA support (which may
not be correct). Backed out previous optimizations as
they killed thread-safety.
Created by cmetz for OPIE 2.3 using the old hash.c as a guide.
+
+$FreeBSD$
*/
#include "opie_cfg.h"
-#if 0
-#include "sha.h"
-#endif /* 0 */
#include "opie.h"
-VOIDRET opiehash FUNCTION((x, algorithm), struct opie_otpkey *results AND
-unsigned algorithm)
+#include <sha.h>
+#include <md4.h>
+#include <md5.h>
+
+VOIDRET opiehash FUNCTION((x, algorithm), VOIDPTR x AND unsigned algorithm)
{
+ UINT4 *results = (UINT4 *)x;
+
switch(algorithm) {
-#if 0
case 3:
{
SHA_CTX sha;
-
- SHAInit(&sha);
- SHAUpdate(&sha, (unsigned char *)results, 8);
- SHAFinal(&sha);
-
- results->words[0] = sha.buffer[0] ^ sha.buffer[2] ^ sha.buffer[4];
- results->words[1] = sha.buffer[1] ^ sha.buffer[3];
+ UINT4 digest[5];
+ SHA1_Init(&sha);
+ SHA1_Update(&sha, (unsigned char *)x, 8);
+ SHA1_Final((unsigned char *)digest, &sha);
+ results[0] = digest[0] ^ digest[2] ^ digest[4];
+ results[1] = digest[1] ^ digest[3];
};
break;
-#endif /* 0 */
case 4:
{
- struct opiemdx_ctx mdx;
+ MD4_CTX mdx;
UINT4 mdx_tmp[4];
- opiemd4init(&mdx);
- opiemd4update(&mdx, (unsigned char *)results, 8);
- opiemd4final((unsigned char *)mdx_tmp, &mdx);
-
- results->words[0] = mdx_tmp[0] ^ mdx_tmp[2];
- results->words[1] = mdx_tmp[1] ^ mdx_tmp[3];
+ MD4Init(&mdx);
+ MD4Update(&mdx, (unsigned char *)x, 8);
+ MD4Final((unsigned char *)mdx_tmp, &mdx);
+ results[0] = mdx_tmp[0] ^ mdx_tmp[2];
+ results[1] = mdx_tmp[1] ^ mdx_tmp[3];
};
break;
case 5:
{
- struct opiemdx_ctx mdx;
+ MD5_CTX mdx;
UINT4 mdx_tmp[4];
- opiemd5init(&mdx);
- opiemd5update(&mdx, (unsigned char *)results, 8);
- opiemd5final((unsigned char *)mdx_tmp, &mdx);
-
- results->words[0] = mdx_tmp[0] ^ mdx_tmp[2];
- results->words[1] = mdx_tmp[1] ^ mdx_tmp[3];
+ MD5Init(&mdx);
+ MD5Update(&mdx, (unsigned char *)x, 8);
+ MD5Final((unsigned char *)mdx_tmp, &mdx);
+ results[0] = mdx_tmp[0] ^ mdx_tmp[2];
+ results[1] = mdx_tmp[1] ^ mdx_tmp[3];
};
break;
}
diff --git a/contrib/opie/libopie/hashlen.c b/contrib/opie/libopie/hashlen.c
index 09390c3..66f7d2c 100644
--- a/contrib/opie/libopie/hashlen.c
+++ b/contrib/opie/libopie/hashlen.c
@@ -1,63 +1,58 @@
/* hashlen.c: The opiehashlen() library function.
%%% copyright-cmetz-96
-This software is Copyright 1996-2001 by Craig Metz, All Rights Reserved.
-The Inner Net License Version 3 applies to this software.
+This software is Copyright 1996-1998 by Craig Metz, All Rights Reserved.
+The Inner Net License Version 2 applies to this software.
You should have received a copy of the license with this software. If
you didn't get a copy, you may request one from <license@inner.net>.
History:
- Modified by cmetz for OPIE 2.4. Use struct opie_otpkey, isolate variables.
Created by cmetz for OPIE 2.3.
+
+$FreeBSD$
*/
#include "opie_cfg.h"
#include "opie.h"
-VOIDRET opiehashlen FUNCTION((algorithm, in, out, n), int algorithm AND
-VOIDPTR in AND struct opie_otpkey *results AND int n)
+#include <sha.h>
+#include <md4.h>
+#include <md5.h>
+
+VOIDRET opiehashlen FUNCTION((algorithm, in, out, n), int algorithm AND VOIDPTR in AND VOIDPTR out AND int n)
{
+ UINT4 *results = (UINT4 *)out;
+ UINT4 mdx_tmp[4];
+
switch(algorithm) {
-#if 0
- case 3:
- {
- SHA_INFO sha;
-
- sha_init(&sha);
- sha_update(&sha, (BYTE *)in, n);
- sha_final(&sha);
-
- results->words[0] = sha.digest[0] ^ sha.digest[2] ^ sha.digest[4];
- results->words[1] = sha.digest[1] ^ sha.digest[3] ^ sha.digest[5];
- };
+ case 3: {
+ SHA_CTX sha;
+ UINT4 digest[5];
+ SHA1_Init(&sha);
+ SHA1_Update(&sha, (unsigned char *)in, n);
+ SHA1_Final((unsigned char *)digest, &sha);
+ results[0] = digest[0] ^ digest[2] ^ digest[4];
+ results[1] = digest[1] ^ digest[3];
break;
-#endif /* 0 */
- case 4:
- {
- struct opiemdx_ctx mdx;
- UINT4 mdx_tmp[4];
-
- opiemd4init(&mdx);
- opiemd4update(&mdx, (unsigned char *)in, n);
- opiemd4final((unsigned char *)mdx_tmp, &mdx);
-
- results->words[0] = mdx_tmp[0] ^ mdx_tmp[2];
- results->words[1] = mdx_tmp[1] ^ mdx_tmp[3];
- }
+ }
+ case 4: {
+ MD4_CTX mdx;
+ MD4Init(&mdx);
+ MD4Update(&mdx, (unsigned char *)in, n);
+ MD4Final((unsigned char *)mdx_tmp, &mdx);
+ results[0] = mdx_tmp[0] ^ mdx_tmp[2];
+ results[1] = mdx_tmp[1] ^ mdx_tmp[3];
break;
- case 5:
- {
- struct opiemdx_ctx mdx;
- UINT4 mdx_tmp[4];
-
- opiemd5init(&mdx);
- opiemd5update(&mdx, (unsigned char *)in, n);
- opiemd5final((unsigned char *)mdx_tmp, &mdx);
-
- results->words[0] = mdx_tmp[0] ^ mdx_tmp[2];
- results->words[1] = mdx_tmp[1] ^ mdx_tmp[3];
- }
+ }
+ case 5: {
+ MD5_CTX mdx;
+ MD5Init(&mdx);
+ MD5Update(&mdx, (unsigned char *)in, n);
+ MD5Final((unsigned char *)mdx_tmp, &mdx);
+ results[0] = mdx_tmp[0] ^ mdx_tmp[2];
+ results[1] = mdx_tmp[1] ^ mdx_tmp[3];
break;
+ }
}
}
diff --git a/contrib/opie/libopie/insecure.c b/contrib/opie/libopie/insecure.c
index 383206f..e02183a 100644
--- a/contrib/opie/libopie/insecure.c
+++ b/contrib/opie/libopie/insecure.c
@@ -1,7 +1,7 @@
/* insecure.c: The opieinsecure() library function.
%%% portions-copyright-cmetz-96
-Portions of this software are Copyright 1996-1999 by Craig Metz, All Rights
+Portions of this software are Copyright 1996-1998 by Craig Metz, All Rights
Reserved. The Inner Net License Version 2 applies to these portions of
the software.
You should have received a copy of the license with this software. If
@@ -14,8 +14,6 @@ License Agreement applies to this software.
History:
- Modified by cmetz for OPIE 2.4. Do utmp checks on utmpx systems.
- Handle unterminated ut_host.
Modified by cmetz for OPIE 2.31. Fixed a logic bug. Call endut[x]ent().
Modified by cmetz for OPIE 2.3. Added result caching. Use
__opiegetutmpentry(). Ifdef around ut_host check. Eliminate
@@ -27,6 +25,9 @@ License Agreement applies to this software.
found. Use uname().
Created at NRL for OPIE 2.2 from opiesubr.c. Fixed pointer
assignment that should have been a comparison.
+
+$FreeBSD$
+
*/
#include "opie_cfg.h"
@@ -58,14 +59,16 @@ int opieinsecure FUNCTION_NOARGS
char *s;
char *term_name;
int insecure = 0;
-#if HAVE_UT_HOST || DOUTMPX
+#if HAVE_UT_HOST
struct utmp utmp;
-#endif /* HAVE_UT_HOST || DOUTMPX */
+#endif /* HAVE_UT_HOST */
static int result = -1;
if (result != -1)
return result;
+ if (getenv("SSH_CLIENT") != NULL)
+ return (result = 0);
display_name = (char *) getenv("DISPLAY");
term_name = (char *) getenv("TERM");
@@ -119,34 +122,30 @@ int opieinsecure FUNCTION_NOARGS
return (result = 1);
};
-#if HAVE_UT_HOST || DOUTMPX
+#if HAVE_UT_HOST
if (isatty(0)) {
memset(&utmp, 0, sizeof(struct utmp));
{
int i = __opiegetutmpentry(ttyname(0), &utmp);
endutent();
if (!i && utmp.ut_host[0]) {
- char host[sizeof(utmp.ut_host) + 1];
insecure = 1;
- strncpy(host, utmp.ut_host, sizeof(utmp.ut_host));
- host[sizeof(utmp.ut_host)] = 0;
-
- if (s = strchr(host, ':')) {
- int n = s - host;
+ if (s = strchr(utmp.ut_host, ':')) {
+ int n = s - utmp.ut_host;
if (!n)
insecure = 0;
else
if (display_name) {
- if (!strncmp(host, display_name, n))
+ if (!strncmp(utmp.ut_host, display_name, n))
insecure = 0;
-#if 1 /* def SOLARIS */
+#ifdef SOLARIS
else
- if (s = strchr(host, ' ')) {
+ if (s = strchr(utmp.ut_host, ' ')) {
*s = ':';
if (s = strchr(s + 1, ' '))
*s = '.';
- if (!strncmp(host, display_name, n))
+ if (!strncmp(utmp.ut_host, display_name, n))
insecure = 0;
}
#endif /* SOLARIS */
@@ -155,7 +154,7 @@ int opieinsecure FUNCTION_NOARGS
}
};
};
-#endif /* HAVE_UT_HOST || DOUTMPX */
+#endif /* HAVE_UT_HOST */
if (insecure)
return (result = 1);
diff --git a/contrib/opie/libopie/lock.c b/contrib/opie/libopie/lock.c
index bd92607..0f666a6 100644
--- a/contrib/opie/libopie/lock.c
+++ b/contrib/opie/libopie/lock.c
@@ -1,7 +1,7 @@
/* lock.c: The opielock() library function.
%%% portions-copyright-cmetz-96
-Portions of this software are Copyright 1996-1999 by Craig Metz, All Rights
+Portions of this software are Copyright 1996-1998 by Craig Metz, All Rights
Reserved. The Inner Net License Version 2 applies to these portions of
the software.
You should have received a copy of the license with this software. If
@@ -14,7 +14,6 @@ License Agreement applies to this software.
History:
- Modified by cmetz for OPIE 2.4. Use snprintf.
Modified by cmetz for OPIE 2.31. Put locks in a separate dir.
Bug fixes.
Modified by cmetz for OPIE 2.3. Do refcounts whether or not we
@@ -28,6 +27,8 @@ License Agreement applies to this software.
error return values. Check open() return value properly.
Avoid NULL.
Created at NRL for OPIE 2.2 from opiesubr2.c
+
+$FreeBSD$
*/
#include "opie_cfg.h"
#if HAVE_STRING_H
@@ -50,12 +51,17 @@ License Agreement applies to this software.
#endif /* !HAVE_LSTAT */
int __opie_lockrefcount = 0;
+static int do_atexit = 1;
+VOIDRET opiedisableaeh FUNCTION_NOARGS
+{
+ do_atexit = 0;
+}
#if USER_LOCKING
char *__opie_lockfilename = (char *)0;
/* atexit() handler for opielock() */
-static VOIDRET opieunlockaeh FUNCTION_NOARGS
+VOIDRET opieunlockaeh FUNCTION_NOARGS
{
if (__opie_lockfilename) {
__opie_lockrefcount = 0;
@@ -195,9 +201,7 @@ int opielock FUNCTION((principal), char *principal)
if (!S_ISREG(statbuf[0].st_mode) || (statbuf[0].st_mode != statbuf[1].st_mode) || (statbuf[0].st_ino != statbuf[1].st_ino))
goto lockret;
- if (snprintf(buffer, sizeof(buffer), "%d\n%d\n", getpid(), time(0)) >= sizeof(buffer))
- goto lockret;
-
+ sprintf(buffer, "%d\n%d\n", getpid(), time(0));
i = strlen(buffer) + 1;
if (lseek(fh, 0, SEEK_SET)) {
close(fh);
@@ -230,7 +234,8 @@ int opielock FUNCTION((principal), char *principal)
__opie_lockrefcount++;
rval = 0;
- atexit(opieunlockaeh);
+ if (do_atexit)
+ atexit(opieunlockaeh);
lockret:
if (fh >= 0)
diff --git a/contrib/opie/libopie/newseed.c b/contrib/opie/libopie/newseed.c
index 0455857..23cdce4 100644
--- a/contrib/opie/libopie/newseed.c
+++ b/contrib/opie/libopie/newseed.c
@@ -1,18 +1,18 @@
/* newseed.c: The opienewseed() library function.
%%% copyright-cmetz-96
-This software is Copyright 1996-2001 by Craig Metz, All Rights Reserved.
-The Inner Net License Version 3 applies to this software.
+This software is Copyright 1996-1998 by Craig Metz, All Rights Reserved.
+The Inner Net License Version 2 applies to this software.
You should have received a copy of the license with this software. If
you didn't get a copy, you may request one from <license@inner.net>.
History:
- Modified by cmetz for OPIE 2.4. Greatly simplified increment. Now does
- not add digits. Reformatted the code.
Modified by cmetz for OPIE 2.32. Added syslog.h if DEBUG.
Modified by cmetz for OPIE 2.31. Added time.h.
Created by cmetz for OPIE 2.22.
+
+$FreeBSD$
*/
#include "opie_cfg.h"
@@ -37,54 +37,73 @@ you didn't get a copy, you may request one from <license@inner.net>.
int opienewseed FUNCTION((seed), char *seed)
{
- if (!seed)
- return -1;
-
- if (seed[0]) {
- char *c, *end;
- unsigned int i, max;
-
- if ((i = strlen(seed)) > OPIE_SEED_MAX)
- i = OPIE_SEED_MAX;
-
- for (c = end = seed + i - 1, max = 1;
- (c > seed) && isdigit(*c); c--)
- max *= 10;
-
- if ((i = strtoul(++c, (char **)0, 10)) < max) {
- if (++i >= max)
- i = 1;
-
- snprintf(c, end - c, "%d", i);
- seed[OPIE_SEED_MAX] = 0;
- return 0;
- }
+ if (!seed)
+ return -1;
+
+ if (seed[0]) {
+ int i;
+
+ if ((i = strlen(seed)) >= OPIE_SEED_MIN) {
+ long j;
+ char *c;
+
+ if (i > OPIE_SEED_MAX)
+ i = OPIE_SEED_MAX;
+
+ c = seed + i - 1;
+
+ while(c != seed) {
+ if (!isdigit(*c))
+ break;
+ c--;
+ }
+
+ c++;
+
+ if (j = strtol(c, (char **)0, 10)) {
+ char buf[OPIE_SEED_MAX];
+
+ *c = 0;
+ strcpy(buf, seed);
+
+ if (errno == ERANGE) {
+ j = 1;
+ } else {
+ int k = 1, l = OPIE_SEED_MAX - strlen(buf);
+ while(l--) k *= 10;
+
+ if (++j >= k)
+ j = 1;
}
- {
- time_t now;
+ sprintf(seed, "%s%04ld", buf, j);
+ return 0;
+ }
+ }
+ }
- time(&now);
- srand(now);
- }
+ {
+ {
+ time_t now;
+ time(&now);
+ srand(now);
+ }
- {
- struct utsname utsname;
+ {
+ struct utsname utsname;
- if (uname(&utsname) < 0) {
+ if (uname(&utsname) < 0) {
#if DEBUG
- syslog(LOG_DEBUG, "uname: %s(%d)", strerror(errno),
- errno);
+ syslog(LOG_DEBUG, "uname: %s(%d)", strerror(errno), errno);
#endif /* DEBUG */
- utsname.nodename[0] = 'k';
- utsname.nodename[1] = 'e';
- }
- utsname.nodename[2] = 0;
-
- if (snprintf(seed, OPIE_SEED_MAX+1, "%s%04d", utsname.nodename,
- (rand() % 9999) + 1) >= OPIE_SEED_MAX+1)
- return -1;
- return 0;
- }
+ utsname.nodename[0] = 'k';
+ utsname.nodename[1] = 'e';
+ }
+ utsname.nodename[2] = 0;
+
+ sprintf(seed, "%s%04d", utsname.nodename, (rand() % 9999) + 1);
+ return 0;
+ }
+ }
}
diff --git a/contrib/opie/logwtmp.c b/contrib/opie/logwtmp.c
deleted file mode 100644
index 4d9dcbf..0000000
--- a/contrib/opie/logwtmp.c
+++ /dev/null
@@ -1,154 +0,0 @@
-/* logwtmp.c: Put an entry in the wtmp file.
-
-%%% portions-copyright-cmetz
-Portions of this software are Copyright 1996 by Craig Metz, All Rights
-Reserved. The Inner Net License Version 2 applies to these portions of
-the software.
-You should have received a copy of the license with this software. If
-you didn't get a copy, you may request one from <license@inner.net>.
-
-Portions of this software are Copyright 1995 by Randall Atkinson and Dan
-McDonald, All Rights Reserved. All Rights under this copyright are assigned
-to the U.S. Naval Research Laboratory (NRL). The NRL Copyright Notice and
-License Agreement applies to this software.
-
- History:
-
- Modified by cmetz for OPIE 2.22. Call gettimeofday() properly.
- Modified by cmetz for OPIE 2.2. Use FUNCTION declaration et al.
- Ifdef around some headers. Added file close hook.
- Modified at NRL for OPIE 2.1. Set process type for HPUX.
- Modified at NRL for OPIE 2.0.
- Originally from BSD.
-*/
-/*
- * Copyright (c) 1988 The Regents of the University of California.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- */
-
-#include "opie_cfg.h"
-
-#include <sys/types.h>
-#if HAVE_SYS_TIME_H
-#include <sys/time.h>
-#endif /* HAVE_SYS_TIME_H */
-#include <sys/stat.h>
-#include <fcntl.h>
-#include <utmp.h>
-#if HAVE_UNISTD_H
-#include <unistd.h>
-#endif /* HAVE_UNISTD_H */
-#if HAVE_STRING_H
-#include <string.h>
-#endif /* HAVE_STRING_H */
-
-#include "opie.h"
-
-static int fd = -1;
-
-#if DOUTMPX
-static int fdx = -1;
-#include <utmpx.h>
-#endif /* DOUTMPX */
-
-#ifndef _PATH_WTMP
-#define _PATH_WTMP "/usr/adm/wtmp"
-#endif
-
-#ifndef _PATH_WTMPX
-#define _PATH_WTMPX "/usr/adm/wtmpx"
-#endif /* _PATH_UTMPX */
-
-/*
- * Modified version of logwtmp that holds wtmp file open
- * after first call, for use with ftp (which may chroot
- * after login, but before logout).
- */
-VOIDRET logwtmp FUNCTION((line, name, host), char *line AND char *name AND char *host)
-{
- struct utmp ut;
-
-#if DOUTMPX
- struct utmpx utx;
-#endif /* DOUTMPX */
- struct stat buf;
-
- memset(&ut, 0, sizeof(struct utmp));
-
- if (!line) {
- close(fd);
-#if DOUTMPX
- close(fdx);
-#endif /* DOUTMPX */
- }
-
- if (fd < 0 && (fd = open(_PATH_WTMP, O_WRONLY | O_APPEND, 0)) < 0)
- return;
- if (fstat(fd, &buf) == 0) {
-#if HAVE_UT_TYPE && defined(USER_PROCESS)
- ut.ut_type = USER_PROCESS;
-#endif /* HAVE_UT_TYPE && defined(USER_PROCESS) */
-#if HAVE_UT_PID
- ut.ut_pid = getpid();
-#endif /* HAVE_UT_PID */
- strncpy(ut.ut_line, line, sizeof(ut.ut_line));
- strncpy(ut.ut_name, name, sizeof(ut.ut_name));
-#if !DOUTMPX
- strncpy(ut.ut_host, host, sizeof(ut.ut_host));
-#endif /* !DOUTMPX */
- time(&ut.ut_time);
- if (write(fd, (char *) &ut, sizeof(struct utmp)) !=
- sizeof(struct utmp))
- ftruncate(fd, buf.st_size);
- }
-#if DOUTMPX
- memset(&utx, 0, sizeof(struct utmpx));
-
- if (fdx < 0 && (fdx = open(WTMPX_FILE, O_WRONLY | O_APPEND, 0)) < 0)
- return;
- if (fstat(fdx, &buf) == 0) {
- strncpy(utx.ut_line, line, sizeof(utx.ut_line));
- strncpy(utx.ut_name, name, sizeof(utx.ut_name));
- strncpy(utx.ut_host, host, sizeof(utx.ut_host));
-#if HAVE_GETTIMEOFDAY
-#if HAVE_ONE_ARG_GETTIMEOFDAY
- gettimeofday(&utx.ut_tv);
-#else /* HAVE_ONE_ARG_GETTIMEOFDAY */
- gettimeofday(&utx.ut_tv, NULL);
-#endif /* HAVE_ONE_ARG_GETTIMEOFDAY */
-#endif /* HAVE_GETTIMEOFDAY */
- if (write(fdx, (char *) &utx, sizeof(struct utmpx)) !=
- sizeof(struct utmpx))
- ftruncate(fdx, buf.st_size);
- }
-#endif /* DOUTMPX */
-}
diff --git a/contrib/opie/opie.4 b/contrib/opie/opie.4
index d66a502..58fa0d3 100644
--- a/contrib/opie/opie.4
+++ b/contrib/opie/opie.4
@@ -1,7 +1,7 @@
.\" opie.4: Overview of the OPIE software.
.\"
.\" %%% portions-copyright-cmetz-96
-.\" Portions of this software are Copyright 1996-1999 by Craig Metz, All Rights
+.\" Portions of this software are Copyright 1996-1998 by Craig Metz, All Rights
.\" Reserved. The Inner Net License Version 2 applies to these portions of
.\" the software.
.\" You should have received a copy of the license with this software. If
@@ -14,13 +14,14 @@
.\"
.\" History:
.\"
-.\" Modified by cmetz for OPIE 2.4. Spelling fixes.
.\" Modified by cmetz for OPIE 2.2. Removed MJR DES documentation. Removed
.\" references to the old square brackets challenge delimiters.
.\" Modified at NRL for OPIE 2.01. Updated UNIX trademark credit.
.\" Definition of "seed" written by Neil Haller of Bellcore
.\" Written at NRL for OPIE 2.0.
.\"
+.\" $FreeBSD$
+.\"
.TH OPIE 4 "January 10, 1995"
.SH NAME
.B OPIE \- One-time Passwords In Everything
@@ -86,7 +87,7 @@ the calculator given the challenge and the secret password. For example,
.TP
.I seed
A piece of information that is used in conjunction with the secret password
-and sequence number to compute the response. Its purpose is to allow the same
+and sequence numer to compute the response. Its purpose is to allow the same
secret password to be used for multiple sequences, by changing the seed, or
for authentication to multiple machines by using different seeds.
.TP
@@ -139,10 +140,10 @@ you can still be broken into.
A solution to this whole problem was invented by Lamport in 1981. This
technique was implemented by Haller, Karn, and Walden at Bellcore. They
-They created a free software package called "S/Key" that used an algorithm
+created a free software package called "S/Key" that used an algorithm
called a cryptographic checksum. A cryptographic checksum is a strong one-way
function such that, knowing the result of such a function, an attacker still
-cannot feasibly determine the input. Further, unlike cyclic redundancy
+cannot feasably determine the input. Further, unlike cyclic redundancy
checksums (CRCs), cryptographic checksums have few inputs that result in the
same output.
.LP
@@ -194,21 +195,12 @@ introduction to what's going on under the hood.
.SH OPIE COMPONENTS
-Included in the OPIE distribution are three OPIE client programs:
-.IR opielogin (1),
-.IR opiesu (1),
-and
-.IR opieftpd (8).
-These three programs are modified versions of the
-freely available 4.3BSD Net/2 versions of
+The OPIE distribution has been incorporated into three standard client
+programs:
.IR login (1),
.IR su (1),
and
.IR ftpd (8),
-respectively. Although most of the modifications actually done to them are so
-that they will work on as many machines as possible, they also have been
-modified to support OPIE for authentication. As you will see from the source,
-it is not very difficult to add support for OPIE to other programs.
.LP
There are also three programs in the OPIE distribution that are specific to
the OPIE system:
@@ -221,17 +213,17 @@ sequence number and seed are, and
.IR opiekey(1),
which is an OPIE key calculator.
-.LP ADDING OPIE TO OTHER PROGRAMS
+.SH ADDING OPIE TO OTHER PROGRAMS
Adding OPIE authentication to programs other than the ones included as clients
in the OPIE distribution isn't very difficult. First, you will need to make
sure that the program includes <stdio.h> somewhere. Then, below the other
includes such as <stdio.h>, but before variable declarations, you need to
-include "opie.h". You need to add a variable of type "struct opie" to your
+include <opie.h>. You need to add a variable of type "struct opie" to your
program, you need to make sure that the buffer that you use to get a password
from the user is big enough to hold OPIE_RESPONSE_MAX+1 characters, and you
need to have a buffer in which to store the challenge string that is big enough
-to hold OPIE_PROMPT_MAX+1 characters.
+to hold OPIE_CHALLENGE_MAX+1 characters.
.LP
When you are ready to output the challenge string and know the user's name,
you would use a call to opiechallenge. Later, to verify the response received,
@@ -245,7 +237,7 @@ you would use a call to opieverify. For example:
.sp 0
.
.sp 0
- #include "opie.h"
+ #include <opie.h>
.sp 0
.
.sp 0
@@ -263,13 +255,13 @@ you would use a call to opieverify. For example:
.sp 0
struct opie opiedata;
.sp 0
- char opieprompt[OPIE_PROMPT_MAX+1];
+ char opieprompt[OPIE_CHALLENGE_MAX+1];
.sp 0
.
.sp 0
.
.sp 0
- opiechallenge(&opiedata, user_name, &opieprompt);
+ opiechallenge(&opiedata, user_name, opieprompt);
.sp 0
.
.sp 0
@@ -307,14 +299,14 @@ because, by doing so, you are allowing any machine to read any of your windows
or your keystrokes without you knowing it.
.SH SEE ALSO
+.BR ftpd (8)
+.BR login (1),
.BR opie (4),
.BR opiekeys (5),
.BR opieaccess (5),
.BR opiekey (1),
.BR opieinfo (1),
.BR opiepasswd (1),
-.BR opielogin (1),
-.BR opieftpd (8)
.sp
Lamport, L. "Password Authentication with Insecure Communication",
Communications of the ACM 24.11 (November 1981), pp. 770-772.
diff --git a/contrib/opie/opie.h b/contrib/opie/opie.h
index 21e9092..7ac9b21 100644
--- a/contrib/opie/opie.h
+++ b/contrib/opie/opie.h
@@ -2,7 +2,7 @@
system that a program might need.
%%% portions-copyright-cmetz-96
-Portions of this software are Copyright 1996-1999 by Craig Metz, All Rights
+Portions of this software are Copyright 1996-1998 by Craig Metz, All Rights
Reserved. The Inner Net License Version 2 applies to these portions of
the software.
You should have received a copy of the license with this software. If
@@ -15,9 +15,6 @@ License Agreement applies to this software.
History:
- Modified by cmetz for OPIE 2.4. Added sequence number limits. Added
- struct opie_otpkey and made many functions use it. Added
- opiestrncpy(). Include header with libmissing prototypes.
Modified by cmetz for OPIE 2.32. Added symbolic flag names for
opiepasswd(). Added __opieparsechallenge() prototype.
Modified by cmetz for OPIE 2.31. Removed active attack protection.
@@ -36,84 +33,12 @@ License Agreement applies to this software.
Modified at NRL for OPIE 2.0.
Written at Bellcore for the S/Key Version 1 software distribution
(skey.h).
+
+$FreeBSD$
*/
#ifndef _OPIE_H
#define _OPIE_H 1
-#if _OPIE
-
-#if HAVE_VOIDPTR
-#define VOIDPTR void *
-#else /* HAVE_VOIDPTR */
-#define VOIDPTR char *
-#endif /* HAVE_VOIDPTR */
-
-#if HAVE_VOIDRET
-#define VOIDRET void
-#else /* HAVE_VOIDRET */
-#define VOIDRET
-#endif /* HAVE_VOIDRET */
-
-#if HAVE_VOIDARG
-#define NOARGS void
-#else /* HAVE_VOIDARG */
-#define NOARGS
-#endif /* HAVE_VOIDARG */
-
-#if HAVE_ANSIDECL
-#define FUNCTION(arglist, args) (args)
-#define AND ,
-#else /* HAVE_ANSIDECL */
-#define FUNCTION(arglist, args) arglist args;
-#define AND ;
-#endif /* HAVE_ANSIDECL */
-
-#define FUNCTION_NOARGS ()
-
-#ifndef __P
-#if HAVE_ANSIPROTO
-#define __P(x) x
-#else /* HAVE_ANSIPROTO */
-#define __P(x) ()
-#endif /* HAVE_ANSIPROTO */
-#endif /* __P */
-
-#ifndef HAVE_SYS_UTSNAME_H
-struct utsname {
- char nodename[65];
- };
-#endif /* HAVE_SYS_UTSNAME_H */
-
-#ifndef _SC_OPEN_MAX
-#define _SC_OPEN_MAX 1
-#endif /* _SC_OPEN_MAX */
-
-#ifndef MAXHOSTNAMELEN
-#define MAXHOSTNAMELEN 1024
-#endif /* MAXHOSTNAMELEN */
-
-#else /* _OPIE */
-#ifdef __STDC__
-#define VOIDRET void
-#define VOIDPTR void *
-#else /* __STDC__ */
-#define VOIDRET
-#define VOIDPTR char *
-#endif /* __STDC__ */
-#endif /* _OPIE */
-
-#ifndef __P
-#ifdef __ARGS
-#define __P __ARGS
-#else /* __ARGS */
-#ifdef __STDC__
-#define __P(x) x
-#else /* __STDC__ */
-#define __P(x) ()
-#endif /* __STDC__ */
-#endif /* __ARGS */
-#endif /* __P */
-
struct opie {
int opie_flags;
char opie_buf[256];
@@ -128,108 +53,77 @@ struct opie {
#define __OPIE_FLAGS_READ 2
/* Minimum length of a secret password */
-#ifndef OPIE_SECRET_MIN
-#define OPIE_SECRET_MIN 1
-#endif /* OPIE_SECRET_MIN */
+#define OPIE_SECRET_MIN 10
/* Maximum length of a secret password */
-#ifndef OPIE_SECRET_MAX
#define OPIE_SECRET_MAX 127
-#endif /* OPIE_SECRET_MAX */
/* Minimum length of a seed */
-#ifndef OPIE_SEED_MIN
#define OPIE_SEED_MIN 5
-#endif /* OPIE_SEED_MIN */
/* Maximum length of a seed */
-#ifndef OPIE_SEED_MAX
#define OPIE_SEED_MAX 16
-#endif /* OPIE_SEED_MAX */
+
+/* Max length of hash algorithm name (md4/md5) */
+#define OPIE_HASHNAME_MAX 3
/* Maximum length of a challenge (otp-md? 9999 seed) */
-#ifndef OPIE_CHALLENGE_MAX
-#define OPIE_CHALLENGE_MAX (7+1+4+1+OPIE_SEED_MAX)
-#endif /* OPIE_CHALLENGE_MAX */
+#define OPIE_CHALLENGE_MAX (4+OPIE_HASHNAME_MAX+1+4+1+OPIE_SEED_MAX)
/* Maximum length of a response that we allow */
-#ifndef OPIE_RESPONSE_MAX
#define OPIE_RESPONSE_MAX (9+1+19+1+9+OPIE_SEED_MAX+1+19+1+19+1+19)
-#endif /* OPIE_RESPONSE_MAX */
/* Maximum length of a principal (read: user name) */
-#ifndef OPIE_PRINCIPAL_MAX
#define OPIE_PRINCIPAL_MAX 32
-#endif /* OPIE_PRINCIPAL_MAX */
-
-/* Maximum sequence number */
-#ifndef OPIE_SEQUENCE_MAX
-#define OPIE_SEQUENCE_MAX 9999
-#endif /* OPIE_SEQUENCE_MAX */
-
-/* Restricted sequence number */
-#ifndef OPIE_SEQUENCE_RESTRICT
-#define OPIE_SEQUENCE_RESTRICT 9
-#endif /* OPIE_SEQUENCE_RESTRICT */
-
-#ifndef __alpha
-#define UINT4 unsigned long
-#else /* __alpha */
-#define UINT4 unsigned int
-#endif /* __alpha */
-
-struct opiemdx_ctx {
- UINT4 state[4];
- UINT4 count[2];
- unsigned char buffer[64];
-};
-struct opie_otpkey {
- UINT4 words[2];
-};
-
-#ifndef SEEK_SET
-#define SEEK_SET 0
-#endif /* SEEK_SET */
-
-#ifndef SEEK_END
-#define SEEK_END 2
-#endif /* SEEK_END */
+#include <sys/cdefs.h>
+__BEGIN_DECLS
int opieaccessfile __P((char *));
int rdnets __P((long));
int isaddr __P((register char *));
int opiealways __P((char *));
-char *opieatob8 __P((struct opie_otpkey *, char *));
-VOIDRET opiebackspace __P((char *));
-char *opiebtoa8 __P((char *, struct opie_otpkey *));
-char *opiebtoe __P((char *, struct opie_otpkey *));
-char *opiebtoh __P((char *, struct opie_otpkey *));
-int opieetob __P((struct opie_otpkey *, char *));
+char *opieatob8 __P((char *,char *));
+void opiebackspace __P((char *));
+char *opiebtoa8 __P((char *,char *));
+char *opiebtoe __P((char *,char *));
+char *opiebtoh __P((char *,char *));
+int opieetob __P((char *,char *));
int opiechallenge __P((struct opie *,char *,char *));
int opiegenerator __P((char *,char *,char *));
int opiegetsequence __P((struct opie *));
-VOIDRET opiehash __P((struct opie_otpkey *, unsigned));
+void opiehash __P((void *, unsigned));
int opiehtoi __P((register char));
-int opiekeycrunch __P((int, struct opie_otpkey *, char *, char *));
+int opiekeycrunch __P((int, char *, char *, char *));
int opielock __P((char *));
+int opieunlock __P((void));
+void opieunlockaeh __P((void));
+void opiedisableaeh __P((void));
int opielookup __P((struct opie *,char *));
-VOIDRET opiemd4init __P((struct opiemdx_ctx *));
-VOIDRET opiemd4update __P((struct opiemdx_ctx *,unsigned char *,unsigned int));
-VOIDRET opiemd4final __P((unsigned char *,struct opiemdx_ctx *));
-VOIDRET opiemd5init __P((struct opiemdx_ctx *));
-VOIDRET opiemd5update __P((struct opiemdx_ctx *,unsigned char *,unsigned int));
-VOIDRET opiemd5final __P((unsigned char *,struct opiemdx_ctx *));
int opiepasscheck __P((char *));
-VOIDRET opierandomchallenge __P((char *));
+void opierandomchallenge __P((char *));
char * opieskipspace __P((register char *));
-VOIDRET opiestripcrlf __P((char *));
+void opiestripcrlf __P((char *));
int opieverify __P((struct opie *,char *));
int opiepasswd __P((struct opie *, int, char *, int, char *, char *));
char *opiereadpass __P((char *, int, int));
int opielogin __P((char *line, char *name, char *host));
+const char *opie_get_algorithm __P((void));
+int opie_haskey __P((char *username));
+char *opie_keyinfo __P((char *));
+int opie_passverify __P((char *username, char *passwd));
+__END_DECLS
#if _OPIE
+#define VOIDPTR void *
+#define VOIDRET void
+#define NOARGS void
+#define FUNCTION(arglist, args) (args)
+#define AND ,
+#define FUNCTION_NOARGS ()
+#define UINT4 u_int32_t
+
+__BEGIN_DECLS
struct utmp;
int __opiegetutmpentry __P((char *, struct utmp *));
#ifdef EOF
@@ -238,14 +132,7 @@ FILE *__opieopen __P((char *, int, int));
int __opiereadrec __P((struct opie *));
int __opiewriterec __P((struct opie *));
int __opieparsechallenge __P((char *buffer, int *algorithm, int *sequence, char **seed, int *exts));
-
-#define opiestrncpy(dst, src, n) \
- do { \
- strncpy(dst, src, n-1); \
- dst[n-1] = 0; \
- } while(0)
-
-/* #include "missing.h" */
+__END_DECLS
#endif /* _OPIE */
#define OPIEPASSWD_CONSOLE 1
diff --git a/contrib/opie/opie_cfg.h b/contrib/opie/opie_cfg.h
index 317e2d9..be29b59 100644
--- a/contrib/opie/opie_cfg.h
+++ b/contrib/opie/opie_cfg.h
@@ -1,7 +1,7 @@
/* opie_cfg.h: Various configuration-type pieces of information for OPIE.
%%% portions-copyright-cmetz-96
-Portions of this software are Copyright 1996-1999 by Craig Metz, All Rights
+Portions of this software are Copyright 1996-1998 by Craig Metz, All Rights
Reserved. The Inner Net License Version 2 applies to these portions of
the software.
You should have received a copy of the license with this software. If
@@ -14,7 +14,6 @@ License Agreement applies to this software.
History:
- Modified by cmetz for OPIE 2.4. Removed NBBY definition.
Modified by cmetz for OPIE 2.32. Include <sys/types.h> before
<dirent.h> to make *BSD happy.
Modified by cmetz for OPIE 2.31. Added 4.4BSD-Lite pathnames.h
@@ -47,13 +46,15 @@ License Agreement applies to this software.
Modified at NRL for OPIE 2.1. Fixed sigprocmask declaration.
Gutted for autoconf. Split up for autoconf.
Written at NRL for OPIE 2.0.
+
+$FreeBSD$
*/
#ifndef _OPIE_CFG_H
#define _OPIE_CFG_H 1
-#define VERSION "2.4"
-#define DATE "Friday, January 19, 2001"
+#define VERSION "2.32"
+#define DATE "Thursday, January 1, 1998"
#ifndef unix
#define unix 1
@@ -164,6 +165,10 @@ License Agreement applies to this software.
#define MOTD_FILE "/etc/motd"
#endif
+#ifndef NBBY
+#define NBBY 8 /* Reasonable for modern systems */
+#endif /* NBBY */
+
#ifndef LOGIN_PATH
#define LOGIN_PATH "/usr/ucb:/bin:/usr/bin"
#endif /* LOGIN_PATH */
diff --git a/contrib/opie/opieaccess.5 b/contrib/opie/opieaccess.5
index e8170e2..1d8f6f3 100644
--- a/contrib/opie/opieaccess.5
+++ b/contrib/opie/opieaccess.5
@@ -7,7 +7,6 @@
.\"
.\" History:
.\"
-.\" Modified by cmetz for OPIE 2.4. Fixed "0PIE" typo.
.\" Written at NRL for OPIE 2.0.
.\"
.ll 6i
@@ -18,7 +17,7 @@
.TH OPIEACCESS 5 "January 10, 1995"
.AT 3
.SH NAME
-[/etc/]opieaccess \- OPIE database of trusted networks
+/etc/opieaccess \- OPIE database of trusted networks
.SH DESCRIPTION
The
@@ -62,17 +61,17 @@ mask Mask of the network to match
Subnets can be controlled by using the appropriate address and mask. Individual
hosts can be controlled by using the appropriate address and a mask of
-255.255.255.255. If no rules are matched, the default is to deny non-OPIE
+255.255.255.255. If no rules are matched, the default is to deny non-0PIE
logins.
.SH SEE ALSO
+.BR ftpd (8)
+.BR login (1),
.BR opie (4),
.BR opiekeys (5),
.BR opiepasswd (1),
.BR opieinfo (1),
-.BR opiesu (1),
-.BR opielogin (1),
-.BR opieftpd (8)
+.BR su (1),
.SH AUTHOR
Bellcore's S/Key was written by Phil Karn, Neil M. Haller, and John S. Walden
diff --git a/contrib/opie/opieftpd.c b/contrib/opie/opieftpd.c
index 3afb6ca..1bace12 100644
--- a/contrib/opie/opieftpd.c
+++ b/contrib/opie/opieftpd.c
@@ -1,7 +1,7 @@
/* opieftpd.c: Main program for an FTP daemon.
%%% portions-copyright-cmetz-96
-Portions of this software are Copyright 1996-1999 by Craig Metz, All Rights
+Portions of this software are Copyright 1996-1998 by Craig Metz, All Rights
Reserved. The Inner Net License Version 2 applies to these portions of
the software.
You should have received a copy of the license with this software. If
@@ -14,8 +14,6 @@ License Agreement applies to this software.
History:
- Modified by cmetz for OPIE 2.4. Add id parameter to opielogwtmp. Use
- opiestrncpy(). Fix incorrect use of setproctitle().
Modified by cmetz for OPIE 2.32. Remove include of dirent.h here; it's
done already (and conditionally) in opie_cfg.h.
Modified by cmetz for OPIE 2.31. Merged in some 4.4BSD-Lite changes.
@@ -47,6 +45,8 @@ License Agreement applies to this software.
Originally from BSD Net/2.
There is some really, really ugly code in here.
+
+$FreeBSD$
*/
/*
* Copyright (c) 1985, 1988, 1990 Regents of the University of California.
@@ -243,7 +243,7 @@ static int receive_data __P((FILE *, FILE *));
static char *gunique __P((char *));
static char *sgetsave __P((char *));
-int opielogwtmp __P((char *, char *, char *, char *));
+int opielogwtmp __P((char *, char *, char *));
int fclose __P((FILE *));
@@ -510,7 +510,7 @@ static VOIDRET end_login FUNCTION_NOARGS
if (seteuid((uid_t) 0))
syslog(LOG_ERR, "Can't set euid");
if (logged_in)
- opielogwtmp(ttyline, "", "", "ftp");
+ opielogwtmp(ttyline, "", "");
pw = NULL;
logged_in = 0;
#if DOANONYMOUS
@@ -564,7 +564,7 @@ VOIDRET pass FUNCTION((passwd), char *passwd)
/* open wtmp before chroot */
sprintf(ttyline, "ftp%d", getpid());
- opielogwtmp(ttyline, pw->pw_name, remotehost, "ftp");
+ opielogwtmp(ttyline, pw->pw_name, remotehost);
logged_in = 1;
#if DOANONYMOUS
@@ -631,10 +631,10 @@ VOIDRET pass FUNCTION((passwd), char *passwd)
if (guest) {
reply(230, "Guest login ok, access restrictions apply.");
#if DOTITLE
- setproctitle("%s: anonymous/%.*s", remotehost,
- sizeof(proctitle) - sizeof(remotehost) - sizeof(": anonymous/"),
- passwd);
-#endif /* DOTITLE */
+ snprintf(proctitle, sizeof(proctitle), "%s: anonymous/%s", remotehost,
+ passwd);
+ setproctitle("%s", proctitle);
+#endif /* DOTITLE */
syslog(LOG_NOTICE, "ANONYMOUS FTP login from %s with ID %s",
remotehost, passwd);
} else
@@ -643,8 +643,9 @@ VOIDRET pass FUNCTION((passwd), char *passwd)
reply(230, "User %s logged in.", pw->pw_name);
#if DOTITLE
- setproctitle("%s: %s", remotehost, pw->pw_name);
-#endif /* DOTITLE */
+ snprintf(proctitle, sizeof(proctitle), "%s: %s", remotehost, pw->pw_name);
+ setproctitle("%s", proctitle);
+#endif /* DOTITLE */
syslog(LOG_INFO, "FTP login from %s with user name %s", remotehost, pw->pw_name);
}
home = pw->pw_dir; /* home dir for globbing */
@@ -668,7 +669,8 @@ VOIDRET retrieve FUNCTION((cmd, name), char *cmd AND char *name)
} else {
char line[BUFSIZ];
- sprintf(line, cmd, name), name = line;
+ snprintf(line, sizeof(line), cmd, name);
+ name = line;
fin = ftpd_popen(line, "r"), closefunc = ftpd_pclose;
st.st_size = -1;
#if HAVE_ST_BLKSIZE
@@ -842,7 +844,7 @@ static FILE *dataconn FUNCTION((name, size, mode), char *name AND off_t size AND
file_size = size;
byte_count = 0;
if (size != (off_t) - 1)
- sprintf(sizebuf, " (%ld bytes)", size);
+ snprintf(sizebuf, sizeof(sizebuf), " (%ld bytes)", size);
else
strcpy(sizebuf, "");
if (pdata >= 0) {
@@ -1069,9 +1071,9 @@ VOIDRET statfilecmd FUNCTION((filename), char *filename)
int c;
#if HAVE_LS_G_FLAG
- sprintf(line, "%s %s", "/bin/ls -lgA", filename);
+ snprintf(line, sizeof(line), "%s %s", "/bin/ls -lgA", filename);
#else /* HAVE_LS_G_FLAG */
- sprintf(line, "%s %s", "/bin/ls -lA", filename);
+ snprintf(line, sizeof(line), "%s %s", "/bin/ls -lA", filename);
#endif /* HAVE_LS_G_FLAG */
fin = ftpd_popen(line, "r");
lreply(211, "status of %s:", filename);
@@ -1254,11 +1256,13 @@ static VOIDRET dolog FUNCTION((sin), struct sockaddr_in *sin)
time_t t, time();
if (hp)
- opiestrncpy(remotehost, hp->h_name, sizeof(remotehost));
+ strncpy(remotehost, hp->h_name, sizeof(remotehost));
else
- opiestrncpy(remotehost, inet_ntoa(sin->sin_addr), sizeof(remotehost));
+ strncpy(remotehost, inet_ntoa(sin->sin_addr), sizeof(remotehost));
+ remotehost[sizeof(remotehost) - 1] = '\0';
#if DOTITLE
- setproctitle("%s: connected", remotehost);
+ snprintf(proctitle, sizeof(proctitle), "%s: connected", remotehost);
+ setproctitle("%s", proctitle);
#endif /* DOTITLE */
t = time((time_t *) 0);
@@ -1276,7 +1280,7 @@ VOIDRET dologout FUNCTION((status), int status)
if (logged_in) {
if (seteuid((uid_t) 0))
syslog(LOG_ERR, "Can't set euid");
- opielogwtmp(ttyline, "", "", "ftp");
+ opielogwtmp(ttyline, "", "");
}
/* beware of flushing buffers after a SIGPIPE */
_exit(status);
@@ -1381,7 +1385,7 @@ static char *gunique FUNCTION((local), char *local)
cp = new + strlen(new);
*cp++ = '.';
for (count = 1; count < 100; count++) {
- sprintf(cp, "%d", count);
+ snprintf(cp, sizeof(new) - (cp - new), "%d", count);
if (stat(new, &st) < 0)
return (new);
}
@@ -1481,7 +1485,7 @@ VOIDRET send_file_list FUNCTION((whichfiles), char *whichfiles)
(strlen(dir->d_name) == 2))
continue;
- sprintf(nbuf, "%s/%s", dirname, dir->d_name);
+ snprintf(nbuf, sizeof(nbuf), "%s/%s", dirname, dir->d_name);
/* We have to do a stat to insure it's not a directory or special file. */
if (simple || (stat(nbuf, &st) == 0 &&
@@ -1532,7 +1536,7 @@ VOIDRET setproctitle FUNCTION((fmt, a, b, c), char *fmt AND int a AND int b AND
register int i;
char buf[BUFSIZ];
- sprintf(buf, fmt, a, b, c);
+ snprintf(buf, sizeof(buf), fmt, a, b, c);
/* make ps print our process name */
p = Argv[0];
diff --git a/contrib/opie/opieinfo.1 b/contrib/opie/opieinfo.1
index fded547..0b09455 100644
--- a/contrib/opie/opieinfo.1
+++ b/contrib/opie/opieinfo.1
@@ -1,7 +1,7 @@
.\" opieinfo.1: Manual page for the opieinfo(1) program.
.\"
.\" %%% portions-copyright-cmetz-96
-.\" Portions of this software are Copyright 1996-1999 by Craig Metz, All Rights
+.\" Portions of this software are Copyright 1996-1998 by Craig Metz, All Rights
.\" Reserved. The Inner Net License Version 2 applies to these portions of
.\" the software.
.\" You should have received a copy of the license with this software. If
@@ -19,6 +19,7 @@
.\" Written at Bellcore for the S/Key Version 1 software distribution
.\" (keyinfo.1).
.\"
+.\" $FreeBSD$
.ll 6i
.pl 10.5i
.lt 6.0i
@@ -79,9 +80,9 @@ wintermute$
.BR opie (4),
.BR opiekey (1),
.BR opiepasswd (1),
-.BR opiesu (1),
-.BR opielogin (1),
-.BR opieftpd (8),
+.BR su (1),
+.BR login (1),
+.BR ftpd (8),
.BR opiekeys (5)
.BR opieaccess (5)
diff --git a/contrib/opie/opieinfo.c b/contrib/opie/opieinfo.c
index 1c25f09..614dad6 100644
--- a/contrib/opie/opieinfo.c
+++ b/contrib/opie/opieinfo.c
@@ -2,7 +2,7 @@
opieinfo: Print a user's current OPIE sequence number and seed
%%% portions-copyright-cmetz-96
-Portions of this software are Copyright 1996-1999 by Craig Metz, All Rights
+Portions of this software are Copyright 1996-1998 by Craig Metz, All Rights
Reserved. The Inner Net License Version 2 applies to these portions of
the software.
You should have received a copy of the license with this software. If
@@ -29,29 +29,34 @@ License Agreement applies to this software.
Modified at NRL for OPIE 2.0.
Written at Bellcore for the S/Key Version 1 software distribution
(keyinfo)
+
+$FreeBSD$
+
*/
#include "opie_cfg.h"
+#include <sys/param.h>
+#include <errno.h>
#include <stdio.h>
+#include <string.h>
#if HAVE_UNISTD_H
#include <unistd.h>
#endif /* HAVE_UNISTD_H */
-#if HAVE_PWD_H
-#include <pwd.h>
-#endif /* HAVE_PWD_H */
#include "opie.h"
/* extern char *optarg; */
-extern int errno, optind;
+/* extern int errno, optind; */
static char *getusername FUNCTION_NOARGS
{
- struct passwd *p = getpwuid(getuid());
-
- if (!p)
- return getlogin();
+ char *login;
- return p->pw_name;
+ login = getlogin();
+ if (login == NULL) {
+ fprintf(stderr, "Cannot find login name\n");
+ exit(1);
+ }
+ return login;
}
int main FUNCTION((argc, argv), int argc AND char *argv[])
@@ -71,11 +76,20 @@ int main FUNCTION((argc, argv), int argc AND char *argv[])
}
}
- if (optind < argc)
+ if (optind < argc) {
+ if (getuid() != 0) {
+ fprintf(stderr, "Only superuser may get another user's keys\n");
+ exit(1);
+ }
username = argv[optind];
- else
+ } else
username = getusername();
+ if (strlen(username) >= MAXLOGNAME) {
+ fprintf(stderr, "Username too long.\n");
+ exit(1);
+ }
+
if ((i = opielookup(&opie, username)) && (i != 2)) {
if (i < 0)
fprintf(stderr, "Error opening database! (errno = %d)\n", errno);
diff --git a/contrib/opie/opiekey.1 b/contrib/opie/opiekey.1
index e110e5e..4adf0ef 100644
--- a/contrib/opie/opiekey.1
+++ b/contrib/opie/opiekey.1
@@ -1,7 +1,7 @@
.\" opiekey.1: Manual page for the opiekey(1) program.
.\"
.\" %%% portions-copyright-cmetz-96
-.\" Portions of this software are Copyright 1996-1999 by Craig Metz, All Rights
+.\" Portions of this software are Copyright 1996-1998 by Craig Metz, All Rights
.\" Reserved. The Inner Net License Version 2 applies to these portions of
.\" the software.
.\" You should have received a copy of the license with this software. If
@@ -25,6 +25,7 @@
.\" Written at Bellcore for the S/Key Version 1 software distribution
.\" (key.1).
.\"
+.\" $FreeBSD$
.ll 6i
.pl 10.5i
.lt 6.0i
@@ -90,7 +91,7 @@ build of OPIE.
.TP
.B \-a
Allows you to input an arbitrary secret pass phrase, instead of running checks
-against it. Arbitrary currently does not include '\0' or '\n' characters. This
+against it. Arbitrary currently does not include '\\0' or '\\n' characters. This
can be used for backwards compatibility with key generators that do not check
passwords.
.TP
@@ -149,15 +150,15 @@ this mistake. Better checks are needed.
.LP
.SH SEE ALSO
+.BR ftpd (8),
+.BR login (1),
.BR opie (4),
.BR opiepasswd (1),
.BR opieinfo (1),
-.BR opiesu (1),
-.BR opielogin (1),
-.BR opieftpd (8),
.BR opiekeys (5),
.BR opieaccess (5),
.BR opiegen (1)
+.BR su (1),
.SH AUTHOR
Bellcore's S/Key was written by Phil Karn, Neil M. Haller, and John S. Walden
diff --git a/contrib/opie/opiekey.c b/contrib/opie/opiekey.c
index cb80a3b..32a1f9c 100644
--- a/contrib/opie/opiekey.c
+++ b/contrib/opie/opiekey.c
@@ -5,7 +5,7 @@
and outputs a response.
%%% portions-copyright-cmetz-96
-Portions of this software are Copyright 1996-1999 by Craig Metz, All Rights
+Portions of this software are Copyright 1996-1998 by Craig Metz, All Rights
Reserved. The Inner Net License Version 2 applies to these portions of
the software.
You should have received a copy of the license with this software. If
@@ -18,7 +18,6 @@ License Agreement applies to this software.
History:
- Modified by cmetz for OPIE 2.4. Use struct opie_key for key blocks.
Modified by cmetz for OPIE 2.31. Renamed "init" and RESPONSE_INIT
to "init-hex" and RESPONSE_INIT_HEX. Removed active attack
protection support.
@@ -36,6 +35,9 @@ License Agreement applies to this software.
Modified at NRL for OPIE 2.0.
Written at Bellcore for the S/Key Version 1 software distribution
(skey.c).
+
+$FreeBSD$
+
*/
#include "opie_cfg.h"
@@ -117,7 +119,7 @@ static void getsecret FUNCTION((secret, promptextra, retype), char *secret AND c
}
memset(verify, 0, sizeof(verify));
}
- if (!(flags & 2) && opiepasscheck(secret)) {
+ if (!(flags & 2) && !aflag && opiepasscheck(secret)) {
memset(secret, 0, sizeof(secret));
fprintf(stderr, "Secret pass phrases must be between %d and %d characters long.\n", OPIE_SECRET_MIN, OPIE_SECRET_MAX);
exit(1);
@@ -133,13 +135,13 @@ int main FUNCTION((argc, argv), int argc AND char *argv[])
int i;
int count = 1;
char secret[OPIE_SECRET_MAX + 1], newsecret[OPIE_SECRET_MAX + 1];
- struct opie_otpkey key, newkey;
+ char key[8], newkey[8];
char *seed, newseed[OPIE_SEED_MAX + 1];
char response[OPIE_RESPONSE_MAX + 1];
char *slash;
int hex = 0;
int type = RESPONSE_STANDARD;
- int force;
+ int force = 0;
if (slash = strchr(argv[0], '/'))
slash++;
@@ -264,13 +266,13 @@ int main FUNCTION((argc, argv), int argc AND char *argv[])
goto error;
}
- if (opiekeycrunch(algorithm, &newkey, newseed, newsecret)) {
+ if (opiekeycrunch(algorithm, newkey, newseed, newsecret)) {
fprintf(stderr, "%s: key crunch failed (1)\n", argv[0]);
goto error;
}
for (i = 0; i < 499; i++)
- opiehash(&newkey, algorithm);
+ opiehash(newkey, algorithm);
} else
#if RETYPE
getsecret(secret, "", 1);
@@ -279,13 +281,13 @@ int main FUNCTION((argc, argv), int argc AND char *argv[])
#endif /* RETYPE */
/* Crunch seed and secret password into starting key normally */
- if (opiekeycrunch(algorithm, &key, seed, secret)) {
+ if (opiekeycrunch(algorithm, key, seed, secret)) {
fprintf(stderr, "%s: key crunch failed\n", argv[0]);
goto error;
}
for (i = 0; i <= (keynum - count); i++)
- opiehash(&key, algorithm);
+ opiehash(key, algorithm);
{
char buf[OPIE_SEED_MAX + 48 + 1];
@@ -298,37 +300,37 @@ int main FUNCTION((argc, argv), int argc AND char *argv[])
switch(type) {
case RESPONSE_STANDARD:
if (hex)
- opiebtoh(response, &key);
+ opiebtoh(response, key);
else
- opiebtoe(response, &key);
+ opiebtoe(response, key);
break;
case RESPONSE_WORD:
strcpy(response, "word:");
- strcat(response, opiebtoe(buf, &key));
+ strcat(response, opiebtoe(buf, key));
break;
case RESPONSE_HEX:
strcpy(response, "hex:");
- strcat(response, opiebtoh(buf, &key));
+ strcat(response, opiebtoh(buf, key));
break;
case RESPONSE_INIT_HEX:
case RESPONSE_INIT_WORD:
if (type == RESPONSE_INIT_HEX) {
strcpy(response, "init-hex:");
- strcat(response, opiebtoh(buf, &key));
+ strcat(response, opiebtoh(buf, key));
sprintf(buf, ":%s 499 %s:", algids[algorithm], newseed);
strcat(response, buf);
- strcat(response, opiebtoh(buf, &newkey));
+ strcat(response, opiebtoh(buf, newkey));
} else {
strcpy(response, "init-word:");
- strcat(response, opiebtoe(buf, &key));
+ strcat(response, opiebtoe(buf, key));
sprintf(buf, ":%s 499 %s:", algids[algorithm], newseed);
strcat(response, buf);
- strcat(response, opiebtoe(buf, &newkey));
+ strcat(response, opiebtoe(buf, newkey));
}
break;
}
puts(response);
- opiehash(&key, algorithm);
+ opiehash(key, algorithm);
}
}
diff --git a/contrib/opie/opiekeys.5 b/contrib/opie/opiekeys.5
index 50041d6..26f08ed 100644
--- a/contrib/opie/opiekeys.5
+++ b/contrib/opie/opiekeys.5
@@ -14,12 +14,13 @@
.ll 6i
.pl 10.5i
.\" @(#)opiekeys.5 2.0 (NRL) 1/10/95
+.\" $FreeBSD$
.\"
.lt 6.0i
.TH OPIEKEYS 5 "January 10, 1995"
.AT 3
.SH NAME
-[/etc/]opiekeys \- OPIE database of user key information
+/etc/opiekeys \- OPIE database of user key information
.SH DESCRIPTION
The
@@ -46,13 +47,13 @@ date Last change date.
time Last change time.
.fi
.SH SEE ALSO
+.BR ftpd (8)
+.BR login (1),
.BR opie (4),
.BR opiekeys (5),
.BR opiepasswd (1),
.BR opieinfo (1),
-.BR opiesu (1),
-.BR opielogin (1),
-.BR opieftpd (8)
+.BR su (1),
.SH AUTHOR
Bellcore's S/Key was written by Phil Karn, Neil M. Haller, and John S. Walden
diff --git a/contrib/opie/opiepasswd.1 b/contrib/opie/opiepasswd.1
index e1c93fb..d3fc5e3 100644
--- a/contrib/opie/opiepasswd.1
+++ b/contrib/opie/opiepasswd.1
@@ -1,7 +1,7 @@
.\" opiepasswd.1: Manual page for the opiepasswd(1) program.
.\"
.\" %%% portions-copyright-cmetz-96
-.\" Portions of this software are Copyright 1996-1999 by Craig Metz, All Rights
+.\" Portions of this software are Copyright 1996-1998 by Craig Metz, All Rights
.\" Reserved. The Inner Net License Version 2 applies to these portions of
.\" the software.
.\" You should have received a copy of the license with this software. If
@@ -14,7 +14,6 @@
.\"
.\" History:
.\"
-.\" Modified by cmetz for OPIE 2.4. Fixed spelling bug.
.\" Modified by cmetz for OPIE 2.3. Added -f flag documentation.
.\" Updated console example.
.\" Modified by cmetz for OPIE 2.2. Removed MJR DES documentation.
@@ -22,6 +21,7 @@
.\" Written at Bellcore for the S/Key Version 1 software distribution
.\" (keyinit.1).
.\"
+.\" $FreeBSD$
.ll 6i
.pl 10.5i
.lt 6.0i
@@ -36,7 +36,7 @@ system.
[\-v] [\-h] [\-c|\-d] [\-f]
.sp 0
[\-n
-.I initial_sequence_number
+.I inital_sequence_number
]
[\-s
.I seed
@@ -153,13 +153,13 @@ wintermute$
/etc/opiekeys -- database of key information for the OPIE system.
.SH SEE ALSO
+.BR ftpd (8),
+.BR login (1),
.BR passwd (1),
.BR opie (4),
.BR opiekey (1),
.BR opieinfo (1),
-.BR opiesu (1),
-.BR opielogin (1),
-.BR opieftpd (8),
+.BR su (1),
.BR opiekeys (5),
.BR opieaccess (5)
diff --git a/contrib/opie/opiepasswd.c b/contrib/opie/opiepasswd.c
index 5e49144..6cb2728 100644
--- a/contrib/opie/opiepasswd.c
+++ b/contrib/opie/opiepasswd.c
@@ -1,7 +1,7 @@
/* opiepasswd.c: Add/change an OTP password in the key database.
%%% portions-copyright-cmetz-96
-Portions of this software are Copyright 1996-1999 by Craig Metz, All Rights
+Portions of this software are Copyright 1996-1998 by Craig Metz, All Rights
Reserved. The Inner Net License Version 2 applies to these portions of
the software.
You should have received a copy of the license with this software. If
@@ -14,8 +14,6 @@ License Agreement applies to this software.
History:
- Modified by cmetz for OPIE 2.4. Use struct opie_key for key blocks.
- Use opiestrncpy().
Modified by cmetz for OPIE 2.32. Use OPIE_SEED_MAX instead of
hard coding the length. Unlock user on failed lookup.
Modified by cmetz for OPIE 2.3. Got of some variables and made some
@@ -43,6 +41,8 @@ License Agreement applies to this software.
Modified heavily at NRL for OPIE 2.0.
Written at Bellcore for the S/Key Version 1 software distribution
(skeyinit.c).
+
+ $FreeBSD$
*/
#include "opie_cfg.h"
@@ -97,13 +97,12 @@ static VOIDRET finish FUNCTION((name), char *name)
}
printf("OTP key is %d %s\n", opie.opie_n, opie.opie_seed);
{
- struct opie_otpkey key;
-
- if (!opieatob8(&key, opie.opie_val)) {
+ char key[8];
+ if (!opieatob8(key, opie.opie_val)) {
fprintf(stderr, "Error verifying key -- possible database corruption.\n");
finish(NULL);
}
- printf("%s\n", opiebtoe(buf, &key));
+ printf("%s\n", opiebtoe(buf, key));
}
}
@@ -120,7 +119,7 @@ int main FUNCTION((argc, argv), int argc AND char *argv[])
memset(seed, 0, sizeof(seed));
- if (!(pp = getpwuid(getuid()))) {
+ if (!(pp = getpwnam(getlogin()))) {
fprintf(stderr, "Who are you?");
return 1;
}
@@ -157,7 +156,8 @@ int main FUNCTION((argc, argv), int argc AND char *argv[])
OPIE_SEED_MIN, OPIE_SEED_MAX);
finish(NULL);
}
- opiestrncpy(seed, optarg, sizeof(seed));
+ strncpy(seed, optarg, sizeof(seed));
+ seed[sizeof(seed) - 1] = 0;
break;
default:
usage(argv[0]);
@@ -242,7 +242,7 @@ int main FUNCTION((argc, argv), int argc AND char *argv[])
{
char *c;
if (c = strrchr(tmp, ' '))
- opiestrncpy(oseed, c + 1, sizeof(oseed));
+ strncpy(oseed, c + 1, sizeof(oseed));
else {
#if DEBUG
fprintf(stderr, "opiepasswd: bogus challenge\n");
@@ -278,7 +278,7 @@ int main FUNCTION((argc, argv), int argc AND char *argv[])
{
char *c;
if (c = strrchr(tmp, ' '))
- opiestrncpy(nseed, c + 1, sizeof(nseed));
+ strncpy(nseed, c + 1, sizeof(nseed));
else {
#if DEBUG
fprintf(stderr, "opiepasswd: bogus challenge\n");
@@ -349,18 +349,18 @@ int main FUNCTION((argc, argv), int argc AND char *argv[])
finish(NULL);
}
{
- struct opie_otpkey key;
+ char key[8];
char tbuf[OPIE_RESPONSE_MAX + 1];
- if (opiekeycrunch(MDX, &key, opie.opie_seed, passwd) != 0) {
+ if (opiekeycrunch(MDX, key, opie.opie_seed, passwd) != 0) {
fprintf(stderr, "%s: key crunch failed. Secret pass phrase unchanged\n", argv[0]);
finish(NULL);
}
memset(passwd, 0, sizeof(passwd));
i = opie.opie_n - 1;
while (i-- != 0)
- opiehash(&key, MDX);
- opiebtoe(tbuf, &key);
+ opiehash(key, MDX);
+ opiebtoe(tbuf, key);
if (opieverify(&opie, tbuf)) {
fprintf(stderr, "Sorry.\n");
finish(NULL);
diff --git a/contrib/opie/options.h b/contrib/opie/options.h
deleted file mode 100644
index 05f1e55..0000000
--- a/contrib/opie/options.h
+++ /dev/null
@@ -1,85 +0,0 @@
-/* options.h: Configuration options the end user might want to tweak.
-
-%%% copyright-cmetz
-This software is Copyright 1996 by Craig Metz, All Rights Reserved.
-The Inner Net License Version 2 applies to this software.
-You should have received a copy of the license with this software. If
-you didn't get a copy, you may request one from <license@inner.net>.
-
- History:
-
- Created by cmetz for OPIE 2.3 using the old Makefile.source as a
- guide.
-*/
-/*
- Which hash should the OPIE server software use?
-
- We strongly recommend that you use MD5. MD4 is faster, but less secure.
-If you are migrating from Bellcore S/Key version 1 and wish to use the
-existing key database, you must use MD4. In this case, you should consider
-ways to re-key your users using MD5.
-*/
-
-#define MDX 5 /* Use MD5 */
-/* #define MDX 4 /* Use MD4 */
-
-/*
- Ask users to re-type their secret pass phrases?
-
- Doing so helps catch typing mistakes, but some users find it annoying.
-*/
-
-/* #define RETYPE 1 /* Ask users to re-type their secret pass phrases */
-#define RETYPE 0 /* Don't ask users to re-type their secret pass phrases */
-
-/*
- Generater lock files to serialize OTP logins?
-
- There is a potential race attack on OTP when more than one session can
-respond to the same challenge at the same time. This locking only allows
-one session at a time per principal (user) to attempt to log in using OTP.
-The locking, however, creates a denial-of-service attack as a trade-off and
-can be annoying if you have a legitimate need for two sessions to attempt
-to authenticate as the same principal at the same time.
-*/
-
-#define USER_LOCKING 1 /* Serialize OTP challenges for a principal */
-/* #define USER_LOCKING 0 /* Don't serialize OTP challenges */
-
-/*
- Should su(8) refuse to switch to disabled accounts?
-
- Traditionally, su(8) can switch to any account, even if it is disabled.
-In most systems, there is no legitimate need for this capability and it can
-create security problems.
-*/
-
-#define SU_STAR_CHECK 1 /* Refuse to switch to disabled accounts */
-/* #define SU_STAR_CHECK 0 /* Allow switching to disabled accounts */
-
-/*
- Should OPIE use more informative prompts?
-
- The new-style, more informative prompts better indicate to the user what
-is being asked for. However, some automated login scripts depend on the
-wording of some prompts and will fail if you change them.
-*/
-
-#define NEW_PROMPTS 1 /* Use the more informative prompts */
-/* #define NEW_PROMPTS 0 /* Use the more compatible prompts */
-
-/*
- Should the user be allowed to override "insecure" terminal checks?
-
- The "insecure" terminal checks are designed to help make it more clear
-to users that they shouldn't disclose their secret over insecure lines
-by refusing to accept the secret directly. These checks aren't perfect and
-sometimes will cause OPIE to refuse to work when it really should. Allowing
-users to override the terminal checks also helps the process of creating
-OTP sequences for users. However, allowing users to override the terminal
-checks also allows users to shoot themselves in the foot, which isn't usually
-what you want.
-*/
-
-#define INSECURE_OVERRIDE 0 /* Don't allow users to override the checks */
-/* #define INSECURE_OVERRIDE 1 /* Allow users to override the checks */
OpenPOWER on IntegriCloud