Mercurial > dropbear
diff svr-session.c @ 568:005530560594
Rearrange getaddrstring() etc
author | Matt Johnston <matt@ucc.asn.au> |
---|---|
date | Tue, 01 Sep 2009 16:38:26 +0000 |
parents | 8711f20b89ab |
children | 8fd0ac8c8cab |
line wrap: on
line diff
--- a/svr-session.c Mon Aug 31 15:25:39 2009 +0000 +++ b/svr-session.c Tue Sep 01 16:38:26 2009 +0000 @@ -74,27 +74,33 @@ NULL /* Null termination is mandatory. */ }; -void svr_session(int sock, int childpipe, - char* remotehost, char *addrstring) { - +void svr_session(int sock, int childpipe) { + char *host, *port; + size_t len; reseedrandom(); crypto_init(); - common_session_init(sock, sock, remotehost); + common_session_init(sock, sock); /* Initialise server specific parts of the session */ svr_ses.childpipe = childpipe; - svr_ses.addrstring = addrstring; #ifdef __uClinux__ svr_ses.server_pid = getpid(); #endif - svr_ses.addrstring = addrstring; svr_authinitialise(); chaninitialise(svr_chantypes); svr_chansessinitialise(); ses.connect_time = time(NULL); + /* for logging the remote address */ + get_socket_address(ses.sock_in, NULL, NULL, &host, &port, 0); + len = strlen(host) + strlen(port) + 2; + svr_ses.addrstring = m_malloc(len); + snprintf(svr_ses.addrstring, len, "%s:%s", host, port); + m_free(host); + m_free(port); + /* set up messages etc */ ses.remoteclosed = svr_remoteclosed;