summaryrefslogtreecommitdiff
path: root/auth-options.c
diff options
context:
space:
mode:
Diffstat (limited to 'auth-options.c')
-rw-r--r--auth-options.c35
1 files changed, 26 insertions, 9 deletions
diff --git a/auth-options.c b/auth-options.c
index 12e2e1dca..15c00d048 100644
--- a/auth-options.c
+++ b/auth-options.c
@@ -58,9 +58,20 @@ int forced_tun_device = -1;
58/* "principals=" option. */ 58/* "principals=" option. */
59char *authorized_principals = NULL; 59char *authorized_principals = NULL;
60 60
61/* Throttle log messages. */
62int logged_from_hostip = 0;
63int logged_cert_hostip = 0;
64
61extern ServerOptions options; 65extern ServerOptions options;
62 66
63void 67void
68auth_start_parse_options(void)
69{
70 logged_from_hostip = 0;
71 logged_cert_hostip = 0;
72}
73
74void
64auth_clear_options(void) 75auth_clear_options(void)
65{ 76{
66 no_agent_forwarding_flag = 0; 77 no_agent_forwarding_flag = 0;
@@ -288,10 +299,13 @@ auth_parse_options(struct passwd *pw, char *opts, char *file, u_long linenum)
288 /* FALLTHROUGH */ 299 /* FALLTHROUGH */
289 case 0: 300 case 0:
290 free(patterns); 301 free(patterns);
291 logit("Authentication tried for %.100s with " 302 if (!logged_from_hostip) {
292 "correct key but not from a permitted " 303 logit("Authentication tried for %.100s with "
293 "host (host=%.200s, ip=%.200s).", 304 "correct key but not from a permitted "
294 pw->pw_name, remote_host, remote_ip); 305 "host (host=%.200s, ip=%.200s).",
306 pw->pw_name, remote_host, remote_ip);
307 logged_from_hostip = 1;
308 }
295 auth_debug_add("Your host '%.200s' is not " 309 auth_debug_add("Your host '%.200s' is not "
296 "permitted to use this key for login.", 310 "permitted to use this key for login.",
297 remote_host); 311 remote_host);
@@ -513,11 +527,14 @@ parse_option_list(u_char *optblob, size_t optblob_len, struct passwd *pw,
513 break; 527 break;
514 case 0: 528 case 0:
515 /* no match */ 529 /* no match */
516 logit("Authentication tried for %.100s " 530 if (!logged_cert_hostip) {
517 "with valid certificate but not " 531 logit("Authentication tried for %.100s "
518 "from a permitted host " 532 "with valid certificate but not "
519 "(ip=%.200s).", pw->pw_name, 533 "from a permitted host "
520 remote_ip); 534 "(ip=%.200s).", pw->pw_name,
535 remote_ip);
536 logged_cert_hostip = 1;
537 }
521 auth_debug_add("Your address '%.200s' " 538 auth_debug_add("Your address '%.200s' "
522 "is not permitted to use this " 539 "is not permitted to use this "
523 "certificate for login.", 540 "certificate for login.",