More fiddling with ssh

This commit is contained in:
Andrew Pamment 2017-09-15 22:06:02 +10:00
parent 9d1821efa3
commit a86c633c2b
2 changed files with 10 additions and 4 deletions

12
bbs.c
View File

@ -461,14 +461,19 @@ void s_readpass(char *buffer, int max) {
}
}
void disconnect(char *calledby) {
void exit_bbs() {
char buffer[1024];
snprintf(buffer, 1024, "%s/nodeinuse.%d", conf.bbs_path, mynode);
remove(buffer);
}
void disconnect(char *calledby) {
if (gUser != NULL) {
save_user(gUser);
}
dolog("Node %d disconnected (%s)", mynode, calledby);
sprintf(buffer, "%s/nodeinuse.%d", conf.bbs_path, mynode);
remove(buffer);
if (!sshBBS) {
close(gSocket);
}
@ -651,6 +656,7 @@ void runbbs_real(int socket, char *ip, int ssh) {
int usernotfound;
int tries;
atexit(exit_bbs);
ipaddress = ip;

2
main.c
View File

@ -661,7 +661,7 @@ static void ssh_chan_close(ssh_session session, ssh_channel channel, void *userd
(void)session;
(void)channel;
kill(bbs_pid, SIGTERM);
//waitpid(bbs_pid, &status, 0);
waitpid(bbs_pid, &status, 0);
close(fd);
}