From ef9269c4983dd3706c90157bdb39717d83e7d085 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 4a4ba9016..d6c4e41b2 100644 --- a/auth-options.c +++ b/auth-options.c @@ -40,8 +40,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; static int dup_strings(char ***dstp, size_t *ndstp, char **src, size_t nsrc) diff --git a/auth-options.h b/auth-options.h index 165180187..e64acdf70 100644 --- a/auth-options.h +++ b/auth-options.h @@ -75,9 +75,9 @@ struct sshauthopt { int require_verify; }; - -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 bba8dfefa..73151b57c 100644 --- a/auth2-pubkey.c +++ b/auth2-pubkey.c @@ -644,12 +644,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 b36e8b1fb..4ae9cab66 100644 --- a/session.c +++ b/session.c @@ -1071,11 +1071,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