There is no check anymore for a valid tty with network calls, instead a fake ttyinfo record is created

This commit is contained in:
Michiel Broek 2005-10-08 17:58:23 +00:00
parent 8721afe4e4
commit a56aff8a92
15 changed files with 148 additions and 100 deletions

View File

@ -12,11 +12,21 @@ v0.81.0 07-Oct-2005
mbsebbs:
Automatic dynamic detection of the users screensize.
There is no check anymore for a valid tty with network calls,
instead a fake ttyinfo record is created. Modem/ISDN and
console still need a valid configured tty.
mbnewusr:
There is no check anymore for a valid tty with network calls,
instead a fake ttyinfo record is created. Modem/ISDN and
console still need a valid configured tty.
mbsetup:
Removed settings for users screenlength.
lang: Removed prompts 64, 80 and 81.
Changed prompt 348.
Added prompt 31.
examples:
removed Change Screenlength from the English menus and

View File

@ -29,7 +29,7 @@
28 page.c |Enter a short reason for chat
29 chat.c |The Sysop cannot use the bbs to chat! Use mbmon to chat
30 chat.c |Sorry, the chatserver is not available
31 .c |
31 mbsebbs.c |line
32 .c |
33 .c |
34 .c |
@ -346,7 +346,7 @@
345 oneline.c | # A Date User Description
346 oneline.c | # Description
347 oneline.c |Please enter number to list:
348 mbsebbs.c |Connected on port
348 mbsebbs.c |Connected from
349 file.c |File(s) :
350 file.c |Size :
351 file.c |Protocol :

View File

@ -29,7 +29,7 @@ YN|Check for new files at login [Y/n]:
|Enter a short reason for chat
|The Sysop cannot use the bbs to chat! Use mbmon to chat
|Sorry, the chatserver is not available
|
|line
|
|<7C>ƒ„…†‡ˆ‰ŠŒ<E280B9>Ž<EFBFBD><C5BD>“”•˜™šœ<E280BA>žŸ ¡¢£¤¥¦§¨©ª«¬­®¯°±²³´µ¶·¸¹º»¼½¾¿ÀÁÂÃÄ
|<7C>ƒ„…†‡ˆ‰ŠŒ<E280B9>Ž<EFBFBD><C5BD>“”•˜™šœ<E280BA>žŸ ¡¢£¤¥¦§¨©ª«¬­®¯°±²³´µ¶·¸¹º»¼½¾¿ÀÁÂÃÄ
@ -346,7 +346,7 @@ YN|View this BBS? [Y/n]:
| # A Date User Description
| # Description
|Please enter number to list:
|Connected on port
|Connected from
|File(s) :
|Size :
|Protocol :

View File

@ -29,7 +29,7 @@ JN|Kijk voor nieuwe bestanden tijdens login [J/n]:
|Geef een korte reden om te kletsen
|De sysop kan niet kletsen via het bbs! Gebruik mbmon
|Sorry, de chatserver is niet beschikbaar
|
|lijn
|
|
|
@ -346,7 +346,7 @@ JN|Bekijk dit BBS? [J/n]:
| # A Datum Gebruiker Omschrijving
| # Omschrijving
|Geef nummer om te bekijken:
|Verbonden via poort
|Verbonden vanaf
|Bestand(en):
|Grootte :
|Protocol :

View File

@ -29,7 +29,7 @@ YN|Check for new files at login [Y/n]:
|Enter a short reason for chat
|The Sysop cannot use the bbs to chat! Use mbmon to chat
|Sorry, the chatserver is not available
|
|line
|
|
|
@ -346,7 +346,7 @@ YN|View this BBS? [Y/n]:
| # A Date User Description
| # Description
|Please enter number to list:
|Connected on port
|Connected from
|File(s) :
|Size :
|Protocol :

View File

@ -29,7 +29,7 @@ YN|Check for new files at login [Y/n]:
|Enter a short reason for chat
|The Sysop cannot use the bbs to chat! Use mbmon to chat
|Sorry, the chatserver is not available
|
|line
|
|
|
@ -346,7 +346,7 @@ YN|View this BBS? [Y/n]:
| # A Date User Description
| # Description
|Please enter number to list:
|Connected on port
|Connected from
|File(s) :
|Size :
|Protocol :

View File

