From 2191bf9196379bc72c4589aa75cdd6e7ce97d856 Mon Sep 17 00:00:00 2001 From: dtucker Date: Fri, 9 Dec 2022 00:17:40 +0000 Subject: [PATCH] Add some server debugging for hostbased auth. auth_debug_add queues messages about the auth process which is sent to the client after successful authentication. This also sends those to the server debug log to aid in debugging. From bz#3507, ok djm@ --- usr.bin/ssh/auth-rhosts.c | 4 +++- usr.bin/ssh/auth.c | 11 +++++------ 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/usr.bin/ssh/auth-rhosts.c b/usr.bin/ssh/auth-rhosts.c index 2771fa5e020..07f75532bfd 100644 --- a/usr.bin/ssh/auth-rhosts.c +++ b/usr.bin/ssh/auth-rhosts.c @@ -1,4 +1,4 @@ -/* $OpenBSD: auth-rhosts.c,v 1.56 2022/02/23 21:21:49 djm Exp $ */ +/* $OpenBSD: auth-rhosts.c,v 1.57 2022/12/09 00:17:40 dtucker Exp $ */ /* * Author: Tatu Ylonen * Copyright (c) 1995 Tatu Ylonen , Espoo, Finland @@ -17,6 +17,7 @@ #include #include +#include #include #include #include @@ -279,6 +280,7 @@ auth_rhosts2(struct passwd *pw, const char *client_user, const char *hostname, xasprintf(&path, "%s/%s", pw->pw_dir, rhosts_files[rhosts_file_index]); if (stat(path, &st) == -1) { + debug3_f("stat %s: %s", path, strerror(errno)); free(path); continue; } diff --git a/usr.bin/ssh/auth.c b/usr.bin/ssh/auth.c index 4cb50e58102..7d60d157068 100644 --- a/usr.bin/ssh/auth.c +++ b/usr.bin/ssh/auth.c @@ -1,4 +1,4 @@ -/* $OpenBSD: auth.c,v 1.158 2022/06/03 04:47:21 djm Exp $ */ +/* $OpenBSD: auth.c,v 1.159 2022/12/09 00:17:40 dtucker Exp $ */ /* * Copyright (c) 2000 Markus Friedl. All rights reserved. * @@ -500,14 +500,13 @@ auth_debug_add(const char *fmt,...) va_list args; int r; - if (auth_debug == NULL) - return; - va_start(args, fmt); vsnprintf(buf, sizeof(buf), fmt, args); va_end(args); - if ((r = sshbuf_put_cstring(auth_debug, buf)) != 0) - fatal_fr(r, "sshbuf_put_cstring"); + debug3("%s", buf); + if (auth_debug != NULL) + if ((r = sshbuf_put_cstring(auth_debug, buf)) != 0) + fatal_fr(r, "sshbuf_put_cstring"); } void -- 2.20.1