Improved IAC non-handling :)
This commit is contained in:
parent
eb3e68388f
commit
f031dc37be
28
bbs.c
28
bbs.c
@ -284,10 +284,20 @@ char s_getchar() {
|
||||
usertimeout = 10;
|
||||
return c;
|
||||
}
|
||||
len = read(gSocket, &c, 1);
|
||||
if (len == 0) {
|
||||
disconnect("Socket Closed");
|
||||
if (c == 254 || c == 253 || c == 252 || c == 251) {
|
||||
len = read(gSocket, &c, 1);
|
||||
if (len == 0) {
|
||||
disconnect("Socket Closed");
|
||||
}
|
||||
} else if (c == 250) {
|
||||
do {
|
||||
len = read(gSocket, &c, 1);
|
||||
if (len == 0) {
|
||||
disconnect("Socket Closed");
|
||||
}
|
||||
} while(c != 240);
|
||||
}
|
||||
|
||||
len = read(gSocket, &c, 1);
|
||||
if (len == 0) {
|
||||
disconnect("Socket Closed");
|
||||
@ -376,7 +386,7 @@ void s_readpass(char *buffer, int max) {
|
||||
}
|
||||
|
||||
void disconnect(char *calledby) {
|
||||
char buffer[256];
|
||||
char buffer[1024];
|
||||
if (gUser != NULL) {
|
||||
save_user(gUser);
|
||||
}
|
||||
@ -567,10 +577,16 @@ void runbbs_real(int socket, char *ip, int ssh) {
|
||||
ipaddress = ip;
|
||||
|
||||
if (!ssh) {
|
||||
write(socket, iac_echo, 3);
|
||||
write(socket, iac_sga, 3);
|
||||
gUser = NULL;
|
||||
sshBBS = 0;
|
||||
if (write(socket, iac_echo, 3) != 3) {
|
||||
dolog("Failed to send iac_echo");
|
||||
exit(0);
|
||||
}
|
||||
if (write(socket, iac_sga, 3) != 3) {
|
||||
dolog("Failed to send iac_sga");
|
||||
exit(0);
|
||||
}
|
||||
} else {
|
||||
sshBBS = 1;
|
||||
}
|
||||
|
17
doors.c
17
doors.c
@ -277,11 +277,22 @@ void runexternal(struct user_record *user, char *cmd, int stdio, char *argv[], c
|
||||
gotiac = 1;
|
||||
}
|
||||
} else {
|
||||
if (gotiac < 2 && gotiac != 0) {
|
||||
gotiac++;
|
||||
if (gotiac == 1) {
|
||||
if (c == 254 || c == 253 || c == 252 || c == 251) {
|
||||
gotiac = 2;
|
||||
} else if (c == 250) {
|
||||
gotiac = 3;
|
||||
} else {
|
||||
gotiac = 0;
|
||||
}
|
||||
} else if (gotiac == 2) {
|
||||
gotiac = 0;
|
||||
} else if (gotiac == 3) {
|
||||
if (c == 240) {
|
||||
gotiac = 0;
|
||||
}
|
||||
} else {
|
||||
write(master, &c, 1);
|
||||
gotiac = 0;
|
||||
}
|
||||
}
|
||||
} else if (FD_ISSET(master, &fdset)) {
|
||||
|
Reference in New Issue
Block a user