ssh-keygen -R is case-sensitive, but should not be
Griff Miller II
griff.miller at oplink.net
Sat Apr 16 14:33:07 AEST 2016
I guess attachments get stripped out. I'll paste it:
----------------------------------------------------
--- match.c 2016-03-09 12:04:48.000000000 -0600
+++ /home/millerig/osrc/openssh-7.2p2/match.c 2016-04-15
22:50:08.917536100 -0500
@@ -119,10 +119,18 @@
match_pattern_list(const char *string, const char *pattern, int dolower)
{
char sub[1024];
+ char *low_string = NULL;
int negated;
int got_positive;
u_int i, subi, len = strlen(pattern);
+ if (dolower) {
+ low_string = xmalloc(strlen(string) + 1);
+ for (i = 0; string[i]; ++i)
+ low_string[i] = tolower(string[i]);
+ low_string[i] = '\0';
+ }
+
got_positive = 0;
for (i = 0; i < len;) {
/* Check if the subpattern is negated. */
@@ -142,8 +150,10 @@
sub[subi] = dolower && isupper((u_char)pattern[i]) ?
tolower((u_char)pattern[i]) : pattern[i];
/* If subpattern too long, return failure (no match). */
- if (subi >= sizeof(sub) - 1)
+ if (subi >= sizeof(sub) - 1) {
+ free(low_string);
return 0;
+ }
/* If the subpattern was terminated by a comma, skip the comma. */
if (i < len && pattern[i] == ',')
@@ -153,18 +163,20 @@
sub[subi] = '\0';
/* Try to match the subpattern against the string. */
- if (match_pattern(string, sub)) {
- if (negated)
- return -1; /* Negative */
- else
+ if (match_pattern((dolower ? low_string : string), sub)) {
+ if (negated) {
+ got_positive = -1; /* Negative */
+ break;
+ } else
got_positive = 1; /* Positive */
}
}
/*
- * Return success if got a positive match. If there was a negative
- * match, we have already returned -1 and never get here.
+ * Return success if there was a positive match;
+ * return -1 if there was a negative match.
*/
+ free(low_string);
return got_positive;
}
----------------------------------------------------
More information about the openssh-unix-dev
mailing list