Splitted mbsebbs sourcetree

This commit is contained in:
Michiel Broek 2002-01-05 13:57:10 +00:00
parent 81c0cc8f10
commit 1e6a95c4b8
64 changed files with 863 additions and 768 deletions

View File

@ -4236,18 +4236,24 @@ v0.33.19 26-Oct-2001
Fill in the right IP addresses in fields 11 and 12 of your
ISP's nameservers. If you don't have internet, fill these
with 192.168.1.1 and 192.168.1.2 as dummy addresses.
Change the startup program in /etc/inetd.conf for telnet if
you previously used mbsebbs to mblogin.
Change the default login program in mgetty's login.config to
* - - /opt/mbse/bin/mblogin @
general:
Made the Makefile system more simple. The bbs programs now
don't run setuid anymore! This makes the system more secure
but you can't login with Fidonet style names anymore. You
can't start the bbs from telnet anymore! With a later release
this may change by adding a login wrapper, for now this is how
it works now. Take it or leave it.
don't run setuid anymore! This makes the system more secure.
A new program, mblogin, is written to allow logins with
Fidonet style names. This is a login replacement for bbs use
only.
On FreeBSD the installed files are not removed anymore from
the source tree.
Added German language file made by Harald Wuensch.
The mbtask daemon now handles the calling of Fidonet nodes.
The sourcetree has now a new subdirectory called unix. Here
are all the system specific programs such as mbpasswd,
mblogin and mbuseradd.
SETUP.sh
Better grep to check for excisting usernames like bbs, mbse.
@ -4365,6 +4371,7 @@ v0.33.19 26-Oct-2001
mbpasswd:
Added more checks to see if it's legal invoked.
Password change on FreeBSD finally works.
Moved to new sourcetree.
mblogin:
New program. Replaces standard login, allows Fidonet style

983
configure vendored

File diff suppressed because it is too large Load Diff

View File

@ -3,7 +3,7 @@ dnl $Id$
AC_INIT(lib/libs.h)
AM_CONFIG_HEADER(config.h)
SUBDIRS="lib mbcico mbfido mbmon mbsebbs mbtask mbsetup import lang examples html script"
SUBDIRS="lib mbcico mbfido mbmon mbsebbs mbtask mbsetup unix import lang examples html script"
AC_SUBST(SUBDIRS)
dnl General settings for MBSE BBS
@ -14,6 +14,8 @@ COPYRIGHT="Copyright (C) 1997-2002 Michiel Broek, All Rights Reserved"
SHORTRIGHT="Copyright (C) 1997-2002 M. Broek"
GROUP="bbs"
OWNER="mbse"
ROOT="root"
RGROUP="`id -gn`"
AC_SUBST(PACKAGE)
AC_SUBST(VERSION)
AC_SUBST(COPYRIGHT)
@ -193,6 +195,7 @@ done
AC_OUTPUT(
Makefile.global
mbfido/paths.h
unix/login.defs
INSTALL
FILE_ID.DIZ
)

View File

