Fix race-condition causing SSH errors:
Terminal Server SSH ERROR 'Bad argument, parameter 1' (-1) ... from output_thread The bbs_thread() sets the global/server sbbs ssh_mode to false and ssh_session to 0 (the "parameter 1" value used in the cryptlib function calls in output_thread) but was doing this without owning the ssh_mutex, so the output_thread had a race condition where it would check ssh_mode=true and then use grab the ssh_mutex and use ssh_session in a few cryptlib function calls. The fix for the bbs_thread() to grab the ssh_mutex before setting ssh_mode to false and ssh_session to 0 and have the output_thread() re-check the ssh_mode after grabbing the ssh_mutex and not call any cryptlib functions if ssh_mode was set to false while waiting for the mutex. The cause would have been more obvious if the various cryptlib error/log messages contained the cryptlib session ID value (which was 0 in this case).
Loading
Please register or sign in to comment