Secured sprintf with snprintf
This commit is contained in:
parent
ff2c677d06
commit
2d42daa395
@ -4,7 +4,7 @@
|
||||
* Purpose ...............: Global Setup Program
|
||||
*
|
||||
*****************************************************************************
|
||||
* Copyright (C) 1997-2004
|
||||
* Copyright (C) 1997-2005
|
||||
*
|
||||
* Michiel Broek FIDO: 2:280/2802
|
||||
* Beekmansbos 10
|
||||
@ -57,7 +57,7 @@ void config_check(char *path)
|
||||
{
|
||||
static char buf[PATH_MAX];
|
||||
|
||||
sprintf(buf, "%s/etc/config.data", path);
|
||||
snprintf(buf, PATH_MAX, "%s/etc/config.data", path);
|
||||
some_fn = buf;
|
||||
|
||||
/*
|
||||
@ -271,10 +271,10 @@ void e_global2(void)
|
||||
case 11:E_PTH(16,16,64, CFG.badtic, "The path to the ^bad tic files^.", 0750)
|
||||
case 12:E_PTH(17,16,64, CFG.ticout, "The path to the ^outgoing TIC^ files.", 0750)
|
||||
case 13:if (strlen(CFG.tmailshort) == 0)
|
||||
sprintf(CFG.tmailshort, "%s/var/tmail/short", getenv("MBSE_ROOT"));
|
||||
snprintf(CFG.tmailshort, 65, "%s/var/tmail/short", getenv("MBSE_ROOT"));
|
||||
E_PTH(18,16,64, CFG.tmailshort, "The ^T-Mail 8.3 basepath^ (blank = disable)", 0770)
|
||||
case 14:if (strlen(CFG.tmaillong) == 0)
|
||||
sprintf(CFG.tmaillong, "%s/var/tmail/long", getenv("MBSE_ROOT"));
|
||||
snprintf(CFG.tmaillong, 65, "%s/var/tmail/long", getenv("MBSE_ROOT"));
|
||||
E_PTH(19,16,64, CFG.tmaillong, "The ^T-Mail long basepath^ (blank = disable)", 0770)
|
||||
}
|
||||
}
|
||||
@ -673,7 +673,7 @@ void e_flags(int Users)
|
||||
}
|
||||
}
|
||||
|
||||
sprintf(temp, "Enter a short ^description^ of flag bit %d", z);
|
||||
snprintf(temp, 80, "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));
|
||||
} else {
|
||||
@ -1094,7 +1094,7 @@ void e_newfiles(void)
|
||||
if (file_exist(logfile, R_OK)) {
|
||||
errmsg("Logfile \"%s\" doesn't exist", logfile);
|
||||
} else {
|
||||
sprintf(CFG.www_logfile, "%s", logfile);
|
||||
snprintf(CFG.www_logfile, 81, "%s", logfile);
|
||||
}
|
||||
} else {
|
||||
CFG.www_logfile[0] = '\0';
|
||||
@ -1108,7 +1108,7 @@ void e_newfiles(void)
|
||||
if (file_exist(logfile, R_OK)) {
|
||||
errmsg("Logfile \"%s\" doesn't exist", logfile);
|
||||
} else {
|
||||
sprintf(CFG.ftp_logfile, "%s", logfile);
|
||||
snprintf(CFG.ftp_logfile, 81, "%s", logfile);
|
||||
}
|
||||
} else {
|
||||
CFG.ftp_logfile[0] = '\0';
|
||||
@ -1188,10 +1188,10 @@ void e_fidoakas(void)
|
||||
else
|
||||
set_color(LIGHTBLUE, BLACK);
|
||||
if (CFG.akavalid[o+i-1]) {
|
||||
sprintf(temp, "%3d %s", o+i, aka2str(CFG.aka[o+i-1]));
|
||||
snprintf(temp, 81, "%3d %s", o+i, aka2str(CFG.aka[o+i-1]));
|
||||
temp[38] = '\0';
|
||||
} else
|
||||
sprintf(temp, "%3d", o+i);
|
||||
snprintf(temp, 81, "%3d", o+i);
|
||||
mbse_mvprintw(y, x, temp);
|
||||
y++;
|
||||
}
|
||||
@ -1319,7 +1319,7 @@ void e_trans(int start, int item)
|
||||
set_color(CYAN, BLACK);
|
||||
mbse_mvprintw( 7, 12, "String to match String to replace");
|
||||
for (i = 0; i < 10; i++) {
|
||||
sprintf(temp, "%2d.", i+1);
|
||||
snprintf(temp, 21, "%2d.", i+1);
|
||||
mbse_mvprintw( 9+i, 6, temp);
|
||||
}
|
||||
for (;;) {
|
||||
@ -1460,25 +1460,25 @@ void global_menu(void)
|
||||
crc = upd_crc32((char *)&CFG, crc, sizeof(CFG));
|
||||
|
||||
if (strlen(CFG.bbs_macros) == 0) {
|
||||
sprintf(CFG.bbs_macros, "%s/english/macro", getenv("MBSE_ROOT"));
|
||||
snprintf(CFG.bbs_macros, 65, "%s/english/macro", getenv("MBSE_ROOT"));
|
||||
Syslog('+', "Main config, upgraded default macro path");
|
||||
}
|
||||
|
||||
if (strlen(CFG.out_queue) == 0) {
|
||||
sprintf(CFG.out_queue, "%s/var/queue", getenv("MBSE_ROOT"));
|
||||
snprintf(CFG.out_queue, 65, "%s/var/queue", getenv("MBSE_ROOT"));
|
||||
Syslog('+', "Main config, upgraded for new queue");
|
||||
}
|
||||
|
||||
if (strlen(CFG.mgrlog) == 0) {
|
||||
sprintf(CFG.mgrlog, "manager.log");
|
||||
snprintf(CFG.mgrlog, 15, "manager.log");
|
||||
for (i = 0; i < 32; i++)
|
||||
sprintf(CFG.aname[i], "Flags %d", i+1);
|
||||
sprintf(CFG.aname[0], "Everyone");
|
||||
snprintf(CFG.aname[i], 17, "Flags %d", i+1);
|
||||
snprintf(CFG.aname[0], 17, "Everyone");
|
||||
Syslog('+', "Main config, upgraded for manager security");
|
||||
}
|
||||
|
||||
if (strlen(CFG.debuglog) == 0) {
|
||||
sprintf(CFG.debuglog, "debug.log");
|
||||
snprintf(CFG.debuglog, 15, "debug.log");
|
||||
Syslog('+', "Main config, upgraded for new debug logfile");
|
||||
}
|
||||
|
||||
@ -1492,19 +1492,19 @@ void global_menu(void)
|
||||
}
|
||||
|
||||
if (strlen(CFG.rulesdir) == 0) {
|
||||
sprintf(CFG.rulesdir, "%s/var/rules", getenv("MBSE_ROOT"));
|
||||
snprintf(CFG.rulesdir, 65, "%s/var/rules", getenv("MBSE_ROOT"));
|
||||
Syslog('+', "Main config, upgraded rules directory");
|
||||
}
|
||||
|
||||
if (!strlen(CFG.www_convert) && strlen(_PATH_CONVERT)) {
|
||||
sprintf(CFG.www_convert,"%s -geometry x100", _PATH_CONVERT);
|
||||
snprintf(CFG.www_convert, 81, "%s -geometry x100", _PATH_CONVERT);
|
||||
Syslog('+', "Main config, installed convert for thumbnails");
|
||||
}
|
||||
|
||||
temp = calloc(PATH_MAX, sizeof(char));
|
||||
sprintf(temp, "%s/magic", getenv("MBSE_ROOT"));
|
||||
snprintf(temp, PATH_MAX, "%s/magic", getenv("MBSE_ROOT"));
|
||||
if (strcmp(CFG.req_magic, temp) == 0) {
|
||||
sprintf(CFG.req_magic, "%s/var/magic", getenv("MBSE_ROOT"));
|
||||
snprintf(CFG.req_magic, 65, "%s/var/magic", getenv("MBSE_ROOT"));
|
||||
Syslog('+', "Main config, magic dir moved to %s", CFG.req_magic);
|
||||
}
|
||||
free(temp);
|
||||
@ -1625,7 +1625,7 @@ int PickAka(char *msg, int openit)
|
||||
for (;;) {
|
||||
clr_index();
|
||||
set_color(WHITE, BLACK);
|
||||
sprintf(temp, "%s. AKA SELECT", msg);
|
||||
snprintf(temp, 81, "%s. AKA SELECT", msg);
|
||||
mbse_mvprintw( 5, 4, temp);
|
||||
set_color(CYAN, BLACK);
|
||||
x = 2;
|
||||
@ -1638,11 +1638,11 @@ int PickAka(char *msg, int openit)
|
||||
if ((o + i) <= 40) {
|
||||
if (CFG.akavalid[o+i-1]) {
|
||||
set_color(CYAN, BLACK);
|
||||
sprintf(temp, "%3d %s", o+i, aka2str(CFG.aka[o+i-1]));
|
||||
snprintf(temp, 81, "%3d %s", o+i, aka2str(CFG.aka[o+i-1]));
|
||||
temp[38] = '\0';
|
||||
} else {
|
||||
set_color(LIGHTBLUE, BLACK);
|
||||
sprintf(temp, "%3d", o+i);
|
||||
snprintf(temp, 81, "%3d", o+i);
|
||||
}
|
||||
mbse_mvprintw(y, x, temp);
|
||||
y++;
|
||||
@ -1741,7 +1741,7 @@ int global_doc(FILE *fp, FILE *toc, int page)
|
||||
#else
|
||||
#error "Don't know utsbuf.domainname on this OS"
|
||||
#endif
|
||||
sprintf(temp, "%s %s", utsbuf.sysname, utsbuf.release);
|
||||
snprintf(temp, 81, "%s %s", utsbuf.sysname, utsbuf.release);
|
||||
add_webtable(wp, (char *)"Operating system", temp);
|
||||
fprintf(fp, " Operating system %s %s\n", utsbuf.sysname, utsbuf.release);
|
||||
add_webtable(wp, (char *)"Kernel version", utsbuf.version);
|
||||
@ -1767,7 +1767,7 @@ int global_doc(FILE *fp, FILE *toc, int page)
|
||||
for (i = 0; i < 40; i++) {
|
||||
if (CFG.akavalid[i]) {
|
||||
fprintf(fp, " Aka %2d %s\n", i+1, aka2str(CFG.aka[i]));
|
||||
sprintf(temp, "Aka %d", i+1);
|
||||
snprintf(temp, 81, "Aka %d", i+1);
|
||||
add_webtable(wp, temp, aka2str(CFG.aka[i]));
|
||||
}
|
||||
}
|
||||
@ -1893,7 +1893,7 @@ int global_doc(FILE *fp, FILE *toc, int page)
|
||||
add_webdigit(wp, (char *)"Minimum password length", CFG.password_length);
|
||||
add_webtable(wp, (char *)"BBS loglevel", getloglevel(CFG.bbs_loglevel));
|
||||
add_webtable(wp, (char *)"Util loglevel", getloglevel(CFG.util_loglevel));
|
||||
sprintf(temp, "%c", CFG.iPasswd_Char);
|
||||
snprintf(temp, 81, "%c", CFG.iPasswd_Char);
|
||||
add_webtable(wp, (char *)"Password char", temp);
|
||||
add_webdigit(wp, (char *)"Idle timeout in minutes", CFG.idleout);
|
||||
add_webdigit(wp, (char *)"Login enters", CFG.iCRLoginCount);
|
||||
@ -1907,9 +1907,9 @@ int global_doc(FILE *fp, FILE *toc, int page)
|
||||
add_webdigit(wp, (char *)"FileAttach security level", CFG.iAttachLevel);
|
||||
add_webdigit(wp, (char *)"Free diskspace in MBytes", CFG.freespace);
|
||||
if (CFG.max_logins)
|
||||
sprintf(temp, "%d", CFG.max_logins);
|
||||
snprintf(temp, 81, "%d", CFG.max_logins);
|
||||
else
|
||||
sprintf(temp, "Unlimited");
|
||||
snprintf(temp, 81, "Unlimited");
|
||||
add_webtable(wp, (char *)"Simultaneous logins", temp);
|
||||
add_webdigit(wp, (char *)"Child priority", CFG.priority);
|
||||
add_webtable(wp, (char *)"Sync on execute", getboolean(CFG.do_sync));
|
||||
@ -1955,7 +1955,7 @@ int global_doc(FILE *fp, FILE *toc, int page)
|
||||
fprintf(wp, "<COL width='30%%'><COL width='70%%'>\n");
|
||||
fprintf(wp, "<TBODY>\n");
|
||||
for (i = 0; i < 32; i++) {
|
||||
sprintf(temp, "Bit %d", i+1);
|
||||
snprintf(temp, 81, "Bit %d", i+1);
|
||||
add_webtable(wp, temp, CFG.fname[i]);
|
||||
}
|
||||
fprintf(wp, "</TBODY>\n");
|
||||
@ -2330,7 +2330,7 @@ int global_doc(FILE *fp, FILE *toc, int page)
|
||||
fprintf(wp, "<COL width='30%%'><COL width='70%%'>\n");
|
||||
fprintf(wp, "<TBODY>\n");
|
||||
for (i = 0; i < 32; i++) {
|
||||
sprintf(temp, "Bit %d", i+1);
|
||||
snprintf(temp, 81, "Bit %d", i+1);
|
||||
add_webtable(wp, temp, CFG.aname[i]);
|
||||
}
|
||||
fprintf(wp, "</TBODY>\n");
|
||||
|
@ -4,7 +4,7 @@
|
||||
* Purpose ...............: Hatch Setup
|
||||
*
|
||||
*****************************************************************************
|
||||
* Copyright (C) 1997-2004
|
||||
* Copyright (C) 1997-2005
|
||||
*
|
||||
* Michiel Broek FIDO: 2:280/2802
|
||||
* Beekmansbos 10
|
||||
@ -62,7 +62,7 @@ int CountHatch(void)
|
||||
char ffile[PATH_MAX];
|
||||
int count;
|
||||
|
||||
sprintf(ffile, "%s/etc/hatch.data", getenv("MBSE_ROOT"));
|
||||
snprintf(ffile, PATH_MAX, "%s/etc/hatch.data", getenv("MBSE_ROOT"));
|
||||
if ((fil = fopen(ffile, "r")) == NULL) {
|
||||
if ((fil = fopen(ffile, "a+")) != NULL) {
|
||||
Syslog('+', "Created new %s", ffile);
|
||||
@ -100,8 +100,8 @@ int OpenHatch(void)
|
||||
long oldsize;
|
||||
int FieldPatch = FALSE;
|
||||
|
||||
sprintf(fnin, "%s/etc/hatch.data", getenv("MBSE_ROOT"));
|
||||
sprintf(fnout, "%s/etc/hatch.temp", getenv("MBSE_ROOT"));
|
||||
snprintf(fnin, PATH_MAX, "%s/etc/hatch.data", getenv("MBSE_ROOT"));
|
||||
snprintf(fnout, PATH_MAX, "%s/etc/hatch.temp", getenv("MBSE_ROOT"));
|
||||
if ((fin = fopen(fnin, "r")) != NULL) {
|
||||
if ((fout = fopen(fnout, "w")) != NULL) {
|
||||
fread(&hatchhdr, sizeof(hatchhdr), 1, fin);
|
||||
@ -156,8 +156,8 @@ void CloseHatch(int force)
|
||||
FILE *fi, *fo;
|
||||
st_list *hat = NULL, *tmp;
|
||||
|
||||
sprintf(fin, "%s/etc/hatch.data", getenv("MBSE_ROOT"));
|
||||
sprintf(fout,"%s/etc/hatch.temp", getenv("MBSE_ROOT"));
|
||||
snprintf(fin, PATH_MAX, "%s/etc/hatch.data", getenv("MBSE_ROOT"));
|
||||
snprintf(fout, PATH_MAX, "%s/etc/hatch.temp", getenv("MBSE_ROOT"));
|
||||
|
||||
if (HatchUpdated == 1) {
|
||||
if (force || (yes_no((char *)"Database is changed, save changes") == 1)) {
|
||||
@ -203,7 +203,7 @@ int AppendHatch(void)
|
||||
char ffile[PATH_MAX];
|
||||
int i;
|
||||
|
||||
sprintf(ffile, "%s/etc/hatch.temp", getenv("MBSE_ROOT"));
|
||||
snprintf(ffile, PATH_MAX, "%s/etc/hatch.temp", getenv("MBSE_ROOT"));
|
||||
if ((fil = fopen(ffile, "a")) != NULL) {
|
||||
memset(&hatch, 0, sizeof(hatch));
|
||||
/*
|
||||
@ -340,7 +340,7 @@ int EditHatchRec(int Area)
|
||||
working(1, 0, 0);
|
||||
IsDoing("Edit Hatch");
|
||||
|
||||
sprintf(mfile, "%s/etc/hatch.temp", getenv("MBSE_ROOT"));
|
||||
snprintf(mfile, PATH_MAX, "%s/etc/hatch.temp", getenv("MBSE_ROOT"));
|
||||
if ((fil = fopen(mfile, "r")) == NULL) {
|
||||
working(2, 0, 0);
|
||||
return -1;
|
||||
@ -484,7 +484,7 @@ void EditHatch(void)
|
||||
mbse_mvprintw( 5, 4, "10.3. HATCH MANAGER");
|
||||
set_color(CYAN, BLACK);
|
||||
if (records != 0) {
|
||||
sprintf(temp, "%s/etc/hatch.temp", getenv("MBSE_ROOT"));
|
||||
snprintf(temp, PATH_MAX, "%s/etc/hatch.temp", getenv("MBSE_ROOT"));
|
||||
working(1, 0, 0);
|
||||
if ((fil = fopen(temp, "r")) != NULL) {
|
||||
fread(&hatchhdr, sizeof(hatchhdr), 1, fil);
|
||||
@ -504,7 +504,7 @@ void EditHatch(void)
|
||||
set_color(CYAN, BLACK);
|
||||
else
|
||||
set_color(LIGHTBLUE, BLACK);
|
||||
sprintf(temp, "%3d. %-32s", o + i, hatch.Spec);
|
||||
snprintf(temp, 81, "%3d. %-32s", o + i, hatch.Spec);
|
||||
temp[37] = 0;
|
||||
mbse_mvprintw(y, x, temp);
|
||||
y++;
|
||||
@ -561,7 +561,7 @@ int tic_hatch_doc(FILE *fp, FILE *toc, int page)
|
||||
FILE *wp, *ip, *no;
|
||||
int i, j, nr = 0, All;
|
||||
|
||||
sprintf(temp, "%s/etc/hatch.data", getenv("MBSE_ROOT"));
|
||||
snprintf(temp, PATH_MAX, "%s/etc/hatch.data", getenv("MBSE_ROOT"));
|
||||
if ((no = fopen(temp, "r")) == NULL)
|
||||
return page;
|
||||
|
||||
@ -588,7 +588,7 @@ int tic_hatch_doc(FILE *fp, FILE *toc, int page)
|
||||
j = 0;
|
||||
}
|
||||
|
||||
sprintf(temp, "hatch_%d.html", nr);
|
||||
snprintf(temp, 81, "hatch_%d.html", nr);
|
||||
fprintf(ip, " <TR><TD><A HREF=\"%s\">%d</A></TD><TD>%s</TD><TD>%s</TD></TR>\n",
|
||||
temp, nr, hatch.Spec, getboolean(hatch.Active));
|
||||
if ((wp = open_webdoc(temp, (char *)"Hatch Manager", hatch.Spec))) {
|
||||
|
@ -53,7 +53,7 @@ int CountIBC(void)
|
||||
char ffile[PATH_MAX];
|
||||
int count;
|
||||
|
||||
sprintf(ffile, "%s/etc/ibcsrv.data", getenv("MBSE_ROOT"));
|
||||
snprintf(ffile, PATH_MAX, "%s/etc/ibcsrv.data", getenv("MBSE_ROOT"));
|
||||
if ((fil = fopen(ffile, "r")) == NULL) {
|
||||
if ((fil = fopen(ffile, "a+")) != NULL) {
|
||||
Syslog('+', "Created new %s", ffile);
|
||||
@ -88,8 +88,8 @@ int OpenIBC(void)
|
||||
char fnin[PATH_MAX], fnout[PATH_MAX];
|
||||
long oldsize;
|
||||
|
||||
sprintf(fnin, "%s/etc/ibcsrv.data", getenv("MBSE_ROOT"));
|
||||
sprintf(fnout, "%s/etc/ibcsrv.temp", getenv("MBSE_ROOT"));
|
||||
snprintf(fnin, PATH_MAX, "%s/etc/ibcsrv.data", getenv("MBSE_ROOT"));
|
||||
snprintf(fnout, PATH_MAX, "%s/etc/ibcsrv.temp", getenv("MBSE_ROOT"));
|
||||
if ((fin = fopen(fnin, "r")) != NULL) {
|
||||
if ((fout = fopen(fnout, "w")) != NULL) {
|
||||
fread(&ibcsrvhdr, sizeof(ibcsrvhdr), 1, fin);
|
||||
@ -137,8 +137,8 @@ void CloseIBC(int force)
|
||||
FILE *fi, *fo;
|
||||
st_list *vir = NULL, *tmp;
|
||||
|
||||
sprintf(fin, "%s/etc/ibcsrv.data", getenv("MBSE_ROOT"));
|
||||
sprintf(fout,"%s/etc/ibcsrv.temp", getenv("MBSE_ROOT"));
|
||||
snprintf(fin, PATH_MAX, "%s/etc/ibcsrv.data", getenv("MBSE_ROOT"));
|
||||
snprintf(fout, PATH_MAX, "%s/etc/ibcsrv.temp", getenv("MBSE_ROOT"));
|
||||
|
||||
if (IBCUpdated == 1) {
|
||||
if (force || (yes_no((char *)"Database is changed, save changes") == 1)) {
|
||||
@ -181,7 +181,7 @@ int AppendIBC(void)
|
||||
FILE *fil;
|
||||
char ffile[PATH_MAX];
|
||||
|
||||
sprintf(ffile, "%s/etc/ibcsrv.temp", getenv("MBSE_ROOT"));
|
||||
snprintf(ffile, PATH_MAX, "%s/etc/ibcsrv.temp", getenv("MBSE_ROOT"));
|
||||
if ((fil = fopen(ffile, "a")) != NULL) {
|
||||
memset(&ibcsrv, 0, sizeof(ibcsrv));
|
||||
strcpy(ibcsrv.myname, CFG.myfqdn);
|
||||
@ -210,7 +210,7 @@ int EditIBCRec(int Area)
|
||||
working(1, 0, 0);
|
||||
IsDoing("Edit ibcsrv");
|
||||
|
||||
sprintf(mfile, "%s/etc/ibcsrv.temp", getenv("MBSE_ROOT"));
|
||||
snprintf(mfile, PATH_MAX, "%s/etc/ibcsrv.temp", getenv("MBSE_ROOT"));
|
||||
if ((fil = fopen(mfile, "r")) == NULL) {
|
||||
working(2, 0, 0);
|
||||
return -1;
|
||||
@ -316,7 +316,7 @@ void EditIBC(void)
|
||||
mbse_mvprintw( 5, 4, "20. INTERNET BBS CHAT SETUP");
|
||||
set_color(CYAN, BLACK);
|
||||
if (records != 0) {
|
||||
sprintf(temp, "%s/etc/ibcsrv.temp", getenv("MBSE_ROOT"));
|
||||
snprintf(temp, PATH_MAX, "%s/etc/ibcsrv.temp", getenv("MBSE_ROOT"));
|
||||
if ((fil = fopen(temp, "r")) != NULL) {
|
||||
fread(&ibcsrvhdr, sizeof(ibcsrvhdr), 1, fil);
|
||||
x = 2;
|
||||
@ -336,7 +336,7 @@ void EditIBC(void)
|
||||
set_color(CYAN, BLACK);
|
||||
else
|
||||
set_color(LIGHTBLUE, BLACK);
|
||||
sprintf(temp, "%3d. %s (%s)", i, ibcsrv.server, ibcsrv.comment);
|
||||
snprintf(temp, 81, "%3d. %s (%s)", i, ibcsrv.server, ibcsrv.comment);
|
||||
temp[37] = 0;
|
||||
mbse_mvprintw(y, x, temp);
|
||||
y++;
|
||||
@ -382,7 +382,7 @@ int ibc_doc(FILE *fp, FILE *toc, int page)
|
||||
FILE *wp, *ip, *vir;
|
||||
int nr = 0, j;
|
||||
|
||||
sprintf(temp, "%s/etc/ibcsrv.data", getenv("MBSE_ROOT"));
|
||||
snprintf(temp, PATH_MAX, "%s/etc/ibcsrv.data", getenv("MBSE_ROOT"));
|
||||
if ((vir = fopen(temp, "r")) == NULL)
|
||||
return page;
|
||||
|
||||
@ -405,7 +405,7 @@ int ibc_doc(FILE *fp, FILE *toc, int page)
|
||||
}
|
||||
|
||||
nr++;
|
||||
sprintf(temp, "ibcsrv_%d.html", nr);
|
||||
snprintf(temp, 81, "ibcsrv_%d.html", nr);
|
||||
fprintf(ip, "<LI><A HREF=\"%s\">%s</A></LI>\n", temp, ibcsrv.comment);
|
||||
if ((wp = open_webdoc(temp, (char *)"Internet BBS Chatserver", ibcsrv.comment))) {
|
||||
fprintf(wp, "<A HREF=\"index.html\">Main</A> <A HREF=\"ibcsrv.html\">Back</A>\n");
|
||||
|
126
mbsetup/m_lang.c
126
mbsetup/m_lang.c
@ -4,7 +4,7 @@
|
||||
* Purpose ...............: Setup Languages.
|
||||
*
|
||||
*****************************************************************************
|
||||
* Copyright (C) 1997-2004
|
||||
* Copyright (C) 1997-2005
|
||||
*
|
||||
* Michiel Broek FIDO: 2:280/2802
|
||||
* Beekmansbos 10
|
||||
@ -52,7 +52,7 @@ int CountLanguage(void)
|
||||
char ffile[PATH_MAX];
|
||||
int count;
|
||||
|
||||
sprintf(ffile, "%s/etc/language.data", getenv("MBSE_ROOT"));
|
||||
snprintf(ffile, PATH_MAX, "%s/etc/language.data", getenv("MBSE_ROOT"));
|
||||
if ((fil = fopen(ffile, "r")) == NULL) {
|
||||
if ((fil = fopen(ffile, "a+")) != NULL) {
|
||||
Syslog('+', "Created new %s", ffile);
|
||||
@ -64,82 +64,82 @@ int CountLanguage(void)
|
||||
* Setup default records
|
||||
*/
|
||||
memset(&lang, 0, sizeof(lang));
|
||||
sprintf(lang.Name, "English");
|
||||
sprintf(lang.LangKey, "E");
|
||||
sprintf(lang.MenuPath, "%s/english/menus", getenv("MBSE_ROOT"));
|
||||
sprintf(lang.TextPath, "%s/english/txtfiles", getenv("MBSE_ROOT"));
|
||||
sprintf(lang.MacroPath, "%s/english/macro", getenv("MBSE_ROOT"));
|
||||
sprintf(lang.Filename, "english.lang");
|
||||
snprintf(lang.Name, 30, "English");
|
||||
snprintf(lang.LangKey, 2, "E");
|
||||
snprintf(lang.MenuPath, 81, "%s/english/menus", getenv("MBSE_ROOT"));
|
||||
snprintf(lang.TextPath, 81, "%s/english/txtfiles", getenv("MBSE_ROOT"));
|
||||
snprintf(lang.MacroPath, 81, "%s/english/macro", getenv("MBSE_ROOT"));
|
||||
snprintf(lang.Filename, 81, "english.lang");
|
||||
lang.Available = TRUE;
|
||||
fwrite(&lang, sizeof(lang), 1, fil);
|
||||
|
||||
memset(&lang, 0, sizeof(lang));
|
||||
sprintf(lang.Name, "Nederlands");
|
||||
sprintf(lang.LangKey, "N");
|
||||
sprintf(lang.MenuPath, "%s/dutch/menus", getenv("MBSE_ROOT"));
|
||||
sprintf(lang.TextPath, "%s/dutch/txtfiles", getenv("MBSE_ROOT"));
|
||||
sprintf(lang.MacroPath, "%s/dutch/macro", getenv("MBSE_ROOT"));
|
||||
sprintf(lang.Filename, "dutch.lang");
|
||||
snprintf(lang.Name, 30, "Nederlands");
|
||||
snprintf(lang.LangKey, 2, "N");
|
||||
snprintf(lang.MenuPath, 81, "%s/dutch/menus", getenv("MBSE_ROOT"));
|
||||
snprintf(lang.TextPath, 81, "%s/dutch/txtfiles", getenv("MBSE_ROOT"));
|
||||
snprintf(lang.MacroPath, 81, "%s/dutch/macro", getenv("MBSE_ROOT"));
|
||||
snprintf(lang.Filename, 81, "dutch.lang");
|
||||
lang.Available = TRUE;
|
||||
fwrite(&lang, sizeof(lang), 1, fil);
|
||||
|
||||
memset(&lang, 0, sizeof(lang));
|
||||
sprintf(lang.Name, "Italian");
|
||||
sprintf(lang.LangKey, "I");
|
||||
sprintf(lang.MenuPath, "%s/italian/menus", getenv("MBSE_ROOT"));
|
||||
sprintf(lang.TextPath, "%s/italian/txtfiles", getenv("MBSE_ROOT"));
|
||||
sprintf(lang.MacroPath, "%s/italian/macro", getenv("MBSE_ROOT"));
|
||||
sprintf(lang.Filename, "italian.lang");
|
||||
snprintf(lang.Name, 30, "Italian");
|
||||
snprintf(lang.LangKey, 2, "I");
|
||||
snprintf(lang.MenuPath, 81, "%s/italian/menus", getenv("MBSE_ROOT"));
|
||||
snprintf(lang.TextPath, 81, "%s/italian/txtfiles", getenv("MBSE_ROOT"));
|
||||
snprintf(lang.MacroPath, 81, "%s/italian/macro", getenv("MBSE_ROOT"));
|
||||
snprintf(lang.Filename, 81, "italian.lang");
|
||||
lang.Available = TRUE;
|
||||
fwrite(&lang, sizeof(lang), 1, fil);
|
||||
|
||||
memset(&lang, 0, sizeof(lang));
|
||||
sprintf(lang.Name, "Spanish");
|
||||
sprintf(lang.LangKey, "S");
|
||||
sprintf(lang.MenuPath, "%s/spanish/menus", getenv("MBSE_ROOT"));
|
||||
sprintf(lang.TextPath, "%s/spanish/txtfiles", getenv("MBSE_ROOT"));
|
||||
sprintf(lang.MacroPath, "%s/spanish/macro", getenv("MBSE_ROOT"));
|
||||
sprintf(lang.Filename, "spanish.lang");
|
||||
snprintf(lang.Name, 30, "Spanish");
|
||||
snprintf(lang.LangKey, 2, "S");
|
||||
snprintf(lang.MenuPath, 81, "%s/spanish/menus", getenv("MBSE_ROOT"));
|
||||
snprintf(lang.TextPath, 81, "%s/spanish/txtfiles", getenv("MBSE_ROOT"));
|
||||
snprintf(lang.MacroPath, 81, "%s/spanish/macro", getenv("MBSE_ROOT"));
|
||||
snprintf(lang.Filename, 81, "spanish.lang");
|
||||
lang.Available = TRUE;
|
||||
fwrite(&lang, sizeof(lang), 1, fil);
|
||||
|
||||
memset(&lang, 0, sizeof(lang));
|
||||
sprintf(lang.Name, "Galego");
|
||||
sprintf(lang.LangKey, "G");
|
||||
sprintf(lang.MenuPath, "%s/galego/menus", getenv("MBSE_ROOT"));
|
||||
sprintf(lang.TextPath, "%s/galego/txtfiles", getenv("MBSE_ROOT"));
|
||||
sprintf(lang.MacroPath, "%s/galego/macro", getenv("MBSE_ROOT"));
|
||||
sprintf(lang.Filename, "galego.lang");
|
||||
snprintf(lang.Name, 30, "Galego");
|
||||
snprintf(lang.LangKey, 2, "G");
|
||||
snprintf(lang.MenuPath, 81, "%s/galego/menus", getenv("MBSE_ROOT"));
|
||||
snprintf(lang.TextPath, 81, "%s/galego/txtfiles", getenv("MBSE_ROOT"));
|
||||
snprintf(lang.MacroPath, 81, "%s/galego/macro", getenv("MBSE_ROOT"));
|
||||
snprintf(lang.Filename, 81, "galego.lang");
|
||||
lang.Available = TRUE;
|
||||
fwrite(&lang, sizeof(lang), 1, fil);
|
||||
|
||||
memset(&lang, 0, sizeof(lang));
|
||||
sprintf(lang.Name, "Deutsch");
|
||||
sprintf(lang.LangKey, "D");
|
||||
sprintf(lang.MenuPath, "%s/german/menus", getenv("MBSE_ROOT"));
|
||||
sprintf(lang.TextPath, "%s/german/txtfiles", getenv("MBSE_ROOT"));
|
||||
sprintf(lang.MacroPath, "%s/german/macro", getenv("MBSE_ROOT"));
|
||||
sprintf(lang.Filename, "german.lang");
|
||||
snprintf(lang.Name, 30, "Deutsch");
|
||||
snprintf(lang.LangKey, 2, "D");
|
||||
snprintf(lang.MenuPath, 81, "%s/german/menus", getenv("MBSE_ROOT"));
|
||||
snprintf(lang.TextPath, 81, "%s/german/txtfiles", getenv("MBSE_ROOT"));
|
||||
snprintf(lang.MacroPath, 81, "%s/german/macro", getenv("MBSE_ROOT"));
|
||||
snprintf(lang.Filename, 81, "german.lang");
|
||||
lang.Available = TRUE;
|
||||
fwrite(&lang, sizeof(lang), 1, fil);
|
||||
|
||||
memset(&lang, 0, sizeof(lang));
|
||||
sprintf(lang.Name, "French");
|
||||
sprintf(lang.LangKey, "F");
|
||||
sprintf(lang.MenuPath, "%s/french/menus", getenv("MBSE_ROOT"));
|
||||
sprintf(lang.TextPath, "%s/french/txtfiles", getenv("MBSE_ROOT"));
|
||||
sprintf(lang.MacroPath, "%s/french/macro", getenv("MBSE_ROOT"));
|
||||
sprintf(lang.Filename, "french.lang");
|
||||
snprintf(lang.Name, 30, "French");
|
||||
snprintf(lang.LangKey, 2, "F");
|
||||
snprintf(lang.MenuPath, 81, "%s/french/menus", getenv("MBSE_ROOT"));
|
||||
snprintf(lang.TextPath, 81, "%s/french/txtfiles", getenv("MBSE_ROOT"));
|
||||
snprintf(lang.MacroPath, 81, "%s/french/macro", getenv("MBSE_ROOT"));
|
||||
snprintf(lang.Filename, 81, "french.lang");
|
||||
lang.Available = TRUE;
|
||||
fwrite(&lang, sizeof(lang), 1, fil);
|
||||
|
||||
memset(&lang, 0, sizeof(lang));
|
||||
sprintf(lang.Name, "Chinese");
|
||||
sprintf(lang.LangKey, "C");
|
||||
sprintf(lang.MenuPath, "%s/chinese/menus", getenv("MBSE_ROOT"));
|
||||
sprintf(lang.TextPath, "%s/chinese/txtfiles", getenv("MBSE_ROOT"));
|
||||
sprintf(lang.MacroPath, "%s/chinese/macro", getenv("MBSE_ROOT"));
|
||||
sprintf(lang.Filename, "chinese.lang");
|
||||
snprintf(lang.Name, 30, "Chinese");
|
||||
snprintf(lang.LangKey, 2, "C");
|
||||
snprintf(lang.MenuPath, 81, "%s/chinese/menus", getenv("MBSE_ROOT"));
|
||||
snprintf(lang.TextPath, 81, "%s/chinese/txtfiles", getenv("MBSE_ROOT"));
|
||||
snprintf(lang.MacroPath, 81, "%s/chinese/macro", getenv("MBSE_ROOT"));
|
||||
snprintf(lang.Filename, 81, "chinese.lang");
|
||||
lang.Available = TRUE;
|
||||
fwrite(&lang, sizeof(lang), 1, fil);
|
||||
|
||||
@ -172,8 +172,8 @@ int OpenLanguage(void)
|
||||
char fnin[PATH_MAX], fnout[PATH_MAX];
|
||||
long oldsize;
|
||||
|
||||
sprintf(fnin, "%s/etc/language.data", getenv("MBSE_ROOT"));
|
||||
sprintf(fnout, "%s/etc/language.temp", getenv("MBSE_ROOT"));
|
||||
snprintf(fnin, PATH_MAX, "%s/etc/language.data", getenv("MBSE_ROOT"));
|
||||
snprintf(fnout, PATH_MAX, "%s/etc/language.temp", getenv("MBSE_ROOT"));
|
||||
if ((fin = fopen(fnin, "r")) != NULL) {
|
||||
if ((fout = fopen(fnout, "w")) != NULL) {
|
||||
fread(&langhdr, sizeof(langhdr), 1, fin);
|
||||
@ -221,8 +221,8 @@ void CloseLanguage(int force)
|
||||
FILE *fi, *fo;
|
||||
st_list *lan = NULL, *tmp;
|
||||
|
||||
sprintf(fin, "%s/etc/language.data", getenv("MBSE_ROOT"));
|
||||
sprintf(fout,"%s/etc/language.temp", getenv("MBSE_ROOT"));
|
||||
snprintf(fin, PATH_MAX, "%s/etc/language.data", getenv("MBSE_ROOT"));
|
||||
snprintf(fout, PATH_MAX, "%s/etc/language.temp", getenv("MBSE_ROOT"));
|
||||
|
||||
if (LangUpdated == 1) {
|
||||
if (force || (yes_no((char *)"Database is changed, save changes") == 1)) {
|
||||
@ -267,7 +267,7 @@ int AppendLanguage(void)
|
||||
FILE *fil;
|
||||
char ffile[PATH_MAX];
|
||||
|
||||
sprintf(ffile, "%s/etc/language.temp", getenv("MBSE_ROOT"));
|
||||
snprintf(ffile, PATH_MAX, "%s/etc/language.temp", getenv("MBSE_ROOT"));
|
||||
if ((fil = fopen(ffile, "a")) != NULL) {
|
||||
memset(&lang, 0, sizeof(lang));
|
||||
fwrite(&lang, sizeof(lang), 1, fil);
|
||||
@ -315,7 +315,7 @@ int EditLangRec(int Area)
|
||||
working(1, 0, 0);
|
||||
IsDoing("Edit Language");
|
||||
|
||||
sprintf(mfile, "%s/etc/language.temp", getenv("MBSE_ROOT"));
|
||||
snprintf(mfile, PATH_MAX, "%s/etc/language.temp", getenv("MBSE_ROOT"));
|
||||
if ((fil = fopen(mfile, "r")) == NULL) {
|
||||
working(2, 0, 0);
|
||||
return -1;
|
||||
@ -415,7 +415,7 @@ void EditLanguage(void)
|
||||
mbse_mvprintw( 5, 6, "8.2 LANGUAGE SETUP");
|
||||
set_color(CYAN, BLACK);
|
||||
if (records != 0) {
|
||||
sprintf(temp, "%s/etc/language.temp", getenv("MBSE_ROOT"));
|
||||
snprintf(temp, PATH_MAX, "%s/etc/language.temp", getenv("MBSE_ROOT"));
|
||||
if ((fil = fopen(temp, "r")) != NULL) {
|
||||
fread(&langhdr, sizeof(langhdr), 1, fil);
|
||||
x = 4;
|
||||
@ -430,7 +430,7 @@ void EditLanguage(void)
|
||||
set_color(CYAN, BLACK);
|
||||
else
|
||||
set_color(LIGHTBLUE, BLACK);
|
||||
sprintf(temp, "%3d. %s %-30s", i, lang.LangKey, lang.Name);
|
||||
snprintf(temp, 81, "%3d. %s %-30s", i, lang.LangKey, lang.Name);
|
||||
mbse_mvprintw(i + 6, x, temp);
|
||||
}
|
||||
fclose(fil);
|
||||
@ -495,11 +495,11 @@ int PickLanguage(char *nr)
|
||||
|
||||
clr_index();
|
||||
set_color(WHITE, BLACK);
|
||||
sprintf(temp, "%s. LANGUAGE SELECT", nr);
|
||||
snprintf(temp, 81, "%s. LANGUAGE SELECT", nr);
|
||||
mbse_mvprintw( 5, 4, temp);
|
||||
set_color(CYAN, BLACK);
|
||||
if (records != 0) {
|
||||
sprintf(temp, "%s/etc/language.data", getenv("MBSE_ROOT"));
|
||||
snprintf(temp, PATH_MAX, "%s/etc/language.data", getenv("MBSE_ROOT"));
|
||||
if ((fil = fopen(temp, "r")) != NULL) {
|
||||
fread(&langhdr, sizeof(langhdr), 1, fil);
|
||||
x = 2;
|
||||
@ -514,7 +514,7 @@ int PickLanguage(char *nr)
|
||||
set_color(CYAN, BLACK);
|
||||
else
|
||||
set_color(LIGHTBLUE, BLACK);
|
||||
sprintf(temp, "%3d. %s %-28s", i, lang.LangKey, lang.Name);
|
||||
snprintf(temp, 81, "%3d. %s %-28s", i, lang.LangKey, lang.Name);
|
||||
mbse_mvprintw(i + 6, x, temp);
|
||||
}
|
||||
strcpy(pick, select_pick(records, 20));
|
||||
@ -541,7 +541,7 @@ int bbs_lang_doc(FILE *fp, FILE *toc, int page)
|
||||
DIR *dp;
|
||||
struct dirent *de;
|
||||
|
||||
sprintf(temp, "%s/etc/language.data", getenv("MBSE_ROOT"));
|
||||
snprintf(temp, PATH_MAX, "%s/etc/language.data", getenv("MBSE_ROOT"));
|
||||
if ((no = fopen(temp, "r")) == NULL)
|
||||
return page;
|
||||
|
||||
@ -563,7 +563,7 @@ int bbs_lang_doc(FILE *fp, FILE *toc, int page)
|
||||
j = 0;
|
||||
}
|
||||
|
||||
sprintf(temp, "language_%s.html", lang.LangKey);
|
||||
snprintf(temp, 81, "language_%s.html", lang.LangKey);
|
||||
fprintf(ip, " <LI><A HREF=\"%s\">%s</A> %s</LI>\n", temp, lang.LangKey, lang.Name);
|
||||
if ((wp = open_webdoc(temp, (char *)"Language", lang.Name))) {
|
||||
fprintf(wp, "<A HREF=\"index.html\">Main</A> <A HREF=\"language.html\">Back</A>\n");
|
||||
|
@ -4,7 +4,7 @@
|
||||
* Purpose ...............: Setup Limits.
|
||||
*
|
||||
*****************************************************************************
|
||||
* Copyright (C) 1997-2004
|
||||
* Copyright (C) 1997-2005
|
||||
*
|
||||
* Michiel Broek FIDO: 2:280/2802
|
||||
* Beekmansbos 10
|
||||
@ -53,7 +53,7 @@ int CountLimits(void)
|
||||
char ffile[PATH_MAX];
|
||||
int count;
|
||||
|
||||
sprintf(ffile, "%s/etc/limits.data", getenv("MBSE_ROOT"));
|
||||
snprintf(ffile, PATH_MAX, "%s/etc/limits.data", getenv("MBSE_ROOT"));
|
||||
if ((fil = fopen(ffile, "r")) == NULL) {
|
||||
if ((fil = fopen(ffile, "a+")) != NULL) {
|
||||
Syslog('+', "Created new %s", ffile);
|
||||
@ -69,7 +69,7 @@ int CountLimits(void)
|
||||
LIMIT.Time = 5;
|
||||
LIMIT.DownK = 1;
|
||||
LIMIT.DownF = 1;
|
||||
sprintf(LIMIT.Description, "Twit");
|
||||
snprintf(LIMIT.Description, 41, "Twit");
|
||||
LIMIT.Available = TRUE;
|
||||
fwrite(&LIMIT, sizeof(LIMIT), 1, fil);
|
||||
|
||||
@ -78,7 +78,7 @@ int CountLimits(void)
|
||||
LIMIT.Time = 15;
|
||||
LIMIT.DownK = 100;
|
||||
LIMIT.DownF = 2;
|
||||
sprintf(LIMIT.Description, "New User");
|
||||
snprintf(LIMIT.Description, 41, "New User");
|
||||
LIMIT.Available = TRUE;
|
||||
fwrite(&LIMIT, sizeof(LIMIT), 1, fil);
|
||||
|
||||
@ -87,7 +87,7 @@ int CountLimits(void)
|
||||
LIMIT.Time = 60;
|
||||
LIMIT.DownK = 10240;
|
||||
LIMIT.DownF = 25;
|
||||
sprintf(LIMIT.Description, "Normal User");
|
||||
snprintf(LIMIT.Description, 41, "Normal User");
|
||||
LIMIT.Available = TRUE;
|
||||
fwrite(&LIMIT, sizeof(LIMIT), 1, fil);
|
||||
|
||||
@ -96,7 +96,7 @@ int CountLimits(void)
|
||||
LIMIT.Time = 90;
|
||||
LIMIT.DownK = 20480;
|
||||
LIMIT.DownF = 100;
|
||||
sprintf(LIMIT.Description, "V.I.P. User");
|
||||
snprintf(LIMIT.Description, 41, "V.I.P. User");
|
||||
LIMIT.Available = TRUE;
|
||||
fwrite(&LIMIT, sizeof(LIMIT), 1, fil);
|
||||
|
||||
@ -104,7 +104,7 @@ int CountLimits(void)
|
||||
LIMIT.Security = 80;
|
||||
LIMIT.Time = 120;
|
||||
LIMIT.DownK = 40960;
|
||||
sprintf(LIMIT.Description, "Fellow Sysop or Point");
|
||||
snprintf(LIMIT.Description, 41, "Fellow Sysop or Point");
|
||||
LIMIT.Available = TRUE;
|
||||
fwrite(&LIMIT, sizeof(LIMIT), 1, fil);
|
||||
|
||||
@ -112,7 +112,7 @@ int CountLimits(void)
|
||||
LIMIT.Security = 100;
|
||||
LIMIT.Time = 180;
|
||||
LIMIT.DownK = 40960;
|
||||
sprintf(LIMIT.Description, "Co-Sysop");
|
||||
snprintf(LIMIT.Description, 41, "Co-Sysop");
|
||||
LIMIT.Available = TRUE;
|
||||
fwrite(&LIMIT, sizeof(LIMIT), 1, fil);
|
||||
|
||||
@ -120,7 +120,7 @@ int CountLimits(void)
|
||||
LIMIT.Security = 32000;
|
||||
LIMIT.Time = 240;
|
||||
LIMIT.DownK = 40960;
|
||||
sprintf(LIMIT.Description, "Sysop");
|
||||
snprintf(LIMIT.Description, 41, "Sysop");
|
||||
LIMIT.Available = TRUE;
|
||||
fwrite(&LIMIT, sizeof(LIMIT), 1, fil);
|
||||
|
||||
@ -153,8 +153,8 @@ int OpenLimits(void)
|
||||
char fnin[PATH_MAX], fnout[PATH_MAX];
|
||||
long oldsize;
|
||||
|
||||
sprintf(fnin, "%s/etc/limits.data", getenv("MBSE_ROOT"));
|
||||
sprintf(fnout, "%s/etc/limits.temp", getenv("MBSE_ROOT"));
|
||||
snprintf(fnin, PATH_MAX, "%s/etc/limits.data", getenv("MBSE_ROOT"));
|
||||
snprintf(fnout, PATH_MAX, "%s/etc/limits.temp", getenv("MBSE_ROOT"));
|
||||
if ((fin = fopen(fnin, "r")) != NULL) {
|
||||
if ((fout = fopen(fnout, "w")) != NULL) {
|
||||
fread(&LIMIThdr, sizeof(LIMIThdr), 1, fin);
|
||||
@ -202,8 +202,8 @@ void CloseLimits(int force)
|
||||
FILE *fi, *fo;
|
||||
st_list *lim = NULL, *tmp;
|
||||
|
||||
sprintf(fin, "%s/etc/limits.data", getenv("MBSE_ROOT"));
|
||||
sprintf(fout,"%s/etc/limits.temp", getenv("MBSE_ROOT"));
|
||||
snprintf(fin, PATH_MAX, "%s/etc/limits.data", getenv("MBSE_ROOT"));
|
||||
snprintf(fout, PATH_MAX, "%s/etc/limits.temp", getenv("MBSE_ROOT"));
|
||||
|
||||
if (LimUpdated == 1) {
|
||||
if (force || (yes_no((char *)"Database is changed, save changes") == 1)) {
|
||||
@ -215,7 +215,7 @@ void CloseLimits(int force)
|
||||
|
||||
while (fread(&LIMIT, LIMIThdr.recsize, 1, fi) == 1)
|
||||
if (!LIMIT.Deleted) {
|
||||
sprintf(temp, "%014ld", LIMIT.Security);
|
||||
snprintf(temp, 20, "%014ld", LIMIT.Security);
|
||||
fill_stlist(&lim, temp, ftell(fi) - LIMIThdr.recsize);
|
||||
}
|
||||
sort_stlist(&lim);
|
||||
@ -249,7 +249,7 @@ int AppendLimits(void)
|
||||
FILE *fil;
|
||||
char ffile[PATH_MAX];
|
||||
|
||||
sprintf(ffile, "%s/etc/limits.temp", getenv("MBSE_ROOT"));
|
||||
snprintf(ffile, PATH_MAX, "%s/etc/limits.temp", getenv("MBSE_ROOT"));
|
||||
if ((fil = fopen(ffile, "a")) != NULL) {
|
||||
memset(&LIMIT, 0, sizeof(LIMIT));
|
||||
fwrite(&LIMIT, sizeof(LIMIT), 1, fil);
|
||||
@ -277,7 +277,7 @@ int EditLimRec(int Area)
|
||||
working(1, 0, 0);
|
||||
IsDoing("Edit Limits");
|
||||
|
||||
sprintf(mfile, "%s/etc/limits.temp", getenv("MBSE_ROOT"));
|
||||
snprintf(mfile, PATH_MAX, "%s/etc/limits.temp", getenv("MBSE_ROOT"));
|
||||
if ((fil = fopen(mfile, "r")) == NULL) {
|
||||
working(2, 0, 0);
|
||||
return -1;
|
||||
@ -383,7 +383,7 @@ void EditLimits(void)
|
||||
mbse_mvprintw( 5, 7, "8.1 LIMITS SETUP");
|
||||
set_color(CYAN, BLACK);
|
||||
if (records != 0) {
|
||||
sprintf(temp, "%s/etc/limits.temp", getenv("MBSE_ROOT"));
|
||||
snprintf(temp, PATH_MAX, "%s/etc/limits.temp", getenv("MBSE_ROOT"));
|
||||
if ((fil = fopen(temp, "r")) != NULL) {
|
||||
fread(&LIMIThdr, sizeof(LIMIThdr), 1, fil);
|
||||
x = 5;
|
||||
@ -401,7 +401,7 @@ void EditLimits(void)
|
||||
set_color(CYAN, BLACK);
|
||||
else
|
||||
set_color(LIGHTBLUE, BLACK);
|
||||
sprintf(temp, "%3d. %-6ld %-40s", i, LIMIT.Security, LIMIT.Description);
|
||||
snprintf(temp, 81, "%3d. %-6ld %-40s", i, LIMIT.Security, LIMIT.Description);
|
||||
temp[37] = '\0';
|
||||
mbse_mvprintw(y, x, temp);
|
||||
y++;
|
||||
@ -467,11 +467,11 @@ char *PickLimits(int nr)
|
||||
|
||||
clr_index();
|
||||
set_color(WHITE, BLACK);
|
||||
sprintf(temp, "%d. LIMITS SELECT", nr);
|
||||
snprintf(temp, 81, "%d. LIMITS SELECT", nr);
|
||||
mbse_mvprintw( 5, 4, temp);
|
||||
set_color(CYAN, BLACK);
|
||||
if (records != 0) {
|
||||
sprintf(temp, "%s/etc/limits.data", getenv("MBSE_ROOT"));
|
||||
snprintf(temp, PATH_MAX, "%s/etc/limits.data", getenv("MBSE_ROOT"));
|
||||
if ((fil = fopen(temp, "r")) != NULL) {
|
||||
fread(&LIMIThdr, sizeof(LIMIThdr), 1, fil);
|
||||
x = 2;
|
||||
@ -489,7 +489,7 @@ char *PickLimits(int nr)
|
||||
set_color(CYAN, BLACK);
|
||||
else
|
||||
set_color(LIGHTBLUE, BLACK);
|
||||
sprintf(temp, "%3d. %-6ld %-40s", i, LIMIT.Security, LIMIT.Description);
|
||||
snprintf(temp, 81, "%3d. %-6ld %-40s", i, LIMIT.Security, LIMIT.Description);
|
||||
temp[37] = '\0';
|
||||
mbse_mvprintw(y, x, temp);
|
||||
y++;
|
||||
@ -500,7 +500,7 @@ char *PickLimits(int nr)
|
||||
offset = sizeof(LIMIThdr) + ((atoi(pick) - 1) * LIMIThdr.recsize);
|
||||
fseek(fil, offset, 0);
|
||||
fread(&LIMIT, LIMIThdr.recsize, 1, fil);
|
||||
sprintf(Lim, "%ld", LIMIT.Security);
|
||||
snprintf(Lim, 21, "%ld", LIMIT.Security);
|
||||
}
|
||||
fclose(fil);
|
||||
}
|
||||
@ -516,8 +516,8 @@ char *get_limit_name(int level)
|
||||
char temp[PATH_MAX];
|
||||
FILE *fp;
|
||||
|
||||
sprintf(buf, "N/A");
|
||||
sprintf(temp, "%s/etc/limits.data", getenv("MBSE_ROOT"));
|
||||
snprintf(buf, 41, "N/A");
|
||||
snprintf(temp, PATH_MAX, "%s/etc/limits.data", getenv("MBSE_ROOT"));
|
||||
if ((fp = fopen(temp, "r")) == NULL)
|
||||
return buf;
|
||||
|
||||
@ -525,7 +525,7 @@ char *get_limit_name(int level)
|
||||
|
||||
while ((fread(&LIMIT, LIMIThdr.recsize, 1, fp)) == 1) {
|
||||
if (level == LIMIT.Security) {
|
||||
sprintf(buf, "%s", LIMIT.Description);
|
||||
snprintf(buf, 41, "%s", LIMIT.Description);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -541,7 +541,7 @@ int bbs_limits_doc(FILE *fp, FILE *toc, int page)
|
||||
FILE *up, *ip, *no;
|
||||
int nr;
|
||||
|
||||
sprintf(temp, "%s/etc/limits.data", getenv("MBSE_ROOT"));
|
||||
snprintf(temp, PATH_MAX, "%s/etc/limits.data", getenv("MBSE_ROOT"));
|
||||
if ((no = fopen(temp, "r")) == NULL)
|
||||
return page;
|
||||
|
||||
@ -579,7 +579,7 @@ int bbs_limits_doc(FILE *fp, FILE *toc, int page)
|
||||
fprintf(ip, "<TR><TH align='left'>Access Level</TH><TH align='left'>User</TH><TH align='left'>Location</TH></TR>\n");
|
||||
fseek(no, LIMIThdr.hdrsize, SEEK_SET);
|
||||
|
||||
sprintf(temp, "%s/etc/users.data", getenv("MBSE_ROOT"));
|
||||
snprintf(temp, PATH_MAX, "%s/etc/users.data", getenv("MBSE_ROOT"));
|
||||
if ((up = fopen(temp, "r"))) {
|
||||
fread(&usrconfighdr, sizeof(usrconfighdr), 1, up);
|
||||
|
||||
|
@ -4,7 +4,7 @@
|
||||
* Purpose ...............: Edit Magics
|
||||
*
|
||||
*****************************************************************************
|
||||
* Copyright (C) 1997-2004
|
||||
* Copyright (C) 1997-2005
|
||||
*
|
||||
* Michiel Broek FIDO: 2:280/2802
|
||||
* Beekmansbos 10
|
||||
@ -53,7 +53,7 @@ int CountMagics(void)
|
||||
char ffile[PATH_MAX];
|
||||
int count;
|
||||
|
||||
sprintf(ffile, "%s/etc/magic.data", getenv("MBSE_ROOT"));
|
||||
snprintf(ffile, PATH_MAX, "%s/etc/magic.data", getenv("MBSE_ROOT"));
|
||||
if ((fil = fopen(ffile, "r")) == NULL) {
|
||||
if ((fil = fopen(ffile, "a+")) != NULL) {
|
||||
Syslog('+', "Created new %s", ffile);
|
||||
@ -90,8 +90,8 @@ int OpenMagics(void)
|
||||
long oldsize;
|
||||
int FieldPatch = FALSE;
|
||||
|
||||
sprintf(fnin, "%s/etc/magic.data", getenv("MBSE_ROOT"));
|
||||
sprintf(fnout, "%s/etc/magic.temp", getenv("MBSE_ROOT"));
|
||||
snprintf(fnin, PATH_MAX, "%s/etc/magic.data", getenv("MBSE_ROOT"));
|
||||
snprintf(fnout, PATH_MAX, "%s/etc/magic.temp", getenv("MBSE_ROOT"));
|
||||
if ((fin = fopen(fnin, "r")) != NULL) {
|
||||
if ((fout = fopen(fnout, "w")) != NULL) {
|
||||
fread(&magichdr, sizeof(magichdr), 1, fin);
|
||||
@ -147,8 +147,8 @@ void CloseMagics(int force)
|
||||
FILE *fi, *fo;
|
||||
st_list *mag = NULL, *tmp;
|
||||
|
||||
sprintf(fin, "%s/etc/magic.data", getenv("MBSE_ROOT"));
|
||||
sprintf(fout,"%s/etc/magic.temp", getenv("MBSE_ROOT"));
|
||||
snprintf(fin, PATH_MAX, "%s/etc/magic.data", getenv("MBSE_ROOT"));
|
||||
snprintf(fout, PATH_MAX, "%s/etc/magic.temp", getenv("MBSE_ROOT"));
|
||||
|
||||
if (MagicUpdated == 1) {
|
||||
if (force || (yes_no((char *)"Database is changed, save changes") == 1)) {
|
||||
@ -193,7 +193,7 @@ int AppendMagics(void)
|
||||
FILE *fil;
|
||||
char ffile[PATH_MAX];
|
||||
|
||||
sprintf(ffile, "%s/etc/magic.temp", getenv("MBSE_ROOT"));
|
||||
snprintf(ffile, PATH_MAX, "%s/etc/magic.temp", getenv("MBSE_ROOT"));
|
||||
if ((fil = fopen(ffile, "a")) != NULL) {
|
||||
memset(&magic, 0, sizeof(magic));
|
||||
fwrite(&magic, sizeof(magic), 1, fil);
|
||||
@ -289,7 +289,7 @@ int EditMagicRec(int Area)
|
||||
working(1, 0, 0);
|
||||
IsDoing("Edit Magics");
|
||||
|
||||
sprintf(mfile, "%s/etc/magic.temp", getenv("MBSE_ROOT"));
|
||||
snprintf(mfile, PATH_MAX, "%s/etc/magic.temp", getenv("MBSE_ROOT"));
|
||||
if ((fil = fopen(mfile, "r")) == NULL) {
|
||||
working(2, 0, 0);
|
||||
return -1;
|
||||
@ -414,7 +414,7 @@ void EditMagics(void)
|
||||
mbse_mvprintw( 5, 2, "10.4. MAGICS EDITOR");
|
||||
set_color(CYAN, BLACK);
|
||||
if (records != 0) {
|
||||
sprintf(temp, "%s/etc/magic.temp", getenv("MBSE_ROOT"));
|
||||
snprintf(temp, PATH_MAX, "%s/etc/magic.temp", getenv("MBSE_ROOT"));
|
||||
working(1, 0, 0);
|
||||
if ((fil = fopen(temp, "r")) != NULL) {
|
||||
fread(&magichdr, sizeof(magichdr), 1, fil);
|
||||
@ -434,7 +434,7 @@ void EditMagics(void)
|
||||
set_color(CYAN, BLACK);
|
||||
else
|
||||
set_color(LIGHTBLUE, BLACK);
|
||||
sprintf(temp, "%3d. %s %s", o + i, getmagictype(magic.Attrib), magic.Mask);
|
||||
snprintf(temp, 81, "%3d. %s %s", o + i, getmagictype(magic.Attrib), magic.Mask);
|
||||
temp[37] = 0;
|
||||
mbse_mvprintw(y, x, temp);
|
||||
y++;
|
||||
@ -491,7 +491,7 @@ int tic_magic_doc(FILE *fp, FILE *toc, int page)
|
||||
FILE *wp, *ip, *no;
|
||||
int nr = 0i, j;
|
||||
|
||||
sprintf(temp, "%s/etc/magic.data", getenv("MBSE_ROOT"));
|
||||
snprintf(temp, PATH_MAX, "%s/etc/magic.data", getenv("MBSE_ROOT"));
|
||||
if ((no = fopen(temp, "r")) == NULL)
|
||||
return page;
|
||||
|
||||
@ -516,7 +516,7 @@ int tic_magic_doc(FILE *fp, FILE *toc, int page)
|
||||
}
|
||||
|
||||
nr++;
|
||||
sprintf(temp, "magic_%d.html", nr);
|
||||
snprintf(temp, 81, "magic_%d.html", nr);
|
||||
fprintf(ip, " <TR><TD><A HREF=\"%s\">%d</A></TD><TD>%s</TD><TD>%s</TD><TD>%s</TD></TR>\n",
|
||||
temp, nr, magic.Mask, getmagictype(magic.Attrib), getboolean(magic.Active));
|
||||
if ((wp = open_webdoc(temp, (char *)"File Magic", magic.Mask))) {
|
||||
|
Reference in New Issue
Block a user