aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFranklin Wei <frankhwei536@gmail.com>2014-07-16 14:40:25 -0400
committerFranklin Wei <frankhwei536@gmail.com>2014-07-16 14:40:25 -0400
commitfcbc403d8c415d35b263583471ccdd1079dcbe63 (patch)
treead8dfe36b9d208c569dbf35e18d6fe72d4fa10a9
parente3e5b740adfa35202b5559e8867b8edb6e08ff1b (diff)
downloadwargames-server-fcbc403d8c415d35b263583471ccdd1079dcbe63.zip
wargames-server-fcbc403d8c415d35b263583471ccdd1079dcbe63.tar.gz
wargames-server-fcbc403d8c415d35b263583471ccdd1079dcbe63.tar.bz2
wargames-server-fcbc403d8c415d35b263583471ccdd1079dcbe63.tar.xz
Fixed some bugs
-rw-r--r--server.c16
-rw-r--r--telnet.h1
2 files changed, 11 insertions, 6 deletions
diff --git a/server.c b/server.c
index 736742e..2efa121 100644
--- a/server.c
+++ b/server.c
@@ -127,10 +127,10 @@ void handle_command(unsigned char* buf, int buflen, int connection)
}
}
/* unimplemented command, just deny it */
- unsigned char deny_cmd[3]={IAC, DONT, opt};
- if(opt==SGA)
+ unsigned char deny_cmd[3]={IAC, WONT, opt};
+ if(opt==LINEMODE)
{
- deny_cmd[1]=DO;
+ deny_cmd[1]=WILL;
}
write(connection, deny_cmd, sizeof(deny_cmd));
fsync(connection);
@@ -190,10 +190,14 @@ void serv_cleanup()
}
void setup_new_connection(int fd)
{
- unsigned char do_naws[]={IAC, DO, NAWS};
- write(fd, do_naws, sizeof(do_naws));
- unsigned char dont_echo[]={IAC, DONT, ECHO};
+ unsigned char will_naws[]={IAC, WILL, NAWS};
+ write(fd, will_naws, sizeof(will_naws));
+ unsigned char dont_echo[]={IAC, WONT, ECHO};
write(fd, dont_echo, sizeof(dont_echo));
+ unsigned char dont_sga[]={IAC, WONT, SGA};
+ write(fd, dont_sga, sizeof(dont_sga));
+ unsigned char will_linemode[]={IAC, WILL, LINEMODE};
+ write(fd, will_linemode, sizeof(will_linemode));
memset(&connection_data[fd], 0, sizeof(struct connection_data_t));
debugf("New connection set up.\n");
}
diff --git a/telnet.h b/telnet.h
index 49841f2..d343419 100644
--- a/telnet.h
+++ b/telnet.h
@@ -21,3 +21,4 @@
#define TERMTYPE 24
#define NAWS 31
#define SURPRESS_LOCAL_ECHO 0x2D
+#define LINEMODE 34