[openssh-commits] [openssh] 01/02: upstream: add some debug output showing how many key file/command lines

git+noreply at mindrot.org git+noreply at mindrot.org
Wed Sep 29 11:35:27 AEST 2021


This is an automated email from the git hooks/post-receive script.

djm pushed a commit to branch master
in repository openssh.

commit ce4854e12e749a05646e5775e9deb8cfaf49a755
Author: djm at openbsd.org <djm at openbsd.org>
Date:   Wed Sep 29 01:33:32 2021 +0000

    upstream: add some debug output showing how many key file/command lines
    
    were processed. Useful to see whether a file or command actually has keys
    present
    
    OpenBSD-Commit-ID: 0bd9ff94e84e03a22df8e6c12f6074a95d27f23c
---
 auth2-pubkey.c | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/auth2-pubkey.c b/auth2-pubkey.c
index 9e32259a..2adbf590 100644
--- a/auth2-pubkey.c
+++ b/auth2-pubkey.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: auth2-pubkey.c,v 1.109 2021/07/23 03:37:52 djm Exp $ */
+/* $OpenBSD: auth2-pubkey.c,v 1.110 2021/09/29 01:33:32 djm Exp $ */
 /*
  * Copyright (c) 2000 Markus Friedl.  All rights reserved.
  *
@@ -376,7 +376,7 @@ process_principals(struct ssh *ssh, FILE *f, const char *file,
 {
 	char loc[256], *line = NULL, *cp, *ep;
 	size_t linesize = 0;
-	u_long linenum = 0;
+	u_long linenum = 0, nonblank = 0;
 	u_int found_principal = 0;
 
 	if (authoptsp != NULL)
@@ -397,10 +397,12 @@ process_principals(struct ssh *ssh, FILE *f, const char *file,
 		if (!*cp || *cp == '\n')
 			continue;
 
+		nonblank++;
 		snprintf(loc, sizeof(loc), "%.200s:%lu", file, linenum);
 		if (check_principals_line(ssh, cp, cert, loc, authoptsp) == 0)
 			found_principal = 1;
 	}
+	debug2_f("%s: processed %lu/%lu lines", file, nonblank, linenum);
 	free(line);
 	return found_principal;
 }
@@ -719,7 +721,7 @@ check_authkeys_file(struct ssh *ssh, struct passwd *pw, FILE *f,
 	char *cp, *line = NULL, loc[256];
 	size_t linesize = 0;
 	int found_key = 0;
-	u_long linenum = 0;
+	u_long linenum = 0, nonblank = 0;
 
 	if (authoptsp != NULL)
 		*authoptsp = NULL;
@@ -735,11 +737,14 @@ check_authkeys_file(struct ssh *ssh, struct passwd *pw, FILE *f,
 		skip_space(&cp);
 		if (!*cp || *cp == '\n' || *cp == '#')
 			continue;
+
+		nonblank++;
 		snprintf(loc, sizeof(loc), "%.200s:%lu", file, linenum);
 		if (check_authkey_line(ssh, pw, key, cp, loc, authoptsp) == 0)
 			found_key = 1;
 	}
 	free(line);
+	debug2_f("%s: processed %lu/%lu lines", file, nonblank, linenum);
 	return found_key;
 }
 

-- 
To stop receiving notification emails like this one, please contact
djm at mindrot.org.


More information about the openssh-commits mailing list