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 exit_bbs() {
char buffer[1024];
snprintf(buffer, 1024, "%s/nodeinuse.%d", conf.bbs_path, mynode);
remove(buffer);
}
void disconnect(char *calledby) { void disconnect(char *calledby) {
char buffer[1024];
if (gUser != NULL) { if (gUser != NULL) {
save_user(gUser); save_user(gUser);
} }
dolog("Node %d disconnected (%s)", mynode, calledby); dolog("Node %d disconnected (%s)", mynode, calledby);
sprintf(buffer, "%s/nodeinuse.%d", conf.bbs_path, mynode);
remove(buffer);
if (!sshBBS) { if (!sshBBS) {
close(gSocket); close(gSocket);
} }
@ -651,6 +656,7 @@ void runbbs_real(int socket, char *ip, int ssh) {
int usernotfound; int usernotfound;
int tries; int tries;
atexit(exit_bbs);
ipaddress = ip; 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)session;
(void)channel; (void)channel;
kill(bbs_pid, SIGTERM); kill(bbs_pid, SIGTERM);
//waitpid(bbs_pid, &status, 0); waitpid(bbs_pid, &status, 0);
close(fd); close(fd);
} }