clang-format
Fix a bunch of trivial formatting issues by running `clang-format`. Signed-off-by: Dan Cross <patchdev@fat-dragon.org>
This commit is contained in:
parent
ff966a6b4d
commit
d6826137dd
32
src/bbs.c
32
src/bbs.c
@ -21,13 +21,11 @@
|
|||||||
#include "lua/lualib.h"
|
#include "lua/lualib.h"
|
||||||
#include "lua/lauxlib.h"
|
#include "lua/lauxlib.h"
|
||||||
|
|
||||||
|
|
||||||
int telnet_bin_mode = 0;
|
int telnet_bin_mode = 0;
|
||||||
|
|
||||||
int mynode = 0;
|
int mynode = 0;
|
||||||
struct bbs_config conf;
|
struct bbs_config conf;
|
||||||
|
|
||||||
|
|
||||||
struct user_record *gUser;
|
struct user_record *gUser;
|
||||||
int gSocket;
|
int gSocket;
|
||||||
int sshBBS;
|
int sshBBS;
|
||||||
@ -39,8 +37,7 @@ struct mosquitto *mosq = NULL;
|
|||||||
|
|
||||||
char *ipaddress = NULL;
|
char *ipaddress = NULL;
|
||||||
|
|
||||||
void sigterm_handler2(int s)
|
void sigterm_handler2(int s) {
|
||||||
{
|
|
||||||
if (mynode != 0) {
|
if (mynode != 0) {
|
||||||
disconnect("Terminated.");
|
disconnect("Terminated.");
|
||||||
}
|
}
|
||||||
@ -48,8 +45,7 @@ void sigterm_handler2(int s)
|
|||||||
exit(0);
|
exit(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void sigint_handler(int s)
|
void sigint_handler(int s) {
|
||||||
{
|
|
||||||
// do nothing...
|
// do nothing...
|
||||||
}
|
}
|
||||||
void broadcast(char *mess, ...) {
|
void broadcast(char *mess, ...) {
|
||||||
@ -153,8 +149,7 @@ struct fido_addr *parse_fido_addr(const char *str) {
|
|||||||
case '6':
|
case '6':
|
||||||
case '7':
|
case '7':
|
||||||
case '8':
|
case '8':
|
||||||
case '9':
|
case '9': {
|
||||||
{
|
|
||||||
switch (state) {
|
switch (state) {
|
||||||
case 0:
|
case 0:
|
||||||
ret->zone = ret->zone * 10 + (str[c] - '0');
|
ret->zone = ret->zone * 10 + (str[c] - '0');
|
||||||
@ -169,8 +164,7 @@ struct fido_addr *parse_fido_addr(const char *str) {
|
|||||||
ret->point = ret->point * 10 + (str[c] - '0');
|
ret->point = ret->point * 10 + (str[c] - '0');
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
} break;
|
||||||
break;
|
|
||||||
default:
|
default:
|
||||||
free(ret);
|
free(ret);
|
||||||
return NULL;
|
return NULL;
|
||||||
@ -179,7 +173,6 @@ struct fido_addr *parse_fido_addr(const char *str) {
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void timer_handler(int signum) {
|
void timer_handler(int signum) {
|
||||||
if (signum == SIGALRM) {
|
if (signum == SIGALRM) {
|
||||||
if (gUser != NULL) {
|
if (gUser != NULL) {
|
||||||
@ -189,8 +182,6 @@ void timer_handler(int signum) {
|
|||||||
s_printf(get_string(0));
|
s_printf(get_string(0));
|
||||||
disconnect("Out of Time");
|
disconnect("Out of Time");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
if (timeoutpaused == 0) {
|
if (timeoutpaused == 0) {
|
||||||
usertimeout--;
|
usertimeout--;
|
||||||
@ -396,7 +387,6 @@ void s_displayansi_p(char *file) {
|
|||||||
s_displayansi_pause(file, 0);
|
s_displayansi_pause(file, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void s_displayansi(char *file) {
|
void s_displayansi(char *file) {
|
||||||
FILE *fptr;
|
FILE *fptr;
|
||||||
char c;
|
char c;
|
||||||
@ -411,7 +401,6 @@ void s_displayansi(char *file) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
char s_getchar() {
|
char s_getchar() {
|
||||||
unsigned char c;
|
unsigned char c;
|
||||||
unsigned char d;
|
unsigned char d;
|
||||||
@ -490,7 +479,6 @@ char s_getchar() {
|
|||||||
disconnect("Disconnected");
|
disconnect("Disconnected");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -887,7 +875,6 @@ void runbbs_real(int socket, char *ip, int ssh) {
|
|||||||
usertimeout = 10;
|
usertimeout = 10;
|
||||||
timeoutpaused = 0;
|
timeoutpaused = 0;
|
||||||
|
|
||||||
|
|
||||||
memset(&sa, 0, sizeof(sa));
|
memset(&sa, 0, sizeof(sa));
|
||||||
sa.sa_handler = &timer_handler;
|
sa.sa_handler = &timer_handler;
|
||||||
sa.sa_flags = SA_RESTART;
|
sa.sa_flags = SA_RESTART;
|
||||||
@ -915,7 +902,6 @@ void runbbs_real(int socket, char *ip, int ssh) {
|
|||||||
}
|
}
|
||||||
gSocket = socket;
|
gSocket = socket;
|
||||||
|
|
||||||
|
|
||||||
if (!ssh) {
|
if (!ssh) {
|
||||||
gUser = NULL;
|
gUser = NULL;
|
||||||
sshBBS = 0;
|
sshBBS = 0;
|
||||||
@ -1095,13 +1081,10 @@ tryagain:
|
|||||||
recursive_delete(buffer);
|
recursive_delete(buffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#if defined(ENABLE_WWW)
|
#if defined(ENABLE_WWW)
|
||||||
www_expire_old_links();
|
www_expire_old_links();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// do post-login
|
// do post-login
|
||||||
dolog("%s logged in, on node %d", user->loginname, mynode);
|
dolog("%s logged in, on node %d", user->loginname, mynode);
|
||||||
broadcast("USER: %s; NODE:%d; STATUS: Logged in.", user->loginname, mynode);
|
broadcast("USER: %s; NODE:%d; STATUS: Logged in.", user->loginname, mynode);
|
||||||
@ -1120,7 +1103,6 @@ tryagain:
|
|||||||
|
|
||||||
user->timeson++;
|
user->timeson++;
|
||||||
|
|
||||||
|
|
||||||
if (conf.script_path != NULL) {
|
if (conf.script_path != NULL) {
|
||||||
snprintf(buffer, PATH_MAX, "%s/login_stanza.lua", conf.script_path);
|
snprintf(buffer, PATH_MAX, "%s/login_stanza.lua", conf.script_path);
|
||||||
if (stat(buffer, &s) == 0) {
|
if (stat(buffer, &s) == 0) {
|
||||||
@ -1339,7 +1321,8 @@ char *str_replace(const char *str, const char *from, const char *to) {
|
|||||||
pos_cache_tmp = realloc(pos_cache, sizeof(*pos_cache) * cache_sz);
|
pos_cache_tmp = realloc(pos_cache, sizeof(*pos_cache) * cache_sz);
|
||||||
if (pos_cache_tmp == NULL) {
|
if (pos_cache_tmp == NULL) {
|
||||||
goto end_repl_str;
|
goto end_repl_str;
|
||||||
} else pos_cache = pos_cache_tmp;
|
} else
|
||||||
|
pos_cache = pos_cache_tmp;
|
||||||
cache_sz_inc *= cache_sz_inc_factor;
|
cache_sz_inc *= cache_sz_inc_factor;
|
||||||
if (cache_sz_inc > cache_sz_inc_max) {
|
if (cache_sz_inc > cache_sz_inc_max) {
|
||||||
cache_sz_inc = cache_sz_inc_max;
|
cache_sz_inc = cache_sz_inc_max;
|
||||||
@ -1356,7 +1339,8 @@ char *str_replace(const char *str, const char *from, const char *to) {
|
|||||||
if (count > 0) {
|
if (count > 0) {
|
||||||
tolen = strlen(to);
|
tolen = strlen(to);
|
||||||
retlen = orglen + (tolen - fromlen) * count;
|
retlen = orglen + (tolen - fromlen) * count;
|
||||||
} else retlen = orglen;
|
} else
|
||||||
|
retlen = orglen;
|
||||||
ret = malloc(retlen + 1);
|
ret = malloc(retlen + 1);
|
||||||
if (ret == NULL) {
|
if (ret == NULL) {
|
||||||
goto end_repl_str;
|
goto end_repl_str;
|
||||||
|
@ -90,7 +90,6 @@ int add_bbs(struct bbs_list_entry_t *new_entry) {
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
rc = sqlite3_step(res);
|
rc = sqlite3_step(res);
|
||||||
|
|
||||||
if (rc != SQLITE_DONE) {
|
if (rc != SQLITE_DONE) {
|
||||||
|
@ -175,7 +175,6 @@ void blog_display() {
|
|||||||
|
|
||||||
s_printf(get_string(6));
|
s_printf(get_string(6));
|
||||||
s_getchar();
|
s_getchar();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void blog_write() {
|
void blog_write() {
|
||||||
|
@ -175,7 +175,6 @@ int bwave_scan_area(int confr, int area, int areano, int totmsgs, FILE *fti_file
|
|||||||
} else if (jlr.LastReadMsg == 0 && jlr.HighReadMsg == 0) {
|
} else if (jlr.LastReadMsg == 0 && jlr.HighReadMsg == 0) {
|
||||||
all_unread = 1;
|
all_unread = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (all_unread == 0) {
|
if (all_unread == 0) {
|
||||||
@ -461,7 +460,6 @@ void bwave_create_packet() {
|
|||||||
if (totmsgs == conf.bwave_max_msgs) {
|
if (totmsgs == conf.bwave_max_msgs) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (totmsgs == conf.bwave_max_msgs) {
|
if (totmsgs == conf.bwave_max_msgs) {
|
||||||
@ -588,7 +586,6 @@ void bwave_create_packet() {
|
|||||||
s_getc();
|
s_getc();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int bwave_add_message(int confr, int area, unsigned int dwritten, char *to, char *subject, struct fido_addr *destaddr, char *msg) {
|
int bwave_add_message(int confr, int area, unsigned int dwritten, char *to, char *subject, struct fido_addr *destaddr, char *msg) {
|
||||||
s_JamBase *jb;
|
s_JamBase *jb;
|
||||||
s_JamMsgHeader jmh;
|
s_JamMsgHeader jmh;
|
||||||
@ -613,7 +610,6 @@ int bwave_add_message(int confr, int area, unsigned int dwritten, char *to, char
|
|||||||
sprintf(buffer, "%s %s", gUser->firstname, gUser->lastname);
|
sprintf(buffer, "%s %s", gUser->firstname, gUser->lastname);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
jsp = JAM_NewSubPacket();
|
jsp = JAM_NewSubPacket();
|
||||||
|
|
||||||
jsf.LoID = JAMSFLD_SENDERNAME;
|
jsf.LoID = JAMSFLD_SENDERNAME;
|
||||||
@ -647,7 +643,6 @@ int bwave_add_message(int confr, int area, unsigned int dwritten, char *to, char
|
|||||||
if (conf.mail_conferences[confr]->mail_areas[area]->type == TYPE_ECHOMAIL_AREA || conf.mail_conferences[confr]->mail_areas[area]->type == TYPE_NEWSGROUP_AREA) {
|
if (conf.mail_conferences[confr]->mail_areas[area]->type == TYPE_ECHOMAIL_AREA || conf.mail_conferences[confr]->mail_areas[area]->type == TYPE_NEWSGROUP_AREA) {
|
||||||
jmh.Attribute |= JAM_MSG_TYPEECHO;
|
jmh.Attribute |= JAM_MSG_TYPEECHO;
|
||||||
|
|
||||||
|
|
||||||
if (conf.mail_conferences[confr]->nettype == NETWORK_FIDO) {
|
if (conf.mail_conferences[confr]->nettype == NETWORK_FIDO) {
|
||||||
if (conf.mail_conferences[confr]->fidoaddr->point) {
|
if (conf.mail_conferences[confr]->fidoaddr->point) {
|
||||||
sprintf(buffer, "%d:%d/%d.%d", conf.mail_conferences[confr]->fidoaddr->zone,
|
sprintf(buffer, "%d:%d/%d.%d", conf.mail_conferences[confr]->fidoaddr->zone,
|
||||||
@ -685,7 +680,6 @@ int bwave_add_message(int confr, int area, unsigned int dwritten, char *to, char
|
|||||||
jsf.Buffer = (char *)buffer;
|
jsf.Buffer = (char *)buffer;
|
||||||
JAM_PutSubfield(jsp, &jsf);
|
JAM_PutSubfield(jsp, &jsf);
|
||||||
|
|
||||||
|
|
||||||
uuid_generate(magi_msgid);
|
uuid_generate(magi_msgid);
|
||||||
uuid_unparse_lower(magi_msgid, buffer);
|
uuid_unparse_lower(magi_msgid, buffer);
|
||||||
|
|
||||||
@ -1118,7 +1112,6 @@ void bwave_upload_reply() {
|
|||||||
}
|
}
|
||||||
body[bpos] = '\0';
|
body[bpos] = '\0';
|
||||||
|
|
||||||
|
|
||||||
if (bwave_add_message(confr, area, convertl(upl_rec.unix_date), upl_rec.to, upl_rec.subj, &addr, body) != 0) {
|
if (bwave_add_message(confr, area, convertl(upl_rec.unix_date), upl_rec.to, upl_rec.subj, &addr, body) != 0) {
|
||||||
// failed to add message
|
// failed to add message
|
||||||
s_printf(get_string(197));
|
s_printf(get_string(197));
|
||||||
|
@ -22,12 +22,10 @@
|
|||||||
#ifndef __BLUEWAVE_H /* An extra safeguard to prevent this header from */
|
#ifndef __BLUEWAVE_H /* An extra safeguard to prevent this header from */
|
||||||
#define __BLUEWAVE_H /* being included twice in the same source file */
|
#define __BLUEWAVE_H /* being included twice in the same source file */
|
||||||
|
|
||||||
|
|
||||||
#define PACKET_LEVEL 3 /* The current mail packet revision level, */
|
#define PACKET_LEVEL 3 /* The current mail packet revision level, */
|
||||||
/* used in the "ver" field of the *.INF */
|
/* used in the "ver" field of the *.INF */
|
||||||
/* file header. */
|
/* file header. */
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
** This header defines the data structures for the following files in the
|
** This header defines the data structures for the following files in the
|
||||||
** official Blue Wave offline mail specification:
|
** official Blue Wave offline mail specification:
|
||||||
@ -67,12 +65,10 @@
|
|||||||
** function. Example: "memset(&ftirec, 0, sizeof(FTI_REC))".)
|
** function. Example: "memset(&ftirec, 0, sizeof(FTI_REC))".)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
/* >>>>>>>>>>>>>>>>>>>>>>> DATA TYPE DEFINITIONS <<<<<<<<<<<<<<<<<<<<<<<<< */
|
/* >>>>>>>>>>>>>>>>>>>>>>> DATA TYPE DEFINITIONS <<<<<<<<<<<<<<<<<<<<<<<<< */
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
** The data type definitions below help make these structures a little more
|
** The data type definitions below help make these structures a little more
|
||||||
** universal between environments. The 8-bit, 16-bit, and 32-bit data types
|
** universal between environments. The 8-bit, 16-bit, and 32-bit data types
|
||||||
@ -96,9 +92,6 @@
|
|||||||
** they aren't, you're bound to get some *very* interesting results.
|
** they aren't, you're bound to get some *very* interesting results.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
typedef signed char tCHAR; /* 8 bit signed values */
|
typedef signed char tCHAR; /* 8 bit signed values */
|
||||||
typedef unsigned char tBYTE; /* 8 bit unsigned values */
|
typedef unsigned char tBYTE; /* 8 bit unsigned values */
|
||||||
typedef signed short tINT; /* 16 bit signed values */
|
typedef signed short tINT; /* 16 bit signed values */
|
||||||
@ -106,12 +99,10 @@ typedef unsigned short tWORD; /* 16 bit unsigned values */
|
|||||||
typedef int tLONG; /* 32 bit signed values */
|
typedef int tLONG; /* 32 bit signed values */
|
||||||
typedef unsigned int tDWORD; /* 32 bit unsigned values */
|
typedef unsigned int tDWORD; /* 32 bit unsigned values */
|
||||||
|
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
/* >>>>>>>>>>>>>>>>>>>>> DOOR DATA FILE STRUCTURES <<<<<<<<<<<<<<<<<<<<<<< */
|
/* >>>>>>>>>>>>>>>>>>>>> DOOR DATA FILE STRUCTURES <<<<<<<<<<<<<<<<<<<<<<< */
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
** Name of file: *.INF
|
** Name of file: *.INF
|
||||||
**
|
**
|
||||||
@ -534,12 +525,10 @@ FTI_REC;
|
|||||||
** File format: Unstructured
|
** File format: Unstructured
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
/* >>>>>>>>>>>>>>>>> MISCELLANEOUS DATA FILE STRUCTURES <<<<<<<<<<<<<<<<<< */
|
/* >>>>>>>>>>>>>>>>> MISCELLANEOUS DATA FILE STRUCTURES <<<<<<<<<<<<<<<<<< */
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
** Name of file: *.MSG
|
** Name of file: *.MSG
|
||||||
**
|
**
|
||||||
@ -667,12 +656,10 @@ typedef struct /* XTI_REC */
|
|||||||
} __attribute__((packed))
|
} __attribute__((packed))
|
||||||
XTI_REC;
|
XTI_REC;
|
||||||
|
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
/* >>>>>>>>>>>>>>>>>>>> READER DATA FILE STRUCTURES <<<<<<<<<<<<<<<<<<<<<< */
|
/* >>>>>>>>>>>>>>>>>>>> READER DATA FILE STRUCTURES <<<<<<<<<<<<<<<<<<<<<< */
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
** Name of file: *.NET
|
** Name of file: *.NET
|
||||||
**
|
**
|
||||||
@ -1149,4 +1136,3 @@ PDQ_REC;
|
|||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#endif /* __BLUEWAVE_H */
|
#endif /* __BLUEWAVE_H */
|
||||||
|
|
||||||
|
@ -37,7 +37,6 @@ struct chat_msg {
|
|||||||
char msg[512];
|
char msg[512];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
static int jsoneq(const char *json, jsmntok_t *tok, const char *s) {
|
static int jsoneq(const char *json, jsmntok_t *tok, const char *s) {
|
||||||
if (tok->type == JSMN_STRING && (int)strlen(s) == tok->end - tok->start &&
|
if (tok->type == JSMN_STRING && (int)strlen(s) == tok->end - tok->start &&
|
||||||
strncmp(json + tok->start, s, tok->end - tok->start) == 0) {
|
strncmp(json + tok->start, s, tok->end - tok->start) == 0) {
|
||||||
@ -284,8 +283,6 @@ void chat_system(struct user_record *user) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
row_at = 0;
|
row_at = 0;
|
||||||
line_at = 0;
|
line_at = 0;
|
||||||
s_putstring("\e[2J\e[23;1H");
|
s_putstring("\e[2J\e[23;1H");
|
||||||
@ -360,8 +357,6 @@ void chat_system(struct user_record *user) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
memset(buffer, 0, 513);
|
memset(buffer, 0, 513);
|
||||||
|
|
||||||
screenbuffer = (struct character_t ***)malloc(sizeof(struct character_t **) * 23);
|
screenbuffer = (struct character_t ***)malloc(sizeof(struct character_t **) * 23);
|
||||||
@ -493,11 +488,9 @@ void chat_system(struct user_record *user) {
|
|||||||
append_screenbuffer(outputbuffer);
|
append_screenbuffer(outputbuffer);
|
||||||
do_update = 1;
|
do_update = 1;
|
||||||
|
|
||||||
|
|
||||||
memset(buffer, 0, 513);
|
memset(buffer, 0, 513);
|
||||||
buffer_at = 0;
|
buffer_at = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
if (z < len) {
|
if (z < len) {
|
||||||
memset(partmessage, 0, 1024);
|
memset(partmessage, 0, 1024);
|
||||||
|
10
src/doors.c
10
src/doors.c
@ -36,10 +36,10 @@ int running_door = 0;
|
|||||||
extern int telnet_bin_mode;
|
extern int telnet_bin_mode;
|
||||||
extern int timeoutpaused;
|
extern int timeoutpaused;
|
||||||
|
|
||||||
void doorchld_handler(int s)
|
void doorchld_handler(int s) {
|
||||||
{
|
|
||||||
// waitpid() might overwrite errno, so we save and restore it:
|
// waitpid() might overwrite errno, so we save and restore it:
|
||||||
while(waitpid(-1, NULL, WNOHANG) > 0);
|
while (waitpid(-1, NULL, WNOHANG) > 0)
|
||||||
|
;
|
||||||
|
|
||||||
running_door = 0;
|
running_door = 0;
|
||||||
}
|
}
|
||||||
@ -192,8 +192,6 @@ int write_door32sys(struct user_record *user) {
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void rundoor(struct user_record *user, char *cmd, int stdio, char *codepage) {
|
void rundoor(struct user_record *user, char *cmd, int stdio, char *codepage) {
|
||||||
char *arguments[4];
|
char *arguments[4];
|
||||||
int door_out;
|
int door_out;
|
||||||
@ -276,8 +274,6 @@ void runexternal(struct user_record *user, char *cmd, int stdio, char *argv[], c
|
|||||||
door_out = gSocket;
|
door_out = gSocket;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
ws.ws_row = 24;
|
ws.ws_row = 24;
|
||||||
ws.ws_col = 80;
|
ws.ws_col = 80;
|
||||||
|
|
||||||
|
@ -82,7 +82,6 @@ void send_email(struct user_record *user) {
|
|||||||
char *subject;
|
char *subject;
|
||||||
char *msg;
|
char *msg;
|
||||||
|
|
||||||
|
|
||||||
s_printf(get_string(54));
|
s_printf(get_string(54));
|
||||||
s_readstring(buffer, 16);
|
s_readstring(buffer, 16);
|
||||||
|
|
||||||
@ -156,7 +155,6 @@ void show_email(struct user_record *user, int msgno, int email_count, struct ema
|
|||||||
lines = 0;
|
lines = 0;
|
||||||
chars = 0;
|
chars = 0;
|
||||||
|
|
||||||
|
|
||||||
msg_line_count = 0;
|
msg_line_count = 0;
|
||||||
start_line = 0;
|
start_line = 0;
|
||||||
|
|
||||||
@ -272,7 +270,6 @@ void show_email(struct user_record *user, int msgno, int email_count, struct ema
|
|||||||
sqlite3_finalize(res);
|
sqlite3_finalize(res);
|
||||||
sqlite3_close(db);
|
sqlite3_close(db);
|
||||||
|
|
||||||
|
|
||||||
if (tolower(c) == 'r') {
|
if (tolower(c) == 'r') {
|
||||||
if (emails[msgno]->subject != NULL) {
|
if (emails[msgno]->subject != NULL) {
|
||||||
if (strncasecmp(emails[msgno]->subject, "RE:", 3) != 0) {
|
if (strncasecmp(emails[msgno]->subject, "RE:", 3) != 0) {
|
||||||
@ -620,7 +617,6 @@ void list_emails(struct user_record *user) {
|
|||||||
free(emails);
|
free(emails);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int mail_getemailcount(struct user_record *user) {
|
int mail_getemailcount(struct user_record *user) {
|
||||||
char *sql = "SELECT COUNT(*) FROM email WHERE recipient LIKE ?";
|
char *sql = "SELECT COUNT(*) FROM email WHERE recipient LIKE ?";
|
||||||
int count;
|
int count;
|
||||||
|
14
src/files.c
14
src/files.c
@ -117,7 +117,6 @@ void ZFlowControl(int onoff, ZModem *info) {
|
|||||||
void ZStatus(int type, int value, char *status) {
|
void ZStatus(int type, int value, char *status) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
char *upload_path;
|
char *upload_path;
|
||||||
char upload_filename[1024];
|
char upload_filename[1024];
|
||||||
|
|
||||||
@ -428,7 +427,6 @@ char *get_file_id_diz(char *filename) {
|
|||||||
continue;
|
continue;
|
||||||
} else {
|
} else {
|
||||||
description[bpos++] = description[i];
|
description[bpos++] = description[i];
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
description[bpos] = '\0';
|
description[bpos] = '\0';
|
||||||
@ -710,7 +708,6 @@ int do_upload(struct user_record *user, char *final_path) {
|
|||||||
recursive_delete(upload_path);
|
recursive_delete(upload_path);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
closedir(inb);
|
closedir(inb);
|
||||||
@ -856,7 +853,6 @@ void download_zmodem(struct user_record *user, char *filename) {
|
|||||||
|
|
||||||
zm.packetsize = 1024;
|
zm.packetsize = 1024;
|
||||||
|
|
||||||
|
|
||||||
ZmodemTInit(&zm);
|
ZmodemTInit(&zm);
|
||||||
done = doIO(&zm);
|
done = doIO(&zm);
|
||||||
if (done != ZmDone) {
|
if (done != ZmDone) {
|
||||||
@ -899,7 +895,6 @@ void download_zmodem(struct user_record *user, char *filename) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void genurls() {
|
void genurls() {
|
||||||
#if defined(ENABLE_WWW)
|
#if defined(ENABLE_WWW)
|
||||||
int i;
|
int i;
|
||||||
@ -942,7 +937,6 @@ void genurls() {
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void download(struct user_record *user) {
|
void download(struct user_record *user) {
|
||||||
int i;
|
int i;
|
||||||
char *ssql = "select dlcount from files where filename like ?";
|
char *ssql = "select dlcount from files where filename like ?";
|
||||||
@ -953,7 +947,6 @@ void download(struct user_record *user) {
|
|||||||
sqlite3_stmt *res;
|
sqlite3_stmt *res;
|
||||||
int rc;
|
int rc;
|
||||||
|
|
||||||
|
|
||||||
for (i = 0; i < tagged_count; i++) {
|
for (i = 0; i < tagged_count; i++) {
|
||||||
s_printf(get_string(254), basename(tagged_files[i]->filename));
|
s_printf(get_string(254), basename(tagged_files[i]->filename));
|
||||||
|
|
||||||
@ -1005,8 +998,6 @@ void download(struct user_record *user) {
|
|||||||
sqlite3_close(db);
|
sqlite3_close(db);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
for (i = 0; i < tagged_count; i++) {
|
for (i = 0; i < tagged_count; i++) {
|
||||||
free(tagged_files[i]->filename);
|
free(tagged_files[i]->filename);
|
||||||
free(tagged_files[i]);
|
free(tagged_files[i]);
|
||||||
@ -1329,8 +1320,6 @@ void file_search() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
while (sqlite3_step(res) == SQLITE_ROW) {
|
while (sqlite3_step(res) == SQLITE_ROW) {
|
||||||
if (files_c == 0) {
|
if (files_c == 0) {
|
||||||
files_e = (struct file_entry **)malloc(sizeof(struct file_entry *));
|
files_e = (struct file_entry **)malloc(sizeof(struct file_entry *));
|
||||||
@ -1456,7 +1445,6 @@ void list_files(struct user_record *user) {
|
|||||||
default:
|
default:
|
||||||
sql = fsql;
|
sql = fsql;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
}
|
}
|
||||||
s_printf("\r\n");
|
s_printf("\r\n");
|
||||||
snprintf(buffer, PATH_MAX, "%s/%s.sq3", conf.bbs_path, conf.file_directories[user->cur_file_dir]->file_subs[user->cur_file_sub]->database);
|
snprintf(buffer, PATH_MAX, "%s/%s.sq3", conf.bbs_path, conf.file_directories[user->cur_file_dir]->file_subs[user->cur_file_sub]->database);
|
||||||
@ -1479,8 +1467,6 @@ void list_files(struct user_record *user) {
|
|||||||
sqlite3_bind_int(res, 1, userlaston);
|
sqlite3_bind_int(res, 1, userlaston);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
files_c = 0;
|
files_c = 0;
|
||||||
|
|
||||||
while (sqlite3_step(res) == SQLITE_ROW) {
|
while (sqlite3_step(res) == SQLITE_ROW) {
|
||||||
|
@ -141,19 +141,16 @@ static unsigned long crc32_tab[] = {
|
|||||||
0xbdbdf21cL, 0xcabac28aL, 0x53b39330L, 0x24b4a3a6L, 0xbad03605L,
|
0xbdbdf21cL, 0xcabac28aL, 0x53b39330L, 0x24b4a3a6L, 0xbad03605L,
|
||||||
0xcdd70693L, 0x54de5729L, 0x23d967bfL, 0xb3667a2eL, 0xc4614ab8L,
|
0xcdd70693L, 0x54de5729L, 0x23d967bfL, 0xb3667a2eL, 0xc4614ab8L,
|
||||||
0x5d681b02L, 0x2a6f2b94L, 0xb40bbe37L, 0xc30c8ea1L, 0x5a05df1bL,
|
0x5d681b02L, 0x2a6f2b94L, 0xb40bbe37L, 0xc30c8ea1L, 0x5a05df1bL,
|
||||||
0x2d02ef8dL
|
0x2d02ef8dL};
|
||||||
};
|
|
||||||
|
|
||||||
/* Return a 32-bit CRC of the contents of the buffer. */
|
/* Return a 32-bit CRC of the contents of the buffer. */
|
||||||
|
|
||||||
unsigned long crc32(const unsigned char *s, unsigned int len)
|
unsigned long crc32(const unsigned char *s, unsigned int len) {
|
||||||
{
|
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
unsigned long crc32val;
|
unsigned long crc32val;
|
||||||
|
|
||||||
crc32val = 0;
|
crc32val = 0;
|
||||||
for (i = 0; i < len; i ++)
|
for (i = 0; i < len; i++) {
|
||||||
{
|
|
||||||
crc32val =
|
crc32val =
|
||||||
crc32_tab[(crc32val ^ s[i]) & 0xff] ^
|
crc32_tab[(crc32val ^ s[i]) & 0xff] ^
|
||||||
(crc32val >> 8);
|
(crc32val >> 8);
|
||||||
@ -392,6 +389,8 @@ void hashmap_free(map_t in){
|
|||||||
/* Return the length of the hashmap */
|
/* Return the length of the hashmap */
|
||||||
int hashmap_length(map_t in) {
|
int hashmap_length(map_t in) {
|
||||||
hashmap_map *m = (hashmap_map *)in;
|
hashmap_map *m = (hashmap_map *)in;
|
||||||
if(m != NULL) return m->size;
|
if (m != NULL)
|
||||||
else return 0;
|
return m->size;
|
||||||
|
else
|
||||||
|
return 0;
|
||||||
}
|
}
|
@ -12,14 +12,12 @@
|
|||||||
#define KEY_PREFIX ("somekey")
|
#define KEY_PREFIX ("somekey")
|
||||||
#define KEY_COUNT (1024 * 1024)
|
#define KEY_COUNT (1024 * 1024)
|
||||||
|
|
||||||
typedef struct data_struct_s
|
typedef struct data_struct_s {
|
||||||
{
|
|
||||||
char key_string[KEY_MAX_LENGTH];
|
char key_string[KEY_MAX_LENGTH];
|
||||||
int number;
|
int number;
|
||||||
} data_struct_t;
|
} data_struct_t;
|
||||||
|
|
||||||
int main(char* argv, int argc)
|
int main(char *argv, int argc) {
|
||||||
{
|
|
||||||
int index;
|
int index;
|
||||||
int error;
|
int error;
|
||||||
map_t mymap;
|
map_t mymap;
|
||||||
@ -29,8 +27,7 @@ int main(char* argv, int argc)
|
|||||||
mymap = hashmap_new();
|
mymap = hashmap_new();
|
||||||
|
|
||||||
/* First, populate the hash map with ascending values */
|
/* First, populate the hash map with ascending values */
|
||||||
for (index=0; index<KEY_COUNT; index+=1)
|
for (index = 0; index < KEY_COUNT; index += 1) {
|
||||||
{
|
|
||||||
/* Store the key string along side the numerical value so we can free it later */
|
/* Store the key string along side the numerical value so we can free it later */
|
||||||
value = malloc(sizeof(data_struct_t));
|
value = malloc(sizeof(data_struct_t));
|
||||||
snprintf(value->key_string, KEY_MAX_LENGTH, "%s%d", KEY_PREFIX, index);
|
snprintf(value->key_string, KEY_MAX_LENGTH, "%s%d", KEY_PREFIX, index);
|
||||||
@ -41,8 +38,7 @@ int main(char* argv, int argc)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Now, check all of the expected values are there */
|
/* Now, check all of the expected values are there */
|
||||||
for (index=0; index<KEY_COUNT; index+=1)
|
for (index = 0; index < KEY_COUNT; index += 1) {
|
||||||
{
|
|
||||||
snprintf(key_string, KEY_MAX_LENGTH, "%s%d", KEY_PREFIX, index);
|
snprintf(key_string, KEY_MAX_LENGTH, "%s%d", KEY_PREFIX, index);
|
||||||
|
|
||||||
error = hashmap_get(mymap, key_string, (void **)(&value));
|
error = hashmap_get(mymap, key_string, (void **)(&value));
|
||||||
@ -61,8 +57,7 @@ int main(char* argv, int argc)
|
|||||||
assert(error == MAP_MISSING);
|
assert(error == MAP_MISSING);
|
||||||
|
|
||||||
/* Free all of the values we allocated and remove them from the map */
|
/* Free all of the values we allocated and remove them from the map */
|
||||||
for (index=0; index<KEY_COUNT; index+=1)
|
for (index = 0; index < KEY_COUNT; index += 1) {
|
||||||
{
|
|
||||||
snprintf(key_string, KEY_MAX_LENGTH, "%s%d", KEY_PREFIX, index);
|
snprintf(key_string, KEY_MAX_LENGTH, "%s%d", KEY_PREFIX, index);
|
||||||
|
|
||||||
error = hashmap_get(mymap, key_string, (void **)(&value));
|
error = hashmap_get(mymap, key_string, (void **)(&value));
|
||||||
|
@ -25,8 +25,7 @@ https://github.com/benhoyt/inih
|
|||||||
#define MAX_NAME 50
|
#define MAX_NAME 50
|
||||||
|
|
||||||
/* Strip whitespace chars off end of given string, in place. Return s. */
|
/* Strip whitespace chars off end of given string, in place. Return s. */
|
||||||
static char* rstrip(char* s)
|
static char *rstrip(char *s) {
|
||||||
{
|
|
||||||
char *p = s + strlen(s);
|
char *p = s + strlen(s);
|
||||||
while (p > s && isspace((unsigned char)(*--p)))
|
while (p > s && isspace((unsigned char)(*--p)))
|
||||||
*p = '\0';
|
*p = '\0';
|
||||||
@ -34,8 +33,7 @@ static char* rstrip(char* s)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Return pointer to first non-whitespace char in given string. */
|
/* Return pointer to first non-whitespace char in given string. */
|
||||||
static char* lskip(const char* s)
|
static char *lskip(const char *s) {
|
||||||
{
|
|
||||||
while (*s && isspace((unsigned char)(*s)))
|
while (*s && isspace((unsigned char)(*s)))
|
||||||
s++;
|
s++;
|
||||||
return (char *)s;
|
return (char *)s;
|
||||||
@ -44,8 +42,7 @@ static char* lskip(const char* s)
|
|||||||
/* Return pointer to first char (of chars) or inline comment in given string,
|
/* Return pointer to first char (of chars) or inline comment in given string,
|
||||||
or pointer to null at end of string if neither found. Inline comment must
|
or pointer to null at end of string if neither found. Inline comment must
|
||||||
be prefixed by a whitespace character to register as a comment. */
|
be prefixed by a whitespace character to register as a comment. */
|
||||||
static char* find_chars_or_comment(const char* s, const char* chars)
|
static char *find_chars_or_comment(const char *s, const char *chars) {
|
||||||
{
|
|
||||||
#if INI_ALLOW_INLINE_COMMENTS
|
#if INI_ALLOW_INLINE_COMMENTS
|
||||||
int was_space = 0;
|
int was_space = 0;
|
||||||
while (*s && (!chars || !strchr(chars, *s)) &&
|
while (*s && (!chars || !strchr(chars, *s)) &&
|
||||||
@ -62,8 +59,7 @@ static char* find_chars_or_comment(const char* s, const char* chars)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Version of strncpy that ensures dest (size bytes) is null-terminated. */
|
/* Version of strncpy that ensures dest (size bytes) is null-terminated. */
|
||||||
static char* strncpy0(char* dest, const char* src, size_t size)
|
static char *strncpy0(char *dest, const char *src, size_t size) {
|
||||||
{
|
|
||||||
strncpy(dest, src, size);
|
strncpy(dest, src, size);
|
||||||
dest[size - 1] = '\0';
|
dest[size - 1] = '\0';
|
||||||
return dest;
|
return dest;
|
||||||
@ -71,8 +67,7 @@ static char* strncpy0(char* dest, const char* src, size_t size)
|
|||||||
|
|
||||||
/* See documentation in header file. */
|
/* See documentation in header file. */
|
||||||
int ini_parse_stream(ini_reader reader, void *stream, ini_handler handler,
|
int ini_parse_stream(ini_reader reader, void *stream, ini_handler handler,
|
||||||
void* user)
|
void *user) {
|
||||||
{
|
|
||||||
/* Uses a fair bit of stack (use heap instead if you need to) */
|
/* Uses a fair bit of stack (use heap instead if you need to) */
|
||||||
#if INI_USE_STACK
|
#if INI_USE_STACK
|
||||||
char line[INI_MAX_LINE];
|
char line[INI_MAX_LINE];
|
||||||
@ -129,13 +124,11 @@ int ini_parse_stream(ini_reader reader, void* stream, ini_handler handler,
|
|||||||
*end = '\0';
|
*end = '\0';
|
||||||
strncpy0(section, start + 1, sizeof(section));
|
strncpy0(section, start + 1, sizeof(section));
|
||||||
*prev_name = '\0';
|
*prev_name = '\0';
|
||||||
}
|
} else if (!error) {
|
||||||
else if (!error) {
|
|
||||||
/* No ']' found on section line */
|
/* No ']' found on section line */
|
||||||
error = lineno;
|
error = lineno;
|
||||||
}
|
}
|
||||||
}
|
} else if (*start) {
|
||||||
else if (*start) {
|
|
||||||
/* Not a comment, must be a name[=:]value pair */
|
/* Not a comment, must be a name[=:]value pair */
|
||||||
end = find_chars_or_comment(start, "=:");
|
end = find_chars_or_comment(start, "=:");
|
||||||
if (*end == '=' || *end == ':') {
|
if (*end == '=' || *end == ':') {
|
||||||
@ -153,8 +146,7 @@ int ini_parse_stream(ini_reader reader, void* stream, ini_handler handler,
|
|||||||
strncpy0(prev_name, name, sizeof(prev_name));
|
strncpy0(prev_name, name, sizeof(prev_name));
|
||||||
if (!handler(user, section, name, value) && !error)
|
if (!handler(user, section, name, value) && !error)
|
||||||
error = lineno;
|
error = lineno;
|
||||||
}
|
} else if (!error) {
|
||||||
else if (!error) {
|
|
||||||
/* No '=' or ':' found on name[=:]value line */
|
/* No '=' or ':' found on name[=:]value line */
|
||||||
error = lineno;
|
error = lineno;
|
||||||
}
|
}
|
||||||
@ -174,14 +166,12 @@ int ini_parse_stream(ini_reader reader, void* stream, ini_handler handler,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* See documentation in header file. */
|
/* See documentation in header file. */
|
||||||
int ini_parse_file(FILE* file, ini_handler handler, void* user)
|
int ini_parse_file(FILE *file, ini_handler handler, void *user) {
|
||||||
{
|
|
||||||
return ini_parse_stream((ini_reader)fgets, file, handler, user);
|
return ini_parse_stream((ini_reader)fgets, file, handler, user);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* See documentation in header file. */
|
/* See documentation in header file. */
|
||||||
int ini_parse(const char* filename, ini_handler handler, void* user)
|
int ini_parse(const char *filename, ini_handler handler, void *user) {
|
||||||
{
|
|
||||||
FILE *file;
|
FILE *file;
|
||||||
int error;
|
int error;
|
||||||
|
|
||||||
|
@ -187,7 +187,6 @@ int l_getBBSInfo(lua_State *L) {
|
|||||||
return 4;
|
return 4;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int l_getUserHandle(lua_State *L) {
|
int l_getUserHandle(lua_State *L) {
|
||||||
lua_pushstring(L, gUser->loginname);
|
lua_pushstring(L, gUser->loginname);
|
||||||
|
|
||||||
@ -281,7 +280,6 @@ int l_readMessageHdr(lua_State *L) {
|
|||||||
memset(recipient, 0, jsp->Fields[z]->DatLen + 1);
|
memset(recipient, 0, jsp->Fields[z]->DatLen + 1);
|
||||||
memcpy(recipient, jsp->Fields[z]->Buffer, jsp->Fields[z]->DatLen);
|
memcpy(recipient, jsp->Fields[z]->Buffer, jsp->Fields[z]->DatLen);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
JAM_DelSubPacket(jsp);
|
JAM_DelSubPacket(jsp);
|
||||||
JAM_CloseMB(jb);
|
JAM_CloseMB(jb);
|
||||||
@ -307,7 +305,6 @@ int l_readMessageHdr(lua_State *L) {
|
|||||||
free(sender);
|
free(sender);
|
||||||
free(recipient);
|
free(recipient);
|
||||||
|
|
||||||
|
|
||||||
return 3;
|
return 3;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -420,7 +417,6 @@ int l_postMessage(lua_State *L) {
|
|||||||
jmh.DateWritten = dwritten;
|
jmh.DateWritten = dwritten;
|
||||||
jmh.Attribute |= JAM_MSG_LOCAL;
|
jmh.Attribute |= JAM_MSG_LOCAL;
|
||||||
|
|
||||||
|
|
||||||
jsp = JAM_NewSubPacket();
|
jsp = JAM_NewSubPacket();
|
||||||
|
|
||||||
jsf.LoID = JAMSFLD_SENDERNAME;
|
jsf.LoID = JAMSFLD_SENDERNAME;
|
||||||
|
@ -36,7 +36,6 @@ time_t utc_to_local(time_t utc) {
|
|||||||
return local;
|
return local;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
s_JamBase *open_jam_base(char *path) {
|
s_JamBase *open_jam_base(char *path) {
|
||||||
int ret;
|
int ret;
|
||||||
s_JamBase *jb;
|
s_JamBase *jb;
|
||||||
@ -432,8 +431,6 @@ char *external_editor(struct user_record *user, char *to, char *from, char *quot
|
|||||||
struct stat s;
|
struct stat s;
|
||||||
struct utsname name;
|
struct utsname name;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if (conf.external_editor_cmd != NULL && user->exteditor != 0) {
|
if (conf.external_editor_cmd != NULL && user->exteditor != 0) {
|
||||||
if (user->exteditor == 2) {
|
if (user->exteditor == 2) {
|
||||||
s_printf(get_string(85));
|
s_printf(get_string(85));
|
||||||
@ -519,8 +516,6 @@ char *external_editor(struct user_record *user, char *to, char *from, char *quot
|
|||||||
body = (char *)realloc(body, totlen + 1);
|
body = (char *)realloc(body, totlen + 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
memcpy(&body[totlen - len], buffer, len);
|
memcpy(&body[totlen - len], buffer, len);
|
||||||
body[totlen] = '\0';
|
body[totlen] = '\0';
|
||||||
|
|
||||||
@ -1303,7 +1298,6 @@ void unmangle_ansi(char *body, int len, char **body_out, int *body_len) {
|
|||||||
bg = 0x07;
|
bg = 0x07;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
state = 0;
|
state = 0;
|
||||||
break;
|
break;
|
||||||
@ -1420,8 +1414,6 @@ void unmangle_ansi(char *body, int len, char **body_out, int *body_len) {
|
|||||||
case 0x07:
|
case 0x07:
|
||||||
buffer[buf_at++] = '7';
|
buffer[buf_at++] = '7';
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
buffer[buf_at++] = '1';
|
buffer[buf_at++] = '1';
|
||||||
@ -1452,12 +1444,9 @@ void unmangle_ansi(char *body, int len, char **body_out, int *body_len) {
|
|||||||
case 0x0F:
|
case 0x0F:
|
||||||
buffer[buf_at++] = '7';
|
buffer[buf_at++] = '7';
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bg = fake_screen[i][j]->bg;
|
bg = fake_screen[i][j]->bg;
|
||||||
buffer[buf_at++] = ';';
|
buffer[buf_at++] = ';';
|
||||||
buffer[buf_at++] = '4';
|
buffer[buf_at++] = '4';
|
||||||
@ -1486,15 +1475,12 @@ void unmangle_ansi(char *body, int len, char **body_out, int *body_len) {
|
|||||||
case 0x07:
|
case 0x07:
|
||||||
buffer[buf_at++] = '7';
|
buffer[buf_at++] = '7';
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
buffer[buf_at++] = 'm';
|
buffer[buf_at++] = 'm';
|
||||||
}
|
}
|
||||||
buffer[buf_at++] = fake_screen[i][j]->c;
|
buffer[buf_at++] = fake_screen[i][j]->c;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
while (buf_at > 0 && buffer[buf_at - 1] == ' ') {
|
while (buf_at > 0 && buffer[buf_at - 1] == ' ') {
|
||||||
buf_at--;
|
buf_at--;
|
||||||
}
|
}
|
||||||
@ -1508,7 +1494,6 @@ void unmangle_ansi(char *body, int len, char **body_out, int *body_len) {
|
|||||||
|
|
||||||
memcpy(&out[out_len], buffer, buf_at);
|
memcpy(&out[out_len], buffer, buf_at);
|
||||||
out_len += buf_at;
|
out_len += buf_at;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i = 0; i < line_count; i++) {
|
for (i = 0; i < line_count; i++) {
|
||||||
@ -1523,14 +1508,10 @@ void unmangle_ansi(char *body, int len, char **body_out, int *body_len) {
|
|||||||
out_len--;
|
out_len--;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
*body_out = out;
|
*body_out = out;
|
||||||
*body_len = out_len;
|
*body_len = out_len;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
int read_message(struct user_record *user, struct msg_headers *msghs, int mailno, int newscan) {
|
int read_message(struct user_record *user, struct msg_headers *msghs, int mailno, int newscan) {
|
||||||
s_JamBase *jb;
|
s_JamBase *jb;
|
||||||
s_JamMsgHeader jmh;
|
s_JamMsgHeader jmh;
|
||||||
@ -1538,7 +1519,6 @@ int read_message(struct user_record *user, struct msg_headers *msghs, int mailno
|
|||||||
s_JamSubfield jsf;
|
s_JamSubfield jsf;
|
||||||
s_JamLastRead jlr;
|
s_JamLastRead jlr;
|
||||||
|
|
||||||
|
|
||||||
char buffer[256];
|
char buffer[256];
|
||||||
int z, z2;
|
int z, z2;
|
||||||
struct tm msg_date;
|
struct tm msg_date;
|
||||||
@ -1726,7 +1706,6 @@ int read_message(struct user_record *user, struct msg_headers *msghs, int mailno
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (tolower(c) == 'r') {
|
if (tolower(c) == 'r') {
|
||||||
@ -1813,8 +1792,6 @@ int read_message(struct user_record *user, struct msg_headers *msghs, int mailno
|
|||||||
jsf.Buffer = (char *)subject;
|
jsf.Buffer = (char *)subject;
|
||||||
JAM_PutSubfield(jsp, &jsf);
|
JAM_PutSubfield(jsp, &jsf);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if (conf.mail_conferences[user->cur_mail_conf]->mail_areas[user->cur_mail_area]->type == TYPE_ECHOMAIL_AREA || conf.mail_conferences[user->cur_mail_conf]->mail_areas[user->cur_mail_area]->type == TYPE_NEWSGROUP_AREA) {
|
if (conf.mail_conferences[user->cur_mail_conf]->mail_areas[user->cur_mail_area]->type == TYPE_ECHOMAIL_AREA || conf.mail_conferences[user->cur_mail_conf]->mail_areas[user->cur_mail_area]->type == TYPE_NEWSGROUP_AREA) {
|
||||||
jmh.Attribute |= JAM_MSG_TYPEECHO;
|
jmh.Attribute |= JAM_MSG_TYPEECHO;
|
||||||
|
|
||||||
@ -1835,7 +1812,6 @@ int read_message(struct user_record *user, struct msg_headers *msghs, int mailno
|
|||||||
jsf.Buffer = (char *)buffer;
|
jsf.Buffer = (char *)buffer;
|
||||||
JAM_PutSubfield(jsp, &jsf);
|
JAM_PutSubfield(jsp, &jsf);
|
||||||
|
|
||||||
|
|
||||||
sprintf(buffer, "%d:%d/%d.%d %08lx", conf.mail_conferences[user->cur_mail_conf]->fidoaddr->zone,
|
sprintf(buffer, "%d:%d/%d.%d %08lx", conf.mail_conferences[user->cur_mail_conf]->fidoaddr->zone,
|
||||||
conf.mail_conferences[user->cur_mail_conf]->fidoaddr->net,
|
conf.mail_conferences[user->cur_mail_conf]->fidoaddr->net,
|
||||||
conf.mail_conferences[user->cur_mail_conf]->fidoaddr->node,
|
conf.mail_conferences[user->cur_mail_conf]->fidoaddr->node,
|
||||||
@ -1858,7 +1834,6 @@ int read_message(struct user_record *user, struct msg_headers *msghs, int mailno
|
|||||||
jmh.ReplyCRC = JAM_Crc32(buffer, strlen(buffer));
|
jmh.ReplyCRC = JAM_Crc32(buffer, strlen(buffer));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
} else if (conf.mail_conferences[user->cur_mail_conf]->nettype == NETWORK_MAGI) {
|
} else if (conf.mail_conferences[user->cur_mail_conf]->nettype == NETWORK_MAGI) {
|
||||||
sprintf(buffer, "%d", conf.mail_conferences[user->cur_mail_conf]->maginode);
|
sprintf(buffer, "%d", conf.mail_conferences[user->cur_mail_conf]->maginode);
|
||||||
jsf.LoID = JAMSFLD_OADDRESS;
|
jsf.LoID = JAMSFLD_OADDRESS;
|
||||||
@ -1932,7 +1907,6 @@ int read_message(struct user_record *user, struct msg_headers *msghs, int mailno
|
|||||||
free(from_addr);
|
free(from_addr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
sprintf(buffer, "%d:%d/%d.%d %08lx", conf.mail_conferences[user->cur_mail_conf]->fidoaddr->zone,
|
sprintf(buffer, "%d:%d/%d.%d %08lx", conf.mail_conferences[user->cur_mail_conf]->fidoaddr->zone,
|
||||||
conf.mail_conferences[user->cur_mail_conf]->fidoaddr->net,
|
conf.mail_conferences[user->cur_mail_conf]->fidoaddr->net,
|
||||||
conf.mail_conferences[user->cur_mail_conf]->fidoaddr->node,
|
conf.mail_conferences[user->cur_mail_conf]->fidoaddr->node,
|
||||||
@ -2334,7 +2308,6 @@ void post_message(struct user_record *user) {
|
|||||||
jsf.Buffer = (char *)buffer;
|
jsf.Buffer = (char *)buffer;
|
||||||
JAM_PutSubfield(jsp, &jsf);
|
JAM_PutSubfield(jsp, &jsf);
|
||||||
|
|
||||||
|
|
||||||
uuid_generate(magi_msgid);
|
uuid_generate(magi_msgid);
|
||||||
uuid_unparse_lower(magi_msgid, buffer);
|
uuid_unparse_lower(magi_msgid, buffer);
|
||||||
|
|
||||||
@ -2516,7 +2489,6 @@ void list_messages(struct user_record *user) {
|
|||||||
}
|
}
|
||||||
closed = 0;
|
closed = 0;
|
||||||
|
|
||||||
|
|
||||||
redraw = 1;
|
redraw = 1;
|
||||||
start = i - 1;
|
start = i - 1;
|
||||||
while (!closed) {
|
while (!closed) {
|
||||||
@ -2693,7 +2665,6 @@ void list_messages(struct user_record *user) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
s_printf("\e[%d;5H", i - start + 1);
|
s_printf("\e[%d;5H", i - start + 1);
|
||||||
|
|
||||||
}
|
}
|
||||||
} else if (c == 75) {
|
} else if (c == 75) {
|
||||||
// END KEY
|
// END KEY
|
||||||
@ -2929,7 +2900,6 @@ void choose_area() {
|
|||||||
height = 13;
|
height = 13;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
for (i = 0; i < conf.mail_conferences[gUser->cur_mail_conf]->mail_area_count; i++) {
|
for (i = 0; i < conf.mail_conferences[gUser->cur_mail_conf]->mail_area_count; i++) {
|
||||||
if (conf.mail_conferences[gUser->cur_mail_conf]->mail_areas[i]->read_sec_level <= gUser->sec_level) {
|
if (conf.mail_conferences[gUser->cur_mail_conf]->mail_areas[i]->read_sec_level <= gUser->sec_level) {
|
||||||
if (list_tmp == 0) {
|
if (list_tmp == 0) {
|
||||||
@ -3084,7 +3054,6 @@ void choose_area() {
|
|||||||
free(area_tmp);
|
free(area_tmp);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void next_mail_conf(struct user_record *user) {
|
void next_mail_conf(struct user_record *user) {
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
@ -3140,8 +3109,6 @@ void prev_mail_area(struct user_record *user) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void do_mail_scan(struct user_record *user, int oldscan, int personal) {
|
void do_mail_scan(struct user_record *user, int oldscan, int personal) {
|
||||||
s_JamBase *jb;
|
s_JamBase *jb;
|
||||||
s_JamBaseHeader jbh;
|
s_JamBaseHeader jbh;
|
||||||
@ -3284,8 +3251,6 @@ void do_mail_scan(struct user_record *user, int oldscan, int personal) {
|
|||||||
} else {
|
} else {
|
||||||
if (jlr.HighReadMsg < jbh.ActiveMsgs) {
|
if (jlr.HighReadMsg < jbh.ActiveMsgs) {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if (conf.mail_conferences[i]->mail_areas[j]->type == TYPE_NETMAIL_AREA) {
|
if (conf.mail_conferences[i]->mail_areas[j]->type == TYPE_NETMAIL_AREA) {
|
||||||
msghs = read_message_headers(i, j, user, personal);
|
msghs = read_message_headers(i, j, user, personal);
|
||||||
if (msghs != NULL) {
|
if (msghs != NULL) {
|
||||||
@ -3413,7 +3378,6 @@ void mail_scan(struct user_record *user) {
|
|||||||
do_mail_scan(user, 1, 0);
|
do_mail_scan(user, 1, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void msg_conf_sub_bases() {
|
void msg_conf_sub_bases() {
|
||||||
int i;
|
int i;
|
||||||
int lines = 0;
|
int lines = 0;
|
||||||
|
47
src/main.c
47
src/main.c
@ -51,8 +51,7 @@ int bbs_stderr;
|
|||||||
struct MHD_Daemon *www_daemon;
|
struct MHD_Daemon *www_daemon;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
void sigterm_handler(int s)
|
void sigterm_handler(int s) {
|
||||||
{
|
|
||||||
if (ssh_pid != -1) {
|
if (ssh_pid != -1) {
|
||||||
kill(ssh_pid, SIGTERM);
|
kill(ssh_pid, SIGTERM);
|
||||||
}
|
}
|
||||||
@ -71,19 +70,18 @@ void sigterm_handler(int s)
|
|||||||
exit(0);
|
exit(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void sigchld_handler(int s)
|
void sigchld_handler(int s) {
|
||||||
{
|
|
||||||
// waitpid() might overwrite errno, so we save and restore it:
|
// waitpid() might overwrite errno, so we save and restore it:
|
||||||
int saved_errno = errno;
|
int saved_errno = errno;
|
||||||
|
|
||||||
while(waitpid(-1, NULL, WNOHANG) > 0);
|
while (waitpid(-1, NULL, WNOHANG) > 0)
|
||||||
|
;
|
||||||
|
|
||||||
errno = saved_errno;
|
errno = saved_errno;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int protocol_config_handler(void *user, const char *section, const char *name,
|
static int protocol_config_handler(void *user, const char *section, const char *name,
|
||||||
const char* value)
|
const char *value) {
|
||||||
{
|
|
||||||
struct bbs_config *conf = (struct bbs_config *)user;
|
struct bbs_config *conf = (struct bbs_config *)user;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
@ -159,8 +157,7 @@ static int protocol_config_handler(void* user, const char* section, const char*
|
|||||||
}
|
}
|
||||||
|
|
||||||
static int archiver_config_handler(void *user, const char *section, const char *name,
|
static int archiver_config_handler(void *user, const char *section, const char *name,
|
||||||
const char* value)
|
const char *value) {
|
||||||
{
|
|
||||||
struct bbs_config *conf = (struct bbs_config *)user;
|
struct bbs_config *conf = (struct bbs_config *)user;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
@ -201,8 +198,7 @@ static int archiver_config_handler(void* user, const char* section, const char*
|
|||||||
}
|
}
|
||||||
|
|
||||||
static int door_config_handler(void *user, const char *section, const char *name,
|
static int door_config_handler(void *user, const char *section, const char *name,
|
||||||
const char* value)
|
const char *value) {
|
||||||
{
|
|
||||||
struct bbs_config *conf = (struct bbs_config *)user;
|
struct bbs_config *conf = (struct bbs_config *)user;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
@ -252,8 +248,7 @@ static int door_config_handler(void* user, const char* section, const char* name
|
|||||||
}
|
}
|
||||||
|
|
||||||
static int file_sub_handler(void *user, const char *section, const char *name,
|
static int file_sub_handler(void *user, const char *section, const char *name,
|
||||||
const char* value)
|
const char *value) {
|
||||||
{
|
|
||||||
struct file_directory *fd = (struct file_directory *)user;
|
struct file_directory *fd = (struct file_directory *)user;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
@ -306,10 +301,8 @@ static int file_sub_handler(void* user, const char* section, const char* name,
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static int mail_area_handler(void *user, const char *section, const char *name,
|
static int mail_area_handler(void *user, const char *section, const char *name,
|
||||||
const char* value)
|
const char *value) {
|
||||||
{
|
|
||||||
struct mail_conference *mc = (struct mail_conference *)user;
|
struct mail_conference *mc = (struct mail_conference *)user;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
@ -417,8 +410,7 @@ static int mail_area_handler(void* user, const char* section, const char* name,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static int handler(void *user, const char *section, const char *name,
|
static int handler(void *user, const char *section, const char *name,
|
||||||
const char* value)
|
const char *value) {
|
||||||
{
|
|
||||||
struct bbs_config *conf = (struct bbs_config *)user;
|
struct bbs_config *conf = (struct bbs_config *)user;
|
||||||
struct passwd *pwd;
|
struct passwd *pwd;
|
||||||
|
|
||||||
@ -612,7 +604,6 @@ static int handler(void* user, const char* section, const char* name,
|
|||||||
conf->text_files[conf->text_file_count]->name = strdup(name);
|
conf->text_files[conf->text_file_count]->name = strdup(name);
|
||||||
conf->text_files[conf->text_file_count]->path = strdup(value);
|
conf->text_files[conf->text_file_count]->path = strdup(value);
|
||||||
conf->text_file_count++;
|
conf->text_file_count++;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
@ -732,8 +723,7 @@ struct ssh_channel_callbacks_struct ssh_cb = {
|
|||||||
.channel_data_function = ssh_copy_chan_to_fd,
|
.channel_data_function = ssh_copy_chan_to_fd,
|
||||||
.channel_eof_function = ssh_chan_close,
|
.channel_eof_function = ssh_chan_close,
|
||||||
.channel_close_function = ssh_chan_close,
|
.channel_close_function = ssh_chan_close,
|
||||||
.userdata = NULL
|
.userdata = NULL};
|
||||||
};
|
|
||||||
|
|
||||||
void serverssh(int port, int ipv6) {
|
void serverssh(int port, int ipv6) {
|
||||||
ssh_session p_ssh_session;
|
ssh_session p_ssh_session;
|
||||||
@ -789,7 +779,6 @@ void serverssh(int port, int ipv6) {
|
|||||||
exit(-1);
|
exit(-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (setsockopt(ssh_sock, SOL_SOCKET, SO_REUSEADDR, (char *)&on, sizeof(on)) < 0) {
|
if (setsockopt(ssh_sock, SOL_SOCKET, SO_REUSEADDR, (char *)&on, sizeof(on)) < 0) {
|
||||||
fprintf(stderr, "setsockopt(SO_REUSEADDR) failed");
|
fprintf(stderr, "setsockopt(SO_REUSEADDR) failed");
|
||||||
exit(-1);
|
exit(-1);
|
||||||
@ -879,7 +868,6 @@ void serverssh(int port, int ipv6) {
|
|||||||
free(ip);
|
free(ip);
|
||||||
ssh_disconnect(p_ssh_session);
|
ssh_disconnect(p_ssh_session);
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
ip_guard->connection_count = 0;
|
ip_guard->connection_count = 0;
|
||||||
@ -945,10 +933,6 @@ void serverssh(int port, int ipv6) {
|
|||||||
exit(-1);
|
exit(-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
bbs_pid = forkpty(&fd, NULL, NULL, NULL);
|
bbs_pid = forkpty(&fd, NULL, NULL, NULL);
|
||||||
if (bbs_pid == 0) {
|
if (bbs_pid == 0) {
|
||||||
tcgetattr(STDIN_FILENO, &tios);
|
tcgetattr(STDIN_FILENO, &tios);
|
||||||
@ -998,7 +982,6 @@ void serverssh(int port, int ipv6) {
|
|||||||
close(csock);
|
close(csock);
|
||||||
free(ip);
|
free(ip);
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1134,7 +1117,6 @@ void server(int port, int ipv6) {
|
|||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (setsockopt(server_socket, SOL_SOCKET, SO_REUSEADDR, (char *)&on, sizeof(on)) < 0) {
|
if (setsockopt(server_socket, SOL_SOCKET, SO_REUSEADDR, (char *)&on, sizeof(on)) < 0) {
|
||||||
remove(conf.pid_file);
|
remove(conf.pid_file);
|
||||||
fprintf(stderr, "setsockopt(SO_REUSEADDR) failed");
|
fprintf(stderr, "setsockopt(SO_REUSEADDR) failed");
|
||||||
@ -1145,7 +1127,6 @@ void server(int port, int ipv6) {
|
|||||||
printf(" - Telnet Starting on Port %d (IPv%d)\n", port, (ipv6 ? 6 : 4));
|
printf(" - Telnet Starting on Port %d (IPv%d)\n", port, (ipv6 ? 6 : 4));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (ipv6) {
|
if (ipv6) {
|
||||||
if (setsockopt(server_socket, IPPROTO_IPV6, IPV6_V6ONLY, (void *)&on, sizeof(on)) < 0) {
|
if (setsockopt(server_socket, IPPROTO_IPV6, IPV6_V6ONLY, (void *)&on, sizeof(on)) < 0) {
|
||||||
fprintf(stderr, "setsockopt(IPV6_V6ONLY) failed");
|
fprintf(stderr, "setsockopt(IPV6_V6ONLY) failed");
|
||||||
@ -1205,7 +1186,6 @@ void server(int port, int ipv6) {
|
|||||||
|
|
||||||
listen(server_socket, 3);
|
listen(server_socket, 3);
|
||||||
|
|
||||||
|
|
||||||
while ((client_sock = accept(server_socket, (struct sockaddr *)client_p, (socklen_t *)&c))) {
|
while ((client_sock = accept(server_socket, (struct sockaddr *)client_p, (socklen_t *)&c))) {
|
||||||
if (ipv6) {
|
if (ipv6) {
|
||||||
ip = strdup(inet_ntop(AF_INET6, &((struct sockaddr_in6 *)client_p)->sin6_addr, str, sizeof(str)));
|
ip = strdup(inet_ntop(AF_INET6, &((struct sockaddr_in6 *)client_p)->sin6_addr, str, sizeof(str)));
|
||||||
@ -1249,7 +1229,6 @@ void server(int port, int ipv6) {
|
|||||||
free(ip);
|
free(ip);
|
||||||
close(client_sock);
|
close(client_sock);
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
ip_guard->connection_count = 0;
|
ip_guard->connection_count = 0;
|
||||||
@ -1375,7 +1354,6 @@ int main(int argc, char **argv) {
|
|||||||
exit(-1);
|
exit(-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
load_strings();
|
load_strings();
|
||||||
|
|
||||||
if (conf.fork) {
|
if (conf.fork) {
|
||||||
@ -1389,8 +1367,7 @@ int main(int argc, char **argv) {
|
|||||||
if (main_pid < 0) {
|
if (main_pid < 0) {
|
||||||
fprintf(stderr, "Error forking.\n");
|
fprintf(stderr, "Error forking.\n");
|
||||||
exit(-1);
|
exit(-1);
|
||||||
} else
|
} else if (main_pid > 0) {
|
||||||
if (main_pid > 0) {
|
|
||||||
if (conf.uid != getuid()) {
|
if (conf.uid != getuid()) {
|
||||||
if (setgid(conf.gid) != 0 || setuid(conf.uid) != 0) {
|
if (setgid(conf.gid) != 0 || setuid(conf.uid) != 0) {
|
||||||
perror("Setuid Error: ");
|
perror("Setuid Error: ");
|
||||||
|
10
src/menus.c
10
src/menus.c
@ -97,7 +97,6 @@ int menu_system(char *menufile) {
|
|||||||
dolog("%s is loading menu: %s", gUser->loginname, menufile);
|
dolog("%s is loading menu: %s", gUser->loginname, menufile);
|
||||||
broadcast("USER: %s; NODE:%d; STATUS: Browsing menu %s.", gUser->loginname, mynode, menufile);
|
broadcast("USER: %s; NODE:%d; STATUS: Browsing menu %s.", gUser->loginname, mynode, menufile);
|
||||||
|
|
||||||
|
|
||||||
if (menufile[0] == '/') {
|
if (menufile[0] == '/') {
|
||||||
snprintf(buffer, PATH_MAX, "%s.mnu", menufile);
|
snprintf(buffer, PATH_MAX, "%s.mnu", menufile);
|
||||||
} else {
|
} else {
|
||||||
@ -113,11 +112,9 @@ int menu_system(char *menufile) {
|
|||||||
lua_script = NULL;
|
lua_script = NULL;
|
||||||
ansi_file = NULL;
|
ansi_file = NULL;
|
||||||
|
|
||||||
|
|
||||||
fgets(buffer, 256, fptr);
|
fgets(buffer, 256, fptr);
|
||||||
while (!feof(fptr)) {
|
while (!feof(fptr)) {
|
||||||
|
|
||||||
|
|
||||||
chomp(buffer);
|
chomp(buffer);
|
||||||
|
|
||||||
if (strncasecmp(buffer, "HOTKEY", 6) == 0) {
|
if (strncasecmp(buffer, "HOTKEY", 6) == 0) {
|
||||||
@ -301,7 +298,6 @@ int menu_system(char *menufile) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
while (!doquit) {
|
while (!doquit) {
|
||||||
if (gUser->nodemsgs) {
|
if (gUser->nodemsgs) {
|
||||||
snprintf(buffer, PATH_MAX, "%s/node%d/nodemsg.txt", conf.bbs_path, mynode);
|
snprintf(buffer, PATH_MAX, "%s/node%d/nodemsg.txt", conf.bbs_path, mynode);
|
||||||
@ -456,8 +452,7 @@ int menu_system(char *menufile) {
|
|||||||
case MENU_SETTINGS:
|
case MENU_SETTINGS:
|
||||||
settings_menu(gUser);
|
settings_menu(gUser);
|
||||||
break;
|
break;
|
||||||
case MENU_DOOR:
|
case MENU_DOOR: {
|
||||||
{
|
|
||||||
for (m = 0; m < conf.door_count; m++) {
|
for (m = 0; m < conf.door_count; m++) {
|
||||||
if (strcasecmp(menu[i]->data[j], conf.doors[m]->name) == 0) {
|
if (strcasecmp(menu[i]->data[j], conf.doors[m]->name) == 0) {
|
||||||
dolog("%s launched door %s, on node %d", gUser->loginname, conf.doors[m]->name, mynode);
|
dolog("%s launched door %s, on node %d", gUser->loginname, conf.doors[m]->name, mynode);
|
||||||
@ -467,8 +462,7 @@ int menu_system(char *menufile) {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
} break;
|
||||||
break;
|
|
||||||
case MENU_MAILSCAN:
|
case MENU_MAILSCAN:
|
||||||
broadcast("USER: %s; NODE:%d; STATUS: Performing Mail Scan.", gUser->loginname, mynode);
|
broadcast("USER: %s; NODE:%d; STATUS: Performing Mail Scan.", gUser->loginname, mynode);
|
||||||
mail_scan(gUser);
|
mail_scan(gUser);
|
||||||
|
@ -34,7 +34,6 @@ int openpty(int *amaster, int *aslave, char *name, void *termp, void *winp) {
|
|||||||
ioctl(pts, TIOCSWINSZ, winp);
|
ioctl(pts, TIOCSWINSZ, winp);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
*amaster = ptm;
|
*amaster = ptm;
|
||||||
*aslave = pts;
|
*aslave = pts;
|
||||||
|
|
||||||
@ -85,7 +84,6 @@ int forkpty(int *amaster, char *name, void *termp, void *winp) {
|
|||||||
return pid;
|
return pid;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static long difftm(struct tm *a, struct tm *b) {
|
static long difftm(struct tm *a, struct tm *b) {
|
||||||
int ay = a->tm_year + (TM_YEAR_ORIGIN - 1);
|
int ay = a->tm_year + (TM_YEAR_ORIGIN - 1);
|
||||||
int by = b->tm_year + (TM_YEAR_ORIGIN - 1);
|
int by = b->tm_year + (TM_YEAR_ORIGIN - 1);
|
||||||
|
@ -5,4 +5,3 @@ extern int openpty(int *amaster, int *aslave, char *name, void *termp, void *win
|
|||||||
extern int forkpty(int *amaster, char *name, void *termp, void *winp);
|
extern int forkpty(int *amaster, char *name, void *termp, void *winp);
|
||||||
extern long gmtoff(time_t value);
|
extern long gmtoff(time_t value);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -45,16 +45,13 @@ void settings_menu(struct user_record *user) {
|
|||||||
c = s_getc();
|
c = s_getc();
|
||||||
|
|
||||||
switch (tolower(c)) {
|
switch (tolower(c)) {
|
||||||
case 27:
|
case 27: {
|
||||||
{
|
|
||||||
c = s_getc();
|
c = s_getc();
|
||||||
if (c == 91) {
|
if (c == 91) {
|
||||||
c = s_getc();
|
c = s_getc();
|
||||||
}
|
}
|
||||||
}
|
} break;
|
||||||
break;
|
case 'p': {
|
||||||
case 'p':
|
|
||||||
{
|
|
||||||
s_printf(get_string(155));
|
s_printf(get_string(155));
|
||||||
s_readpass(buffer, 16);
|
s_readpass(buffer, 16);
|
||||||
hash = hash_sha256(buffer, user->salt);
|
hash = hash_sha256(buffer, user->salt);
|
||||||
@ -76,20 +73,16 @@ void settings_menu(struct user_record *user) {
|
|||||||
} else {
|
} else {
|
||||||
s_printf(get_string(159));
|
s_printf(get_string(159));
|
||||||
}
|
}
|
||||||
}
|
} break;
|
||||||
break;
|
case 'l': {
|
||||||
case 'l':
|
|
||||||
{
|
|
||||||
s_printf(get_string(160));
|
s_printf(get_string(160));
|
||||||
s_readstring(buffer, 32);
|
s_readstring(buffer, 32);
|
||||||
free(user->location);
|
free(user->location);
|
||||||
user->location = (char *)malloc(strlen(buffer) + 1);
|
user->location = (char *)malloc(strlen(buffer) + 1);
|
||||||
strcpy(user->location, buffer);
|
strcpy(user->location, buffer);
|
||||||
save_user(user);
|
save_user(user);
|
||||||
}
|
} break;
|
||||||
break;
|
case 'a': {
|
||||||
case 'a':
|
|
||||||
{
|
|
||||||
s_printf(get_string(206));
|
s_printf(get_string(206));
|
||||||
|
|
||||||
for (i = 0; i < conf.archiver_count; i++) {
|
for (i = 0; i < conf.archiver_count; i++) {
|
||||||
@ -106,11 +99,9 @@ void settings_menu(struct user_record *user) {
|
|||||||
user->defarchiver = new_arc;
|
user->defarchiver = new_arc;
|
||||||
save_user(user);
|
save_user(user);
|
||||||
}
|
}
|
||||||
}
|
} break;
|
||||||
break;
|
|
||||||
|
|
||||||
case 'o':
|
case 'o': {
|
||||||
{
|
|
||||||
s_printf(get_string(212));
|
s_printf(get_string(212));
|
||||||
|
|
||||||
for (i = 0; i < conf.protocol_count; i++) {
|
for (i = 0; i < conf.protocol_count; i++) {
|
||||||
@ -127,38 +118,28 @@ void settings_menu(struct user_record *user) {
|
|||||||
user->defprotocol = new_arc;
|
user->defprotocol = new_arc;
|
||||||
save_user(user);
|
save_user(user);
|
||||||
}
|
}
|
||||||
}
|
} break;
|
||||||
break;
|
case 'm': {
|
||||||
case 'm':
|
|
||||||
{
|
|
||||||
user->nodemsgs = !user->nodemsgs;
|
user->nodemsgs = !user->nodemsgs;
|
||||||
save_user(user);
|
save_user(user);
|
||||||
}
|
} break;
|
||||||
break;
|
case 'c': {
|
||||||
case 'c':
|
|
||||||
{
|
|
||||||
user->codepage = !user->codepage;
|
user->codepage = !user->codepage;
|
||||||
save_user(user);
|
save_user(user);
|
||||||
}
|
} break;
|
||||||
break;
|
case 'e': {
|
||||||
case 'e':
|
|
||||||
{
|
|
||||||
user->exteditor++;
|
user->exteditor++;
|
||||||
if (user->exteditor == 3) {
|
if (user->exteditor == 3) {
|
||||||
user->exteditor = 0;
|
user->exteditor = 0;
|
||||||
}
|
}
|
||||||
save_user(user);
|
save_user(user);
|
||||||
}
|
} break;
|
||||||
break;
|
case 'b': {
|
||||||
case 'b':
|
|
||||||
{
|
|
||||||
user->bwavepktno = 0;
|
user->bwavepktno = 0;
|
||||||
user->bwavestyle = !user->bwavestyle;
|
user->bwavestyle = !user->bwavestyle;
|
||||||
save_user(user);
|
save_user(user);
|
||||||
}
|
} break;
|
||||||
break;
|
case 's': {
|
||||||
case 's':
|
|
||||||
{
|
|
||||||
// set signature
|
// set signature
|
||||||
if (user->signature != NULL) {
|
if (user->signature != NULL) {
|
||||||
free(user->signature);
|
free(user->signature);
|
||||||
@ -168,14 +149,11 @@ void settings_menu(struct user_record *user) {
|
|||||||
user->signature = sig;
|
user->signature = sig;
|
||||||
save_user(user);
|
save_user(user);
|
||||||
}
|
}
|
||||||
}
|
} break;
|
||||||
break;
|
case 't': {
|
||||||
case 't':
|
|
||||||
{
|
|
||||||
user->autosig = !user->autosig;
|
user->autosig = !user->autosig;
|
||||||
save_user(user);
|
save_user(user);
|
||||||
}
|
} break;
|
||||||
break;
|
|
||||||
case 'q':
|
case 'q':
|
||||||
dosettings = 1;
|
dosettings = 1;
|
||||||
break;
|
break;
|
||||||
|
13
src/users.c
13
src/users.c
@ -29,7 +29,6 @@ char *hash_sha256(char *pass, char *salt) {
|
|||||||
|
|
||||||
sprintf(buffer, "%s%s", pass, salt);
|
sprintf(buffer, "%s%s", pass, salt);
|
||||||
|
|
||||||
|
|
||||||
EVP_MD_CTX *context = EVP_MD_CTX_new();
|
EVP_MD_CTX *context = EVP_MD_CTX_new();
|
||||||
|
|
||||||
if (context != NULL) {
|
if (context != NULL) {
|
||||||
@ -40,7 +39,6 @@ char *hash_sha256(char *pass, char *salt) {
|
|||||||
shash = (char *)malloc(length_of_hash * 2 + 1);
|
shash = (char *)malloc(length_of_hash * 2 + 1);
|
||||||
for (i = 0; i < length_of_hash; i++) {
|
for (i = 0; i < length_of_hash; i++) {
|
||||||
sprintf(shash + (i * 2), "%02x", (int)hash[i]);
|
sprintf(shash + (i * 2), "%02x", (int)hash[i]);
|
||||||
|
|
||||||
}
|
}
|
||||||
EVP_MD_CTX_free(context);
|
EVP_MD_CTX_free(context);
|
||||||
free(buffer);
|
free(buffer);
|
||||||
@ -82,8 +80,7 @@ void gen_salt(char **s) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static int secLevel(void *user, const char *section, const char *name,
|
static int secLevel(void *user, const char *section, const char *name,
|
||||||
const char* value)
|
const char *value) {
|
||||||
{
|
|
||||||
struct sec_level_t *conf = (struct sec_level_t *)user;
|
struct sec_level_t *conf = (struct sec_level_t *)user;
|
||||||
|
|
||||||
if (strcasecmp(section, "main") == 0) {
|
if (strcasecmp(section, "main") == 0) {
|
||||||
@ -145,7 +142,6 @@ int save_user(struct user_record *user) {
|
|||||||
dolog("Failed to execute statement: %s", sqlite3_errmsg(db));
|
dolog("Failed to execute statement: %s", sqlite3_errmsg(db));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
rc = sqlite3_step(res);
|
rc = sqlite3_step(res);
|
||||||
if (rc != SQLITE_DONE) {
|
if (rc != SQLITE_DONE) {
|
||||||
sqlite3_finalize(res);
|
sqlite3_finalize(res);
|
||||||
@ -156,7 +152,6 @@ int save_user(struct user_record *user) {
|
|||||||
sqlite3_finalize(res);
|
sqlite3_finalize(res);
|
||||||
sqlite3_close(db);
|
sqlite3_close(db);
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int msgbase_flag_unflag(struct user_record *user, int conference, int msgbase, int msgid) {
|
int msgbase_flag_unflag(struct user_record *user, int conference, int msgbase, int msgid) {
|
||||||
@ -170,7 +165,6 @@ int msgbase_flag_unflag(struct user_record *user, int conference, int msgbase, i
|
|||||||
char *err_msg = 0;
|
char *err_msg = 0;
|
||||||
int flagunflag = 0;
|
int flagunflag = 0;
|
||||||
|
|
||||||
|
|
||||||
flagunflag = msgbase_is_flagged(user, conference, msgbase, msgid);
|
flagunflag = msgbase_is_flagged(user, conference, msgbase, msgid);
|
||||||
|
|
||||||
snprintf(buffer, PATH_MAX, "%s/users.sq3", conf.bbs_path);
|
snprintf(buffer, PATH_MAX, "%s/users.sq3", conf.bbs_path);
|
||||||
@ -266,7 +260,6 @@ int msgbase_sub_unsub(int conference, int msgbase) {
|
|||||||
char *err_msg = 0;
|
char *err_msg = 0;
|
||||||
int subunsub = 0;
|
int subunsub = 0;
|
||||||
|
|
||||||
|
|
||||||
subunsub = msgbase_is_subscribed(conference, msgbase);
|
subunsub = msgbase_is_subscribed(conference, msgbase);
|
||||||
|
|
||||||
snprintf(buffer, PATH_MAX, "%s/users.sq3", conf.bbs_path);
|
snprintf(buffer, PATH_MAX, "%s/users.sq3", conf.bbs_path);
|
||||||
@ -316,8 +309,6 @@ int msgbase_is_subscribed(int conference, int msgbase) {
|
|||||||
|
|
||||||
char *sql_buf = "SELECT * FROM msg_subs WHERE conference=? AND msgbase=? AND uid=?";
|
char *sql_buf = "SELECT * FROM msg_subs WHERE conference=? AND msgbase=? AND uid=?";
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
snprintf(buffer, PATH_MAX, "%s/users.sq3", conf.bbs_path);
|
snprintf(buffer, PATH_MAX, "%s/users.sq3", conf.bbs_path);
|
||||||
|
|
||||||
rc = sqlite3_open(buffer, &db);
|
rc = sqlite3_open(buffer, &db);
|
||||||
@ -442,7 +433,6 @@ int inst_user(struct user_record *user) {
|
|||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
rc = sqlite3_step(res);
|
rc = sqlite3_step(res);
|
||||||
|
|
||||||
if (rc != SQLITE_DONE) {
|
if (rc != SQLITE_DONE) {
|
||||||
@ -567,7 +557,6 @@ struct user_record *check_user_pass(char *loginname, char *password) {
|
|||||||
user->cur_file_sub = 0;
|
user->cur_file_sub = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
return user;
|
return user;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -103,7 +103,6 @@ static int iterate_post (void *coninfo_cls, enum MHD_ValueKind kind, const char
|
|||||||
return MHD_NO;
|
return MHD_NO;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (con_info != NULL) {
|
if (con_info != NULL) {
|
||||||
if (con_info->connection_type == POST) {
|
if (con_info->connection_type == POST) {
|
||||||
for (i = 0; i < con_info->count; i++) {
|
for (i = 0; i < con_info->count; i++) {
|
||||||
@ -842,7 +841,6 @@ int www_handler(void * cls, struct MHD_Connection * connection, const char * url
|
|||||||
page = www_msgs_messageview(con_inf->user, conference, area, msg);
|
page = www_msgs_messageview(con_inf->user, conference, area, msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (page == NULL) {
|
if (page == NULL) {
|
||||||
if (www_403(header, footer, connection) != 0) {
|
if (www_403(header, footer, connection) != 0) {
|
||||||
free(header);
|
free(header);
|
||||||
@ -881,7 +879,6 @@ int www_handler(void * cls, struct MHD_Connection * connection, const char * url
|
|||||||
mime = www_get_mime_type(NULL);
|
mime = www_get_mime_type(NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// load file
|
// load file
|
||||||
|
|
||||||
sprintf(buffer, "%s%s", conf.www_path, url);
|
sprintf(buffer, "%s%s", conf.www_path, url);
|
||||||
@ -982,7 +979,6 @@ int www_handler(void * cls, struct MHD_Connection * connection, const char * url
|
|||||||
fno = open(filename, O_RDONLY);
|
fno = open(filename, O_RDONLY);
|
||||||
if (fno != -1) {
|
if (fno != -1) {
|
||||||
|
|
||||||
|
|
||||||
response = MHD_create_response_from_fd(s.st_size, fno);
|
response = MHD_create_response_from_fd(s.st_size, fno);
|
||||||
MHD_add_response_header(response, MHD_HTTP_HEADER_CONTENT_TYPE, mime);
|
MHD_add_response_header(response, MHD_HTTP_HEADER_CONTENT_TYPE, mime);
|
||||||
sprintf(buffer, "%ld", s.st_size);
|
sprintf(buffer, "%ld", s.st_size);
|
||||||
@ -1209,7 +1205,6 @@ int www_handler(void * cls, struct MHD_Connection * connection, const char * url
|
|||||||
|
|
||||||
sprintf(whole_page, "%s%s%s", header, page, footer);
|
sprintf(whole_page, "%s%s%s", header, page, footer);
|
||||||
|
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
free(header);
|
free(header);
|
||||||
free(footer);
|
free(footer);
|
||||||
|
@ -5,7 +5,6 @@
|
|||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include "bbs.h"
|
#include "bbs.h"
|
||||||
|
|
||||||
|
|
||||||
extern struct bbs_config conf;
|
extern struct bbs_config conf;
|
||||||
|
|
||||||
char *www_blog() {
|
char *www_blog() {
|
||||||
|
@ -7,7 +7,6 @@
|
|||||||
#include <sys/utsname.h>
|
#include <sys/utsname.h>
|
||||||
#include "bbs.h"
|
#include "bbs.h"
|
||||||
|
|
||||||
|
|
||||||
extern struct bbs_config conf;
|
extern struct bbs_config conf;
|
||||||
|
|
||||||
int www_email_delete(struct user_record *user, int id) {
|
int www_email_delete(struct user_record *user, int id) {
|
||||||
@ -88,8 +87,6 @@ int www_send_email(struct user_record *user, char *recipient, char *subject, cha
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
uname(&name);
|
uname(&name);
|
||||||
|
|
||||||
snprintf(buffer, 256, "\r--- MagickaBBS v%d.%d%s (%s/%s)\r * Origin: %s \r", VERSION_MAJOR, VERSION_MINOR, VERSION_STR, name.sysname, name.machine, conf.default_tagline);
|
snprintf(buffer, 256, "\r--- MagickaBBS v%d.%d%s (%s/%s)\r * Origin: %s \r", VERSION_MAJOR, VERSION_MINOR, VERSION_STR, name.sysname, name.machine, conf.default_tagline);
|
||||||
@ -139,8 +136,6 @@ int www_send_email(struct user_record *user, char *recipient, char *subject, cha
|
|||||||
}
|
}
|
||||||
sqlite3_step(res);
|
sqlite3_step(res);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
sqlite3_finalize(res);
|
sqlite3_finalize(res);
|
||||||
sqlite3_close(db);
|
sqlite3_close(db);
|
||||||
return 1;
|
return 1;
|
||||||
@ -205,7 +200,6 @@ char *www_new_email() {
|
|||||||
strcat(page, buffer);
|
strcat(page, buffer);
|
||||||
len += strlen(buffer);
|
len += strlen(buffer);
|
||||||
|
|
||||||
|
|
||||||
sprintf(buffer, "</form>\n");
|
sprintf(buffer, "</form>\n");
|
||||||
if (len + strlen(buffer) > max_len - 1) {
|
if (len + strlen(buffer) > max_len - 1) {
|
||||||
max_len += 4096;
|
max_len += 4096;
|
||||||
@ -475,7 +469,6 @@ char *www_email_display(struct user_record *user, int email) {
|
|||||||
strcat(page, buffer);
|
strcat(page, buffer);
|
||||||
len += strlen(buffer);
|
len += strlen(buffer);
|
||||||
|
|
||||||
|
|
||||||
sprintf(buffer, "</form>\n");
|
sprintf(buffer, "</form>\n");
|
||||||
if (len + strlen(buffer) > max_len - 1) {
|
if (len + strlen(buffer) > max_len - 1) {
|
||||||
max_len += 4096;
|
max_len += 4096;
|
||||||
@ -552,7 +545,6 @@ char *www_email_summary(struct user_record *user) {
|
|||||||
"date INTEGER,"
|
"date INTEGER,"
|
||||||
"seen INTEGER);";
|
"seen INTEGER);";
|
||||||
|
|
||||||
|
|
||||||
page = (char *)malloc(4096);
|
page = (char *)malloc(4096);
|
||||||
max_len = 4096;
|
max_len = 4096;
|
||||||
len = 0;
|
len = 0;
|
||||||
@ -642,7 +634,6 @@ sqlite3_busy_timeout(db, 5000);
|
|||||||
if (len + strlen(buffer) > max_len - 1) {
|
if (len + strlen(buffer) > max_len - 1) {
|
||||||
max_len += 4096;
|
max_len += 4096;
|
||||||
page = (char *)realloc(page, max_len);
|
page = (char *)realloc(page, max_len);
|
||||||
|
|
||||||
}
|
}
|
||||||
strcat(page, buffer);
|
strcat(page, buffer);
|
||||||
len += strlen(buffer);
|
len += strlen(buffer);
|
||||||
|
@ -7,7 +7,6 @@
|
|||||||
#include "bbs.h"
|
#include "bbs.h"
|
||||||
#include "../deps/hashids/hashids.h"
|
#include "../deps/hashids/hashids.h"
|
||||||
|
|
||||||
|
|
||||||
extern struct bbs_config conf;
|
extern struct bbs_config conf;
|
||||||
extern struct user_record *gUser;
|
extern struct user_record *gUser;
|
||||||
extern char *aha(char *input);
|
extern char *aha(char *input);
|
||||||
@ -405,7 +404,6 @@ char *www_files_display_listing(int dir, int sub) {
|
|||||||
}
|
}
|
||||||
strcat(page, buffer);
|
strcat(page, buffer);
|
||||||
len += strlen(buffer);
|
len += strlen(buffer);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
snprintf(buffer, 4096, "</tbody></table>\n");
|
snprintf(buffer, 4096, "</tbody></table>\n");
|
||||||
@ -539,7 +537,6 @@ char *www_files_get_from_area(int dir, int sub, char *clean_file) {
|
|||||||
rc = sqlite3_step(res);
|
rc = sqlite3_step(res);
|
||||||
if (rc == SQLITE_ROW) {
|
if (rc == SQLITE_ROW) {
|
||||||
ret = strdup(sqlite3_column_text(res, 0));
|
ret = strdup(sqlite3_column_text(res, 0));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
free(filenamelike);
|
free(filenamelike);
|
||||||
|
@ -5,7 +5,6 @@
|
|||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include "bbs.h"
|
#include "bbs.h"
|
||||||
|
|
||||||
|
|
||||||
extern struct bbs_config conf;
|
extern struct bbs_config conf;
|
||||||
|
|
||||||
char *www_last10() {
|
char *www_last10() {
|
||||||
|
@ -15,7 +15,6 @@
|
|||||||
extern char *aha(char *input);
|
extern char *aha(char *input);
|
||||||
extern struct bbs_config conf;
|
extern struct bbs_config conf;
|
||||||
|
|
||||||
|
|
||||||
static char *www_wordwrap(char *content, int cutoff);
|
static char *www_wordwrap(char *content, int cutoff);
|
||||||
char *www_sanitize(char *inp) {
|
char *www_sanitize(char *inp) {
|
||||||
int i;
|
int i;
|
||||||
@ -543,7 +542,6 @@ char *www_msgs_messageview(struct user_record *user, int conference, int area, i
|
|||||||
strcat(page, buffer);
|
strcat(page, buffer);
|
||||||
len += strlen(buffer);
|
len += strlen(buffer);
|
||||||
|
|
||||||
|
|
||||||
aha_text = (char *)malloc(jmh.TxtLen + 1);
|
aha_text = (char *)malloc(jmh.TxtLen + 1);
|
||||||
|
|
||||||
memcpy(aha_text, body, jmh.TxtLen);
|
memcpy(aha_text, body, jmh.TxtLen);
|
||||||
@ -567,8 +565,6 @@ char *www_msgs_messageview(struct user_record *user, int conference, int area, i
|
|||||||
strcat(page, buffer);
|
strcat(page, buffer);
|
||||||
len += strlen(buffer);
|
len += strlen(buffer);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
sprintf(buffer, "<div class=\"msg-reply-form\">\n");
|
sprintf(buffer, "<div class=\"msg-reply-form\">\n");
|
||||||
if (len + strlen(buffer) > max_len - 1) {
|
if (len + strlen(buffer) > max_len - 1) {
|
||||||
max_len += 4096;
|
max_len += 4096;
|
||||||
@ -701,7 +697,6 @@ char *www_msgs_messageview(struct user_record *user, int conference, int area, i
|
|||||||
strcat(page, buffer);
|
strcat(page, buffer);
|
||||||
len += strlen(buffer);
|
len += strlen(buffer);
|
||||||
|
|
||||||
|
|
||||||
sprintf(buffer, "<input type=\"submit\" name=\"submit\" value=\"Reply\" />\n<br />");
|
sprintf(buffer, "<input type=\"submit\" name=\"submit\" value=\"Reply\" />\n<br />");
|
||||||
if (len + strlen(buffer) > max_len - 1) {
|
if (len + strlen(buffer) > max_len - 1) {
|
||||||
max_len += 4096;
|
max_len += 4096;
|
||||||
@ -710,7 +705,6 @@ char *www_msgs_messageview(struct user_record *user, int conference, int area, i
|
|||||||
strcat(page, buffer);
|
strcat(page, buffer);
|
||||||
len += strlen(buffer);
|
len += strlen(buffer);
|
||||||
|
|
||||||
|
|
||||||
sprintf(buffer, "</form>\n");
|
sprintf(buffer, "</form>\n");
|
||||||
if (len + strlen(buffer) > max_len - 1) {
|
if (len + strlen(buffer) > max_len - 1) {
|
||||||
max_len += 4096;
|
max_len += 4096;
|
||||||
@ -787,7 +781,8 @@ static char *www_wordwrap(char *content, int cutoff) {
|
|||||||
line_count = 0;
|
line_count = 0;
|
||||||
quote_line = 0;
|
quote_line = 0;
|
||||||
} else if (quote_line != 1) {
|
} else if (quote_line != 1) {
|
||||||
for (z = i+1;content[z] != ' ' && z < len;z++);
|
for (z = i + 1; content[z] != ' ' && z < len; z++)
|
||||||
|
;
|
||||||
if (at > 0 && content[at - 1] != '\r' && content[at - 1] != ' ' && cutoff - line_count < z - i) {
|
if (at > 0 && content[at - 1] != '\r' && content[at - 1] != ' ' && cutoff - line_count < z - i) {
|
||||||
content[at++] = ' ';
|
content[at++] = ' ';
|
||||||
line_count++;
|
line_count++;
|
||||||
@ -815,7 +810,6 @@ static char *www_wordwrap(char *content, int cutoff) {
|
|||||||
content[at++] = content[i];
|
content[at++] = content[i];
|
||||||
content[at] = '\0';
|
content[at] = '\0';
|
||||||
|
|
||||||
|
|
||||||
at = 0;
|
at = 0;
|
||||||
|
|
||||||
len = strlen(content);
|
len = strlen(content);
|
||||||
@ -1034,8 +1028,6 @@ int www_send_msg(struct user_record *user, char *to, char *subj, int conference,
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if (conf.mail_conferences[conference]->tagline != NULL) {
|
if (conf.mail_conferences[conference]->tagline != NULL) {
|
||||||
tagline = conf.mail_conferences[conference]->tagline;
|
tagline = conf.mail_conferences[conference]->tagline;
|
||||||
} else {
|
} else {
|
||||||
@ -1078,7 +1070,6 @@ int www_send_msg(struct user_record *user, char *to, char *subj, int conference,
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
memset(body3, 0, strlen(body2) + 2 + strlen(buffer));
|
memset(body3, 0, strlen(body2) + 2 + strlen(buffer));
|
||||||
pos = 0;
|
pos = 0;
|
||||||
sprintf(body3, "%s%s", body2, buffer);
|
sprintf(body3, "%s%s", body2, buffer);
|
||||||
@ -1113,7 +1104,6 @@ int www_send_msg(struct user_record *user, char *to, char *subj, int conference,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
free(body2);
|
free(body2);
|
||||||
|
|
||||||
JAM_UnlockMB(jb);
|
JAM_UnlockMB(jb);
|
||||||
@ -1209,7 +1199,6 @@ char *www_new_msg(struct user_record *user, int conference, int area) {
|
|||||||
strcat(page, buffer);
|
strcat(page, buffer);
|
||||||
len += strlen(buffer);
|
len += strlen(buffer);
|
||||||
|
|
||||||
|
|
||||||
sprintf(buffer, "</form>\n");
|
sprintf(buffer, "</form>\n");
|
||||||
if (len + strlen(buffer) > max_len - 1) {
|
if (len + strlen(buffer) > max_len - 1) {
|
||||||
max_len += 4096;
|
max_len += 4096;
|
||||||
|
Reference in New Issue
Block a user