mblogin updates for FreeBSD
This commit is contained in:
parent
202fe3f0b1
commit
ce20472e98
@ -8,6 +8,9 @@
|
|||||||
/* Memory debugging */
|
/* Memory debugging */
|
||||||
#undef MEMWATCH
|
#undef MEMWATCH
|
||||||
|
|
||||||
|
/* Define if you have the snprintf function. */
|
||||||
|
#undef HAVE_SNPRINTF
|
||||||
|
|
||||||
/* Has strcasestr function */
|
/* Has strcasestr function */
|
||||||
#undef HAVE_STRCASESTR
|
#undef HAVE_STRCASESTR
|
||||||
|
|
||||||
@ -340,6 +343,12 @@
|
|||||||
/* Define if `utime(file, NULL)' sets file's timestamp to the present. */
|
/* Define if `utime(file, NULL)' sets file's timestamp to the present. */
|
||||||
#undef HAVE_UTIME_NULL
|
#undef HAVE_UTIME_NULL
|
||||||
|
|
||||||
|
/* Define if you have the <utmp.h> header file. */
|
||||||
|
#undef HAVE_UTMP_H
|
||||||
|
|
||||||
|
/* Define if you have the <utmpx.h> header file. */
|
||||||
|
#undef HAVE_UTMPX_H
|
||||||
|
|
||||||
/* Define if you have the <vfork.h> header file. */
|
/* Define if you have the <vfork.h> header file. */
|
||||||
#undef HAVE_VFORK_H
|
#undef HAVE_VFORK_H
|
||||||
|
|
||||||
|
@ -15,7 +15,7 @@ SRCS = bank.c commonio.c filesub.c language.c mbtoberep.c \
|
|||||||
door.c dispfile.c userlist.c timestats.c logentry.c pw_util.c \
|
door.c dispfile.c userlist.c timestats.c logentry.c pw_util.c \
|
||||||
mblogin.c env.c chowntty.c ttytype.c shell.c basename.c \
|
mblogin.c env.c chowntty.c ttytype.c shell.c basename.c \
|
||||||
failure.c pwdcheck.c pwauth.c loginprompt.c utmp.c limits.c \
|
failure.c pwdcheck.c pwauth.c loginprompt.c utmp.c limits.c \
|
||||||
setupenv.c sub.c ulimit.c log.c tz.c setugid.c
|
setupenv.c sub.c ulimit.c log.c tz.c setugid.c utent.c
|
||||||
HDRS = bank.h commonio.h filesub.h language.h mbsebbs.h misc.h offline.h \
|
HDRS = bank.h commonio.h filesub.h language.h mbsebbs.h misc.h offline.h \
|
||||||
putpwent.h salt.h timeout.h bbslist.h email.h fsedit.h lineedit.h \
|
putpwent.h salt.h timeout.h bbslist.h email.h fsedit.h lineedit.h \
|
||||||
mbstat.h msgutil.h oneline.h sgetpwent.h user.h bye.h morefile.h \
|
mbstat.h msgutil.h oneline.h sgetpwent.h user.h bye.h morefile.h \
|
||||||
@ -26,7 +26,7 @@ HDRS = bank.h commonio.h filesub.h language.h mbsebbs.h misc.h offline.h \
|
|||||||
door.h dispfile.h userlist.h timestats.h logentry.h lastcallers.h pw_util.h \
|
door.h dispfile.h userlist.h timestats.h logentry.h lastcallers.h pw_util.h \
|
||||||
mblogin.h env.h chowntty.h ttytype.h shell.h basename.h \
|
mblogin.h env.h chowntty.h ttytype.h shell.h basename.h \
|
||||||
failure.h pwdcheck.h pwauth.h loginprompt.h utmp.h limits.h \
|
failure.h pwdcheck.h pwauth.h loginprompt.h utmp.h limits.h \
|
||||||
setupenv.h sub.h ulimit.h log.h tz.h setugid.h
|
setupenv.h sub.h ulimit.h log.h tz.h setugid.h utent.h
|
||||||
MBSEBBS_OBJS = bank.o bbslist.o chat.o file.o funcs.o mail.o menu.o \
|
MBSEBBS_OBJS = bank.o bbslist.o chat.o file.o funcs.o mail.o menu.o \
|
||||||
misc.o pinfo.o nextuser.o oneline.o page.o fsedit.o \
|
misc.o pinfo.o nextuser.o oneline.o page.o fsedit.o \
|
||||||
bye.o change.o mbsebbs.o safe.o timeout.o user.o timecheck.o \
|
bye.o change.o mbsebbs.o safe.o timeout.o user.o timecheck.o \
|
||||||
@ -57,7 +57,7 @@ MBPASSWD_OBJS = mbpasswd.o commonio.o pwio.o shadowio.o sgetpwent.o \
|
|||||||
xmalloc.o myname.o rad64.o salt.o getdef.o encrypt.o putpwent.o pw_util.o
|
xmalloc.o myname.o rad64.o salt.o getdef.o encrypt.o putpwent.o pw_util.o
|
||||||
MBLOGIN_OBJS = getdef.o env.o chowntty.o ttytype.o shell.o basename.o failure.o \
|
MBLOGIN_OBJS = getdef.o env.o chowntty.o ttytype.o shell.o basename.o failure.o \
|
||||||
pwdcheck.o pwauth.o encrypt.o loginprompt.o utmp.o limits.o setupenv.o sub.o \
|
pwdcheck.o pwauth.o encrypt.o loginprompt.o utmp.o limits.o setupenv.o sub.o \
|
||||||
xmalloc.o ulimit.o log.o tz.o setugid.o mblogin.o
|
xmalloc.o ulimit.o log.o tz.o setugid.o utent.o mblogin.o
|
||||||
OTHER = Makefile
|
OTHER = Makefile
|
||||||
TARGET = mbsebbs mbnewusr mball mblang mbchat mbstat mbtoberep mbuser mbuseradd mbpasswd mblogin
|
TARGET = mbsebbs mbnewusr mball mblang mbchat mbstat mbtoberep mbuser mbuseradd mbpasswd mblogin
|
||||||
|
|
||||||
@ -238,4 +238,5 @@ ulimit.o: ../config.h ulimit.h
|
|||||||
log.o: ../config.h mblogin.h log.h
|
log.o: ../config.h mblogin.h log.h
|
||||||
tz.o: ../config.h mblogin.h getdef.h tz.h
|
tz.o: ../config.h mblogin.h getdef.h tz.h
|
||||||
setugid.o: ../config.h mblogin.h getdef.h setugid.h
|
setugid.o: ../config.h mblogin.h getdef.h setugid.h
|
||||||
|
utent.o: ../config.h mblogin.h
|
||||||
# End of generated dependencies
|
# End of generated dependencies
|
||||||
|
@ -138,10 +138,12 @@ int check_logins(const char *name, const char *maxlogins)
|
|||||||
if (ut->ut_type != USER_PROCESS)
|
if (ut->ut_type != USER_PROCESS)
|
||||||
continue;
|
continue;
|
||||||
#endif
|
#endif
|
||||||
|
#ifndef __FreeBSD__
|
||||||
if (ut->ut_user[0] == '\0')
|
if (ut->ut_user[0] == '\0')
|
||||||
continue;
|
continue;
|
||||||
if (strncmp(name, ut->ut_user, sizeof(ut->ut_user)) != 0)
|
if (strncmp(name, ut->ut_user, sizeof(ut->ut_user)) != 0)
|
||||||
continue;
|
continue;
|
||||||
|
#endif
|
||||||
if (++count > limit)
|
if (++count > limit)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -37,11 +37,7 @@
|
|||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
#include "mblogin.h"
|
#include "mblogin.h"
|
||||||
#if HAVE_LASTLOG_H
|
#include <utmp.h>
|
||||||
#include <lastlog.h>
|
|
||||||
#else
|
|
||||||
// #include "lastlog_.h"
|
|
||||||
#endif
|
|
||||||
#include "log.h"
|
#include "log.h"
|
||||||
|
|
||||||
|
|
||||||
@ -91,7 +87,7 @@ void dolastlog(struct lastlog *ll, const struct passwd *pw, const char *line, co
|
|||||||
|
|
||||||
time(&newlog.ll_time);
|
time(&newlog.ll_time);
|
||||||
strncpy(newlog.ll_line, line, sizeof newlog.ll_line);
|
strncpy(newlog.ll_line, line, sizeof newlog.ll_line);
|
||||||
#if HAVE_LL_HOST
|
#ifdef HAVE_LL_HOST
|
||||||
strncpy(newlog.ll_host, host, sizeof newlog.ll_host);
|
strncpy(newlog.ll_host, host, sizeof newlog.ll_host);
|
||||||
#endif
|
#endif
|
||||||
if (lseek(fd, offset, SEEK_SET) == offset)
|
if (lseek(fd, offset, SEEK_SET) == offset)
|
||||||
|
@ -47,7 +47,7 @@
|
|||||||
#endif
|
#endif
|
||||||
#include <signal.h>
|
#include <signal.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <lastlog.h>
|
#include <utmp.h>
|
||||||
#include "getdef.h"
|
#include "getdef.h"
|
||||||
|
|
||||||
#ifdef SVR4_SI86_EUA
|
#ifdef SVR4_SI86_EUA
|
||||||
@ -725,7 +725,9 @@ auth_ok:
|
|||||||
else
|
else
|
||||||
failent_user = "UNKNOWN";
|
failent_user = "UNKNOWN";
|
||||||
}
|
}
|
||||||
|
#ifndef __FreeBSD__
|
||||||
strncpy(failent.ut_user, failent_user, sizeof(failent.ut_user));
|
strncpy(failent.ut_user, failent_user, sizeof(failent.ut_user));
|
||||||
|
#endif
|
||||||
#ifdef USER_PROCESS
|
#ifdef USER_PROCESS
|
||||||
failent.ut_type = USER_PROCESS;
|
failent.ut_type = USER_PROCESS;
|
||||||
#endif
|
#endif
|
||||||
@ -780,7 +782,11 @@ auth_ok:
|
|||||||
if (getenv("IFS")) /* don't export user IFS ... */
|
if (getenv("IFS")) /* don't export user IFS ... */
|
||||||
addenv("IFS= \t\n", NULL); /* ... instead, set a safe IFS */
|
addenv("IFS= \t\n", NULL); /* ... instead, set a safe IFS */
|
||||||
|
|
||||||
|
#ifdef __FreeBSD__
|
||||||
|
setutmp(username, tty); /* make entry in utmp & wtmp files */
|
||||||
|
#else
|
||||||
setutmp(username, tty, hostname); /* make entry in utmp & wtmp files */
|
setutmp(username, tty, hostname); /* make entry in utmp & wtmp files */
|
||||||
|
#endif
|
||||||
if (pwent.pw_shell[0] == '*') { /* subsystem root */
|
if (pwent.pw_shell[0] == '*') { /* subsystem root */
|
||||||
subsystem (&pwent); /* figure out what to execute */
|
subsystem (&pwent); /* figure out what to execute */
|
||||||
subroot++; /* say i was here again */
|
subroot++; /* say i was here again */
|
||||||
|
114
mbsebbs/utent.c
Normal file
114
mbsebbs/utent.c
Normal file
@ -0,0 +1,114 @@
|
|||||||
|
/*****************************************************************************
|
||||||
|
*
|
||||||
|
* $Id$
|
||||||
|
* Purpose ...............: MBSE BBS Shadow Password Suite
|
||||||
|
* Original Source .......: Shadow Password Suite
|
||||||
|
* Original Copyright ....: Julianne Frances Haugh and others.
|
||||||
|
*
|
||||||
|
*****************************************************************************
|
||||||
|
* Copyright (C) 1997-2001
|
||||||
|
*
|
||||||
|
* Michiel Broek FIDO: 2:280/2802
|
||||||
|
* Beekmansbos 10
|
||||||
|
* 1971 BV IJmuiden
|
||||||
|
* the Netherlands
|
||||||
|
*
|
||||||
|
* This file is part of MBSE BBS.
|
||||||
|
*
|
||||||
|
* This BBS is free software; you can redistribute it and/or modify it
|
||||||
|
* under the terms of the GNU General Public License as published by the
|
||||||
|
* Free Software Foundation; either version 2, or (at your option) any
|
||||||
|
* later version.
|
||||||
|
*
|
||||||
|
* MBSE BBS is distributed in the hope that it will be useful, but
|
||||||
|
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
* General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with MBSE BBS; see the file COPYING. If not, write to the Free
|
||||||
|
* Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||||
|
*****************************************************************************/
|
||||||
|
|
||||||
|
#include "../config.h"
|
||||||
|
|
||||||
|
#ifndef HAVE_GETUTENT
|
||||||
|
|
||||||
|
#include "mblogin.h"
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <fcntl.h>
|
||||||
|
#include <utmp.h>
|
||||||
|
|
||||||
|
|
||||||
|
static int utmp_fd = -1;
|
||||||
|
static struct utmp utmp_buf;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* setutent - open or rewind the utmp file
|
||||||
|
*/
|
||||||
|
|
||||||
|
void
|
||||||
|
setutent(void)
|
||||||
|
{
|
||||||
|
if (utmp_fd == -1)
|
||||||
|
if ((utmp_fd = open (_UTMP_FILE, O_RDWR)) == -1)
|
||||||
|
utmp_fd = open (_UTMP_FILE, O_RDONLY);
|
||||||
|
|
||||||
|
if (utmp_fd != -1)
|
||||||
|
lseek (utmp_fd, (off_t) 0L, SEEK_SET);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* endutent - close the utmp file
|
||||||
|
*/
|
||||||
|
|
||||||
|
void
|
||||||
|
endutent(void)
|
||||||
|
{
|
||||||
|
if (utmp_fd != -1)
|
||||||
|
close (utmp_fd);
|
||||||
|
|
||||||
|
utmp_fd = -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* getutent - get the next record from the utmp file
|
||||||
|
*/
|
||||||
|
|
||||||
|
struct utmp *
|
||||||
|
getutent(void)
|
||||||
|
{
|
||||||
|
if (utmp_fd == -1)
|
||||||
|
setutent ();
|
||||||
|
|
||||||
|
if (utmp_fd == -1)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
if (read (utmp_fd, &utmp_buf, sizeof utmp_buf) != sizeof utmp_buf)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
return &utmp_buf;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* getutline - get the utmp entry matching ut_line
|
||||||
|
*/
|
||||||
|
|
||||||
|
struct utmp *
|
||||||
|
getutline(const struct utmp *utent)
|
||||||
|
{
|
||||||
|
struct utmp save;
|
||||||
|
struct utmp *new;
|
||||||
|
|
||||||
|
save = *utent;
|
||||||
|
while (new = getutent ())
|
||||||
|
if (strncmp (new->ut_line, save.ut_line, sizeof new->ut_line))
|
||||||
|
continue;
|
||||||
|
else
|
||||||
|
return new;
|
||||||
|
|
||||||
|
return (struct utmp *) 0;
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
extern int errno; /* warning: ANSI C forbids an empty source file */
|
||||||
|
#endif
|
12
mbsebbs/utent.h
Normal file
12
mbsebbs/utent.h
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
|
||||||
|
|
||||||
|
#include "../config.h"
|
||||||
|
|
||||||
|
#ifndef HAVE_GETUTENT
|
||||||
|
|
||||||
|
void setutent(void);
|
||||||
|
void endutent(void);
|
||||||
|
struct utmp *getutent(void);
|
||||||
|
struct utmp *getutline(const struct utmp *utent);
|
||||||
|
|
||||||
|
#endif
|
@ -281,7 +281,7 @@ updwtmpx(const char *filename, const struct utmpx *utx)
|
|||||||
* USER_PROCESS. the wtmp file will be updated as well.
|
* USER_PROCESS. the wtmp file will be updated as well.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#if defined(__linux__) /* XXX */
|
#if defined(__linux__) /* XXX */
|
||||||
|
|
||||||
void
|
void
|
||||||
setutmp(const char *name, const char *line, const char *host)
|
setutmp(const char *name, const char *line, const char *host)
|
||||||
@ -427,7 +427,9 @@ setutmp(const char *name, const char *line)
|
|||||||
* while System V has the name, PID and a type.
|
* while System V has the name, PID and a type.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#ifndef __FreeBSD__
|
||||||
strncpy(utmp.ut_user, name, sizeof utent.ut_user);
|
strncpy(utmp.ut_user, name, sizeof utent.ut_user);
|
||||||
|
#endif
|
||||||
#ifdef USER_PROCESS
|
#ifdef USER_PROCESS
|
||||||
utmp.ut_type = USER_PROCESS;
|
utmp.ut_type = USER_PROCESS;
|
||||||
utmp.ut_pid = getpid ();
|
utmp.ut_pid = getpid ();
|
||||||
|
@ -16,6 +16,12 @@ static void updwtmpx(const char *, const struct utmpx *);
|
|||||||
#endif /* ! HAVE_UPDWTMPX */
|
#endif /* ! HAVE_UPDWTMPX */
|
||||||
#endif /* ! HAVE_UTMPX_H */
|
#endif /* ! HAVE_UTMPX_H */
|
||||||
|
|
||||||
|
#if defined(__linux__) /* XXX */
|
||||||
void setutmp(const char *, const char *, const char *);
|
void setutmp(const char *, const char *, const char *);
|
||||||
|
#elif HAVE_UTMPX_H
|
||||||
|
void setutmp(const char *, const char *, const char *);
|
||||||
|
#else /* !SVR4 */
|
||||||
|
void setutmp(const char *, const char *);
|
||||||
|
#endif
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -74,7 +74,7 @@ grlist.o: ../lib/libs.h ../lib/structs.h ../lib/common.h ../lib/clcomm.h screen.
|
|||||||
m_domain.o: ../lib/libs.h ../lib/structs.h ../lib/records.h ../lib/common.h ../lib/clcomm.h screen.h mutil.h ledit.h m_global.h m_menu.h m_domain.h
|
m_domain.o: ../lib/libs.h ../lib/structs.h ../lib/records.h ../lib/common.h ../lib/clcomm.h screen.h mutil.h ledit.h m_global.h m_menu.h m_domain.h
|
||||||
m_fgroup.o: ../lib/libs.h ../lib/structs.h ../lib/records.h ../lib/common.h ../lib/clcomm.h screen.h mutil.h ledit.h stlist.h m_global.h m_node.h m_ticarea.h m_fgroup.h
|
m_fgroup.o: ../lib/libs.h ../lib/structs.h ../lib/records.h ../lib/common.h ../lib/clcomm.h screen.h mutil.h ledit.h stlist.h m_global.h m_node.h m_ticarea.h m_fgroup.h
|
||||||
m_lang.o: ../lib/libs.h ../lib/structs.h ../lib/records.h ../lib/common.h ../lib/clcomm.h screen.h mutil.h ledit.h stlist.h m_global.h m_lang.h
|
m_lang.o: ../lib/libs.h ../lib/structs.h ../lib/records.h ../lib/common.h ../lib/clcomm.h screen.h mutil.h ledit.h stlist.h m_global.h m_lang.h
|
||||||
m_marea.o: ../lib/libs.h ../lib/structs.h ../lib/records.h ../lib/common.h ../lib/clcomm.h screen.h mutil.h ledit.h grlist.h m_global.h m_node.h m_mgroup.h m_marea.h
|
m_marea.o: ../lib/libs.h ../lib/structs.h ../lib/records.h ../lib/common.h ../lib/clcomm.h ../lib/msg.h screen.h mutil.h ledit.h grlist.h m_global.h m_node.h m_mgroup.h m_marea.h
|
||||||
m_new.o: ../lib/libs.h ../lib/structs.h ../lib/records.h ../lib/common.h ../lib/clcomm.h screen.h mutil.h ledit.h stlist.h m_global.h grlist.h m_new.h m_lang.h m_marea.h m_ngroup.h
|
m_new.o: ../lib/libs.h ../lib/structs.h ../lib/records.h ../lib/common.h ../lib/clcomm.h screen.h mutil.h ledit.h stlist.h m_global.h grlist.h m_new.h m_lang.h m_marea.h m_ngroup.h
|
||||||
m_protocol.o: ../lib/libs.h ../lib/structs.h ../lib/records.h ../lib/clcomm.h ../lib/common.h screen.h mutil.h ledit.h stlist.h m_global.h m_protocol.h
|
m_protocol.o: ../lib/libs.h ../lib/structs.h ../lib/records.h ../lib/clcomm.h ../lib/common.h screen.h mutil.h ledit.h stlist.h m_global.h m_protocol.h
|
||||||
m_ticarea.o: ../lib/libs.h ../lib/structs.h ../lib/records.h ../lib/common.h ../lib/clcomm.h screen.h mutil.h ledit.h stlist.h grlist.h m_global.h m_node.h m_fgroup.h m_farea.h m_archive.h m_ticarea.h
|
m_ticarea.o: ../lib/libs.h ../lib/structs.h ../lib/records.h ../lib/common.h ../lib/clcomm.h screen.h mutil.h ledit.h stlist.h grlist.h m_global.h m_node.h m_fgroup.h m_farea.h m_archive.h m_ticarea.h
|
||||||
|
Reference in New Issue
Block a user