@ -4,29 +4,23 @@
include ../Makefile.global
SRCS = bank.c commonio.c filesub.c language.c mbtoberep.c \
msgutil.c oneline.c sgetpwent.c xmalloc.c bbslist.c morefile.c \
email.c fsedit.c lineedit.c mblang.c mbuser.c myname.c page.c \
pwio.c shadowio.c bye.c encrypt.c funcs.c mail.c mbpasswd.c \
mbuseradd.c newuser.c pinfo.c rad64.c timecheck.c change.c \
SRCS = bank.c filesub.c language.c mbtoberep.c \
msgutil.c oneline.c bbslist.c morefile.c \
email.c fsedit.c lineedit.c mblang.c mbuser.c page.c \
bye.c funcs.c mail.c \
newuser.c pinfo.c timecheck.c change.c \
exitinfo.c mball.c mbsebbs.c menu.c nextuser.c pop3.c lastcallers.c \
safe.c timeout.c chat.c file.c getdef.c mbchat.c mbstat.c misc.c \
offline.c putpwent.c salt.c user.c mbnewusr.c input.c whoson.c \
door.c dispfile.c userlist.c timestats.c logentry.c pw_util.c \
mblogin.c env.c chowntty.c shell.c basename.c \
pwdcheck.c pwauth.c loginprompt.c utmp.c limits.c \
setupenv.c sub.c log.c setugid.c utent.c
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 \
mbstat.h msgutil.h oneline.h sgetpwent.h user.h bye.h morefile.h \
encrypt.h funcs.h mail.h mbuser.h myname.h page.h pwio.h shadowio.h \
xmalloc.h change.h exitinfo.h mball.h mbuseradd.h newuser.h \
pinfo.h rad64.h chat.h file.h getdef.h mbpasswd.h menu.h \
safe.c timeout.c chat.c file.c mbchat.c mbstat.c misc.c \
offline.c user.c mbnewusr.c input.c whoson.c \
door.c dispfile.c userlist.c timestats.c logentry.c
HDRS = bank.h filesub.h language.h mbsebbs.h misc.h offline.h \
timeout.h bbslist.h email.h fsedit.h lineedit.h \
mbstat.h msgutil.h oneline.h user.h bye.h morefile.h \
funcs.h mail.h mbuser.h page.h \
change.h exitinfo.h mball.h newuser.h \
pinfo.h chat.h file.h menu.h \
nextuser.h pop3.h safe.h timecheck.h mbnewusr.h input.h whoson.h \
door.h dispfile.h userlist.h timestats.h logentry.h lastcallers.h pw_util.h \
mblogin.h env.h chowntty.h shell.h basename.h \
pwdcheck.h pwauth.h loginprompt.h utmp.h limits.h \
setupenv.h sub.h log.h setugid.h utent.h
door.h dispfile.h userlist.h timestats.h logentry.h lastcallers.h
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 \
bye.o change.o mbsebbs.o safe.o timeout.o user.o timecheck.o \
@ -52,14 +46,8 @@ MBTOBEREP_OBJS = mbtoberep.o
MBTOBEREP_LIBS = ../lib/libmemwatch.a ../lib/libclcomm.a ../lib/libcommon.a ../lib/libdbase.a
MBUSER_OBJS = mbuser.o
MBUSER_LIBS = ../lib/libmemwatch.a ../lib/libclcomm.a ../lib/libcommon.a ../lib/libdbase.a
MBUSERADD_OBJS = mbuseradd.o
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
MBLOGIN_OBJS = getdef.o env.o chowntty.o shell.o basename.o \
pwdcheck.o pwauth.o encrypt.o loginprompt.o utmp.o limits.o setupenv.o sub.o \
xmalloc.o log.o setugid.o utent.o mblogin.o
OTHER = Makefile
TARGET = mbsebbs mbnewusr mball mblang mbchat mbstat mbtoberep mbuser mbuseradd mbpasswd mblogin
TARGET = mbsebbs mbnewusr mball mblang mbchat mbstat mbtoberep mbuser
#############################################################################################################
@ -103,18 +91,6 @@ mbuser: ${MBUSER_OBJS} ${MBUSER_LIBS}
${CC} -o mbuser ${MBUSER_OBJS} ${LIBS} ${MBUSER_LIBS}
strip mbuser
mbuseradd: ${MBUSERADD_OBJS}
${CC} -o mbuseradd ${MBUSERADD_OBJS} ${LIBS}
strip mbuseradd
mbpasswd: ${MBPASSWD_OBJS}
${CC} -o mbpasswd ${MBPASSWD_OBJS} ${LIBS}
strip mbpasswd
mblogin: ${MBLOGIN_OBJS}
${CC} -o mblogin ${MBLOGIN_OBJS} ${LIBS}
strip mblogin
install: all
@if [ "`id -un`" != "root" ] ; then \
echo; echo " Must be root to install!"; echo; exit 3; \
@ -127,10 +103,8 @@ install: all
${INSTALL} -c -s -o ${OWNER} -g ${GROUP} -m 0711 mbstat ${BINDIR}
${INSTALL} -c -s -o ${OWNER} -g ${GROUP} -m 0711 mbtoberep ${BINDIR}
${INSTALL} -c -s -o `id -un` -g `id -gn` -m 6711 mbuser ${BINDIR}
${INSTALL} -c -s -o `id -un` -g `id -gn` -m 6711 mbuseradd ${BINDIR}
${INSTALL} -c -s -o `id -un` -g `id -gn` -m 6711 mbpasswd ${BINDIR}
${INSTALL} -c -s -o `id -un` -g `id -gn` -m 0755 mblogin ${BINDIR}
@rm -f ${BINDIR}/mbfbgen
@rm -f mbuseradd mbpasswd mblogin
filelist: Makefile
BASE=`pwd`; \
@ -162,14 +136,11 @@ depend:
# DO NOT DELETE THIS LINE - MAKE DEPEND RELIES ON IT
# Dependencies generated by make depend
bank.o: ../lib/libs.h ../lib/mbse.h ../lib/structs.h ../lib/records.h ../lib/clcomm.h ../lib/common.h bank.h input.h language.h dispfile.h timeout.h timecheck.h whoson.h exitinfo.h
commonio.o: ../config.h commonio.h
filesub.o: ../lib/libs.h ../lib/mbse.h ../lib/structs.h ../lib/records.h ../lib/common.h ../lib/clcomm.h filesub.h funcs.h language.h input.h misc.h timeout.h exitinfo.h change.h
language.o: ../lib/libs.h ../lib/mbse.h ../lib/structs.h ../lib/records.h ../lib/common.h ../lib/clcomm.h input.h language.h
mbtoberep.o: ../lib/libs.h ../lib/structs.h
msgutil.o: ../lib/libs.h ../lib/mbse.h ../lib/structs.h ../lib/records.h ../lib/common.h ../lib/clcomm.h ../lib/msgtext.h ../lib/msg.h oneline.h msgutil.h
oneline.o: ../lib/libs.h ../lib/mbse.h ../lib/structs.h ../lib/records.h ../lib/common.h ../lib/clcomm.h oneline.h funcs.h input.h language.h
sgetpwent.o: ../config.h sgetpwent.h
xmalloc.o: ../config.h xmalloc.h
bbslist.o: ../lib/libs.h ../lib/mbse.h ../lib/structs.h ../lib/records.h ../lib/clcomm.h ../lib/common.h bbslist.h funcs.h input.h language.h
morefile.o: ../lib/libs.h ../lib/mbse.h ../lib/structs.h ../lib/records.h ../lib/clcomm.h ../lib/common.h input.h language.h morefile.h timeout.h
email.o: ../lib/libs.h ../lib/mbse.h ../lib/structs.h ../lib/records.h ../lib/msgtext.h ../lib/msg.h ../lib/common.h ../lib/clcomm.h ../lib/mbinet.h exitinfo.h language.h mail.h timeout.h msgutil.h input.h email.h whoson.h
@ -177,19 +148,12 @@ fsedit.o: ../lib/libs.h ../lib/mbse.h ../lib/structs.h ../lib/records.h ../lib/a
lineedit.o: ../lib/libs.h ../lib/mbse.h ../lib/structs.h ../lib/records.h ../lib/common.h ../lib/clcomm.h mail.h input.h language.h timeout.h lineedit.h
mblang.o: ../lib/libs.h ../lib/structs.h ../lib/records.h
mbuser.o: ../lib/libs.h ../lib/structs.h ../lib/records.h ../lib/common.h ../lib/clcomm.h ../lib/dbcfg.h mbuser.h
myname.o: ../config.h
page.o: ../lib/libs.h ../lib/mbse.h ../lib/structs.h ../lib/records.h ../lib/common.h ../lib/clcomm.h dispfile.h input.h chat.h page.h timeout.h mail.h language.h
pwio.o: ../config.h sgetpwent.h commonio.h putpwent.h pwio.h
shadowio.o: ../config.h commonio.h shadowio.h
bye.o: ../lib/libs.h ../lib/mbse.h ../lib/structs.h ../lib/records.h ../lib/clcomm.h ../lib/common.h dispfile.h misc.h language.h bye.h
encrypt.o: ../config.h encrypt.h
funcs.o: ../lib/libs.h ../lib/mbse.h ../lib/structs.h ../lib/records.h ../lib/common.h ../lib/msgtext.h ../lib/msg.h ../lib/clcomm.h funcs.h
mail.o: ../lib/libs.h ../lib/mbse.h ../lib/structs.h ../lib/records.h ../lib/common.h ../lib/msgtext.h ../lib/clcomm.h ../lib/msg.h mail.h funcs.h input.h language.h misc.h timeout.h oneline.h exitinfo.h lineedit.h fsedit.h filesub.h msgutil.h pop3.h email.h whoson.h
mbpasswd.o: ../config.h encrypt.h rad64.h myname.h xmalloc.h pwio.h shadowio.h pw_util.h mbpasswd.h
mbuseradd.o: ../config.h mbuseradd.h
newuser.o: ../lib/libs.h ../lib/mbse.h ../lib/structs.h ../lib/records.h ../lib/clcomm.h ../lib/common.h funcs.h input.h newuser.h language.h timeout.h change.h dispfile.h
pinfo.o: ../lib/libs.h ../lib/mbse.h ../lib/structs.h ../lib/records.h ../lib/common.h ../lib/clcomm.h pinfo.h input.h
rad64.o: ../config.h rad64.h
timecheck.o: ../lib/libs.h ../lib/mbse.h ../lib/structs.h ../lib/records.h ../lib/clcomm.h ../lib/common.h timecheck.h funcs.h bye.h exitinfo.h language.h input.h
change.o: ../lib/libs.h ../lib/mbse.h ../lib/structs.h ../lib/records.h ../lib/common.h ../lib/clcomm.h change.h dispfile.h funcs.h input.h language.h misc.h timeout.h exitinfo.h bye.h
exitinfo.o: ../lib/libs.h ../lib/mbse.h ../lib/structs.h ../lib/records.h ../lib/common.h ../lib/clcomm.h funcs.h input.h language.h oneline.h misc.h bye.h timeout.h timecheck.h exitinfo.h
@ -203,13 +167,10 @@ safe.o: ../lib/libs.h ../lib/mbse.h ../lib/structs.h ../lib/records.h ../lib/clc
timeout.o: ../lib/libs.h ../lib/mbse.h ../lib/structs.h ../lib/records.h ../lib/common.h ../lib/clcomm.h ../lib/msg.h timeout.h funcs.h bye.h filesub.h language.h
chat.o: ../lib/libs.h ../lib/mbse.h ../lib/structs.h ../lib/records.h ../lib/common.h ../lib/clcomm.h chat.h funcs.h input.h language.h misc.h whoson.h
file.o: ../lib/libs.h ../lib/mbse.h ../lib/structs.h ../lib/records.h ../lib/common.h ../lib/clcomm.h filesub.h file.h funcs.h input.h language.h misc.h timeout.h exitinfo.h whoson.h change.h
getdef.o: ../config.h getdef.h
mbchat.o: ../lib/libs.h ../lib/structs.h ../lib/common.h ../lib/clcomm.h
mbstat.o: ../lib/libs.h ../lib/structs.h ../lib/records.h ../lib/common.h ../lib/clcomm.h ../lib/dbcfg.h mbstat.h
misc.o: ../lib/libs.h ../lib/mbse.h ../lib/structs.h ../lib/records.h ../lib/clcomm.h ../lib/common.h funcs.h input.h language.h misc.h timeout.h exitinfo.h
offline.o: ../lib/libs.h ../lib/structs.h ../lib/mbse.h ../lib/records.h ../lib/bluewave.h ../lib/common.h ../lib/clcomm.h ../lib/msgtext.h ../lib/msg.h mail.h funcs.h input.h language.h file.h filesub.h exitinfo.h timeout.h msgutil.h pop3.h offline.h whoson.h
putpwent.o: ../config.h putpwent.h
salt.o: ../config.h rad64.h getdef.h
user.o: ../lib/libs.h ../lib/mbse.h ../lib/structs.h ../lib/records.h ../lib/common.h ../lib/clcomm.h timeout.h user.h dispfile.h funcs.h input.h misc.h bye.h file.h mail.h change.h menu.h exitinfo.h language.h offline.h email.h
mbnewusr.o: ../lib/libs.h ../lib/mbse.h ../lib/structs.h ../lib/records.h ../lib/common.h ../lib/clcomm.h mbnewusr.h funcs.h input.h language.h misc.h timeout.h newuser.h
input.o: ../lib/libs.h ../lib/mbse.h ../lib/structs.h ../lib/records.h ../lib/clcomm.h ../lib/common.h input.h timeout.h language.h
@ -219,20 +180,4 @@ dispfile.o: ../lib/libs.h ../lib/mbse.h ../lib/structs.h ../lib/records.h ../lib
userlist.o: ../lib/libs.h ../lib/mbse.h ../lib/structs.h ../lib/records.h ../lib/common.h ../lib/clcomm.h userlist.h language.h input.h timeout.h
timestats.o: ../lib/libs.h ../lib/mbse.h ../lib/structs.h ../lib/records.h ../lib/common.h timestats.h funcs.h language.h input.h exitinfo.h
logentry.o: ../lib/libs.h ../lib/mbse.h ../lib/structs.h ../lib/records.h ../lib/common.h ../lib/clcomm.h logentry.h
pw_util.o: pw_util.h
mblogin.o: ../config.h mblogin.h getdef.h env.h chowntty.h basename.h shell.h pwdcheck.h pwauth.h loginprompt.h utmp.h limits.h setupenv.h sub.h log.h setugid.h
env.o: ../config.h mblogin.h xmalloc.h
chowntty.o: ../config.h mblogin.h getdef.h chowntty.h
shell.o: ../config.h mblogin.h basename.h shell.h
basename.o: ../config.h mblogin.h basename.h
pwdcheck.o: ../config.h mblogin.h pwauth.h pwdcheck.h
pwauth.o: ../config.h mblogin.h pwauth.h getdef.h encrypt.h
loginprompt.o: ../config.h mblogin.h getdef.h xmalloc.h env.h loginprompt.h
utmp.o: ../config.h mblogin.h utmp.h
limits.o: ../config.h mblogin.h getdef.h utmp.h limits.h
setupenv.o: ../config.h mblogin.h getdef.h xmalloc.h env.h setupenv.h
sub.o: ../config.h mblogin.h sub.h
log.o: ../config.h mblogin.h log.h
setugid.o: ../config.h mblogin.h getdef.h setugid.h
utent.o: ../config.h mblogin.h
# End of generated dependencies

