Several mbsetup protections and checks added

This commit is contained in:
Michiel Broek 2003-01-31 21:49:29 +00:00
parent d95fc43626
commit 08542985ff
8 changed files with 606 additions and 526 deletions

View File

@ -92,7 +92,7 @@ m_tty.o: ../config.h ../lib/libs.h ../lib/memwatch.h ../lib/structs.h ../lib/use
mutil.o: ../config.h ../lib/libs.h ../lib/memwatch.h ../lib/structs.h ../lib/common.h ../lib/clcomm.h ../lib/mberrors.h screen.h mutil.h
m_archive.o: ../config.h ../lib/libs.h ../lib/memwatch.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/common.h ../lib/clcomm.h ../paths.h screen.h mutil.h ledit.h stlist.h m_global.h m_archive.h
m_fdb.o: ../config.h ../lib/libs.h ../lib/memwatch.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/common.h ../lib/clcomm.h screen.h mutil.h ledit.h m_global.h m_farea.h m_fdb.h
m_global.o: ../config.h ../lib/libs.h ../lib/memwatch.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/common.h ../lib/clcomm.h ../lib/mberrors.h screen.h mutil.h ledit.h m_node.h m_marea.h m_ticarea.h m_new.h m_global.h
m_global.o: ../config.h ../lib/libs.h ../lib/memwatch.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/common.h ../lib/clcomm.h ../lib/mberrors.h screen.h mutil.h ledit.h m_node.h m_marea.h m_ticarea.h m_new.h m_fgroup.h m_mgroup.h m_global.h
m_magic.o: ../config.h ../lib/libs.h ../lib/memwatch.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/common.h ../lib/clcomm.h screen.h mutil.h ledit.h stlist.h m_ticarea.h m_global.h m_magic.h
m_mgroup.o: ../config.h ../lib/libs.h ../lib/memwatch.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/common.h ../lib/clcomm.h screen.h mutil.h ledit.h stlist.h m_global.h m_node.h m_marea.h m_mgroup.h
m_node.o: ../config.h ../lib/libs.h ../lib/memwatch.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/common.h ../lib/clcomm.h screen.h mutil.h ledit.h grlist.h stlist.h m_global.h m_lang.h m_ticarea.h m_marea.h m_node.h

View File

