=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/ssh/monitor.c,v retrieving revision 1.147 retrieving revision 1.148 diff -u -r1.147 -r1.148 --- src/usr.bin/ssh/monitor.c 2015/04/27 01:52:30 1.147 +++ src/usr.bin/ssh/monitor.c 2015/05/01 03:23:51 1.148 @@ -1,4 +1,4 @@ -/* $OpenBSD: monitor.c,v 1.147 2015/04/27 01:52:30 djm Exp $ */ +/* $OpenBSD: monitor.c,v 1.148 2015/05/01 03:23:51 djm Exp $ */ /* * Copyright 2002 Niels Provos * Copyright 2002 Markus Friedl @@ -897,7 +897,7 @@ Key *key; char *cuser, *chost; u_char *blob; - u_int bloblen; + u_int bloblen, pubkey_auth_attempt; enum mm_keytype type = 0; int allowed = 0; @@ -907,6 +907,7 @@ cuser = buffer_get_string(m, NULL); chost = buffer_get_string(m, NULL); blob = buffer_get_string(m, &bloblen); + pubkey_auth_attempt = buffer_get_int(m); key = key_from_blob(blob, bloblen); @@ -929,10 +930,12 @@ match_pattern_list(sshkey_ssh_name(key), options.pubkey_key_types, strlen(options.pubkey_key_types), 0) == 1 && - user_key_allowed(authctxt->pw, key); + user_key_allowed(authctxt->pw, key, + pubkey_auth_attempt); pubkey_auth_info(authctxt, key, NULL); auth_method = "publickey"; - if (options.pubkey_authentication && allowed != 1) + if (options.pubkey_authentication && + (!pubkey_auth_attempt || allowed != 1)) auth_clear_options(); break; case MM_HOSTKEY: