OLD | NEW |
1 /* This Source Code Form is subject to the terms of the Mozilla Public | 1 /* This Source Code Form is subject to the terms of the Mozilla Public |
2 * License, v. 2.0. If a copy of the MPL was not distributed with this | 2 * License, v. 2.0. If a copy of the MPL was not distributed with this |
3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ | 3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
4 #include "nspr.h" | 4 #include "nspr.h" |
5 #include "secerr.h" | 5 #include "secerr.h" |
6 #include "secasn1.h" | 6 #include "secasn1.h" |
7 #include "seccomon.h" | 7 #include "seccomon.h" |
8 #include "pk11func.h" | 8 #include "pk11func.h" |
9 #include "certdb.h" | 9 #include "certdb.h" |
10 #include "certt.h" | 10 #include "certt.h" |
11 #include "cert.h" | 11 #include "cert.h" |
12 #include "certxutl.h" | 12 #include "certxutl.h" |
13 | 13 |
14 #include "nsspki.h" | 14 #include "nsspki.h" |
15 #include "pki.h" | 15 #include "pki.h" |
16 #include "pkit.h" | 16 #include "pkit.h" |
17 #include "pkitm.h" | 17 #include "pkitm.h" |
18 #include "pki3hack.h" | 18 #include "pki3hack.h" |
19 | 19 |
20 | 20 |
21 PRBool | 21 PRBool |
22 CERT_MatchNickname(char *name1, char *name2) { | 22 CERT_MatchNickname(char *name1, char *name2) { |
23 char *nickname1= NULL; | 23 char *nickname1= NULL; |
24 char *nickname2 = NULL; | 24 char *nickname2 = NULL; |
25 char *token1; | 25 char *token1; |
26 char *token2; | 26 char *token2; |
27 char *token = NULL; | |
28 int len; | |
29 | 27 |
30 /* first deal with the straight comparison */ | 28 /* first deal with the straight comparison */ |
31 if (PORT_Strcmp(name1, name2) == 0) { | 29 if (PORT_Strcmp(name1, name2) == 0) { |
32 return PR_TRUE; | 30 return PR_TRUE; |
33 } | 31 } |
34 /* we need to handle the case where one name has an explicit token and the o
ther | 32 /* we need to handle the case where one name has an explicit token and the o
ther |
35 * doesn't */ | 33 * doesn't */ |
36 token1 = PORT_Strchr(name1,':'); | 34 token1 = PORT_Strchr(name1,':'); |
37 token2 = PORT_Strchr(name2,':'); | 35 token2 = PORT_Strchr(name2,':'); |
38 if ((token1 && token2) || (!token1 && !token2)) { | 36 if ((token1 && token2) || (!token1 && !token2)) { |
39 /* either both token names are specified or neither are, not match */ | 37 /* either both token names are specified or neither are, not match */ |
40 return PR_FALSE; | 38 return PR_FALSE; |
41 } | 39 } |
42 if (token1) { | 40 if (token1) { |
43 token=name1; | |
44 nickname1=token1; | 41 nickname1=token1; |
45 nickname2=name2; | 42 nickname2=name2; |
46 } else { | 43 } else { |
47 token=name2; | |
48 nickname1=token2; | 44 nickname1=token2; |
49 nickname2=name1; | 45 nickname2=name1; |
50 } | 46 } |
51 len = nickname1-token; | |
52 nickname1++; | 47 nickname1++; |
53 if (PORT_Strcmp(nickname1,nickname2) != 0) { | 48 if (PORT_Strcmp(nickname1,nickname2) != 0) { |
54 return PR_FALSE; | 49 return PR_FALSE; |
55 } | 50 } |
56 /* compare the other token with the internal slot here */ | 51 /* Bug 1192443 - compare the other token with the internal slot here */ |
57 return PR_TRUE; | 52 return PR_TRUE; |
58 } | 53 } |
59 | 54 |
60 /* | 55 /* |
61 * Find all user certificates that match the given criteria. | 56 * Find all user certificates that match the given criteria. |
62 * | 57 * |
63 * "handle" - database to search | 58 * "handle" - database to search |
64 * "usage" - certificate usage to match | 59 * "usage" - certificate usage to match |
65 * "oneCertPerName" - if set then only return the "best" cert per | 60 * "oneCertPerName" - if set then only return the "best" cert per |
66 * name | 61 * name |
(...skipping 1117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1184 } | 1179 } |
1185 return NULL; | 1180 return NULL; |
1186 } | 1181 } |
1187 | 1182 |
1188 void | 1183 void |
1189 CERT_DestroyCertificateList(CERTCertificateList *list) | 1184 CERT_DestroyCertificateList(CERTCertificateList *list) |
1190 { | 1185 { |
1191 PORT_FreeArena(list->arena, PR_FALSE); | 1186 PORT_FreeArena(list->arena, PR_FALSE); |
1192 } | 1187 } |
1193 | 1188 |
OLD | NEW |