summaryrefslogtreecommitdiff
path: root/monitor.c
diff options
context:
space:
mode:
authordjm@openbsd.org <djm@openbsd.org>2017-02-03 23:05:57 +0000
committerDamien Miller <djm@mindrot.org>2017-02-04 10:09:43 +1100
commitf1a193464a7b77646f0d0cedc929068e4a413ab4 (patch)
tree27a13d64537438a863c5eddc1b72d0e729800f49 /monitor.c
parent07edd7e9537ab32aa52abb5fb2a915c350fcf441 (diff)
upstream commit
use ssh_packet_set_log_preamble() to include connection username in packet log messages, e.g. Connection closed by invalid user foo 10.1.1.1 port 44056 [preauth] ok markus@ bz#113 Upstream-ID: 3591b88bdb5416d6066fb3d49d8fff2375bf1a15
Diffstat (limited to 'monitor.c')
-rw-r--r--monitor.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/monitor.c b/monitor.c
index 43f484709..96d22b7e4 100644
--- a/monitor.c
+++ b/monitor.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: monitor.c,v 1.166 2016/09/28 16:33:06 djm Exp $ */ 1/* $OpenBSD: monitor.c,v 1.167 2017/02/03 23:05:57 djm Exp $ */
2/* 2/*
3 * Copyright 2002 Niels Provos <provos@citi.umich.edu> 3 * Copyright 2002 Niels Provos <provos@citi.umich.edu>
4 * Copyright 2002 Markus Friedl <markus@openbsd.org> 4 * Copyright 2002 Markus Friedl <markus@openbsd.org>
@@ -283,6 +283,7 @@ monitor_permit_authentications(int permit)
283void 283void
284monitor_child_preauth(Authctxt *_authctxt, struct monitor *pmonitor) 284monitor_child_preauth(Authctxt *_authctxt, struct monitor *pmonitor)
285{ 285{
286 struct ssh *ssh = active_state; /* XXX */
286 struct mon_table *ent; 287 struct mon_table *ent;
287 int authenticated = 0, partial = 0; 288 int authenticated = 0, partial = 0;
288 289
@@ -356,6 +357,7 @@ monitor_child_preauth(Authctxt *_authctxt, struct monitor *pmonitor)
356 357
357 debug("%s: %s has been authenticated by privileged process", 358 debug("%s: %s has been authenticated by privileged process",
358 __func__, authctxt->user); 359 __func__, authctxt->user);
360 ssh_packet_set_log_preamble(ssh, "user %s", authctxt->user);
359 361
360 mm_get_keystate(pmonitor); 362 mm_get_keystate(pmonitor);
361 363
@@ -695,6 +697,7 @@ mm_answer_sign(int sock, Buffer *m)
695int 697int
696mm_answer_pwnamallow(int sock, Buffer *m) 698mm_answer_pwnamallow(int sock, Buffer *m)
697{ 699{
700 struct ssh *ssh = active_state; /* XXX */
698 char *username; 701 char *username;
699 struct passwd *pwent; 702 struct passwd *pwent;
700 int allowed = 0; 703 int allowed = 0;
@@ -739,6 +742,8 @@ mm_answer_pwnamallow(int sock, Buffer *m)
739 buffer_put_cstring(m, pwent->pw_shell); 742 buffer_put_cstring(m, pwent->pw_shell);
740 743
741 out: 744 out:
745 ssh_packet_set_log_preamble(ssh, "%suser %s",
746 authctxt->valid ? "authenticating" : "invalid ", authctxt->user);
742 buffer_put_string(m, &options, sizeof(options)); 747 buffer_put_string(m, &options, sizeof(options));
743 748
744#define M_CP_STROPT(x) do { \ 749#define M_CP_STROPT(x) do { \