summaryrefslogtreecommitdiff
path: root/auth-options.c
diff options
context:
space:
mode:
authordjm@openbsd.org <djm@openbsd.org>2016-03-07 19:02:43 +0000
committerDamien Miller <djm@mindrot.org>2016-03-08 06:20:35 +1100
commit95767262caa6692eff1e1565be1f5cb297949a89 (patch)
tree1055360a328d0998dabb966f2e1002389f8c6c41 /auth-options.c
parentaf0bb38ffd1f2c4f9f43b0029be2efe922815255 (diff)
upstream commit
refactor canohost.c: move functions that cache results closer to the places that use them (authn and session code). After this, no state is cached in canohost.c feedback and ok markus@ Upstream-ID: 5f2e4df88d4803fc8ec59ec53629105e23ce625e
Diffstat (limited to 'auth-options.c')
-rw-r--r--auth-options.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/auth-options.c b/auth-options.c
index edbaf80bb..b399b91e3 100644
--- a/auth-options.c
+++ b/auth-options.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: auth-options.c,v 1.70 2015/12/10 17:08:40 mmcc Exp $ */ 1/* $OpenBSD: auth-options.c,v 1.71 2016/03/07 19:02:43 djm Exp $ */
2/* 2/*
3 * Author: Tatu Ylonen <ylo@cs.hut.fi> 3 * Author: Tatu Ylonen <ylo@cs.hut.fi>
4 * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland 4 * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
@@ -29,6 +29,7 @@
29#include "ssherr.h" 29#include "ssherr.h"
30#include "log.h" 30#include "log.h"
31#include "canohost.h" 31#include "canohost.h"
32#include "packet.h"
32#include "sshbuf.h" 33#include "sshbuf.h"
33#include "misc.h" 34#include "misc.h"
34#include "channels.h" 35#include "channels.h"
@@ -120,6 +121,7 @@ match_flag(const char *opt, int allow_negate, char **optsp, const char *msg)
120int 121int
121auth_parse_options(struct passwd *pw, char *opts, char *file, u_long linenum) 122auth_parse_options(struct passwd *pw, char *opts, char *file, u_long linenum)
122{ 123{
124 struct ssh *ssh = active_state; /* XXX */
123 const char *cp; 125 const char *cp;
124 int i, r; 126 int i, r;
125 127
@@ -273,9 +275,9 @@ auth_parse_options(struct passwd *pw, char *opts, char *file, u_long linenum)
273 } 275 }
274 cp = "from=\""; 276 cp = "from=\"";
275 if (strncasecmp(opts, cp, strlen(cp)) == 0) { 277 if (strncasecmp(opts, cp, strlen(cp)) == 0) {
276 const char *remote_ip = get_remote_ipaddr(); 278 const char *remote_ip = ssh_remote_ipaddr(ssh);
277 const char *remote_host = get_canonical_hostname( 279 const char *remote_host = auth_get_canonical_hostname(
278 options.use_dns); 280 ssh, options.use_dns);
279 char *patterns = xmalloc(strlen(opts) + 1); 281 char *patterns = xmalloc(strlen(opts) + 1);
280 282
281 opts += strlen(cp); 283 opts += strlen(cp);
@@ -457,6 +459,7 @@ parse_option_list(struct sshbuf *oblob, struct passwd *pw,
457 char **cert_forced_command, 459 char **cert_forced_command,
458 int *cert_source_address_done) 460 int *cert_source_address_done)
459{ 461{
462 struct ssh *ssh = active_state; /* XXX */
460 char *command, *allowed; 463 char *command, *allowed;
461 const char *remote_ip; 464 const char *remote_ip;
462 char *name = NULL; 465 char *name = NULL;
@@ -530,7 +533,7 @@ parse_option_list(struct sshbuf *oblob, struct passwd *pw,
530 free(allowed); 533 free(allowed);
531 goto out; 534 goto out;
532 } 535 }
533 remote_ip = get_remote_ipaddr(); 536 remote_ip = ssh_remote_ipaddr(ssh);
534 result = addr_match_cidr_list(remote_ip, 537 result = addr_match_cidr_list(remote_ip,
535 allowed); 538 allowed);
536 free(allowed); 539 free(allowed);