]> git.ipfire.org Git - thirdparty/openssh-portable.git/commitdiff
upstream: Add server debugging for hostbased auth.
authordtucker@openbsd.org <dtucker@openbsd.org>
Fri, 9 Dec 2022 00:17:40 +0000 (00:17 +0000)
committerDarren Tucker <dtucker@dtucker.net>
Fri, 9 Dec 2022 00:36:27 +0000 (11:36 +1100)
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@

OpenBSD-Commit-ID: 46ff67518cccf9caf47e06393e2a121ee5aa258a

auth-rhosts.c
auth.c

index 4fc9252a6b617b8f797218faf8dd3be5125911a1..56724677a9e27bc804bf4860dfdcb0ed129dd3f8 100644 (file)
@@ -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 <ylo@cs.hut.fi>
  * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
@@ -19,6 +19,7 @@
 #include <sys/types.h>
 #include <sys/stat.h>
 
+#include <errno.h>
 #include <fcntl.h>
 #ifdef HAVE_NETGROUP_H
 # include <netgroup.h>
@@ -283,6 +284,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/auth.c b/auth.c
index 13e8d7998a98679519584a0dcbd39d03fa8b2a67..03a777ccee39e215d002f773d9f58d01b0d2e0af 100644 (file)
--- a/auth.c
+++ b/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.
  *
@@ -571,14 +571,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