diff --git a/src/sbbs3/main.cpp b/src/sbbs3/main.cpp index 70707ecd367da416f4107efb7d50129ce1c2d33f..ff178c6bbe15c01c60823709fcac51346846f379 100644 --- a/src/sbbs3/main.cpp +++ b/src/sbbs3/main.cpp @@ -2187,8 +2187,13 @@ void output_thread(void* arg) sbbs->online=FALSE; i=buftop-bufbot; // Pretend we sent it all } - else - cryptFlushData(sbbs->ssh_session); + else { + if(!cryptStatusOK((err=cryptFlushData(sbbs->ssh_session)))) { + lprintf(LOG_WARNING,"%s !ERROR %d flushing Cryptlib session", node, err); + sbbs->online=FALSE; + i=buftop-bufbot; // Pretend we sent it all + } + } pthread_mutex_unlock(&sbbs->ssh_mutex); } else @@ -3461,7 +3466,7 @@ sbbs_t::~sbbs_t() /* Reset text.dat */ - for(i=0;i<TOTAL_TEXT && text!=NULL;i++) + for(i=0;i<TOTAL_TEXT;i++) if(text[i]!=text_sav[i]) { if(text[i]!=nulstr) free(text[i]); @@ -4492,7 +4497,7 @@ void DLLCALL bbs_thread(void* arg) struct main_sock_cb_data ssh_cb; struct main_sock_cb_data rlogin_cb; void *ts_cb; - struct in_addr iaddr; + int err; if(startup==NULL) { sbbs_beep(100,500); @@ -4712,8 +4717,6 @@ void DLLCALL bbs_thread(void* arg) #warning This version of Cryptlib is known to crash Synchronet. Upgrade to at least version 3.3 or do not build with Cryptlib support. #endif if(startup->options&BBS_OPT_ALLOW_SSH) { - bool loaded_key=false; - CRYPT_KEYSET ssh_keyset; if(!do_cryptInit()) @@ -4742,8 +4745,10 @@ void DLLCALL bbs_thread(void* arg) /* Ok, now try saving this one... use the syspass to enctrpy it. */ if(cryptStatusOK(cryptKeysetOpen(&ssh_keyset, CRYPT_UNUSED, CRYPT_KEYSET_FILE, str, CRYPT_KEYOPT_CREATE))) { - cryptAddPrivateKey(ssh_keyset, ssh_context, scfg.sys_pass); - cryptKeysetClose(ssh_keyset); + if(!cryptStatusOK(cryptAddPrivateKey(ssh_keyset, ssh_context, scfg.sys_pass))) + lprintf(LOG_ERR,"SSH Cryptlib error %d saving key",i); + if(!cryptStatusOK(cryptKeysetClose(ssh_keyset))) + lprintf(LOG_ERR,"SSH Cryptlib error %d closing keyset",i); } } @@ -5082,7 +5087,10 @@ NO_SSH: close_socket(client_socket); continue; } - cryptPopData(sbbs->ssh_session, str, sizeof(str), &i); + if(!cryptStatusOK(err=cryptPopData(sbbs->ssh_session, str, sizeof(str), &i))) { + lprintf(LOG_WARNING,"Node %d !ERROR %d receiving on Cryptlib session", sbbs->cfg.node_num, err); + i=0; + } } #endif sbbs->client_socket=client_socket; // required for output to the user @@ -5339,7 +5347,10 @@ NO_PASSTHRU: /* Wait for pending data to be sent then turn off ssh_mode for uber-output */ while(sbbs->output_thread_running && RingBufFull(&sbbs->outbuf)) SLEEP(1); - cryptPopData(sbbs->ssh_session, str, sizeof(str), &i); + if(!cryptStatusOK(err=cryptPopData(sbbs->ssh_session, str, sizeof(str), &i))) { + lprintf(LOG_WARNING,"Node %d !ERROR %d receiving on Cryptlib session", sbbs->cfg.node_num, err); + i=0; + } sbbs->ssh_mode=false; } #endif