Bugzilla – Attachment 2841 Details for
Bug 2591
ssh-keygen -R is case-sensitive, but should not be
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Proposed patch for ssh-keygen -R case sensitivity bug
match.c.patch (text/plain), 1.65 KB, created by
Griff Miller II
on 2016-06-18 06:48:51 AEST
(
hide
)
Description:
Proposed patch for ssh-keygen -R case sensitivity bug
Filename:
MIME Type:
Creator:
Griff Miller II
Created:
2016-06-18 06:48:51 AEST
Size:
1.65 KB
patch
obsolete
>--- 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; > } >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 2591
: 2841 |
2847
|
2959