From 56584647e29241f4a7b695b84a38f51cb72bba56 Mon Sep 17 00:00:00 2001 From: Theodore Tso Date: Wed, 27 May 1998 19:12:45 +0000 Subject: [PATCH] login.c (dolastlog): BSD 4.4 systems don't have lastlog.h, but still define struct lastlog somewhere. Included from Dima Ruban's FreeBSD patches. krlogin.c: Include sys/ioctl_compat.h if it is present (instead of just for 386BSD). loginpaths.h (LPATH): If the OS provides _PATH_DEFPATH, use it to define LPATH and RPATH. login.c: #include paths.h if present, and use it to set the pathnames for certain common files. configure.in (withval): Check for and git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@10586 dc483132-0cff-0310-8789-dd5450dbe970 --- src/appl/bsd/ChangeLog | 18 ++++++++++++++++++ src/appl/bsd/configure.in | 2 +- src/appl/bsd/krlogin.c | 2 +- src/appl/bsd/login.c | 36 ++++++++++++++++++++++++++++++------ src/appl/bsd/loginpaths.h | 5 +++++ 5 files changed, 55 insertions(+), 8 deletions(-) diff --git a/src/appl/bsd/ChangeLog b/src/appl/bsd/ChangeLog index 00b6d4bf1..1ccedefd4 100644 --- a/src/appl/bsd/ChangeLog +++ b/src/appl/bsd/ChangeLog @@ -1,3 +1,21 @@ +1998-05-26 Theodore Ts'o + + * login.c (dolastlog): BSD 4.4 systems don't have lastlog.h, but + still define struct lastlog somewhere. Included from Dima + Ruban's FreeBSD patches. + + * krlogin.c: Include sys/ioctl_compat.h if it is present (instead + of just for 386BSD). + + * loginpaths.h (LPATH): If the OS provides _PATH_DEFPATH, use it + to define LPATH and RPATH. + + * login.c: #include paths.h if present, and use it to set the + pathnames for certain common files. + + * configure.in (withval): Check for and + + Sat May 16 16:07:42 1998 Tom Yu * login.c: Replace strcpy with strncpy in places. Add nul diff --git a/src/appl/bsd/configure.in b/src/appl/bsd/configure.in index 25c3d1703..e9895225a 100644 --- a/src/appl/bsd/configure.in +++ b/src/appl/bsd/configure.in @@ -64,7 +64,7 @@ dnl AC_VFORK AC_TYPE_MODE_T AC_CHECK_FUNCS(isatty inet_aton gettosbyname killpg initgroups setpriority setreuid setresuid waitpid setsid ptsname setlogin tcgetpgrp tcsetpgrp setpgid strsave utimes) -AC_CHECK_HEADERS(unistd.h stdlib.h string.h sys/filio.h sys/sockio.h sys/label.h sys/tty.h ttyent.h lastlog.h sys/select.h sys/ptyvar.h utmp.h sys/time.h krb4-proto.h) +AC_CHECK_HEADERS(unistd.h stdlib.h string.h sys/filio.h sys/sockio.h sys/label.h sys/tty.h ttyent.h lastlog.h sys/select.h sys/ptyvar.h utmp.h sys/time.h krb4-proto.h sys/ioctl_compat.h paths.h) AC_HEADER_STDARG AC_REPLACE_FUNCS(getdtablesize) KRB5_SIGTYPE diff --git a/src/appl/bsd/krlogin.c b/src/appl/bsd/krlogin.c index e3f89788c..baa9fb1a2 100644 --- a/src/appl/bsd/krlogin.c +++ b/src/appl/bsd/krlogin.c @@ -120,7 +120,7 @@ char copyright[] = #define TIOCPKT_FLUSHWRITE 0x02 #endif -#ifdef __386BSD__ +#ifdef HAVE_SYS_IOCTL_COMPAT_H #include #endif diff --git a/src/appl/bsd/login.c b/src/appl/bsd/login.c index 9a5b2f8b7..cb18f4c2c 100644 --- a/src/appl/bsd/login.c +++ b/src/appl/bsd/login.c @@ -204,6 +204,10 @@ static const char * krb_get_err_text(kerror) #endif #endif +#ifdef HAVE_PATHS_H +#include +#endif + #include "loginpaths.h" #ifdef POSIX_TERMIOS @@ -231,12 +235,33 @@ static const char * krb_get_err_text(kerror) #define TTYGRPNAME "tty" /* name of group to own ttys */ +#if defined(_PATH_MAILDIR) +#define MAILDIR _PATH_MAILDIR +#else +#define MAILDIR "/usr/spool/mail" +#endif +#if defined(_PATH_NOLOGIN) +#define NOLOGIN _PATH_NOLOGIN +#else +#define NOLOGIN "/etc/nologin" +#endif +#if defined(_PATH_LASTLOG) +#define LASTLOG _PATH_LASTLOG +#else +#define LASTLOG "/usr/adm/lastlog" +#endif +#if defined(_PATH_BSHELL) +#define BSHELL _PATH_BSHELL +#else +#define BSHELL "/bin/sh" +#endif + +#if (defined(BSD) && (BSD >= 199103)) /* no /usr/ucb */ +#define QUOTAWARN "/usr/bin/quota" +#endif + #define MOTDFILE "/etc/motd" -#define MAILDIR "/usr/spool/mail" -#define NOLOGIN "/etc/nologin" #define HUSHLOGIN ".hushlogin" -#define LASTLOG "/usr/adm/lastlog" -#define BSHELL "/bin/sh" #if !defined(OQUOTA) && !defined(QUOTAWARN) #define QUOTAWARN "/usr/ucb/quota" /* warn user about quotas */ @@ -1401,7 +1426,6 @@ int rewrite_ccache = 1; /*try to write out ccache*/ if (pwd == NULL || pwd->pw_uid) checknologin(); - /* * Allows automatic login by root. * If not invoked by root, disallow if the uid's differ. @@ -2201,7 +2225,7 @@ void dolastlog(quiet, tty) int quiet; char *tty; { -#ifdef HAVE_LASTLOG_H +#if defined(HAVE_LASTLOG_H) || (defined(BSD) && (BSD >= 199103)) struct lastlog ll; int fd; diff --git a/src/appl/bsd/loginpaths.h b/src/appl/bsd/loginpaths.h index 99d28b091..41683ee38 100644 --- a/src/appl/bsd/loginpaths.h +++ b/src/appl/bsd/loginpaths.h @@ -95,6 +95,11 @@ #endif #endif +#ifdef _PATH_DEFPATH +#define LPATH _PATH_DEFPATH +#define RPATH _PATH_DEFPATH +#endif + /* catch-all entries for operating systems we haven't looked up hardcoded paths for */ #ifndef LPATH -- 2.26.2