summaryrefslogtreecommitdiffstats
path: root/auth-rsa.c
diff options
context:
space:
mode:
authorDarren Tucker <dtucker@zip.com.au>2008-07-02 14:37:30 +0200
committerDarren Tucker <dtucker@zip.com.au>2008-07-02 14:37:30 +0200
commit33c787f23c0267c679ad3e3f8bc4679c6ced5ea3 (patch)
treeb444437050374e67966df54450358b5506b797ea /auth-rsa.c
parent - djm@cvs.openbsd.org 2008/07/02 02:24:18 (diff)
downloadopenssh-33c787f23c0267c679ad3e3f8bc4679c6ced5ea3.tar.xz
openssh-33c787f23c0267c679ad3e3f8bc4679c6ced5ea3.zip
- dtucker@cvs.openbsd.org 2008/07/02 12:03:51
[auth-rsa.c auth.c auth2-pubkey.c auth.h] Merge duplicate host key file checks, based in part on a patch from Rob Holland via bz #1348 . Also checks for non-regular files during protocol 1 RSA auth. ok djm@
Diffstat (limited to 'auth-rsa.c')
-rw-r--r--auth-rsa.c23
1 files changed, 2 insertions, 21 deletions
diff --git a/auth-rsa.c b/auth-rsa.c
index 69f9a5896..bf5462076 100644
--- a/auth-rsa.c
+++ b/auth-rsa.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: auth-rsa.c,v 1.72 2006/11/06 21:25:27 markus Exp $ */
+/* $OpenBSD: auth-rsa.c,v 1.73 2008/07/02 12:03:51 dtucker Exp $ */
/*
* Author: Tatu Ylonen <ylo@cs.hut.fi>
* Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
@@ -173,7 +173,6 @@ auth_rsa_key_allowed(struct passwd *pw, BIGNUM *client_n, Key **rkey)
u_int bits;
FILE *f;
u_long linenum = 0;
- struct stat st;
Key *key;
/* Temporarily use the user's uid. */
@@ -182,27 +181,9 @@ auth_rsa_key_allowed(struct passwd *pw, BIGNUM *client_n, Key **rkey)
/* The authorized keys. */
file = authorized_keys_file(pw);
debug("trying public RSA key file %s", file);
-
- /* Fail quietly if file does not exist */
- if (stat(file, &st) < 0) {
- /* Restore the privileged uid. */
- restore_uid();
- xfree(file);
- return (0);
- }
- /* Open the file containing the authorized keys. */
- f = fopen(file, "r");
+ f = auth_openkeyfile(file, pw, options.strict_modes);
if (!f) {
- /* Restore the privileged uid. */
- restore_uid();
- xfree(file);
- return (0);
- }
- if (options.strict_modes &&
- secure_filename(f, file, pw, line, sizeof(line)) != 0) {
xfree(file);
- fclose(f);
- logit("Authentication refused: %s", line);
restore_uid();
return (0);
}