From b4096259775ac622ffb8b3d8b700c625f9d1a750 Mon Sep 17 00:00:00 2001 From: kcwu <kcwu@63ad8ddf-47c3-0310-b6dd-a9e9d9715204> Date: Sat, 16 Oct 2004 07:39:43 +0000 Subject: strip IAC char in user's nick git-svn-id: http://opensvn.csie.org/pttbbs/trunk/pttbbs@2254 63ad8ddf-47c3-0310-b6dd-a9e9d9715204 --- mbbsd/io.c | 13 +++++++++++++ mbbsd/mbbsd.c | 1 + 2 files changed, 14 insertions(+) (limited to 'mbbsd') diff --git a/mbbsd/io.c b/mbbsd/io.c index 4b324b8c..57d639c2 100644 --- a/mbbsd/io.c +++ b/mbbsd/io.c @@ -484,6 +484,19 @@ strip_ansi(char *buf, char *str, int mode) * (buf) *buf = '\0'; return count; */ } +void +strip_iac(unsigned char *str, int maxlen) +{ + int i,len=0; + + for(i=0;i<maxlen && str[i]; i++) + if(str[i]!=255) { + str[len++]=str[i]; + } + if(len<maxlen) + str[len]='\0'; +} + int oldgetdata(int line, int col, char *prompt, char *buf, int len, int echo) { diff --git a/mbbsd/mbbsd.c b/mbbsd/mbbsd.c index 611d603b..101299c9 100644 --- a/mbbsd/mbbsd.c +++ b/mbbsd/mbbsd.c @@ -734,6 +734,7 @@ setup_utmp(int mode) strlcpy(uinfo.userid, cuser.userid, sizeof(uinfo.userid)); //strlcpy(uinfo.realname, cuser.realname, sizeof(uinfo.realname)); strlcpy(uinfo.username, cuser.username, sizeof(uinfo.username)); + strip_iac(uinfo.username, sizeof(uinfo.username)); strlcpy(uinfo.from, fromhost, sizeof(uinfo.from)); uinfo.five_win = cuser.five_win; uinfo.five_lose = cuser.five_lose; -- cgit v1.2.3