Synchronet now requires the libarchive development package (e.g. libarchive-dev on Debian-based Linux distros, libarchive.org for more info) to build successfully.

Commit c355409f authored by rswindell's avatar rswindell

Reimplement smb_stack() as an sbbs_t member function using a member linked

list (smb_list) for thread-safe SMB stack storage.
parent 53d0ec5b
......@@ -3403,6 +3403,7 @@ sbbs_t::sbbs_t(ushort node_num, union xp_sockaddr *addr, size_t addr_len, const
telnet_ack_event=CreateEvent(NULL, /* Manual Reset: */FALSE,/* InitialState */FALSE,NULL);
listInit(&savedlines, /* flags: */0);
listInit(&smb_list, /* flags: */0);
sys_status=lncntr=tos=criterrs=0L;
column=0;
tabstop=8;
......@@ -3907,6 +3908,7 @@ sbbs_t::~sbbs_t()
FREE_AND_NULL(batdn_alt);
listFree(&savedlines);
listFree(&smb_list);
#ifdef USE_CRYPTLIB
while(ssh_mutex_created && pthread_mutex_destroy(&ssh_mutex)==EBUSY)
......@@ -3925,6 +3927,25 @@ sbbs_t::~sbbs_t()
#endif
}
int sbbs_t::smb_stack(smb_t* smb, bool push)
{
if(push) {
if(smb == NULL || !SMB_IS_OPEN(smb))
return SMB_SUCCESS; /* Msg base not open, do nothing */
if(listPushNodeData(&smb_list, smb, sizeof(*smb)) == NULL)
return SMB_FAILURE;
return SMB_SUCCESS;
}
/* pop */
smb_t* data = (smb_t*)listPopNode(&smb_list);
if(data == NULL) /* Nothing on the stack, so do nothing */
return SMB_SUCCESS;
*smb = *data;
free(data);
return SMB_SUCCESS;
}
/****************************************************************************/
/* Network open function. Opens all files DENYALL and retries LOOP_NOPEN */
/* number of times if the attempted file is already open or denying access */
......@@ -5642,8 +5663,8 @@ NO_SSH:
SOCKADDR_IN local_addr;
memset(&local_addr, 0, sizeof(local_addr));
socklen_t addr_len=sizeof(local_addr);
if(getsockname(client_socket, (struct sockaddr *)&local_addr, &addr_len) == 0
&& (ntohs(local_addr.sin_port) == startup->pet40_port
if(getsockname(client_socket, (struct sockaddr *)&local_addr, &addr_len) == 0
&& (ntohs(local_addr.sin_port) == startup->pet40_port
|| ntohs(local_addr.sin_port) == startup->pet80_port)) {
sbbs->autoterm = PETSCII;
sbbs->cols = ntohs(local_addr.sin_port) == startup->pet40_port ? 40 : 80;
......
......@@ -375,7 +375,7 @@ public:
uchar telnet_last_rxch;
char telnet_location[128];
char telnet_terminal[TELNET_TERM_MAXLEN+1];
long telnet_rows;
long telnet_rows;
long telnet_cols;
long telnet_speed;
......@@ -408,7 +408,12 @@ public:
user_t useron; /* User currently online */
node_t thisnode; /* Node information */
smb_t smb; /* Currently open message base */
smb_t smb; /* Currently active message base */
link_list_t smb_list;
#define SMB_STACK_PUSH true
#define SMB_STACK_POP false
int smb_stack(smb_t* smb, bool push);
char rlogin_name[LEN_ALIAS+1];
char rlogin_pass[LEN_PASS+1];
char rlogin_term[TELNET_TERM_MAXLEN+1]; /* RLogin passed terminal type/speed (e.g. "xterm/57600") */
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment