From 4738aeb85fa56865244969dee521ef7f24d4f7c1 Mon Sep 17 00:00:00 2001 From: Andrew Cady Date: Sun, 26 Aug 2018 07:31:58 -0400 Subject: variable renames, store key type --- auth-options.c | 5 +++-- auth-options.h | 6 +++--- auth2-pubkey.c | 7 ++++--- session.c | 10 +++++++--- 4 files changed, 17 insertions(+), 11 deletions(-) diff --git a/auth-options.c b/auth-options.c index d4569b091..1337121ef 100644 --- a/auth-options.c +++ b/auth-options.c @@ -39,8 +39,9 @@ #include "ssh2.h" #include "auth-options.h" -char *wildcard_match = NULL; -char *wildcard_fingerprint = NULL; +char *wildcard_remote_key = NULL; +char *wildcard_remote_key_type = NULL; +char *wildcard_remote_key_fingerprint = NULL; /* * Match flag 'opt' in *optsp, and if allow_negate is set then also match diff --git a/auth-options.h b/auth-options.h index a6efa8ee3..5773812bf 100644 --- a/auth-options.h +++ b/auth-options.h @@ -67,9 +67,9 @@ struct sshauthopt { char *required_from_host_keys; }; - -extern char *wildcard_match; -extern char *wildcard_fingerprint; +extern char *wildcard_remote_key; +extern char *wildcard_remote_key_type; +extern char *wildcard_remote_key_fingerprint; struct sshauthopt *sshauthopt_new(void); struct sshauthopt *sshauthopt_new_with_keys_defaults(void); diff --git a/auth2-pubkey.c b/auth2-pubkey.c index bf075c47d..d630d43ef 100644 --- a/auth2-pubkey.c +++ b/auth2-pubkey.c @@ -620,12 +620,13 @@ check_authkey_line(struct ssh *ssh, struct passwd *pw, struct sshkey *key, goto fail_reason; } - wildcard_match = keytext; - wildcard_fingerprint = sshkey_fingerprint(key, SSH_DIGEST_SHA256, SSH_FP_HEX); + wildcard_remote_key = keytext; + wildcard_remote_key_type = sshkey_type(key); + wildcard_remote_key_fingerprint = sshkey_fingerprint(key, SSH_DIGEST_SHA256, SSH_FP_HEX); verbose("Accepted wildcard authorization for %s key %s with forced_command=%s", sshkey_type(key), - wildcard_fingerprint, + wildcard_remote_key_fingerprint, keyopts->force_command); finalopts = keyopts; diff --git a/session.c b/session.c index a5634ccc2..fca7e4095 100644 --- a/session.c +++ b/session.c @@ -1094,11 +1094,15 @@ do_setup_env(struct ssh *ssh, Session *s, const char *shell) child_set_env(&env, &envsize, "TERM", s->term); if (s->display) child_set_env(&env, &envsize, "DISPLAY", s->display); - if (wildcard_match) { + if (wildcard_remote_key) { + /* This is basically obsolete because of SSH_USER_AUTH */ + /* I'm leaving it here only because I have code that uses these variables. */ child_set_env(&env, &envsize, "SSH_REMOTE_KEY", - wildcard_match); + wildcard_remote_key); + child_set_env(&env, &envsize, "SSH_REMOTE_KEY_TYPE", + wildcard_remote_key_type); child_set_env(&env, &envsize, "SSH_REMOTE_FINGERPRINT", - wildcard_fingerprint); + wildcard_remote_key_fingerprint); } -- cgit v1.2.3