Several setup settings added

This commit is contained in:
Michiel Broek 2004-03-17 20:24:59 +00:00
parent 80e8422263
commit a479fa7b77
11 changed files with 192 additions and 135 deletions

View File

@ -10,7 +10,7 @@ v0.51.2 06-Mar-2004
Install programs as root (as usual).
Start mbsetup, this can take a while on a system with lots of
files, during startup the files database will be converted.
After the menu appears, you may exit mbsetup.
After the menu appears, enter global setup, exit and save.
Open the system again.
If you want you may restart mbtask.
@ -20,6 +20,8 @@ v0.51.2 06-Mar-2004
features.
Removed all references to costsharing for ticfiles which wasn't
fully implemented.
Added setup items for subprocess priority and sync filesystem.
Added setup parameter for filefind keyword length.
libcommon.a:
Moved the initial delay in the execute functions to the child
@ -81,6 +83,9 @@ v0.51.2 06-Mar-2004
Changed menus 14, 7.n.6, 10.1 and 8.4.
Changed default charset for new mailgroups and message areas
to CP437.
Added setup for filefind keyword length in menu 13.
Added setup items in menu 1.5 for child priority and filesystem
sync calls.
mbuseradd:
Fixed removing of a OS created homedir. This may solve problems

2
TODO
View File

@ -152,7 +152,7 @@ mbmsg:
areas.
mbaff:
L: Add setup parameters for minimum length of keywords.
L: Rewrite filefind search algorithm.
mbindex:
X: Add usernames index.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.1 KiB

After

Width:  |  Height:  |  Size: 10 KiB

View File

@ -14,7 +14,7 @@
</HEAD>
<BODY>
<BLOCKQUOTE>
<div align='right'><h5>Last update 30-Jan-2001</h5></div>
<div align='right'><h5>Last update 17-Mar-2004</h5></div>
<div align='center'><H1>MBSE BBS Setup - Filefind Areas.</H1></div>
<H3>Introduction.</H3>
@ -44,6 +44,7 @@ for.
<strong>Deleted </strong>If this area must be deleted.
<strong>Net. reply </strong>If the reply will be sent by netmail.
<strong>Hi ACSII </strong>If high ASCII is allowed in the replies.
<strong>Keywrd len </strong>The minimum keyword length allowed in search.
</pre>
<P>
<IMG SRC="../images/filefind.png" alt='Filefind setup'>

View File

@ -14,7 +14,7 @@
</HEAD>
<BODY>
<BLOCKQUOTE>
<div align="right"><h5>Last update 14-Jan-2004</h5></div>
<div align="right"><h5>Last update 17-Mar-2004</h5></div>
<div align="center"><H1>MBSE BBS Setup - Global Setup</H1></div>
In this setup you can edit all global settings for MBSE BBS. All sections will
@ -125,12 +125,26 @@ files.
<strong>FileAttach level </strong>Minimum level to allow attach files to netmail
<strong>Min diskspace MB </strong>At which low diskspace level utilities should stop working.
<strong>Simult. logins </strong>Maximum simultaneous logins allowed, 0 is unlimited, 1 is adviced.
<strong>Child priority </strong>Subproces nice priority, 0=high, 15=low CPU load.
<strong>Filesystem sync </strong>Call sync before and after execute.
</pre>
The minimum diskspace setting is to prevent that files get corrupted if your filesystem
is full. All drives are checked except CD-roms and floppies and the /boot directory if that
one is on a separate filesystem. Ext2, ext3, reiserfs, msdos and vfat partitions
are checked. The lowest free diskspace found counts. Default is 10 MB.
<p>
The Child priority sets the nice value for example zip/unzip, virus scanners
etc. Modern fast hardware will do fine with a low setting, older (pre PII)
hardware may need 15 to prevent a too heavy CPU load.
<p>
The filesystem sync setting is to call sync before and after the execute call,
such as when unzip is called. Almost all GNU/Linux systems need this because GNU/Linux
uses asynchronous directory changes. Since Linux 2.5.19 it should be possible to
mount filesystems synchronous. If this setting is No on asynchronous filesystems
mail and files can get corrupted. XxxxBSD systems use synchronous directory
updates and don't need this switch. If you don't know what all this is about,
leave this to the default setting.
<p>
<h3>1.6. User flag Descriptions.</h3>
<p>

View File

@ -36,8 +36,8 @@ int e_pid = 0; /* Execute child pid */
int _execute(char **, char *, char *, char *, int);
int _execute(char **args, char *in, char *out, char *err, int priority)
int _execute(char **, char *, char *, char *);
int _execute(char **args, char *in, char *out, char *err)
{
char buf[PATH_MAX];
int i, pid, terrno = 0, status = 0, rc = 0;
@ -84,12 +84,15 @@ int _execute(char **args, char *in, char *out, char *err, int priority)
}
errno = 0;
if (priority) {
if (CFG.priority) {
rc = getpriority(PRIO_PROCESS, 0);
Syslog('e', "getpriority in child %d", rc);
if (errno == 0) {
rc = setpriority(PRIO_PROCESS, 0, priority);
rc = setpriority(PRIO_PROCESS, 0, CFG.priority);
if (rc)
WriteError("$execv can't set priority to %d", priority);
WriteError("$execv can't set priority to %d", CFG.priority);
rc = getpriority(PRIO_PROCESS, 0);
Syslog('e', "getpriority in set to %d", rc);
}
}
rc = execv(args[0],args);
@ -105,8 +108,11 @@ int _execute(char **args, char *in, char *out, char *err, int priority)
} while (((rc > 0) && (rc != pid)) || ((rc == -1) && (errno == EINTR)));
terrno = errno;
if (priority)
if (CFG.priority) {
rc = getpriority(PRIO_PROCESS, 0);
Syslog('e', "getpriority in parent %d", rc);
setpriority(PRIO_PROCESS, 0, 0);
}
errno = terrno;
switch (rc) {
@ -149,14 +155,11 @@ int execute(char **args, char *in, char *out, char *err)
{
int rc;
#ifdef __linux__
sync();
#endif
rc = _execute(args, in, out, err, 15);
#ifdef __linux__
sync();
#endif
// msleep(300);
if (CFG.do_sync)
sync();
rc = _execute(args, in, out, err);
if (CFG.do_sync)
sync();
return rc;
}
@ -248,7 +251,7 @@ int _execsh(char *cmd, char *in, char *out, char *err)
* A delay in the child to prevent it returns before the main
* process sess it ever started.
*/
msleep(300);
msleep(150);
if (in) {
close(0);
@ -301,14 +304,11 @@ int execsh(char *cmd, char *in, char *out, char *err)
{
int rc;
#ifdef __linux__
sync();
#endif
if (CFG.do_sync)
sync();
rc = _execsh(cmd, in, out, err);
#ifdef __linux__
sync();
#endif
// msleep(300);
if (CFG.do_sync)
sync();
return rc;
}

View File

@ -1176,6 +1176,10 @@ struct sysconfig {
char debuglog[15]; /* Debug logfile */
char tmailshort[65]; /* T-Mail short filebox base*/
char tmaillong[65]; /* T-Mail long filebox base */
int priority; /* Child process priority */
unsigned do_sync : 1; /* Sync() during execute */
unsigned is_upgraded : 1; /* For internal upgrade use */
};
@ -1876,6 +1880,7 @@ struct _scanmgr {
unsigned NetReply : 1; /* Netmail reply */
unsigned Deleted : 1; /* Area is deleted */
unsigned HiAscii : 1; /* High Ascii allowed */
int keywordlen; /* Minimum keyword length */
};

View File

@ -332,7 +332,7 @@ void ScanFiles(ff_list *tmp)
}
tl(kwd);
if (strlen(kwd) > 3) {
if (strlen(kwd) > scanmgr.keywordlen) {
if (strstr(fdb.Name, kwd) != NULL) {
Found = TRUE;
Syslog('m', "Found %s in %s in filename", kwd, fdb.Name);

View File

@ -120,6 +120,10 @@ int OpenFilefind(void)
sprintf(scanmgr.template, "filefind");
FilefindUpdated = 1;
}
if (!scanmgr.keywordlen) {
scanmgr.keywordlen = 3;
FilefindUpdated = 1;
}
fwrite(&scanmgr, sizeof(scanmgr), 1, fout);
memset(&scanmgr, 0, sizeof(scanmgr));
}
@ -195,6 +199,7 @@ int AppendFilefind(void)
scanmgr.Language = 'E';
sprintf(scanmgr.template, "filefind");
strncpy(scanmgr.Origin, CFG.origin, 50);
scanmgr.keywordlen = 3;
fwrite(&scanmgr, sizeof(scanmgr), 1, fil);
fclose(fil);
FilefindUpdated = 1;
@ -222,6 +227,7 @@ void FFScreen(void)
mvprintw(15, 2, "9. Deleted");
mvprintw(16, 2, "10. Net. reply");
mvprintw(17, 2, "11. Hi Ascii");
mvprintw(18, 2, "12. Keywrd len");
}
@ -231,90 +237,90 @@ void FFScreen(void)
*/
int EditFfRec(int Area)
{
FILE *fil;
char mfile[PATH_MAX], temp1[2];
long offset;
unsigned long crc, crc1;
int i;
FILE *fil;
char mfile[PATH_MAX], temp1[2];
long offset;
unsigned long crc, crc1;
int i;
clr_index();
working(1, 0, 0);
IsDoing("Edit Filefind");
clr_index();
working(1, 0, 0);
IsDoing("Edit Filefind");
sprintf(mfile, "%s/etc/scanmgr.temp", getenv("MBSE_ROOT"));
if ((fil = fopen(mfile, "r")) == NULL) {
working(2, 0, 0);
return -1;
}
sprintf(mfile, "%s/etc/scanmgr.temp", getenv("MBSE_ROOT"));
if ((fil = fopen(mfile, "r")) == NULL) {
working(2, 0, 0);
return -1;
}
fread(&scanmgrhdr, sizeof(scanmgrhdr), 1, fil);
offset = scanmgrhdr.hdrsize + ((Area -1) * scanmgrhdr.recsize);
if (fseek(fil, offset, 0) != 0) {
working(2, 0, 0);
return -1;
}
fread(&scanmgrhdr, sizeof(scanmgrhdr), 1, fil);
offset = scanmgrhdr.hdrsize + ((Area -1) * scanmgrhdr.recsize);
if (fseek(fil, offset, 0) != 0) {
working(2, 0, 0);
return -1;
}
fread(&scanmgr, scanmgrhdr.recsize, 1, fil);
fclose(fil);
crc = 0xffffffff;
crc = upd_crc32((char *)&scanmgr, crc, scanmgrhdr.recsize);
fread(&scanmgr, scanmgrhdr.recsize, 1, fil);
fclose(fil);
crc = 0xffffffff;
crc = upd_crc32((char *)&scanmgr, crc, scanmgrhdr.recsize);
for (;;) {
FFScreen();
set_color(WHITE, BLACK);
show_str( 7,18,55, scanmgr.Comment);
show_str( 8,18,50, scanmgr.Origin);
show_str( 9,18,35, aka2str(scanmgr.Aka));
show_str( 10,18,50, scanmgr.ScanBoard);
show_str( 11,18,50, scanmgr.ReplBoard);
sprintf(temp1, "%c", scanmgr.Language);
show_str( 12,18,2, temp1);
show_str( 13,18,14, scanmgr.template);
show_bool(14,18, scanmgr.Active);
show_bool(15,18, scanmgr.Deleted);
show_bool(16,18, scanmgr.NetReply);
show_bool(17,18, scanmgr.HiAscii);
switch(select_menu(11)) {
case 0:
crc1 = 0xffffffff;
crc1 = upd_crc32((char *)&scanmgr, crc1, scanmgrhdr.recsize);
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(&scanmgr, scanmgrhdr.recsize, 1, fil);
fclose(fil);
FilefindUpdated = 1;
working(6, 0, 0);
}
for (;;) {
FFScreen();
set_color(WHITE, BLACK);
show_str( 7,18,55, scanmgr.Comment);
show_str( 8,18,50, scanmgr.Origin);
show_str( 9,18,35, aka2str(scanmgr.Aka));
show_str( 10,18,50, scanmgr.ScanBoard);
show_str( 11,18,50, scanmgr.ReplBoard);
sprintf(temp1, "%c", scanmgr.Language);
show_str( 12,18,2, temp1);
show_str( 13,18,14, scanmgr.template);
show_bool(14,18, scanmgr.Active);
show_bool(15,18, scanmgr.Deleted);
show_bool(16,18, scanmgr.NetReply);
show_bool(17,18, scanmgr.HiAscii);
show_int( 18,18, scanmgr.keywordlen);
switch(select_menu(12)) {
case 0: crc1 = 0xffffffff;
crc1 = upd_crc32((char *)&scanmgr, crc1, scanmgrhdr.recsize);
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(&scanmgr, scanmgrhdr.recsize, 1, fil);
fclose(fil);
FilefindUpdated = 1;
working(6, 0, 0);
}
IsDoing("Browsing Menu");
return 0;
case 1: E_STR( 7,18,55, scanmgr.Comment, "The ^comment^ for this area")
case 2: E_STR( 8,18,50, scanmgr.Origin, "The ^origin^ line to append, leave blank for random lines")
case 3: i = PickAka((char *)"13.3", TRUE);
if (i != -1)
scanmgr.Aka = CFG.aka[i];
break;
case 4: strcpy(scanmgr.ScanBoard, PickMsgarea((char *)"13.4"));
break;
case 5: strcpy(scanmgr.ReplBoard, PickMsgarea((char *)"13.5"));
break;
case 6: scanmgr.Language = PickLanguage((char *)"13.6");
break;
case 7: E_STR( 13,18,14, scanmgr.template, "The ^template^ file to use for the report")
case 8: E_BOOL(14,18, scanmgr.Active, "If this report is ^active^")
case 9: E_BOOL(15,18, scanmgr.Deleted, "If this record is ^deleted^")
case 10:E_BOOL(16,18, scanmgr.NetReply, "If reply's via ^netmail^ instead of echomail")
case 11:E_BOOL(17,18, scanmgr.HiAscii, "Allow ^Hi ASCII^ in this area")
}
}
IsDoing("Browsing Menu");
return 0;
case 1: E_STR( 7,18,55, scanmgr.Comment, "The ^comment^ for this area")
case 2: E_STR( 8,18,50, scanmgr.Origin, "The ^origin^ line to append, leave blank for random lines")
case 3: i = PickAka((char *)"13.3", TRUE);
if (i != -1)
scanmgr.Aka = CFG.aka[i];
break;
case 4: strcpy(scanmgr.ScanBoard, PickMsgarea((char *)"13.4"));
break;
case 5: strcpy(scanmgr.ReplBoard, PickMsgarea((char *)"13.5"));
break;
case 6: scanmgr.Language = PickLanguage((char *)"13.6");
break;
case 7: E_STR( 13,18,14, scanmgr.template, "The ^template^ file to use for the report")
case 8: E_BOOL(14,18, scanmgr.Active, "If this report is ^active^")
case 9: E_BOOL(15,18, scanmgr.Deleted, "If this record is ^deleted^")
case 10:E_BOOL(16,18, scanmgr.NetReply, "If reply's via ^netmail^ instead of echomail")
case 11:E_BOOL(17,18, scanmgr.HiAscii, "Allow ^Hi ASCII^ in this area")
case 12:E_IRC( 18,18, scanmgr.keywordlen, 3, 8, "Minimum ^keyword length^ to allowed for search")
}
}
}
@ -443,7 +449,7 @@ int ff_doc(FILE *fp, FILE *toc, int page)
while ((fread(&scanmgr, scanmgrhdr.recsize, 1, no)) == 1) {
if (j == 5) {
if (j == 4) {
page = newpage(fp, page);
fprintf(fp, "\n");
j = 0;
@ -455,8 +461,11 @@ int ff_doc(FILE *fp, FILE *toc, int page)
fprintf(fp, " Scan msg board %s\n", scanmgr.ScanBoard);
fprintf(fp, " Reply msg board %s\n", scanmgr.ReplBoard);
fprintf(fp, " Language %c\n", scanmgr.Language);
fprintf(fp, " Template file %s\n", scanmgr.template);
fprintf(fp, " Active %s\n", getboolean(scanmgr.Active));
fprintf(fp, " Netmail reply %s\n", getboolean(scanmgr.NetReply));
fprintf(fp, " Allow Hi-ASCII %s\n", getboolean(scanmgr.HiAscii));
fprintf(fp, " Keyword length %d\n", scanmgr.keywordlen);
fprintf(fp, "\n\n");
j++;
}

View File

@ -350,17 +350,19 @@ void b_screen(void)
mvprintw(15, 2, "9. Homedir Quota");
mvprintw(16, 2, "10. Location length");
mvprintw(17, 2, "11. Show new msgarea");
mvprintw( 7,37, "12. OLR Max. msgs.");
mvprintw( 8,37, "13. OLR Newfile days");
mvprintw( 9,37, "14. OLR Max Filereq");
mvprintw(10,37, "15. BBS Log Level");
mvprintw(11,37, "16. Utils loglevel");
mvprintw(12,37, "17. Utils slowly");
mvprintw(13,37, "18. CrashMail level");
mvprintw(14,37, "19. FileAttach level");
mvprintw(15,37, "20. Min diskspace MB");
mvprintw(16,37, "21. Simult. logins");
mvprintw(18, 2, "12. OLR Max. msgs.");
mvprintw( 7,37, "13. OLR Newfile days");
mvprintw( 8,37, "14. OLR Max Filereq");
mvprintw( 9,37, "15. BBS Log Level");
mvprintw(10,37, "16. Utils loglevel");
mvprintw(11,37, "17. Utils slowly");
mvprintw(12,37, "18. CrashMail level");
mvprintw(13,37, "19. FileAttach level");
mvprintw(14,37, "20. Min diskspace MB");
mvprintw(15,37, "21. Simult. logins");
mvprintw(16,37, "22. Child priority");
mvprintw(17,37, "23. Filesystem sync");
set_color(WHITE, BLACK);
show_bool( 7,24, CFG.exclude_sysop);
@ -374,17 +376,19 @@ void b_screen(void)
show_int( 15,24, CFG.iQuota);
show_int( 16,24, CFG.CityLen);
show_bool(17,24, CFG.NewAreas);
show_int( 18,24, CFG.OLR_MaxMsgs);
show_int( 7,59, CFG.OLR_MaxMsgs);
show_int( 8,59, CFG.OLR_NewFileLimit);
show_int( 9,59, CFG.OLR_MaxReq);
show_logl(10,59, CFG.bbs_loglevel);
show_logl(11,59, CFG.util_loglevel);
show_bool(12,59, CFG.slow_util);
show_int( 13,59, CFG.iCrashLevel);
show_int( 14,59, CFG.iAttachLevel);
show_int( 15,59, CFG.freespace);
show_int( 16,59, CFG.max_logins);
show_int( 7,59, CFG.OLR_NewFileLimit);
show_int( 8,59, CFG.OLR_MaxReq);
show_logl( 9,59, CFG.bbs_loglevel);
show_logl(10,59, CFG.util_loglevel);
show_bool(11,59, CFG.slow_util);
show_int( 12,59, CFG.iCrashLevel);
show_int( 13,59, CFG.iAttachLevel);
show_int( 14,59, CFG.freespace);
show_int( 15,59, CFG.max_logins);
show_int( 16,59, CFG.priority);
show_bool(17,59, CFG.do_sync);
}
@ -394,7 +398,7 @@ void e_bbsglob(void)
b_screen();
for (;;) {
switch(select_menu(21)) {
switch(select_menu(23)) {
case 0: return;
case 1: E_BOOL( 7,24, CFG.exclude_sysop, "^Exclude^ sysop from lists.")
case 2: E_BOOL( 8,24, CFG.iConnectString, "Show ^connect string^ at logon")
@ -407,17 +411,19 @@ void e_bbsglob(void)
case 9: E_INT( 15,24, CFG.iQuota, "Maximum ^Quota^ in MBytes in users homedirectory");
case 10:E_IRC( 16,24, CFG.CityLen, 3, 6, "Minimum ^Location name^ length (3..6)")
case 11:E_BOOL(17,24, CFG.NewAreas, "Show ^new^ or ^deleted^ message areas to the user at login.")
case 12:E_INT( 18,24, CFG.OLR_MaxMsgs, "^Maximum messages^ to pack for download (0=unlimited)")
case 12:E_INT( 7,59, CFG.OLR_MaxMsgs, "^Maximum messages^ to pack for download (0=unlimited)")
case 13:E_INT( 8,59, CFG.OLR_NewFileLimit, "^Limit Newfiles^ listing for maximum days")
case 14:E_INT( 9,59, CFG.OLR_MaxReq, "Maximum ^Filerequests^ to honor")
case 13:E_INT( 7,59, CFG.OLR_NewFileLimit, "^Limit Newfiles^ listing for maximum days")
case 14:E_INT( 8,59, CFG.OLR_MaxReq, "Maximum ^Filerequests^ to honor")
case 15:E_LOGL(CFG.bbs_loglevel, "1.5.15", b_screen)
case 16:E_LOGL(CFG.util_loglevel, "1.5.16", b_screen)
case 17:E_BOOL(12,59, CFG.slow_util, "Let background utilities run ^slowly^")
case 18:E_INT( 13,59, CFG.iCrashLevel, "The user level to allow sending ^CrashMail^")
case 19:E_INT( 14,59, CFG.iAttachLevel, "The user level to allow sending ^File Attaches^")
case 20:E_IRC( 15,59, CFG.freespace, 2, 1000, "Minimum ^free diskspace^ in MBytes on filesystems (2..1000)")
case 21:E_INT( 16,59, CFG.max_logins, "Maximum ^simultaneous logins^ allowed, 0 means unlimited")
case 17:E_BOOL(11,59, CFG.slow_util, "Let background utilities run ^slowly^")
case 18:E_INT( 12,59, CFG.iCrashLevel, "The user level to allow sending ^CrashMail^")
case 19:E_INT( 13,59, CFG.iAttachLevel, "The user level to allow sending ^File Attaches^")
case 20:E_IRC( 14,59, CFG.freespace, 2, 1000, "Minimum ^free diskspace^ in MBytes on filesystems (2..1000)")
case 21:E_INT( 15,59, CFG.max_logins, "Maximum ^simultaneous logins^ allowed, 0 means unlimited")
case 22:E_IRC( 16,59, CFG.priority, 0, 15, "Subproces ^nice priority^, 0=high, 15=low CPU load")
case 23:E_BOOL(17,59, CFG.do_sync, "Call ^sync^ before and after execute, use Yes on GNU/Linux")
}
}
}
@ -1430,6 +1436,15 @@ void global_menu(void)
Syslog('+', "Main config, upgraded rules directory");
}
if (!CFG.is_upgraded) {
CFG.priority = 15;
#ifdef __linux__
CFG.do_sync = TRUE;
#endif
CFG.is_upgraded = TRUE;
Syslog('+', "Main config, upgraded execute settings");
}
for (;;) {
clr_index();
@ -1692,6 +1707,8 @@ int global_doc(FILE *fp, FILE *toc, int page)
fprintf(fp, " Simult. logins %d\n", CFG.max_logins);
else
fprintf(fp, " Simult. logins unlimited\n");
fprintf(fp, " Child priority %d\n", CFG.priority);
fprintf(fp, " Sync on execute %s\n", getboolean(CFG.do_sync));
page = newpage(fp, page);
addtoc(fp, toc, 1, 7, page, (char *)"Users flag descriptions");

View File

@ -355,6 +355,12 @@ void load_maincfg(void)
CFG.maxarticles = 500;
CFG.priority = 15;
#ifdef __linux__
CFG.do_sync = TRUE;
#endif
CFG.is_upgraded = TRUE;
if ((fp = fopen(cfgfn, "a+")) == NULL) {
perror("");
fprintf(stderr, "Can't create %s\n", cfgfn);