Added areas security

This commit is contained in:
Michiel Broek 2002-09-28 22:18:49 +00:00
parent 2c0aa5ea42
commit 6ba7ecc05c
5 changed files with 349 additions and 201 deletions

View File

@ -1349,6 +1349,80 @@ securityrec edit_usec(int y, int x, securityrec sec, char *shdr)
securityrec edit_asec(securityrec sec, char *shdr)
{
int c, i, xx, yy, s;
clr_index();
set_color(WHITE, BLACK);
mvprintw(4,3,shdr);
set_color(CYAN, BLACK);
xx = 3;
yy = 6;
for (i = 0; i < 32; i++) {
if (i == 11) {
xx = 28;
yy = 6;
}
if (i == 22) {
xx = 53;
yy = 6;
}
set_color(CYAN,BLACK);
mvprintw(yy, xx, (char *)"%2d. %-16s", i+1, CFG.aname[i]);
yy++;
}
for (;;) {
set_color(WHITE, BLACK);
xx = 24;
yy = 6;
for (i = 0; i < 32; i++) {
if (i == 11) {
xx = 49;
yy = 6;
}
if (i == 22) {
xx = 74;
yy = 6;
}
c = '-';
if ((sec.flags >> i) & 1)
c = 'X';
if ((sec.notflags >> i) & 1)
c = 'O';
/*
* The next one may never show up
*/
if (((sec.flags >> i) & 1) && ((sec.notflags >> i) & 1))
c = '!';
mvprintw(yy,xx,(char *)"%c", c);
yy++;
}
s = select_menu(32);
switch(s) {
case 0: return sec;
default: if ((sec.notflags >> (s - 1)) & 1) {
sec.notflags = (sec.notflags ^ (1 << (s - 1)));
break;
}
if ((sec.flags >> (s - 1)) & 1) {
sec.flags = (sec.flags ^ (1 << (s - 1)));
sec.notflags = (sec.notflags | (1 << (s - 1)));
break;
}
sec.flags = (sec.flags | (1 << (s - 1)));
break;
}
}
}
char *get_secstr(securityrec S) char *get_secstr(securityrec S)
{ {
static char temp[45]; static char temp[45];

View File

@ -34,6 +34,7 @@ char *getflag(unsigned long, unsigned long);
void show_sec(int, int, securityrec); void show_sec(int, int, securityrec);
securityrec edit_sec(int, int, securityrec, char *); securityrec edit_sec(int, int, securityrec, char *);
securityrec edit_usec(int, int, securityrec, char *); securityrec edit_usec(int, int, securityrec, char *);
securityrec edit_asec(securityrec, char *);
char *get_secstr(securityrec); char *get_secstr(securityrec);
void show_int(int, int, int); void show_int(int, int, int);
int edit_int(int, int, int, char *); int edit_int(int, int, int, char *);

View File

@ -189,29 +189,33 @@ void e_filenames(void)
set_color(CYAN, BLACK); set_color(CYAN, BLACK);
mvprintw( 7, 6, "1. System logfile"); mvprintw( 7, 6, "1. System logfile");
mvprintw( 8, 6, "2. Error logfile"); mvprintw( 8, 6, "2. Error logfile");
mvprintw( 9, 6, "3. Default Menu"); mvprintw( 9, 6, "3. Mgr logfile");
mvprintw(10, 6, "4. Default Language"); mvprintw(10, 6, "4. Default Menu");
mvprintw(11, 6, "5. Chat Logfile"); mvprintw(11, 6, "5. Default Language");
mvprintw(12, 6, "6. Welcome Logo"); mvprintw(12, 6, "6. Chat Logfile");
mvprintw(13, 6, "7. Welcome Logo");
for (;;) { for (;;) {
set_color(WHITE, BLACK); set_color(WHITE, BLACK);
show_str( 7,28,14, CFG.logfile); show_str( 7,28,14, CFG.logfile);
show_str( 8,28,14, CFG.error_log); show_str( 8,28,14, CFG.error_log);
show_str( 9,28,14, CFG.default_menu); show_str( 9,28,14, CFG.mgrlog);
show_str(10,28,14, CFG.current_language); show_str(10,28,14, CFG.default_menu);
show_str(11,28,14, CFG.chat_log); show_str(11,28,14, CFG.current_language);
show_str(12,28,14, CFG.welcome_logo); show_str(12,28,14, CFG.chat_log);
show_str(13,28,14, CFG.welcome_logo);
switch(select_menu(6)) { switch(select_menu(7)) {
case 0: return; case 0: return;
case 1: E_STR( 7,28,14, CFG.logfile, "The name of the ^system^ logfile.") case 1: E_STR( 7,28,14, CFG.logfile, "The name of the ^system^ logfile.")
case 2: E_STR( 8,28,14, CFG.error_log, "The name of the ^errors^ logfile.") case 2: E_STR( 8,28,14, CFG.error_log, "The name of the ^errors^ logfile.")
case 3: E_STR( 9,28,14, CFG.default_menu, "The name of the ^default^ (top) ^menu^.") case 3: E_STR( 9,28,14, CFG.mgrlog, "The name of the ^area-/filemgr^ logfile.")
case 4: E_STR(10,28,14, CFG.current_language, "The name of the ^default language^.") case 4: E_STR(10,28,14, CFG.default_menu, "The name of the ^default^ (top) ^menu^.")
case 5: E_STR(11,28,14, CFG.chat_log, "The name of the ^chat^ logfile.") case 5: E_STR(11,28,14, CFG.current_language, "The name of the ^default language^.")
case 6: E_STR(12,28,14, CFG.welcome_logo, "The name of the ^BBS logo^ file.") case 6: E_STR(12,28,14, CFG.chat_log, "The name of the ^chat^ logfile.")
case 7: E_STR(13,28,14, CFG.welcome_logo, "The name of the ^BBS logo^ file.")
}
} }
};
} }
@ -741,14 +745,18 @@ void e_paging(void)
void e_flags(void) void e_flags(int Users)
{ {
int i, x, y, z; int i, x, y, z;
char temp[80]; char temp[80];
clr_index(); clr_index();
set_color(WHITE, BLACK); set_color(WHITE, BLACK);
mvprintw( 5, 6, "1.6 EDIT FLAG DESCRIPTIONS"); if (Users)
mvprintw( 5, 6, "1.6 EDIT USER FLAG DESCRIPTIONS");
else
mvprintw( 5, 6, "1.20 EDIT MANAGER FLAG DESCRIPTIONS");
set_color(CYAN, BLACK); set_color(CYAN, BLACK);
for (i = 0; i < 32; i++) { for (i = 0; i < 32; i++) {
if (i < 11) if (i < 11)
@ -759,16 +767,28 @@ void e_flags(void)
else else
mvprintw(i - 15, 54, (char *)"%d.", i+1); mvprintw(i - 15, 54, (char *)"%d.", i+1);
} }
for (;;) { for (;;) {
set_color(WHITE, BLACK); set_color(WHITE, BLACK);
for (i = 0; i < 32; i++) { for (i = 0; i < 32; i++) {
if (i < 11) if (i < 11) {
if (Users)
show_str(i + 7, 6, 16, CFG.fname[i]); show_str(i + 7, 6, 16, CFG.fname[i]);
else else
if (i < 22) show_str(i + 7, 6, 16, CFG.aname[i]);
} else {
if (i < 22) {
if (Users)
show_str(i - 4, 32, 16, CFG.fname[i]); show_str(i - 4, 32, 16, CFG.fname[i]);
else else
show_str(i - 4, 32, 16, CFG.aname[i]);
} else {
if (Users)
show_str(i -15, 58, 16, CFG.fname[i]); show_str(i -15, 58, 16, CFG.fname[i]);
else
show_str(i - 15,58, 16, CFG.aname[i]);
}
}
} }
z = select_menu(32); z = select_menu(32);
@ -778,7 +798,7 @@ void e_flags(void)
if (z < 12) { if (z < 12) {
x = 6; x = 6;
y = z + 6; y = z + 6;
} else } else {
if (z < 23) { if (z < 23) {
x = 32; x = 32;
y = z - 5; y = z - 5;
@ -786,9 +806,15 @@ void e_flags(void)
x = 58; x = 58;
y = z - 16; y = z - 16;
} }
}
sprintf(temp, "Enter a short ^description^ of flag bit %d", z); sprintf(temp, "Enter a short ^description^ of flag bit %d", z);
if (Users) {
strcpy(CFG.fname[z-1], edit_str(y, x, 16, CFG.fname[z-1], temp)); strcpy(CFG.fname[z-1], edit_str(y, x, 16, CFG.fname[z-1], temp));
}; } else {
strcpy(CFG.aname[z-1], edit_str(y, x, 16, CFG.aname[z-1], temp));
}
}
} }
@ -1545,6 +1571,7 @@ void e_html(void)
void global_menu(void) void global_menu(void)
{ {
unsigned long crc, crc1; unsigned long crc, crc1;
int i;
if (! check_free()) if (! check_free())
return; return;
@ -1578,10 +1605,20 @@ void global_menu(void)
if (strlen(CFG.bbs_macros) == 0) { if (strlen(CFG.bbs_macros) == 0) {
sprintf(CFG.bbs_macros, "%s/english/macro", getenv("MBSE_ROOT")); sprintf(CFG.bbs_macros, "%s/english/macro", getenv("MBSE_ROOT"));
Syslog('+', "Main config, upgraded default macro path");
} }
if (strlen(CFG.out_queue) == 0) { if (strlen(CFG.out_queue) == 0) {
sprintf(CFG.out_queue, "%s/var/queue", getenv("MBSE_ROOT")); sprintf(CFG.out_queue, "%s/var/queue", getenv("MBSE_ROOT"));
Syslog('+', "Main config, upgraded for new queue");
}
if (strlen(CFG.mgrlog) == 0) {
sprintf(CFG.mgrlog, "manager.log");
for (i = 0; i < 32; i++)
sprintf(CFG.aname[i], "Flags %d", i+1);
sprintf(CFG.aname[0], "Everyone");
Syslog('+', "Main config, upgraded for manager security");
} }
for (;;) { for (;;) {
@ -1595,7 +1632,7 @@ void global_menu(void)
mvprintw( 9, 6, "3. Edit Global Filenames"); mvprintw( 9, 6, "3. Edit Global Filenames");
mvprintw(10, 6, "4. Edit Global Paths"); mvprintw(10, 6, "4. Edit Global Paths");
mvprintw(11, 6, "5. Edit Global Settings"); mvprintw(11, 6, "5. Edit Global Settings");
mvprintw(12, 6, "6. Edit Flag Descriptions"); mvprintw(12, 6, "6. Edit User flag Descriptions");
mvprintw(13, 6, "7. Edit New Users defaults"); mvprintw(13, 6, "7. Edit New Users defaults");
mvprintw(14, 6, "8. Edit Text Colors"); mvprintw(14, 6, "8. Edit Text Colors");
mvprintw(15, 6, "9. Edit Next User Door"); mvprintw(15, 6, "9. Edit Next User Door");
@ -1607,11 +1644,12 @@ void global_menu(void)
mvprintw(10,46, "14. Edit Fidonet Mail/Echomail"); mvprintw(10,46, "14. Edit Fidonet Mail/Echomail");
mvprintw(11,46, "15. Edit Internet Mail/News"); mvprintw(11,46, "15. Edit Internet Mail/News");
mvprintw(12,46, "16. Edit All-/Newfiles lists"); mvprintw(12,46, "16. Edit All-/Newfiles lists");
mvprintw(13,46, "17. Edit Mailer setup"); mvprintw(13,46, "17. Edit Mailer global setup");
mvprintw(14,46, "18. Edit Ftp daemon setup"); mvprintw(14,46, "18. Edit Ftp daemon setup");
mvprintw(15,46, "19. Edit HTML pages setup"); mvprintw(15,46, "19. Edit HTML pages setup");
mvprintw(16,46, "20. Edit Mgr flag descriptions");
switch(select_menu(19)) { switch(select_menu(20)) {
case 0: case 0:
crc1 = 0xffffffff; crc1 = 0xffffffff;
crc1 = upd_crc32((char *)&CFG, crc1, sizeof(CFG)); crc1 = upd_crc32((char *)&CFG, crc1, sizeof(CFG));
@ -1639,7 +1677,7 @@ void global_menu(void)
e_bbsglob(); e_bbsglob();
break; break;
case 6: case 6:
e_flags(); e_flags(TRUE);
break; break;
case 7: case 7:
e_newuser(); e_newuser();
@ -1680,6 +1718,9 @@ void global_menu(void)
case 19: case 19:
e_html(); e_html();
break; break;
case 20:
e_flags(FALSE);
break;
} }
} }
} }
@ -1798,6 +1839,7 @@ int global_doc(FILE *fp, FILE *toc, int page)
addtoc(fp, toc, 1, 4, page, (char *)"Global filenames"); addtoc(fp, toc, 1, 4, page, (char *)"Global filenames");
fprintf(fp, " System logfile %s\n", CFG.logfile); fprintf(fp, " System logfile %s\n", CFG.logfile);
fprintf(fp, " Error logfile %s\n", CFG.error_log); fprintf(fp, " Error logfile %s\n", CFG.error_log);
fprintf(fp, " Manager logfile %s\n", CFG.mgrlog);
fprintf(fp, " Default menu %s\n", CFG.default_menu); fprintf(fp, " Default menu %s\n", CFG.default_menu);
fprintf(fp, " Default language %s\n", CFG.current_language); fprintf(fp, " Default language %s\n", CFG.current_language);
fprintf(fp, " Chat logfile %s\n", CFG.chat_log); fprintf(fp, " Chat logfile %s\n", CFG.chat_log);
@ -1853,7 +1895,7 @@ int global_doc(FILE *fp, FILE *toc, int page)
fprintf(fp, " Free diskspace %d MB.\n", CFG.freespace); fprintf(fp, " Free diskspace %d MB.\n", CFG.freespace);
page = newpage(fp, page); page = newpage(fp, page);
addtoc(fp, toc, 1, 7, page, (char *)"Flag descriptions"); addtoc(fp, toc, 1, 7, page, (char *)"Users flag descriptions");
fprintf(fp, " 1 1 2 2 3 3\n"); fprintf(fp, " 1 1 2 2 3 3\n");
fprintf(fp, " 1 5 0 5 0 5 0 2\n"); fprintf(fp, " 1 5 0 5 0 5 0 2\n");
fprintf(fp, " --------------------------------\n"); fprintf(fp, " --------------------------------\n");
@ -2083,6 +2125,22 @@ int global_doc(FILE *fp, FILE *toc, int page)
fprintf(fp, " Convert command %s\n", CFG.www_convert); fprintf(fp, " Convert command %s\n", CFG.www_convert);
fprintf(fp, " File per webpage %d\n", CFG.www_files_page); fprintf(fp, " File per webpage %d\n", CFG.www_files_page);
page = newpage(fp, page);
addtoc(fp, toc, 1,21, page, (char *)"Manager flag descriptions");
fprintf(fp, " 1 1 2 2 3 3\n");
fprintf(fp, " 1 5 0 5 0 5 0 2\n");
fprintf(fp, " --------------------------------\n");
fprintf(fp, " ||||||||||||||||||||||||||||||||\n");
for (i = 0; i < 32; i++) {
fprintf(fp, " ");
for (j = 0; j < (31 - i); j++)
fprintf(fp, "|");
fprintf(fp, "+");
for (j = (32 - i); j < 32; j++)
fprintf(fp, "-");
fprintf(fp, " %s\n", CFG.aname[31 - i]);
}
return page; return page;
} }

