From ccac6983bd25c68d046c82f9168be448d12da721 Mon Sep 17 00:00:00 2001 From: wens Date: Wed, 19 Jan 2005 18:10:25 +0000 Subject: 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 --- mbbsd/mbbsd.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'mbbsd/mbbsd.c') 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" -- cgit v1.2.3