@ -29,7 +29,7 @@ YN|Check for new files at login [Y/n]:
|Enter a short reason for chat
|The Sysop cannot use the bbs to chat! Use mbmon to chat
|Sorry, the chatserver is not available
|
|line
|
|
|
@ -346,7 +346,7 @@ SN| BBS? [S/n]:
|n§ A Fecha Usuario Descripci¢n
| # Descripci¢n
|Teclee n£mero a listar:
|Conectado no porto
|Connected from
|Ficheiros :
|Tama¤o :
|Protocolo :

View File

@ -29,7 +29,7 @@ YN|Check for new files at login [Y/n]:
|Enter a short reason for chat
|The Sysop cannot use the bbs to chat! Use mbmon to chat
|Sorry, the chatserver is not available
|
|line
|
|
|
@ -346,7 +346,7 @@ JN|BBS-Details anzeigen ? [J/n]:
| # A Datum User Beschreibung
| # Beschreibung
|Bitte aufzulistende Nummer eingeben:
|Verbunden an Port
|Verbunden von
|Datei(en) :
|Groesse :
|Protokoll :

View File

@ -29,7 +29,7 @@ YN|Check for new files at login [Y/n]:
|Enter a short reason for chat
|The Sysop cannot use the bbs to chat! Use mbmon to chat
|Sorry, the chatserver is not available
|
|line
|
|
|
@ -346,7 +346,7 @@ JN|BBS-Details anzeigen ? [<J>a/<n>ein]:
| # A Datum User Beschreibung
| # Beschreibung
|Bitte aufzulistende Nummer eingeben:
|Verbunden an Port
|Verbunden von
|Datei(en) :
|Groesse :
|Protokoll :

View File

@ -29,7 +29,7 @@ YN|Check for new files at login [Y/n]:
|Enter a short reason for chat
|The Sysop cannot use the bbs to chat! Use mbmon to chat
|Sorry, the chatserver is not available
|
|line
|
|
|
@ -346,7 +346,7 @@ SN|
|n§ A Fecha Usuario Descripci¢n
| # Descripci¢n
|Teclee n£mero a listar:
|Conectado en puerto
|Connected from
|Ficheros :
|Tama¤o :
|Protocolo :

View File

