summaryrefslogtreecommitdiffstats
path: root/mbbsd
diff options
context:
space:
mode:
authorwens <wens@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2005-01-20 02:10:25 +0800
committerwens <wens@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2005-01-20 02:10:25 +0800
commitccac6983bd25c68d046c82f9168be448d12da721 (patch)
treeb173d4fb13eebc0a887fa063848fccd9087094e0 /mbbsd
parentbb629566335ef1ea90859bd467028d52e67e0f81 (diff)
downloadpttbbs-ccac6983bd25c68d046c82f9168be448d12da721.tar
pttbbs-ccac6983bd25c68d046c82f9168be448d12da721.tar.gz
pttbbs-ccac6983bd25c68d046c82f9168be448d12da721.tar.bz2
pttbbs-ccac6983bd25c68d046c82f9168be448d12da721.tar.lz
pttbbs-ccac6983bd25c68d046c82f9168be448d12da721.tar.xz
pttbbs-ccac6983bd25c68d046c82f9168be448d12da721.tar.zst
pttbbs-ccac6983bd25c68d046c82f9168be448d12da721.zip
generic support for ssh hostname via SSH_CLIENT env (with support for ipv6 like IPs)
fix shell mode proctitle git-svn-id: http://opensvn.csie.org/pttbbs/trunk/pttbbs@2414 63ad8ddf-47c3-0310-b6dd-a9e9d9715204
Diffstat (limited to 'mbbsd')
-rw-r--r--mbbsd/mbbsd.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/mbbsd/mbbsd.c b/mbbsd/mbbsd.c
index 96981179..1237a8db 100644
--- a/mbbsd/mbbsd.c
+++ b/mbbsd/mbbsd.c
@@ -919,7 +919,10 @@ user_login()
sscanf(getenv("SSH_CLIENT"), "%s", frombuf);
xsin.sin_family = AF_INET;
xsin.sin_port = htons(23);
- inet_pton(AF_INET, frombuf, &xsin.sin_addr);
+ if (strrchr(frombuf, ':'))
+ inet_pton(AF_INET, strrchr(frombuf, ':') + 1, &xsin.sin_addr);
+ else
+ inet_pton(AF_INET, frombuf, &xsin.sin_addr);
getremotename(&xsin, fromhost, remoteusername); /* FC931 */
}
@@ -1299,6 +1302,7 @@ shell_login(int argc, char *argv[], char *envp[])
use_shell_login_mode = 1;
initsetproctitle(argc, argv, envp);
+ snprintf(margs, sizeof(margs), "%s ssh ", argv[0]);
/*
* copy fromindent: Standard input:1138: Error:Unexpected end of file the
* original "bbs"