116
unix/Makefile Normal file
View File

@ -0,0 +1,116 @@
# Makefile for MBSE BBS under Linux
# Copyright (c) 1998, 2001 by M. Broek.
# $Id$
include ../Makefile.global
SRCS = commonio.c putpwent.c salt.c sgetpwent.c xmalloc.c myname.c encrypt.c \
pwio.c shadowio.c mbpasswd.c mbuseradd.c rad64.c getdef.c pw_util.c \
mblogin.c env.c chowntty.c shell.c basename.c pwdcheck.c pwauth.c \
loginprompt.c utmp.c limits.c setupenv.c sub.c log.c setugid.c utent.c
HDRS = commonio.h putpwent.h salt.h sgetpwent.h xmalloc.h myname.h encrypt.h \
pwio.h shadowio.h mbpasswd.h mbuseradd.h rad64.h getdef.h pw_util.h \
mblogin.h env.h chowntty.h shell.h basename.h pwdcheck.h pwauth.h \
loginprompt.h utmp.h limits.h setupenv.h sub.h log.h setugid.h utent.h
MBUSERADD_OBJS = mbuseradd.o
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
MBLOGIN_OBJS = getdef.o env.o chowntty.o shell.o basename.o pwdcheck.o pwauth.o encrypt.o \
loginprompt.o utmp.o limits.o setupenv.o sub.o xmalloc.o log.o setugid.o \
utent.o mblogin.o
OTHER = Makefile login.defs.in
TARGET = mbuseradd mbpasswd mblogin
#############################################################################################################
.c.o:
${CC} ${CFLAGS} ${INCLUDES} ${DEFINES} -c $<
all: ${TARGET}
clean:
rm -f ${TARGET} *.o *.h~ *.c~ core filelist Makefile.bak
mbuseradd: ${MBUSERADD_OBJS}
${CC} -o mbuseradd ${MBUSERADD_OBJS} ${LIBS}
strip mbuseradd
mbpasswd: ${MBPASSWD_OBJS}
${CC} -o mbpasswd ${MBPASSWD_OBJS} ${LIBS}
strip mbpasswd
mblogin: ${MBLOGIN_OBJS}
${CC} -o mblogin ${MBLOGIN_OBJS} ${LIBS}
strip mblogin
install: all
@if [ "`id -un`" != "root" ] ; then \
echo; echo " Must be root to install!"; echo; exit 3; \
fi
${INSTALL} -c -s -o `id -un` -g `id -gn` -m 6711 mbuseradd ${BINDIR}
${INSTALL} -c -s -o `id -un` -g `id -gn` -m 6711 mbpasswd ${BINDIR}
${INSTALL} -c -s -o `id -un` -g `id -gn` -m 0755 mblogin ${BINDIR}
@if [ ! -f ${ETCDIR}/login.defs ] ; then \
${INSTALL} -c -o ${OWNER} -g ${GROUP} -m 0644 login.defs ${ETCDIR} ; \
echo "${INSTALL} -c -o ${OWNER} -g ${GROUP} -m 0644 login.defs ${ETCDIR}" ; \
fi
filelist: Makefile
BASE=`pwd`; \
BASE=`basename $${BASE}`; \
(for f in ${SRCS} ${HDRS} ${OTHER} ; do echo ${PACKAGE}-${VERSION}/$${BASE}/$$f; done) >filelist
depend:
@rm -f Makefile.bak; \
mv Makefile Makefile.bak; \
sed -e '/^# DO NOT DELETE/,$$d' Makefile.bak >Makefile; \
${ECHO} '# DO NOT DELETE THIS LINE - MAKE DEPEND RELIES ON IT' \
>>Makefile; \
${ECHO} '# Dependencies generated by make depend' >>Makefile; \
for f in ${SRCS}; \
do \
${ECHO} "Dependencies for $$f:\c"; \
${ECHO} "`basename $$f .c`.o:\c" >>Makefile; \
for h in `sed -n -e \
's/^#[ ]*include[ ]*"\([^"]*\)".*/\1/p' $$f`; \
do \
${ECHO} " $$h\c"; \
${ECHO} " $$h\c" >>Makefile; \
done; \
${ECHO} " done."; \
${ECHO} "" >>Makefile; \
done; \
${ECHO} '# End of generated dependencies' >>Makefile
# DO NOT DELETE THIS LINE - MAKE DEPEND RELIES ON IT
# Dependencies generated by make depend
commonio.o: ../config.h commonio.h
putpwent.o: ../config.h putpwent.h
salt.o: ../config.h rad64.h getdef.h
sgetpwent.o: ../config.h sgetpwent.h
xmalloc.o: ../config.h xmalloc.h
myname.o: ../config.h
encrypt.o: ../config.h encrypt.h
pwio.o: ../config.h sgetpwent.h commonio.h putpwent.h pwio.h
shadowio.o: ../config.h commonio.h shadowio.h
mbpasswd.o: ../config.h encrypt.h rad64.h myname.h xmalloc.h pwio.h shadowio.h pw_util.h mbpasswd.h
mbuseradd.o: ../config.h mbuseradd.h
rad64.o: ../config.h rad64.h
getdef.o: ../config.h getdef.h
pw_util.o: pw_util.h
mblogin.o: ../config.h mblogin.h getdef.h env.h chowntty.h basename.h shell.h pwdcheck.h pwauth.h loginprompt.h utmp.h limits.h setupenv.h sub.h log.h setugid.h
env.o: ../config.h mblogin.h xmalloc.h
chowntty.o: ../config.h mblogin.h getdef.h chowntty.h
shell.o: ../config.h mblogin.h basename.h shell.h
basename.o: ../config.h mblogin.h basename.h
pwdcheck.o: ../config.h mblogin.h pwauth.h pwdcheck.h
pwauth.o: ../config.h mblogin.h pwauth.h getdef.h encrypt.h
loginprompt.o: ../config.h mblogin.h getdef.h xmalloc.h env.h loginprompt.h
utmp.o: ../config.h mblogin.h utmp.h
limits.o: ../config.h mblogin.h limits.h
setupenv.o: ../config.h mblogin.h getdef.h xmalloc.h env.h setupenv.h
sub.o: ../config.h mblogin.h sub.h
log.o: ../config.h mblogin.h log.h
setugid.o: ../config.h mblogin.h getdef.h setugid.h
utent.o: ../config.h mblogin.h
# End of generated dependencies

