Pass remote host lookup to goutmp

This commit is contained in:
Russ Magee 2018-06-27 17:32:26 -07:00
parent 2e9f3d7726
commit 11fad87345
1 changed files with 4 additions and 2 deletions

View File

@ -300,9 +300,11 @@ func main() {
log.Println("[Command complete]")
} else if rec.op[0] == 's' {
log.Println("[Running shell]")
utmpx := goutmp.Put_utmp(string(rec.who), string("todo.example.org"))
addr := c.RemoteAddr()
utmpx := goutmp.Put_utmp(string(rec.who), addr.String())
defer func() { goutmp.Unput_utmp(utmpx) }()
goutmp.Put_lastlog_entry("hkexsh", string(rec.who), string("todo.example.org"))
goutmp.Put_lastlog_entry("hkexsh", string(rec.who), addr.String())
runShellAs(string(rec.who), string(rec.cmd), true, conn, chaffEnabled)
// Returned hopefully via an EOF or exit/logout;
// Clear current op so user can enter next, or EOF