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: mbsebbs:
Automatic dynamic detection of the users screensize. 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: mbsetup:
Removed settings for users screenlength. Removed settings for users screenlength.
lang: Removed prompts 64, 80 and 81. lang: Removed prompts 64, 80 and 81.
Changed prompt 348.
Added prompt 31.
examples: examples:
removed Change Screenlength from the English menus and removed Change Screenlength from the English menus and

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -127,8 +127,6 @@ int main(int argc, char **argv)
if ((p = getenv("CALLER_ID")) != NULL) if ((p = getenv("CALLER_ID")) != NULL)
if (strncmp(p, "none", 4)) if (strncmp(p, "none", 4))
Syslog('+', "CALLER %s", p); Syslog('+', "CALLER %s", p);
if ((p = getenv("REMOTEHOST")) != NULL)
Syslog('+', "REMOTEHOST %s", p);
if ((p = getenv("TERM")) != NULL) if ((p = getenv("TERM")) != NULL)
Syslog('+', "TERM=%s %dx%d", p, cols, rows); Syslog('+', "TERM=%s %dx%d", p, cols, rows);
else else
@ -188,43 +186,60 @@ int main(int argc, char **argv)
pout(WHITE, BLACK, (char *)COPYRIGHT); pout(WHITE, BLACK, (char *)COPYRIGHT);
Enter(2); Enter(2);
/* if ((p = getenv("REMOTEHOST")) != NULL) {
* Check if this port is available. /*
*/ * Network connection, no tty checking but fill a ttyinfo record.
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) { memset(&ttyinfo, 0, sizeof(ttyinfo));
/* Connected on port */ snprintf(ttyinfo.comment, 41, "%s", p);
snprintf(temp, 81, "%s\"%s\" ", (char *) Language(348), ttyinfo.comment); snprintf(ttyinfo.tty, 7, "%s", pTTY);
pout(CYAN, BLACK, temp); snprintf(ttyinfo.speed, 21, "10 mbit");
/* on */ snprintf(ttyinfo.flags, 31, "IBN,IFC,XX");
snprintf(temp, 81, "%s %s", (char *) Language(135), ctime(&ltime)); ttyinfo.type = NETWORK;
PUTSTR(temp); ttyinfo.available = TRUE;
Enter(1); 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(); alarm_on();
Pause(); Pause();

View File

@ -120,8 +120,6 @@ int main(int argc, char **argv)
if ((p = getenv("CALLER_ID")) != NULL) if ((p = getenv("CALLER_ID")) != NULL)
if (strncmp(p, "none", 4)) if (strncmp(p, "none", 4))
Syslog('+', "CALLER_ID %s", p); Syslog('+', "CALLER_ID %s", p);
if ((p = getenv("REMOTEHOST")) != NULL)
Syslog('+', "REMOTEHOST %s", p);
if ((p = getenv("TERM")) != NULL) if ((p = getenv("TERM")) != NULL)
Syslog('+', "TERM=%s %dx%d", p, cols, rows); Syslog('+', "TERM=%s %dx%d", p, cols, rows);
else else
@ -137,7 +135,7 @@ int main(int argc, char **argv)
InitLanguage(); InitLanguage();
InitMenu(); InitMenu();
memset(&MsgBase, 0, sizeof(MsgBase)); memset(&MsgBase, 0, sizeof(MsgBase));
i = getpid(); i = getpid();
if ((tty = ttyname(0)) == NULL) { if ((tty = ttyname(0)) == NULL) {
@ -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()); snprintf(temp, 81, "MBSE BBS v%s (Release: %s) on %s/%s", VERSION, ReleaseDate, OsName(), OsCPU());
poutCR(YELLOW, BLACK, temp); poutCR(YELLOW, BLACK, temp);
pout(WHITE, BLACK, (char *)COPYRIGHT); 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 * 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); 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 ((p = getenv("REMOTEHOST")) != NULL) {
if (strcmp(ttyinfo.tty, pTTY) == 0) /*
break; * Network connection, no tty checking but fill a ttyinfo record.
}
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) { memset(&ttyinfo, 0, sizeof(ttyinfo));
/* Connected on port */ snprintf(ttyinfo.comment, 41, "%s", p);
snprintf(temp, 81, "%s\"%s\" ", (char *) Language(348), ttyinfo.comment); snprintf(ttyinfo.tty, 7, "%s", pTTY);
pout(CYAN, BLACK, temp); snprintf(ttyinfo.speed, 21, "10 mbit");
/* on */ snprintf(ttyinfo.flags, 31, "IBN,IFC,XX");
snprintf(temp, 81, "%s %s", (char *) Language(135), ctime(&ltime)); ttyinfo.type = NETWORK;
PUTSTR(temp); ttyinfo.available = TRUE;
Enter(1); 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 * Some debugging for me
*/ */
Syslog('b', "setlocale(LC_ALL, NULL) returns \"%s\"", printable(setlocale(LC_ALL, NULL), 0)); 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"); snprintf(sMailbox, 21, "mailbox");
colour(LIGHTGRAY, BLACK); colour(LIGHTGRAY, BLACK);

View File

@ -235,7 +235,7 @@ void user(void)
} else } else
strncpy(FirstName, UserName, sizeof(FirstName)-1); strncpy(FirstName, UserName, sizeof(FirstName)-1);
strncpy(UserName, usrconfig.sUserName, sizeof(UserName)-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"); IsDoing("Just Logged In");
/* /*