From 4dfb834f7cd153cd90904c36dca314f5516beca2 Mon Sep 17 00:00:00 2001 From: Matt Johnston <matt@ucc.asn.au> Date: Sat, 5 Sep 2009 11:40:00 +0000 Subject: [PATCH] Move remotehost into svr_ses structure since we can't look it up once we've forked (the connection socket has been closed). Fixes inetd mode. --HG-- extra : convert_revision : 7d5d152ec84fb11a188966c1400d213c908cc511 --- session.h | 3 +++ svr-chansession.c | 5 +---- svr-session.c | 3 +++ 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/session.h b/session.h index 128214be..20a90a45 100644 --- a/session.h +++ b/session.h @@ -211,6 +211,9 @@ struct serversession { /* The numeric address they connected from, used for logging */ char * addrstring; + /* The resolved remote address, used for lastlog etc */ + char *remotehost; + #ifdef __uClinux__ pid_t server_pid; #endif diff --git a/svr-chansession.c b/svr-chansession.c index 782e97fa..5ecc57fc 100644 --- a/svr-chansession.c +++ b/svr-chansession.c @@ -253,12 +253,9 @@ static int newchansess(struct Channel *channel) { static struct logininfo* chansess_login_alloc(struct ChanSess *chansess) { - char *remotehost; struct logininfo * li; - get_socket_address(ses.sock_in, NULL, NULL, &remotehost, NULL, 1); li = login_alloc_entry(chansess->pid, ses.authstate.username, - remotehost, chansess->tty); - m_free(remotehost); + svr_ses.remotehost, chansess->tty); return li; } diff --git a/svr-session.c b/svr-session.c index a5099069..da49e1aa 100644 --- a/svr-session.c +++ b/svr-session.c @@ -101,6 +101,9 @@ void svr_session(int sock, int childpipe) { m_free(host); m_free(port); + get_socket_address(ses.sock_in, NULL, NULL, + &svr_ses.remotehost, NULL, 1); + /* set up messages etc */ ses.remoteclosed = svr_remoteclosed; -- GitLab