diff options
author | Dag-Erling Smørgrav <des@FreeBSD.org> | 2008-07-23 09:33:08 +0000 |
---|---|---|
committer | Dag-Erling Smørgrav <des@FreeBSD.org> | 2008-07-23 09:33:08 +0000 |
commit | 5521539314d87d3432e3c5c0e74954a673a884bd (patch) | |
tree | 8f06d9ad2f958f06e579924065ecbaf74dd734f7 /auth2-pubkey.c | |
parent | d4033b6b6f7aa0e69be09f9613e062e0fb7a9f11 (diff) | |
download | src-5521539314d87d3432e3c5c0e74954a673a884bd.tar.gz src-5521539314d87d3432e3c5c0e74954a673a884bd.zip |
Vendor import of OpenSSH 5.1p1
Notes
Notes:
svn path=/vendor-crypto/openssh/dist/; revision=180750
Diffstat (limited to 'auth2-pubkey.c')
-rw-r--r-- | auth2-pubkey.c | 22 |
1 files changed, 4 insertions, 18 deletions
diff --git a/auth2-pubkey.c b/auth2-pubkey.c index 9863cd9e6e54..b1e38e5f586d 100644 --- a/auth2-pubkey.c +++ b/auth2-pubkey.c @@ -1,4 +1,4 @@ -/* $OpenBSD: auth2-pubkey.c,v 1.15 2006/08/03 03:34:41 deraadt Exp $ */ +/* $OpenBSD: auth2-pubkey.c,v 1.19 2008/07/03 21:46:58 otto Exp $ */ /* * Copyright (c) 2000 Markus Friedl. All rights reserved. * @@ -28,9 +28,11 @@ #include <sys/types.h> #include <sys/stat.h> +#include <fcntl.h> #include <pwd.h> #include <stdio.h> #include <stdarg.h> +#include <unistd.h> #include "xmalloc.h" #include "ssh.h" @@ -183,7 +185,6 @@ user_key_allowed2(struct passwd *pw, Key *key, char *file) int found_key = 0; FILE *f; u_long linenum = 0; - struct stat st; Key *found; char *fp; @@ -191,24 +192,9 @@ user_key_allowed2(struct passwd *pw, Key *key, char *file) temporarily_use_uid(pw); debug("trying public key file %s", file); + f = auth_openkeyfile(file, pw, options.strict_modes); - /* Fail quietly if file does not exist */ - if (stat(file, &st) < 0) { - /* Restore the privileged uid. */ - restore_uid(); - return 0; - } - /* Open the file containing the authorized keys. */ - f = fopen(file, "r"); if (!f) { - /* Restore the privileged uid. */ - restore_uid(); - return 0; - } - if (options.strict_modes && - secure_filename(f, file, pw, line, sizeof(line)) != 0) { - fclose(f); - logit("Authentication refused: %s", line); restore_uid(); return 0; } |