summaryrefslogtreecommitdiff
path: root/auth.c
diff options
context:
space:
mode:
authorColin Watson <cjwatson@debian.org>2011-01-24 12:43:25 +0000
committerColin Watson <cjwatson@debian.org>2011-01-24 12:43:25 +0000
commit626f1d986ff72aa514da63e34744e1de9cf21b9a (patch)
treed215a5280bc2e57251e4a9e08bfd3674ad824a94 /auth.c
parent6ed622cb6fe8f71bbe0d998cdd12280410bfb420 (diff)
parent0970072c89b079b022538e3c366fbfa2c53fc821 (diff)
* New upstream release (http://www.openssh.org/txt/release-5.7):
- Implement Elliptic Curve Cryptography modes for key exchange (ECDH) and host/user keys (ECDSA) as specified by RFC5656. ECDH and ECDSA offer better performance than plain DH and DSA at the same equivalent symmetric key length, as well as much shorter keys. - sftp(1)/sftp-server(8): add a protocol extension to support a hard link operation. It is available through the "ln" command in the client. The old "ln" behaviour of creating a symlink is available using its "-s" option or through the preexisting "symlink" command. - scp(1): Add a new -3 option to scp: Copies between two remote hosts are transferred through the local host (closes: #508613). - ssh(1): "atomically" create the listening mux socket by binding it on a temporary name and then linking it into position after listen() has succeeded. This allows the mux clients to determine that the server socket is either ready or stale without races (closes: #454784). Stale server sockets are now automatically removed (closes: #523250). - ssh(1): install a SIGCHLD handler to reap expired child process (closes: #594687). - ssh(1)/ssh-agent(1): honour $TMPDIR for client xauth and ssh-agent temporary directories (closes: #357469, although only if you arrange for ssh-agent to actually see $TMPDIR since the setgid bit will cause it to be stripped off).
Diffstat (limited to 'auth.c')
-rw-r--r--auth.c32
1 files changed, 19 insertions, 13 deletions
diff --git a/auth.c b/auth.c
index 669bfc740..4f9b75334 100644
--- a/auth.c
+++ b/auth.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: auth.c,v 1.89 2010/08/04 05:42:47 djm Exp $ */ 1/* $OpenBSD: auth.c,v 1.91 2010/11/29 23:45:51 djm Exp $ */
2/* 2/*
3 * Copyright (c) 2000 Markus Friedl. All rights reserved. 3 * Copyright (c) 2000 Markus Friedl. All rights reserved.
4 * 4 *
@@ -380,16 +380,15 @@ HostStatus
380check_key_in_hostfiles(struct passwd *pw, Key *key, const char *host, 380check_key_in_hostfiles(struct passwd *pw, Key *key, const char *host,
381 const char *sysfile, const char *userfile) 381 const char *sysfile, const char *userfile)
382{ 382{
383 Key *found;
384 char *user_hostfile; 383 char *user_hostfile;
385 struct stat st; 384 struct stat st;
386 HostStatus host_status; 385 HostStatus host_status;
386 struct hostkeys *hostkeys;
387 const struct hostkey_entry *found;
387 388
388 /* Check if we know the host and its host key. */ 389 hostkeys = init_hostkeys();
389 found = key_new(key_is_cert(key) ? KEY_UNSPEC : key->type); 390 load_hostkeys(hostkeys, host, sysfile);
390 host_status = check_host_in_hostfile(sysfile, host, key, found, NULL); 391 if (userfile != NULL) {
391
392 if (host_status != HOST_OK && userfile != NULL) {
393 user_hostfile = tilde_expand_filename(userfile, pw->pw_uid); 392 user_hostfile = tilde_expand_filename(userfile, pw->pw_uid);
394 if (options.strict_modes && 393 if (options.strict_modes &&
395 (stat(user_hostfile, &st) == 0) && 394 (stat(user_hostfile, &st) == 0) &&
@@ -401,16 +400,23 @@ check_key_in_hostfiles(struct passwd *pw, Key *key, const char *host,
401 user_hostfile); 400 user_hostfile);
402 } else { 401 } else {
403 temporarily_use_uid(pw); 402 temporarily_use_uid(pw);
404 host_status = check_host_in_hostfile(user_hostfile, 403 load_hostkeys(hostkeys, host, user_hostfile);
405 host, key, found, NULL);
406 restore_uid(); 404 restore_uid();
407 } 405 }
408 xfree(user_hostfile); 406 xfree(user_hostfile);
409 } 407 }
410 key_free(found); 408 host_status = check_key_in_hostkeys(hostkeys, key, &found);
409 if (host_status == HOST_REVOKED)
410 error("WARNING: revoked key for %s attempted authentication",
411 found->host);
412 else if (host_status == HOST_OK)
413 debug("%s: key for %s found at %s:%ld", __func__,
414 found->host, found->file, found->line);
415 else
416 debug("%s: key for host %s not found", __func__, host);
417
418 free_hostkeys(hostkeys);
411 419
412 debug2("check_key_in_hostfiles: key %s for %s", host_status == HOST_OK ?
413 "ok" : "not found", host);
414 return host_status; 420 return host_status;
415} 421}
416 422
@@ -516,7 +522,7 @@ auth_openfile(const char *file, struct passwd *pw, int strict_modes,
516 close(fd); 522 close(fd);
517 return NULL; 523 return NULL;
518 } 524 }
519 if (options.strict_modes && 525 if (strict_modes &&
520 secure_filename(f, file, pw, line, sizeof(line)) != 0) { 526 secure_filename(f, file, pw, line, sizeof(line)) != 0) {
521 fclose(f); 527 fclose(f);
522 logit("Authentication refused: %s", line); 528 logit("Authentication refused: %s", line);