fixes for disconnecting ssh without logging out
This commit is contained in:
parent
005bb33767
commit
8e6667ed4f
4
bbs.c
4
bbs.c
@ -15,7 +15,7 @@
|
||||
#include "lua/lualib.h"
|
||||
#include "lua/lauxlib.h"
|
||||
|
||||
int mynode;
|
||||
int mynode = 0;
|
||||
struct bbs_config conf;
|
||||
|
||||
struct user_record *gUser;
|
||||
@ -508,7 +508,6 @@ void runbbs_real(int socket, char *ip, int ssh) {
|
||||
s_printf("Magicka BBS v%d.%d (%s), Loading...\r\n", VERSION_MAJOR, VERSION_MINOR, VERSION_STR);
|
||||
|
||||
// find out which node we are
|
||||
mynode = 0;
|
||||
for (i=1;i<=conf.nodes;i++) {
|
||||
sprintf(buffer, "%s/nodeinuse.%d", conf.bbs_path, i);
|
||||
if (stat(buffer, &s) != 0) {
|
||||
@ -710,6 +709,7 @@ void runbbs(int socket, char *ip) {
|
||||
}
|
||||
|
||||
void runbbs_ssh(char *ip) {
|
||||
setbuf(stdin, NULL);
|
||||
setbuf(stdout, NULL);
|
||||
runbbs_real(-1, ip, 1);
|
||||
}
|
||||
|
5
main.c
5
main.c
@ -28,6 +28,7 @@
|
||||
|
||||
extern struct bbs_config conf;
|
||||
extern struct user_record *gUser;
|
||||
extern int mynode;
|
||||
|
||||
int ssh_pid = -1;
|
||||
|
||||
@ -450,6 +451,10 @@ static void ssh_chan_close(ssh_session session, ssh_channel channel, void *userd
|
||||
(void)session;
|
||||
(void)channel;
|
||||
|
||||
if (mynode != 0) {
|
||||
disconnect("Channel Closed");
|
||||
}
|
||||
|
||||
close(fd);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user