@ -45,10 +45,6 @@
#include "ttyio.h"
extern int cols;
extern int rows;
int Chg_Language(int NewMode)
{

View File

@ -43,9 +43,11 @@
#include "timeout.h"
#define RBUFLEN 81
int chat_with_sysop = FALSE; /* Global sysop chat flag */
int chatting = FALSE; /* Global chatting flag */
char rbuf[50][81]; /* Chat receive buffer */ /* FIXME: must be a dynamic buffer */
char rbuf[50][RBUFLEN]; /* Chat receive buffer */ /* FIXME: must be a dynamic buffer */
int rpointer = 0; /* Chat receive pointer */
int rsize = 5; /* Chat receive size */
extern pid_t mypid;
@ -126,7 +128,7 @@ void DispMsg(char *msg)
{
int i;
strncpy(rbuf[rpointer], msg, 81);
strncpy(rbuf[rpointer], msg, RBUFLEN);
Showline(2 + rpointer, 1, rbuf[rpointer]);
if (rpointer == rsize) {
/*
@ -135,7 +137,7 @@ void DispMsg(char *msg)
for (i = 0; i <= rsize; i++) {
locate(i + 2, 1);
clrtoeol();
snprintf(rbuf[i], 81, "%s", rbuf[i+1]);
snprintf(rbuf[i], RBUFLEN, "%s", rbuf[i+1]);
Showline(i + 2, 1, rbuf[i]);
}
} else {

View File

@ -127,8 +127,6 @@ int main(int argc, char **argv)
if ((p = getenv("CALLER_ID")) != NULL)
if (strncmp(p, "none", 4))
Syslog('+', "CALLER %s", p);
if ((p = getenv("REMOTEHOST")) != NULL)
Syslog('+', "REMOTEHOST %s", p);
if ((p = getenv("TERM")) != NULL)
Syslog('+', "TERM=%s %dx%d", p, cols, rows);
else
@ -188,43 +186,60 @@ int main(int argc, char **argv)
pout(WHITE, BLACK, (char *)COPYRIGHT);
Enter(2);
/*
* Check if this port is available.
*/
snprintf(temp, PATH_MAX, "%s/etc/ttyinfo.data", getenv("MBSE_ROOT"));
if ((pTty = fopen(temp, "r")) == NULL) {
WriteError("Can't read %s", temp);
} else {
fread(&ttyinfohdr, sizeof(ttyinfohdr), 1, pTty);
while (fread(&ttyinfo, ttyinfohdr.recsize, 1, pTty) == 1) {
if (strcmp(ttyinfo.tty, pTTY) == 0)
break;
}
fclose(pTty);
if ((strcmp(ttyinfo.tty, pTTY) != 0) || (!ttyinfo.available)) {
Syslog('+', "No BBS allowed on port \"%s\"", pTTY);
PUTSTR((char *)"No BBS on this port allowed!");
Enter(2);
Fast_Bye(MBERR_OK);
}
if ((p = getenv("REMOTEHOST")) != NULL) {
/*
* Ask whether to display Connect String
* Network connection, no tty checking but fill a ttyinfo record.
*/
if (CFG.iConnectString) {
/* Connected on port */
snprintf(temp, 81, "%s\"%s\" ", (char *) Language(348), ttyinfo.comment);
pout(CYAN, BLACK, temp);
/* on */
snprintf(temp, 81, "%s %s", (char *) Language(135), ctime(&ltime));
PUTSTR(temp);
Enter(1);
memset(&ttyinfo, 0, sizeof(ttyinfo));
snprintf(ttyinfo.comment, 41, "%s", p);
snprintf(ttyinfo.tty, 7, "%s", pTTY);
snprintf(ttyinfo.speed, 21, "10 mbit");
snprintf(ttyinfo.flags, 31, "IBN,IFC,XX");
ttyinfo.type = NETWORK;
ttyinfo.available = TRUE;
snprintf(ttyinfo.name, 36, "Network port #%d", iNode);
} else {
/*
* Check if this port is available.
*/
snprintf(temp, PATH_MAX, "%s/etc/ttyinfo.data", getenv("MBSE_ROOT"));
if ((pTty = fopen(temp, "r")) == NULL) {
WriteError("Can't read %s", temp);
} else {
fread(&ttyinfohdr, sizeof(ttyinfohdr), 1, pTty);
while (fread(&ttyinfo, ttyinfohdr.recsize, 1, pTty) == 1) {
if (strcmp(ttyinfo.tty, pTTY) == 0)
break;
}
fclose(pTty);
if ((strcmp(ttyinfo.tty, pTTY) != 0) || (!ttyinfo.available)) {
Syslog('+', "No BBS allowed on port \"%s\"", pTTY);
PUTSTR((char *)"No BBS on this port allowed!");
Enter(2);
Fast_Bye(MBERR_OK);
}
}
}
/*
* Ask whether to display Connect String
*/
if (CFG.iConnectString) {
/* Connected from */
snprintf(temp, 81, "%s\"%s\" ", (char *) Language(348), ttyinfo.comment);
pout(CYAN, BLACK, temp);
/* line */
snprintf(temp, 81, "%s%d ", (char *) Language(31), iNode);
pout(CYAN, BLACK, temp);
/* on */
snprintf(temp, 81, "%s %s", (char *) Language(135), ctime(&ltime));
PUTSTR(temp);
Enter(1);
}
alarm_on();
Pause();

View File

@ -120,8 +120,6 @@ int main(int argc, char **argv)
if ((p = getenv("CALLER_ID")) != NULL)
if (strncmp(p, "none", 4))
Syslog('+', "CALLER_ID %s", p);
if ((p = getenv("REMOTEHOST")) != NULL)
Syslog('+', "REMOTEHOST %s", p);
if ((p = getenv("TERM")) != NULL)
Syslog('+', "TERM=%s %dx%d", p, cols, rows);
else
@ -188,7 +186,19 @@ int main(int argc, char **argv)
snprintf(temp, 81, "MBSE BBS v%s (Release: %s) on %s/%s", VERSION, ReleaseDate, OsName(), OsCPU());
poutCR(YELLOW, BLACK, temp);
pout(WHITE, BLACK, (char *)COPYRIGHT);
Enter(2);
/*
* Check and report screens that are too small
*/
if ((cols < 80) || (rows < 24)) {
snprintf(temp, 81, "Your screen is set to %dx%d, we use 80x24 at least", cols, rows);
poutCR(LIGHTRED, BLACK, temp);
Enter(1);
cols = 80;
rows = 24;
} else {
Enter(2);
}
/*
* Check users homedirectory, some *nix systems let users in if no
@ -202,50 +212,65 @@ int main(int argc, char **argv)
Quick_Bye(MBERR_OK);
}
/*
* Check if this port is available. In iNode we set a fake
* line number, this will be used by doors.
*/
snprintf(temp, PATH_MAX, "%s/etc/ttyinfo.data", getenv("MBSE_ROOT"));
if ((pTty = fopen(temp, "r")) == NULL) {
WriteError("Can't read %s", temp);
} else {
fread(&ttyinfohdr, sizeof(ttyinfohdr), 1, pTty);
while (fread(&ttyinfo, ttyinfohdr.recsize, 1, pTty) == 1) {
if (strcmp(ttyinfo.tty, pTTY) == 0)
break;
}
fclose(pTty);
if ((strcmp(ttyinfo.tty, pTTY) != 0) || (!ttyinfo.available)) {
Syslog('+', "No BBS allowed on port \"%s\"", pTTY);
snprintf(temp, 81, "No BBS on this port allowed!\r\n\r\n");
PUTSTR(temp);
Free_Language();
Quick_Bye(MBERR_OK);
}
if ((p = getenv("REMOTEHOST")) != NULL) {
/*
* Display Connect String if turned on.
* Network connection, no tty checking but fill a ttyinfo record.
*/
if (CFG.iConnectString) {
/* Connected on port */
snprintf(temp, 81, "%s\"%s\" ", (char *) Language(348), ttyinfo.comment);
pout(CYAN, BLACK, temp);
/* on */
snprintf(temp, 81, "%s %s", (char *) Language(135), ctime(&ltime));
PUTSTR(temp);
Enter(1);
memset(&ttyinfo, 0, sizeof(ttyinfo));
snprintf(ttyinfo.comment, 41, "%s", p);
snprintf(ttyinfo.tty, 7, "%s", pTTY);
snprintf(ttyinfo.speed, 21, "10 mbit");
snprintf(ttyinfo.flags, 31, "IBN,IFC,XX");
ttyinfo.type = NETWORK;
ttyinfo.available = TRUE;
snprintf(ttyinfo.name, 36, "Network port #%d", iNode);
} else {
/*
* Check if this port is available.
*/
snprintf(temp, PATH_MAX, "%s/etc/ttyinfo.data", getenv("MBSE_ROOT"));
if ((pTty = fopen(temp, "r")) == NULL) {
WriteError("Can't read %s", temp);
} else {
fread(&ttyinfohdr, sizeof(ttyinfohdr), 1, pTty);
while (fread(&ttyinfo, ttyinfohdr.recsize, 1, pTty) == 1) {
if (strcmp(ttyinfo.tty, pTTY) == 0)
break;
}
fclose(pTty);
if ((strcmp(ttyinfo.tty, pTTY) != 0) || (!ttyinfo.available)) {
Syslog('+', "No BBS allowed on port \"%s\"", pTTY);
snprintf(temp, 81, "No BBS on this port allowed!\r\n\r\n");
PUTSTR(temp);
Free_Language();
Quick_Bye(MBERR_OK);
}
}
}
/*
* Display Connect String if turned on.
*/
if (CFG.iConnectString) {
/* Connected from */
snprintf(temp, 81, "%s\"%s\" ", (char *) Language(348), ttyinfo.comment);
pout(CYAN, BLACK, temp);
/* line */
snprintf(temp, 81, "%s%d ", (char *) Language(31), iNode);
pout(CYAN, BLACK, temp);
/* on */
snprintf(temp, 81, "%s %s", (char *) Language(135), ctime(&ltime));
PUTSTR(temp);
Enter(1);
}
/*
* Some debugging for me
*/
Syslog('b', "setlocale(LC_ALL, NULL) returns \"%s\"", printable(setlocale(LC_ALL, NULL), 0));
/* Next is not usefull */
Syslog('b', "nl_langinfo(LC_CTYPE) returns \"%s\"", printable(nl_langinfo(LC_CTYPE), 0));
snprintf(sMailbox, 21, "mailbox");
colour(LIGHTGRAY, BLACK);

View File

@ -235,7 +235,7 @@ void user(void)
} else
strncpy(FirstName, UserName, sizeof(FirstName)-1);
strncpy(UserName, usrconfig.sUserName, sizeof(UserName)-1);
Syslog('+', "%s On-Line at \"%s\", node %d", UserName, ttyinfo.comment, iNode);
Syslog('+', "%s On-Line from \"%s\", node %d", UserName, ttyinfo.comment, iNode);
IsDoing("Just Logged In");
/*