diff options
author | Colin Watson <cjwatson@debian.org> | 2014-02-09 16:10:02 +0000 |
---|---|---|
committer | Colin Watson <cjwatson@debian.org> | 2014-02-09 16:18:41 +0000 |
commit | ec5991d73abdc0b3c43ea9f8a0e99da045e7beb1 (patch) | |
tree | 9b694e0a84c6382cb5eede01c5eb5e72074a749e /auth-options.c | |
parent | 145099bdca1b959e2ef3555cd6ce0bc44fb69ce8 (diff) |
Quieten logs when multiple from= restrictions are used
Bug-Debian: http://bugs.debian.org/630606
Forwarded: no
Last-Update: 2013-09-14
Patch-Name: auth-log-verbosity.patch
Diffstat (limited to 'auth-options.c')
-rw-r--r-- | auth-options.c | 35 |
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. */ |
59 | char *authorized_principals = NULL; | 59 | char *authorized_principals = NULL; |
60 | 60 | ||
61 | /* Throttle log messages. */ | ||
62 | int logged_from_hostip = 0; | ||
63 | int logged_cert_hostip = 0; | ||
64 | |||
61 | extern ServerOptions options; | 65 | extern ServerOptions options; |
62 | 66 | ||
63 | void | 67 | void |
68 | auth_start_parse_options(void) | ||
69 | { | ||
70 | logged_from_hostip = 0; | ||
71 | logged_cert_hostip = 0; | ||
72 | } | ||
73 | |||
74 | void | ||
64 | auth_clear_options(void) | 75 | auth_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.", |