View File

@ -67,10 +67,25 @@ int is_my_tty(const char *tty)
*/
void chown_tty(const char *tty, const struct passwd *info)
{
char buf[200], full_tty[200];
gid_t gid;
char buf[200], full_tty[200];
char *group; /* TTY group name or number */
struct group *grent;
gid_t gid;
/*
* * See if login.defs has some value configured for the port group
* * ID. Otherwise, use the user's primary group ID.
* */
if (! (group = getdef_str ("TTYGROUP")))
gid = info->pw_gid;
else if (group[0] >= '0' && group[0] <= '9')
gid = atoi (group);
else if ((grent = getgrnam (group)))
gid = grent->gr_gid;
else
gid = info->pw_gid;
gid = info->pw_gid;
/*
* Change the permissions on the TTY to be owned by the user with

View File

@ -30,34 +30,6 @@
* Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
*****************************************************************************/
/*
* Copyright 1991 - 1994, Julianne Frances Haugh and Chip Rosenthal
* 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. Neither the name of Julianne F. Haugh 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 JULIE HAUGH 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 JULIE HAUGH 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 "../config.h"
#include <stdio.h>
@ -65,15 +37,15 @@
#include <ctype.h>
#include <string.h>
#include <syslog.h>
#include <sys/param.h>
#include <pwd.h>
#include "getdef.h"
#ifndef __FreeBSD__
/*
* A configuration item definition.
*/
struct itemdef {
const char *name; /* name of the item */
char *value; /* value given, or NULL if no value */
@ -88,80 +60,34 @@ struct itemdef {
* on. Missing entries here gives a nasty message to
* new bbs users.
*/
#define NUMDEFS (sizeof(def_table)/sizeof(def_table[0]))
static struct itemdef def_table[] = {
{ "CHFN_AUTH", NULL },
{ "CHFN_RESTRICT", NULL },
{ "CLOSE_SESSIONS", NULL },
{ "CONSOLE", NULL },
{ "CONSOLE_GROUPS", NULL },
{ "CRACKLIB_DICTPATH", NULL },
{ "CREATE_HOME", NULL },
{ "ALLOW_MBSE", NULL },
{ "ASK_NEWUSER", NULL },
{ "DEFAULT_HOME", NULL },
{ "DIALUPS_CHECK_ENAB", NULL },
{ "ENVIRON_FILE", NULL },
{ "ENV_HZ", NULL },
{ "ENV_PATH" , NULL },
{ "ENV_ROOTPATH", NULL },
{ "ENV_SUPATH", NULL },
{ "ENV_TZ", NULL },
{ "ERASECHAR", NULL },
{ "FAILLOG_ENAB", NULL },
{ "FAIL_DELAY", NULL },
{ "FAKE_SHELL", NULL },
{ "FTMP_FILE", NULL },
{ "GID_MAX", NULL },
{ "GID_MIN", NULL },
{ "HUSHLOGIN_FILE", NULL },
{ "ISSUE_FILE", NULL },
{ "KILLCHAR", NULL },
{ "LASTLOG_ENAB", NULL },
{ "LOGIN_RETRIES", NULL },
{ "LOGIN_STRING", NULL },
{ "LOGIN_TIMEOUT", NULL },
{ "LOG_OK_LOGINS", NULL },
{ "LOG_UNKFAIL_ENAB", NULL },
{ "MAIL_CHECK_ENAB", NULL },
{ "MAIL_DIR", NULL },
{ "MAIL_FILE", NULL },
{ "MD5_CRYPT_ENAB", NULL },
{ "MOTD_FILE", NULL },
{ "NEWUSER_ACCOUNT", NULL },
{ "NOLOGINS_FILE", NULL },
{ "NOLOGIN_STR", NULL },
{ "NO_PASSWORD_CONSOLE", NULL },
{ "OBSCURE_CHECKS_ENAB", NULL },
{ "PASS_ALWAYS_WARN", NULL },
{ "PASS_CHANGE_TRIES", NULL },
{ "PASS_MAX_DAYS", NULL },
{ "PASS_MAX_LEN", NULL },
{ "PASS_MIN_DAYS", NULL },
{ "PASS_MIN_LEN", NULL },
{ "PASS_WARN_AGE", NULL },
{ "PORTTIME_CHECKS_ENAB", NULL },
{ "QMAIL_DIR", NULL },
{ "QUOTAS_ENAB", NULL },
{ "SULOG_FILE", NULL },
{ "SU_NAME", NULL },
{ "SU_WHEEL_ONLY", NULL },
{ "SYSLOG_SG_ENAB", NULL },
{ "SYSLOG_SU_ENAB", NULL },
{ "TTYGROUP", NULL },
{ "TTYPERM", NULL },
{ "TTYTYPE_FILE", NULL },
{ "UID_MAX", NULL },
{ "UID_MIN", NULL },
{ "ULIMIT", NULL },
{ "UMASK", NULL },
{ "USERDEL_CMD", NULL },
{ "USERGROUPS_ENAB", NULL },
};
#ifndef LOGINDEFS
#define LOGINDEFS "/etc/login.defs"
#endif
static char def_fname[] = LOGINDEFS; /* login config defs file */
static int def_loaded = 0; /* are defs already loaded? */
@ -170,13 +96,13 @@ static struct itemdef *def_find (const char *);
static void def_load (void);
/*
* getdef_str - get string value from table of definitions.
*
* Return point to static data for specified item, or NULL if item is not
* defined. First time invoked, will load definitions from the file.
*/
char *getdef_str(const char *item)
{
struct itemdef *d;
@ -188,12 +114,12 @@ char *getdef_str(const char *item)
}
/*
* getdef_bool - get boolean value from table of definitions.
*
* Return TRUE if specified item is defined as "yes", else FALSE.
*/
int getdef_bool(const char *item)
{
struct itemdef *d;
@ -208,6 +134,7 @@ int getdef_bool(const char *item)
}
/*
* getdef_num - get numerical value from table of definitions
*
@ -215,7 +142,6 @@ int getdef_bool(const char *item)
* the item is not defined. Octal (leading "0") and hex (leading "0x")
* values are handled.
*/
int getdef_num(const char *item, int dflt)
{
struct itemdef *d;
@ -230,6 +156,7 @@ int getdef_num(const char *item, int dflt)
}
/*
* getdef_long - get long integer value from table of definitions
*
@ -237,7 +164,6 @@ int getdef_num(const char *item, int dflt)
* the item is not defined. Octal (leading "0") and hex (leading "0x")
* values are handled.
*/
long getdef_long(const char *item, long dflt)
{
struct itemdef *d;
@ -251,13 +177,14 @@ long getdef_long(const char *item, long dflt)
return strtol(d->value, (char **)NULL, 0);
}
/*
* def_find - locate named item in table
*
* Search through a sorted table of configurable items to locate the
* specified configuration option.
*/
static struct itemdef *def_find(const char *name)
{
int min, max, curr, n;
@ -290,28 +217,38 @@ static struct itemdef *def_find(const char *name)
* Item was never found.
*/
fprintf(stderr, "mbpasswd: configuration error - unknown item '%s' (notify administrator)\r\n", name);
syslog(LOG_CRIT, "unknown configuration item `%s'", name);
fprintf(stderr, "getdef(): configuration error - unknown item '%s' (notify administrator)\r\n", name);
syslog(LOG_CRIT, "getdef(): unknown configuration item `%s'", name);
return (struct itemdef *) NULL;
}
/*
* def_load - load configuration table
*
* Loads the user-configured options from the default configuration file
*/
static void def_load(void)
{
int i;
FILE *fp;
struct itemdef *d;
char buf[BUFSIZ], *name, *value, *s;
int i;
FILE *fp;
struct itemdef *d;
char buf[BUFSIZ], def_fname[PATH_MAX], *name, *value, *s;
struct passwd *pw;
/*
* Get MBSE BBS root directory
*/
if ((pw = getpwnam("mbse")) == NULL) {
syslog(LOG_CRIT, "cannot find user `mbse' in password file");
return;
}
sprintf(def_fname, "%s/etc/login.defs", pw->pw_dir);
/*
* Open the configuration definitions file.
*/
if ((fp = fopen(def_fname, "r")) == NULL) {
syslog(LOG_CRIT, "cannot open login definitions %s [%m]", def_fname);
return;
@ -320,7 +257,6 @@ static void def_load(void)
/*
* Go through all of the lines in the file.
*/
while (fgets(buf, sizeof(buf), fp) != NULL) {
/*
@ -362,8 +298,8 @@ static void def_load(void)
*/
if ((d->value = strdup(value)) == NULL) {
fprintf(stderr, "mbpasswd: Could not allocate space for config info.\n");
syslog(LOG_ERR, "could not allocate space for config info");
fprintf(stderr, "getdef: Could not allocate space for config info.\n");
syslog(LOG_ERR, "getdef: could not allocate space for config info");
break;
}
}
@ -372,10 +308,11 @@ static void def_load(void)
/*
* Set the initialized flag.
*/
++def_loaded;
}
#ifdef CKDEFS
int main(int argc, char **argv)
{
@ -401,4 +338,3 @@ int main(int argc, char **argv)
}
#endif
#endif /* ifndef __FreeBSD__ */

View File

@ -3,13 +3,11 @@
#ifndef _GETDEF_H
#define _GETDEF_H
#ifndef __FreeBSD__
int getdef_bool(const char *);
long getdef_long(const char *, long);
int getdef_num(const char *, int);
char *getdef_str(const char *);
#endif
#endif /* _GETDEF_H */

145
unix/login.defs.in Normal file
View File

@ -0,0 +1,145 @@
#
# $MBSE_ROOT/etc/login.defs - Configuration control definitions for mblogin.
#
# $Id$
# Three items must be defined: MAIL_DIR, ENV_SUPATH, and ENV_PATH.
# If unspecified, some arbitrary (and possibly incorrect) value will
# be assumed. All other items are optional - if not specified then
# the described action or option will be inhibited.
#
# Comment lines (lines beginning with "#") and blank lines are ignored.
#
#
# Allow user "mbse" to login and get a shell.
#
ALLOW_MBSE no
#
# Ask a user when his username is not found if he wants to register as new
# user. If not, the user has to use the special account to start mbnewusr.
# If no, it is not bbs user friendly,
# If yes, usernames may be easy guessed, but most bbses do it like this.
#
ASK_NEWUSER yes
#
# The newuser account name, defaults to "bbs". If you change this change it
# in the password files, change it in mbsetup and in this file. Better
# leave this unchanged.
#
NEWUSER_ACCOUNT bbs
#
# Delay in seconds before being allowed another attempt after a login failure
#
FAIL_DELAY 3
#
# Enable display of unknown usernames when login failures are recorded.
#
LOG_UNKFAIL_ENAB no
#
# Enable logging of successful logins
#
LOG_OK_LOGINS no
#
# Enable logging and display of /var/log/lastlog login time info.
#
LASTLOG_ENAB yes
#
# If defined, this file will be output before each login prompt.
# Should not be needed, mgetty and getty will do this already.
#
#ISSUE_FILE @prefix@/etc/issue
#
# If defined, name of file whose presence which will inhibit non-root
# logins. The contents of this file should be a message indicating
# why logins are inhibited.
#
NOLOGINS_FILE /etc/nologin
#
# If defined, an HZ environment parameter spec.
#
# for Linux/x86
ENV_HZ HZ=100
# For Linux/Alpha...
#ENV_HZ HZ=1024
#
# *REQUIRED* The default PATH settings, for superuser and normal users.
#
# (they are minimal, add the rest in the shell startup files)
ENV_PATH PATH=/usr/local/bin:/bin:/usr/bin:@prefix@/bin
#
# Terminal permissions
#
# TTYGROUP Login tty will be assigned this group ownership.
# TTYPERM Login tty will be set to this permission.
#
# If you have a "write" program which is "setgid" to a special group
# which owns the terminals, define TTYGROUP to the group number and
# TTYPERM to 0620. Otherwise leave TTYGROUP commented out and assign
# TTYPERM to either 622 or 600.
#
TTYGROUP tty
TTYPERM 0620
#
# Login configuration initializations:
#
# ERASECHAR Terminal ERASE character ('\010' = backspace).
# KILLCHAR Terminal KILL character ('\025' = CTRL/U).
# UMASK Default "umask" value.
# ULIMIT Default "ulimit" value.
#
# The ERASECHAR and KILLCHAR are used only on System V machines.
# The ULIMIT is used only if the system supports it.
# (now it works with setrlimit too; ulimit is in 512-byte units)
#
# Prefix these values with "0" to get octal, "0x" to get hexadecimal.
#
ERASECHAR 0177
KILLCHAR 025
UMASK 007
#
# Max number of login retries if password is bad
#
LOGIN_RETRIES 5
#
# Max time in seconds for login
#
LOGIN_TIMEOUT 60
#
# Only works if compiled with MD5_CRYPT defined:
# If set to "yes", new passwords will be encrypted using the MD5-based
# algorithm compatible with the one used by recent releases of FreeBSD.
# It supports passwords of unlimited length and longer salt strings.
# Set to "no" if you need to copy encrypted passwords to other systems
# which don't understand the new algorithm. Default is "no".
#
MD5_CRYPT_ENAB yes
#
# Should login be allowed if we can't cd to the home directory?
# Default in no.
#
DEFAULT_HOME no
#
# Enable setting of the umask group bits to be the same as owner bits
# (examples: 022 -> 002, 077 -> 007) for non-root users, if the uid is
# the same as gid, and username is the same as the primary group name.
#
USERGROUPS_ENAB yes

View File

@ -86,8 +86,7 @@ void login_prompt(const char *prompt, char *name, int namesize)
*/
if (prompt) {
// cp = getdef_str("ISSUE_FILE");
cp = NULL;
cp = getdef_str("ISSUE_FILE");
if (cp && (fp = fopen(cp, "r"))) {
while ((i = getc(fp)) != EOF)
putc(i, stdout);

View File

@ -149,7 +149,7 @@ extern char **environ;
static void usage(void);
static void setup_tty(void);
static void check_flags(int, char * const *);
static void check_nologin(char *);
static void check_nologin(void);
static void init_env(void);
static RETSIGTYPE alarm_handler(int);
int main(int, char **);
@ -214,11 +214,9 @@ static void setup_tty(void)
termio.c_oflag |= (XTABS|OPOST|ONLCR);
#endif
#ifndef __FreeBSD__
/* leave these values unchanged if not specified in login.defs */
termio.c_cc[VERASE] = getdef_num("ERASECHAR", termio.c_cc[VERASE]);
termio.c_cc[VKILL] = getdef_num("KILLCHAR", termio.c_cc[VKILL]);
#endif
/*
* ttymon invocation prefers this, but these settings won't come into
@ -248,10 +246,7 @@ static void check_flags(int argc, char * const *argv)
/*
* nologin file is $MBSE_ROOT/etc/nologin
*/
static void check_nologin(char *path)
static void check_nologin(void)
{
char *fname;
@ -263,8 +258,7 @@ static void check_nologin(char *path)
* forgotten about it ...
*/
fname = calloc(PATH_MAX, sizeof(char));
sprintf(fname, "%s/etc/nologin", path);
fname = getdef_str("NOLOGINS_FILE");
if (access(fname, F_OK) == 0) {
FILE *nlfp;
int c;
@ -298,10 +292,7 @@ static void check_nologin(char *path)
static void init_env(void)
{
#ifndef __FreeBSD__
char *cp;
#endif
char *tmp;
char *cp, *tmp;
if ((tmp = getenv("LANG"))) {
addenv("LANG", tmp);
@ -323,12 +314,9 @@ static void init_env(void)
if ((tmp = getenv("HZ"))) {
addenv("HZ", tmp);
#ifndef __FreeBSD__
} else if ((cp = getdef_str("ENV_HZ")))
} else if ((cp = getdef_str("ENV_HZ"))) {
addenv(cp, NULL);
#else
}
#endif
}
@ -488,7 +476,7 @@ int main(int argc, char **argv)
openlog("mblogin", LOG_PID|LOG_CONS|LOG_NOWAIT, LOG_AUTH);
setup_tty();
umask(007);
umask(getdef_num("UMASK", 007));
if (pflg)
while (*envp) /* add inherited environment, */
@ -509,7 +497,7 @@ int main(int argc, char **argv)
addenv("MBSE_ROOT", pw->pw_dir);
sprintf(userfile, "%s/etc/users.data", pw->pw_dir);
check_nologin(pw->pw_dir);
check_nologin();
init_env();
@ -574,13 +562,13 @@ int main(int argc, char **argv)
top:
/* only allow ALARM sec. for login */
signal(SIGALRM, alarm_handler);
timeout = LOGIN_TIMEOUT;
timeout = getdef_num("LOGIN_TIMEOUT", ALARM);
if (timeout > 0)
alarm(timeout);
environ = newenvp; /* make new environment active */
delay = LOGIN_DELAY;
retries = LOGIN_RETRIES;
delay = getdef_num("FAIL_DELAY", 1);
retries = getdef_num("LOGIN_RETRIES", RETRIES);
while (1) { /* repeatedly get login/password pairs */
failed = 0; /* haven't failed authentication yet */
@ -663,7 +651,7 @@ top:
* username at least once... Should probably use LOG_AUTHPRIV
* for those who really want to log them. --marekm
*/
syslog(LOG_WARNING, BAD_PASSWD, "UNKNOWN", fromhost);
syslog(LOG_WARNING, BAD_PASSWD, (pwd || getdef_bool("LOG_UNKFAIL_ENAB")) ? username : "UNKNOWN", fromhost);
failed = 1;
auth_ok:
@ -722,20 +710,6 @@ auth_ok:
} /* while (1) */
(void) alarm (0); /* turn off alarm clock */
#if 1
/*
* porttime checks moved here, after the user has been
* authenticated. now prints a message, as suggested
* by Ivan Nejgebauer <ian@unsux.ns.ac.yu>. --marekm
*/
// if (getdef_bool("PORTTIME_CHECKS_ENAB") &&
// !isttytime(pwent.pw_name, tty, time ((time_t *) 0))) {
// SYSLOG((LOG_WARN, BAD_TIME, username, fromhost));
// closelog();
// bad_time_notify();
// exit(1);
// }
#endif
if (getenv("IFS")) /* don't export user IFS ... */
addenv("IFS= \t\n", NULL); /* ... instead, set a safe IFS */
@ -759,7 +733,8 @@ auth_ok:
goto top; /* go do all this all over again */
}
dolastlog(&lastlog, &pwent, utent.ut_line, hostname);
if (getdef_bool("LASTLOG_ENAB")) /* give last login and log this one */
dolastlog(&lastlog, &pwent, utent.ut_line, hostname);
#ifdef SVR4_SI86_EUA
sysi86(SI86LIMUSER, EUA_ADD_USER); /* how do we test for fail? */

View File

@ -64,11 +64,9 @@ char *crypt_make_salt(void)
result[0] = '\0';
#ifndef __FreeBSD__
if (getdef_bool("MD5_CRYPT_ENAB")) {
strcpy(result, "$1$"); /* magic for the new MD5 crypt() */
}
#endif
/*
* Generate 8 chars of salt, the old crypt() will use only first 2.

View File

@ -49,59 +49,6 @@
void addenv_path(const char *varname, const char *dirname, const char *filename)
{
char *buf;
buf = xmalloc(strlen(dirname) + strlen(filename) + 2);
sprintf(buf, "%s/%s", dirname, filename);
addenv(varname, buf);
free(buf);
}
void read_env_file(const char *filename)
{
FILE *fp;
char buf[1024];
char *cp, *name, *val;
fp = fopen(filename, "r");
if (!fp)
return;
while (fgets(buf, sizeof buf, fp) == buf) {
cp = strrchr(buf, '\n');
if (!cp)
break;
*cp = '\0';
cp = buf;
/* ignore whitespace and comments */
while (*cp && isspace(*cp))
cp++;
if (*cp == '\0' || *cp == '#')
continue;
/*
* ignore lines which don't follow the name=value format
* (for example, the "export NAME" shell commands)
*/
name = cp;
while (*cp && !isspace(*cp) && *cp != '=')
cp++;
if (*cp != '=')
continue;
/* NUL-terminate the name */
*cp++ = '\0';
val = cp;
addenv(name, val);
}
fclose(fp);
}
/*
* change to the user's home directory
* set the HOME, SHELL, MAIL, PATH, and LOGNAME or USER environmental
@ -109,6 +56,8 @@ void read_env_file(const char *filename)
*/
void setup_env(struct passwd *info)
{
char *cp;
/*
* Change the current working directory to be the home directory
* of the user. It is a fatal error for this process to be unable
@ -119,10 +68,15 @@ void setup_env(struct passwd *info)
* home directories.
*/
if (chdir(info->pw_dir) == -1) {
static char temp_pw_dir[] = "/";
if (!getdef_bool("DEFAULT_HOME") || chdir("/") == -1) {
fprintf(stderr, _("Unable to cd to \"%s\"\n"), info->pw_dir);
syslog(LOG_WARNING, "unable to cd to `%s' for user `%s'\n", info->pw_dir, info->pw_name);
closelog();
exit (1);
}
puts(_("No directory, logging in with HOME=/"));
info->pw_dir = temp_pw_dir;
}
/*
@ -143,7 +97,8 @@ void setup_env(struct passwd *info)
/*
* Create the PATH environmental variable and export it.
*/
addenv("PATH=/bin:/usr/bin", NULL);
cp = getdef_str("ENV_PATH");
addenv(cp ? cp : "PATH=/bin:/usr/bin", NULL);
/*
* Export the user name. For BSD derived systems, it's "USER", for

View File

@ -3,8 +3,6 @@
#ifndef _SETUPENV_H
#define _SETUPENV_H
void addenv_path(const char *, const char *, const char *);
void read_env_file(const char *);
void setup_env(struct passwd *);
#endif