@ -502,9 +502,8 @@ int EditFGrpRec(int Area)
void EditFGroup(void)
{
int records, i, o, x, y;
char pick[12];
char pick[12], temp[PATH_MAX];
FILE *fil;
char temp[PATH_MAX];
long offset;
clr_index();
@ -575,6 +574,7 @@ void EditFGroup(void)
}
if (strncmp(pick, "A", 1) == 0) {
if (records < CFG.tic_groups) {
working(1, 0, 0);
if (AppendFGroup() == 0) {
records++;
@ -582,15 +582,18 @@ void EditFGroup(void)
} else
working(2, 0, 0);
working(0, 0, 0);
} else {
errmsg("Cannot add group, change global setting in menu 1.13.5");
}
}
if (strncmp(pick, "N", 1) == 0)
if ((o + 20) < records)
o = o + 20;
o += 20;
if (strncmp(pick, "P", 1) == 0)
if ((o - 20) >= 0)
o = o - 20;
o -= 20;
if ((atoi(pick) >= 1) && (atoi(pick) <= records)) {
EditFGrpRec(atoi(pick));

View File

@ -44,6 +44,8 @@
#include "m_marea.h"
#include "m_ticarea.h"
#include "m_new.h"
#include "m_fgroup.h"
#include "m_mgroup.h"
#include "m_global.h"
@ -822,6 +824,8 @@ void e_flags(int Users)
void e_ticconf(void)
{
int temp;
clr_index();
set_color(WHITE, BLACK);
mvprintw( 5, 6, "1.13 EDIT FILEECHO PROCESSING");
@ -870,17 +874,29 @@ void e_ticconf(void)
case 1: E_INT( 7,18, CFG.tic_days, "Number of days to ^keep^ files on hold.")
case 2: E_STR( 8,18,20, CFG.hatchpasswd, "Enter the internal ^hatch^ password.")
case 3: E_INT( 9,18, CFG.drspace, "Enter the minimal ^free drivespace^ in KBytes.")
case 4: CFG.tic_systems = edit_int(10,18, CFG.tic_systems,
(char *)"Enter the maximum number of ^connected systems^ in the database.");
case 4: temp = CFG.tic_systems;
temp = edit_int(10,18, temp, (char *)"Enter the maximum number of ^connected systems^ in the database.");
if (temp < CountNoderec()) {
errmsg("You have %d nodes defined", CountNoderec());
show_int(10,18, CFG.tic_systems);
} else {
CFG.tic_systems = temp;
if ((OpenTicarea() == 0))
CloseTicarea(TRUE);
working(0, 0, 0);
}
break;
case 5: CFG.tic_groups = edit_int(11,18, CFG.tic_groups,
(char *)"Enter the maximum number of ^fileecho groups^ in the database.");
case 5: temp = CFG.tic_groups;
temp = edit_int(11,18, temp, (char *)"Enter the maximum number of ^fileecho groups^ in the database.");
if (temp < CountFGroup()) {
errmsg("You have %d groups defined", CountFGroup());
show_int(11,18, CFG.tic_groups);
} else {
CFG.tic_groups = temp;
if ((OpenNoderec() == 0))
CloseNoderec(TRUE);
working(0, 0, 0);
}
break;
case 6: E_INT( 12,18, CFG.tic_dupes, "Enter the maximum number of ^dupes^ in the dupe database.")
@ -954,6 +970,8 @@ void s_fidomailcfg(void)
void e_fidomailcfg(void)
{
int temp;
s_fidomailcfg();
for (;;) {
switch(select_menu(19)) {
@ -968,17 +986,29 @@ void e_fidomailcfg(void)
case 8: E_INT( 14,16, CFG.toss_old, "^Reject^ mail older then days, 0 means never reject.")
case 9: E_INT( 15,16, CFG.defmsgs, "The default maximum number of ^messages^ in each mail area.")
case 10:E_INT( 16,16, CFG.defdays, "The default maximum ^age in days^ in each mail area.")
case 11:CFG.toss_systems = edit_int(17,16, CFG.toss_systems,
(char *)"The maximum number of connected ^systems^ in the database.");
case 11:temp = CFG.toss_systems;
temp = edit_int(17,16, temp, (char *)"The maximum number of connected ^systems^ in the database.");
if (temp < CountNoderec()) {
errmsg("You have %d nodes defined", CountNoderec());
show_int( 17,16, CFG.toss_systems);
} else {
CFG.toss_systems = temp;
if ((OpenMsgarea() == 0))
CloseMsgarea(TRUE);
working(0, 0, 0);
}
break;
case 12:CFG.toss_groups = edit_int(18,16, CFG.toss_groups,
(char *)"The maximum number of ^groups^ in the database.");
case 12:temp = CFG.toss_groups;
temp = edit_int(18,16, temp, (char *)"The maximum number of ^groups^ in the database.");
if (temp < CountMGroup()) {
errmsg("You have %d groups defined", CountMGroup());
show_int( 18,16, CFG.toss_groups);
} else {
CFG.toss_groups = temp;
if ((OpenNoderec() == 0))
CloseNoderec(TRUE);
working(0, 0, 0);
}
break;
case 13:E_BOOL(12,58, CFG.addr4d, "Use ^4d^ addressing instead of ^5d^ addressing.")
case 14:E_INT( 13,58, CFG.new_split, "Gently ^split^ newfiles reports after n kilobytes (12..60).")
@ -1162,6 +1192,8 @@ void s_newfiles(void)
void e_newfiles(void)
{
int temp;
s_newfiles();
for (;;) {
set_color(WHITE, BLACK);
@ -1172,15 +1204,21 @@ void e_newfiles(void)
switch(select_menu(3)) {
case 0: return;
case 1: E_INT(7,16, CFG.newdays, "Add files younger than this in newfiles report.")
case 2: E_SEC(8,16, CFG.security, "1.14 NEWFILES REPORTS SECURITY", s_newfiles)
case 3: CFG.new_groups = edit_int( 9, 16, CFG.new_groups,
(char *)"The maximum of ^newfiles^ groups in the newfiles database");
case 2: E_SEC(8,16, CFG.security, "1.16 NEWFILES REPORTS SECURITY", s_newfiles)
case 3: temp = CFG.new_groups;
temp = edit_int( 9, 16, temp, (char *)"The maximum of ^newfiles^ groups in the newfiles database");
if (temp < CountNewfiles()) {
errmsg("You have %d newfiles reports defined", CountNewfiles());
show_int( 9,16, CFG.new_groups);
} else {
CFG.new_groups = temp;
if (OpenNewfiles() == 0)
CloseNewfiles(TRUE);
working(0, 0, 0);
}
break;
}
};
}
}

View File

@ -1334,12 +1334,10 @@ int EditMsgRec(int Area)
void EditMsgarea(void)
{
int records, i, o, y;
char pick[12];
int records, rc, i, o, y, from, too;
char pick[12], temp[PATH_MAX];
FILE *fil;
char temp[PATH_MAX];
long offset;
int from, too;
sysconnect System;
clr_index();
@ -1433,16 +1431,42 @@ void EditMsgarea(void)
from = edit_int(LINES -3, 10, from, (char *)"Wich ^area^ you want to move");
mvprintw(LINES -3,15, "To");
too = edit_int(LINES -3, 18, too, (char *)"Too which ^area^ to move");
if ((LoadMsgRec(from, TRUE) == -1) || (!msgs.Active)) {
errmsg((char *)"The originating area is invalid");
rc = 0;
/*
* Check originating area
*/
if (from == 0) {
errmsg((char *)"The originating area cannot be zero");
rc = 1;
}
if (!rc && LoadMsgRec(from, TRUE) == -1) {
errmsg((char *)"The originating area does not exist");
rc = 1;
}
if (!rc)
fclose(tfil);
} else {
fclose(tfil);
if ((LoadMsgRec(too, TRUE) == -1) || (msgs.Active)) {
errmsg((char *)"The destination area is invalid");
fclose(tfil);
} else {
if (!rc && !msgs.Active) {
errmsg((char *)"The originating area is not in use");
rc = 1;
}
if (!rc && (too == 0)) {
errmsg((char *)"The destination area cannot be zero");
rc = 1;
}
if (!rc && LoadMsgRec(too, TRUE) == -1) {
errmsg((char *)"The destination area does not exist");
rc = 1;
}
if (!rc)
fclose(tfil);
if (!rc && (msgs.Active)) {
errmsg((char *)"The destination area is in use");
rc = 1;
}
if (!rc) {
LoadMsgRec(from, TRUE);
SaveMsgRec(too, TRUE);
LoadMsgRec(from, TRUE);
@ -1454,7 +1478,7 @@ void EditMsgarea(void)
}
SaveMsgRec(from, TRUE);
MsgUpdated = 1;
}
Syslog('+', "Moved message area %d to %d", from, too);
}
}

View File

@ -436,9 +436,8 @@ int EditMGrpRec(int Area)
void EditMGroup(void)
{
int records, i, o, x, y;
char pick[12];
char pick[12], temp[PATH_MAX];
FILE *fil;
char temp[PATH_MAX];
long offset;
clr_index();
@ -509,6 +508,7 @@ void EditMGroup(void)
}
if (strncmp(pick, "A", 1) == 0) {
if (records < CFG.toss_groups) {
working(1, 0, 0);
if (AppendMGroup() == 0) {
records++;
@ -516,7 +516,11 @@ void EditMGroup(void)
} else
working(2, 0, 0);
working(0, 0, 0);
} else {
errmsg("Cannot add group, change global setting in menu 1.14.12");
}
}
if (strncmp(pick, "N", 1) == 0)
if ((o + 20) < records)

View File

@ -437,9 +437,8 @@ int EditNewRec(int Area)
void EditNewfiles(void)
{
int records, i, o, x, y;
char pick[12];
char pick[12], temp[PATH_MAX];
FILE *fil;
char temp[PATH_MAX];
long offset;
clr_index();
@ -507,6 +506,7 @@ void EditNewfiles(void)
}
if (strncmp(pick, "A", 1) == 0) {
if (records > CFG.new_groups) {
working(1, 0, 0);
if (AppendNewfiles() == 0) {
records++;
@ -514,6 +514,9 @@ void EditNewfiles(void)
} else
working(2, 0, 0);
working(0, 0, 0);
} else {
errmsg("Cannot add, change global setting in menu 1.16.3");
}
}
if (strncmp(pick, "N", 1) == 0)

View File

@ -4,7 +4,7 @@
* Purpose ...............: Nodes Setup Program
*
*****************************************************************************
* Copyright (C) 1997-2002
* Copyright (C) 1997-2003
*
* Michiel Broek FIDO: 2:280/2802
* Beekmansbos 10
@ -55,7 +55,6 @@ int NodeUpdated = 0;
* Count nr of nodes records in the database.
* Creates the database if it doesn't exist.
*/
int CountNoderec(void);
int CountNoderec(void)
{
FILE *fil;
@ -1181,9 +1180,8 @@ int EditNodeRec(int Area)
void EditNodes(void)
{
int records, i, o, x, y;
char pick[12];
char pick[12], temp[PATH_MAX];
FILE *fil;
char temp[PATH_MAX];
long offset;
clr_index();
@ -1254,6 +1252,7 @@ void EditNodes(void)
}
if (strncmp(pick, "A", 1) == 0) {
if ((records < CFG.toss_systems) && (records < CFG.tic_systems)) {
working(1, 0, 0);
if (AppendNoderec() == 0) {
records++;
@ -1261,6 +1260,13 @@ void EditNodes(void)
} else
working(2, 0, 0);
working(0, 0, 0);
} else {
if ((records + 1) > CFG.toss_systems) {
errmsg("Cannot add node, change global setting in menu 1.14.11");
} else {
errmsg("Cannot add node, change global setting in menu 1.13.4");
}
}
}
if (strncmp(pick, "N", 1) == 0)

View File

@ -1,6 +1,9 @@
#ifndef _NODE_H
#define _NODE_H
/* $Id$ */
int CountNoderec(void);
int OpenNoderec(void);
void CloseNoderec(int);
int GroupInNode(char *, int);
@ -10,4 +13,3 @@ int node_doc(FILE *, FILE *, int);
fidoaddr PullUplink(char *);
#endif