Mercurial > dropbear
diff svr-chansession.c @ 568:005530560594
Rearrange getaddrstring() etc
author | Matt Johnston <matt@ucc.asn.au> |
---|---|
date | Tue, 01 Sep 2009 16:38:26 +0000 |
parents | 893a9dd0b9dd |
children | 6f472dc54da7 |
line wrap: on
line diff
--- a/svr-chansession.c Mon Aug 31 15:25:39 2009 +0000 +++ b/svr-chansession.c Tue Sep 01 16:38:26 2009 +0000 @@ -250,6 +250,17 @@ } +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); + return li; +} + /* clean a session channel */ static void closechansess(struct Channel *channel) { @@ -273,8 +284,7 @@ if (chansess->tty) { /* write the utmp/wtmp login record */ - li = login_alloc_entry(chansess->pid, ses.authstate.username, - ses.remotehost, chansess->tty); + li = chansess_login_alloc(chansess); login_logout(li); login_free_entry(li); @@ -578,7 +588,6 @@ int iscmd, int issubsys) { unsigned int cmdlen; - int is_forced; int ret; TRACE(("enter sessioncommand")) @@ -628,6 +637,8 @@ } #endif + // XXX set SSH_CONNECTION string here, since about to close socket... + if (chansess->term == NULL) { /* no pty */ ret = noptycommand(channel, chansess); @@ -737,8 +748,7 @@ /* write the utmp/wtmp login record - must be after changing the * terminal used for stdout with the dup2 above */ - li= login_alloc_entry(getpid(), ses.authstate.username, - ses.remotehost, chansess->tty); + li = chansess_login_alloc(chansess); login_login(li); login_free_entry(li); @@ -886,6 +896,8 @@ addnewvar("SSH_TTY", chansess->tty); } + + #ifdef ENABLE_SVR_PUBKEY_OPTIONS if (ses.authstate.pubkey_options && ses.authstate.pubkey_options->original_command) {