View File

@ -151,7 +151,16 @@ int OpenNoderec(void)
memset(&nodes, 0, sizeof(nodes)); memset(&nodes, 0, sizeof(nodes));
while (fread(&nodes, oldsize, 1, fin) == 1) { while (fread(&nodes, oldsize, 1, fin) == 1) {
if (oldsize != sizeof(nodes)) { if (oldsize != sizeof(nodes)) {
if (strlen(nodes.Spasswd) == 0)
strcpy(nodes.Spasswd, nodes.Epasswd); strcpy(nodes.Spasswd, nodes.Epasswd);
if (nodes.Security.level == 0) {
/*
* Level is not used, here it is used to mark
* the upgrade to default.
*/
nodes.Security.level = 1;
nodes.Security.flags = 1;
}
} }
fwrite(&nodes, sizeof(nodes), 1, fout); fwrite(&nodes, sizeof(nodes), 1, fout);
memset(&nodes, 0, sizeof(nodes)); memset(&nodes, 0, sizeof(nodes));
@ -293,6 +302,8 @@ int AppendNoderec(void)
nodes.ARCmailCompat = TRUE; nodes.ARCmailCompat = TRUE;
nodes.ARCmailAlpha = TRUE; nodes.ARCmailAlpha = TRUE;
nodes.StartDate = time(NULL); nodes.StartDate = time(NULL);
nodes.Security.level = 1;
nodes.Security.flags = 1;
fwrite(&nodes, sizeof(nodes), 1, fil); fwrite(&nodes, sizeof(nodes), 1, fil);
memset(&group, 0, 13); memset(&group, 0, 13);
for (i = 1; i <= CFG.tic_groups; i++) for (i = 1; i <= CFG.tic_groups; i++)
@ -493,7 +504,7 @@ void S_Stat(void)
clr_index(); clr_index();
set_color(WHITE, BLACK); set_color(WHITE, BLACK);
mvprintw( 5, 6, "7.9 NODE STATISTICS"); mvprintw( 5, 6, "7.10 NODE STATISTICS");
set_color(CYAN, BLACK); set_color(CYAN, BLACK);
mvprintw( 8,18, " This week Last week This month Last month Total"); mvprintw( 8,18, " This week Last week This month Last month Total");
mvprintw( 9,18, "---------- ---------- ---------- ---------- ----------"); mvprintw( 9,18, "---------- ---------- ---------- ---------- ----------");
@ -1086,9 +1097,10 @@ int EditNodeRec(int Area)
mvprintw(12, 6, "6. Files setup"); mvprintw(12, 6, "6. Files setup");
mvprintw(13, 6, "7. Files groups"); mvprintw(13, 6, "7. Files groups");
mvprintw(14, 6, "8. Directory session"); mvprintw(14, 6, "8. Directory session");
mvprintw(15, 6, "9. Statistics"); mvprintw(15, 6, "9. Security flags");
mvprintw(16, 6, "10. Statistics");
switch(select_menu(9)) { switch(select_menu(10)) {
case 0: crc1 = 0xffffffff; case 0: crc1 = 0xffffffff;
crc1 = upd_crc32((char *)&nodes, crc1, nodeshdr.recsize); crc1 = upd_crc32((char *)&nodes, crc1, nodeshdr.recsize);
if ((crc != crc1) || GrpChanged) { if ((crc != crc1) || GrpChanged) {
@ -1157,7 +1169,9 @@ int EditNodeRec(int Area)
break; break;
case 8: DirectoryEdit(); case 8: DirectoryEdit();
break; break;
case 9: S_Stat(); case 9: nodes.Security = edit_asec(nodes.Security, (char *)"7.9 SECURITY FLAGS");
break;
case 10:S_Stat();
break; break;
} }
} }
@ -1474,7 +1488,8 @@ int node_doc(FILE *fp, FILE *toc, int page)
fprintf(fp, " Advanced TIC %s", getboolean(nodes.AdvTic)); fprintf(fp, " Advanced TIC %s", getboolean(nodes.AdvTic));
fprintf(fp, " Billing %s", getboolean(nodes.Billing)); fprintf(fp, " Billing %s", getboolean(nodes.Billing));
fprintf(fp, " Bill direct %s\n", getboolean(nodes.BillDirect)); fprintf(fp, " Bill direct %s\n", getboolean(nodes.BillDirect));
fprintf(fp, " Uplink add + %s\n\n", getboolean(nodes.AddPlus)); fprintf(fp, " Uplink add + %s\n", getboolean(nodes.AddPlus));
fprintf(fp, " Security flags %s\n\n", getflag(nodes.Security.flags, nodes.Security.notflags));
fprintf(fp, " Outb session %s\n", get_sessiontype(nodes.Session_out)); fprintf(fp, " Outb session %s\n", get_sessiontype(nodes.Session_out));
if (nodes.Session_out == S_DIR) { if (nodes.Session_out == S_DIR) {

View File

@ -407,7 +407,7 @@ int main(int argc, char *argv[])
*/ */
config_check(getenv("MBSE_ROOT")); config_check(getenv("MBSE_ROOT"));
config_read(); config_read();
InitClient(pw->pw_name, (char *)"mbsetup", CFG.location, CFG.logfile, 0x1f, CFG.error_log); InitClient(pw->pw_name, (char *)"mbsetup", CFG.location, CFG.logfile, 0x1f, CFG.error_log, CFG.mgrlog);
/* /*
* Setup several signals so when the program terminate's it * Setup several signals so when the program terminate's it