summaryrefslogtreecommitdiff
path: root/authfile.c
diff options
context:
space:
mode:
authorColin Watson <cjwatson@debian.org>2008-05-17 07:48:57 +0000
committerColin Watson <cjwatson@debian.org>2008-05-17 07:48:57 +0000
commit1f920ffc4c4f933e3c4e8c474460385fea131266 (patch)
tree7c23ed1becb8b315640229ad8eb18405b532151a /authfile.c
parent7eb2c79966e70e03a1ecbdf9077d64299241bd3a (diff)
Check RSA1 keys without the need for a separate blacklist. Thanks to
Simon Tatham for the idea.
Diffstat (limited to 'authfile.c')
-rw-r--r--authfile.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/authfile.c b/authfile.c
index 5348a014d..a18509a50 100644
--- a/authfile.c
+++ b/authfile.c
@@ -693,6 +693,7 @@ blacklist_filename(const Key *key)
693int 693int
694blacklisted_key(const Key *key) 694blacklisted_key(const Key *key)
695{ 695{
696 Key *public;
696 char *blacklist_file; 697 char *blacklist_file;
697 int fd = -1; 698 int fd = -1;
698 char *dgst_hex = NULL; 699 char *dgst_hex = NULL;
@@ -704,13 +705,17 @@ blacklisted_key(const Key *key)
704 off_t start, lower, upper; 705 off_t start, lower, upper;
705 int ret = 0; 706 int ret = 0;
706 707
707 blacklist_file = blacklist_filename(key); 708 public = key_demote(key);
709 if (public->type == KEY_RSA1)
710 public->type = KEY_RSA;
711
712 blacklist_file = blacklist_filename(public);
708 debug("Checking blacklist file %s", blacklist_file); 713 debug("Checking blacklist file %s", blacklist_file);
709 fd = open(blacklist_file, O_RDONLY); 714 fd = open(blacklist_file, O_RDONLY);
710 if (fd < 0) 715 if (fd < 0)
711 goto out; 716 goto out;
712 717
713 dgst_hex = key_fingerprint(key, SSH_FP_MD5, SSH_FP_HEX); 718 dgst_hex = key_fingerprint(public, SSH_FP_MD5, SSH_FP_HEX);
714 /* Remove all colons */ 719 /* Remove all colons */
715 dgst_packed = xcalloc(1, strlen(dgst_hex) + 1); 720 dgst_packed = xcalloc(1, strlen(dgst_hex) + 1);
716 for (i = 0, p = dgst_packed; dgst_hex[i]; i++) 721 for (i = 0, p = dgst_packed; dgst_hex[i]; i++)
@@ -786,5 +791,6 @@ out:
786 if (fd >= 0) 791 if (fd >= 0)
787 close(fd); 792 close(fd);
788 xfree(blacklist_file); 793 xfree(blacklist_file);
794 key_free(public);
789 return ret; 795 return ret;
790} 796}