# HG changeset patch # User Matt Johnston # Date 1252150800 0 # Node ID 8fd0ac8c8cabbbce69b09af8bccf69a1db8359e2 # Parent 281ed8384eb499a1748239854a5c9e2ae562826d 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. diff -r 281ed8384eb4 -r 8fd0ac8c8cab session.h --- a/session.h Wed Sep 02 15:17:14 2009 +0000 +++ b/session.h Sat Sep 05 11:40:00 2009 +0000 @@ -211,6 +211,9 @@ /* 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 -r 281ed8384eb4 -r 8fd0ac8c8cab svr-chansession.c --- a/svr-chansession.c Wed Sep 02 15:17:14 2009 +0000 +++ b/svr-chansession.c Sat Sep 05 11:40:00 2009 +0000 @@ -253,12 +253,9 @@ 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 -r 281ed8384eb4 -r 8fd0ac8c8cab svr-session.c --- a/svr-session.c Wed Sep 02 15:17:14 2009 +0000 +++ b/svr-session.c Sat Sep 05 11:40:00 2009 +0000 @@ -101,6 +101,9 @@ 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;