From 1ef0643fcc6dbd125ad764b77336409c8e85ff36 Mon Sep 17 00:00:00 2001 From: Michiel Broek Date: Mon, 27 Sep 2004 11:41:03 +0000 Subject: [PATCH] Basic installation updates --- ChangeLog | 6 ++ SETUP.sh | 31 +++++++- mbsetup/m_users.c | 191 ++++++++++++++++++++++++---------------------- 3 files changed, 132 insertions(+), 96 deletions(-) diff --git a/ChangeLog b/ChangeLog index 1ddc3d97..979061e7 100644 --- a/ChangeLog +++ b/ChangeLog @@ -5,6 +5,12 @@ v0.61.5 25-Sep-2004 general: In SETUP.sh better xinetd.d system detection. + On Linux SETUP.sh adds user mbse to group wheel and uucp. + SETUP.sh adds disabled telnet service to inetd.conf or xinetd. + + mbsetup: + In user setup, if user gets a new security level, his timelimit + is updated with your permission. v0.61.4 11-Aug-2004 - 25-Sep-2004 diff --git a/SETUP.sh b/SETUP.sh index 2ab1f308..791f6925 100644 --- a/SETUP.sh +++ b/SETUP.sh @@ -245,7 +245,11 @@ log "+" "[$?] Added group bbs" echo -n ", user 'mbse'" if [ "$OSTYPE" = "Linux" ]; then - useradd -c "MBSE BBS Admin" -d $MHOME -g bbs -G uucp -m -s /bin/bash mbse + if [ "`grep wheel /etc/group`" = "" ]; then + useradd -c "MBSE BBS Admin" -d $MHOME -g bbs -G uucp -m -s /bin/bash mbse + else + useradd -c "MBSE BBS Admin" -d $MHOME -g bbs -G wheel,uucp -m -s /bin/bash mbse + fi fi if [ "$OSTYPE" = "FreeBSD" ]; then pw useradd mbse -c "MBSE BBS Admin" -d $MHOME -g bbs -G wheel,dialer -m -s /usr/local/bin/bash @@ -445,6 +449,7 @@ cat << EOF >>/etc/inetd.conf binkp stream tcp nowait mbse $MHOME/bin/mbcico mbcico -t ibn fido stream tcp nowait mbse $MHOME/bin/mbcico mbcico -t ifc tfido stream tcp nowait mbse $MHOME/bin/mbcico mbcico -t itn +#telnet stream tcp nowait root /usr/sbin/tcpd in.telnetd -L $MHOME/bin/mblogin EOF chmod 644 /etc/inetd.conf @@ -459,8 +464,8 @@ EOF fi fi -if [ -f /etc/xinetd.conf ] || [ -d /etc/xinetd.d ]; then - log "+" "/etc/xinetd.conf or /etc/xinetd.d found, xinetd system" +if [ -f /etc/xinetd.conf ]; then + log "+" "/etc/xinetd.conf found, xinetd system" if [ -d /etc/xinetd.d ]; then log "+" "has xinetd.d subdir, writing files" XINET="/etc/xinetd.d/mbsebbs" @@ -471,7 +476,7 @@ if [ -f /etc/xinetd.conf ] || [ -d /etc/xinetd.d ]; then cat << EOF >> $XINET #:MBSE BBS services are defined here. # -# Author: Michiel Broek , 01-Feb-2004 +# Author: Michiel Broek , 27-Sep-2004 service binkp { @@ -505,6 +510,24 @@ service tfido server = $MHOME/bin/mbcico server_args = -t itn } +disable=yes + +# Telnet to the bbs using mblogin, disabled by default. +# +service telnet +{ + disable = yes + protocol = tcp + instances = 10 + flags = REUSE + log_on_failure += USERID + socket_type = stream + user = root + server = /usr/sbin/telnetd + server_args = -L $MHOME/bin/mblogin + wait = no +} + EOF fi diff --git a/mbsetup/m_users.c b/mbsetup/m_users.c index f90be54f..f69f0ef9 100644 --- a/mbsetup/m_users.c +++ b/mbsetup/m_users.c @@ -451,28 +451,28 @@ int EditUsrRec2(void) void Reset_Time(void); void Reset_Time(void) { - char *temp; - FILE *pLimits; + char *temp; + FILE *pLimits; -temp = calloc(PATH_MAX, sizeof(char)); -sprintf(temp, "%s/etc/limits.data", getenv("MBSE_ROOT")); -if ((pLimits = fopen(temp,"r")) == NULL) { -WriteError("$Can't open %s", temp); -} else { -fread(&LIMIThdr, sizeof(LIMIThdr), 1, pLimits); -while (fread(&LIMIT, sizeof(LIMIT), 1, pLimits) == 1) { -if (LIMIT.Security == usrconfig.Security.level) { -if (LIMIT.Time) -usrconfig.iTimeLeft = LIMIT.Time; -else -usrconfig.iTimeLeft = 86400; -usrconfig.iTimeUsed = 0; -break; -} -} -fclose(pLimits); -} -free(temp); + temp = calloc(PATH_MAX, sizeof(char)); + sprintf(temp, "%s/etc/limits.data", getenv("MBSE_ROOT")); + if ((pLimits = fopen(temp,"r")) == NULL) { + WriteError("$Can't open %s", temp); + } else { + fread(&LIMIThdr, sizeof(LIMIThdr), 1, pLimits); + while (fread(&LIMIT, sizeof(LIMIT), 1, pLimits) == 1) { + if (LIMIT.Security == usrconfig.Security.level) { + if (LIMIT.Time) + usrconfig.iTimeLeft = LIMIT.Time; + else + usrconfig.iTimeLeft = 86400; + usrconfig.iTimeUsed = 0; + break; + } + } + fclose(pLimits); + } + free(temp); } @@ -482,85 +482,92 @@ free(temp); */ int EditUsrRec(int Area) { - FILE *fil; - char mfile[PATH_MAX]; - long offset; - int j = 0; - unsigned long crc, crc1; + FILE *fil; + char mfile[PATH_MAX]; + long offset; + int j = 0; + unsigned long crc, crc1, level; - clr_index(); - working(1, 0, 0); - IsDoing("Edit Users"); + clr_index(); + working(1, 0, 0); + IsDoing("Edit Users"); - sprintf(mfile, "%s/etc/users.temp", getenv("MBSE_ROOT")); - if ((fil = fopen(mfile, "r")) == NULL) { - working(2, 0, 0); - return -1; - } + sprintf(mfile, "%s/etc/users.temp", getenv("MBSE_ROOT")); + if ((fil = fopen(mfile, "r")) == NULL) { + working(2, 0, 0); + return -1; + } - offset = sizeof(usrconfighdr) + ((Area -1) * sizeof(usrconfig)); - if (fseek(fil, offset, 0) != 0) { - working(2, 0, 0); - return -1; - } + offset = sizeof(usrconfighdr) + ((Area -1) * sizeof(usrconfig)); + if (fseek(fil, offset, 0) != 0) { + working(2, 0, 0); + return -1; + } - fread(&usrconfig, sizeof(usrconfig), 1, fil); - fclose(fil); - crc = 0xffffffff; - crc = upd_crc32((char *)&usrconfig, crc, sizeof(usrconfig)); - Screen1(); + fread(&usrconfig, sizeof(usrconfig), 1, fil); + fclose(fil); + crc = 0xffffffff; + crc = upd_crc32((char *)&usrconfig, crc, sizeof(usrconfig)); + Screen1(); - for (;;) { - Fields1(); - j = select_menu(16); - switch(j) { - case 0: - crc1 = 0xffffffff; - crc1 = upd_crc32((char *)&usrconfig, crc1, sizeof(usrconfig)); - if (crc != crc1) { - if (yes_no((char *)"Record is changed, save") == 1) { - working(1, 0, 0); - if ((fil = fopen(mfile, "r+")) == NULL) { - working(2, 0, 0); - return -1; - } - fseek(fil, offset, 0); - fwrite(&usrconfig, sizeof(usrconfig), 1, fil); - fclose(fil); - UsrUpdated = 1; - working(6, 0, 0); - } + for (;;) { + Fields1(); + j = select_menu(16); + switch(j) { + case 0: crc1 = 0xffffffff; + crc1 = upd_crc32((char *)&usrconfig, crc1, sizeof(usrconfig)); + if (crc != crc1) { + if (yes_no((char *)"Record is changed, save") == 1) { + working(1, 0, 0); + if ((fil = fopen(mfile, "r+")) == NULL) { + working(2, 0, 0); + return -1; } - IsDoing("Browsing Menu"); - return 0; - case 1: E_STR( 6,17,35,usrconfig.sUserName, "The ^First and Last name^ of this user") - case 2: E_USEC( 7,17, usrconfig.Security, "15.2 EDIT USER SECURITY", Screen1) - break; - case 3 :E_STR( 8,17,10,usrconfig.sExpiryDate, "The ^Expiry Date^ in DD-MM-YYYY format, 00-00-0000 is no expire") - case 4 :E_INT( 9,17, usrconfig.ExpirySec.level,"The ^Expiry Level^ for this user") - case 5 :E_STR( 10,17,8, usrconfig.Name, "The ^Unix username^ for this user") - case 6 :E_INT( 14,17, usrconfig.Credit, "Users ^Credit^") - case 7 :E_BOOL(15,17, usrconfig.Hidden, "Is user ^hidden^ on the BBS") - case 8 :E_BOOL(16,17, usrconfig.Deleted, "Is user marked for ^deletion^") - case 9 :E_BOOL(17,17, usrconfig.NeverDelete, "^Never delete^ this user") - case 10:E_STR( 18,17,62,usrconfig.sComment, "A ^Comment^ for this user") - - case 11:E_BOOL( 6,68, usrconfig.LockedOut, "User is ^Locked Out^ of this BBS") - case 12:E_BOOL( 7,68, usrconfig.Guest, "This is a ^Guest^ account") - case 13:E_BOOL( 8,68, usrconfig.OL_ExtInfo, "Add ^Extended Message Info^ in OLR download") - case 14:E_BOOL( 9,68, usrconfig.Email, "User has a ^private email^ mailbox") - case 15:if (yes_no((char *)"Reset time left for today") == 1) { - Reset_Time(); - } - break; - case 16:EditUsrRec2(); - clr_index(); - Screen1(); - Fields1(); - break; + fseek(fil, offset, 0); + fwrite(&usrconfig, sizeof(usrconfig), 1, fil); + fclose(fil); + UsrUpdated = 1; + working(6, 0, 0); + } } + IsDoing("Browsing Menu"); + return 0; + case 1: E_STR( 6,17,35,usrconfig.sUserName, "The ^First and Last name^ of this user") + case 2: level = usrconfig.Security.level; + usrconfig.Security = edit_usec(7,17,usrconfig.Security, (char *)"15.2 EDIT USER SECURITY"); + Screen1(); + Fields1(); + if (level != usrconfig.Security.level) { + if (yes_no((char *)"Set time left for new level") == 1) { + Reset_Time(); + } + } + break; + case 3 :E_STR( 8,17,10,usrconfig.sExpiryDate, "The ^Expiry Date^ in DD-MM-YYYY format, 00-00-0000 is no expire") + case 4 :E_INT( 9,17, usrconfig.ExpirySec.level,"The ^Expiry Level^ for this user") + case 5 :E_STR( 10,17,8, usrconfig.Name, "The ^Unix username^ for this user") + case 6 :E_INT( 14,17, usrconfig.Credit, "Users ^Credit^") + case 7 :E_BOOL(15,17, usrconfig.Hidden, "Is user ^hidden^ on the BBS") + case 8 :E_BOOL(16,17, usrconfig.Deleted, "Is user marked for ^deletion^") + case 9 :E_BOOL(17,17, usrconfig.NeverDelete, "^Never delete^ this user") + case 10:E_STR( 18,17,62,usrconfig.sComment, "A ^Comment^ for this user") + + case 11:E_BOOL( 6,68, usrconfig.LockedOut, "User is ^Locked Out^ of this BBS") + case 12:E_BOOL( 7,68, usrconfig.Guest, "This is a ^Guest^ account") + case 13:E_BOOL( 8,68, usrconfig.OL_ExtInfo, "Add ^Extended Message Info^ in OLR download") + case 14:E_BOOL( 9,68, usrconfig.Email, "User has a ^private email^ mailbox") + case 15:if (yes_no((char *)"Reset time left for today") == 1) { + Reset_Time(); + } + break; + case 16:EditUsrRec2(); + clr_index(); + Screen1(); + Fields1(); + break; } - return 0; + } + return 0; }