Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Bug 1342137 - Permit unknown dotted-decimal X500 Principals r=franzis…
…kus,ttaubert RFC 1485 permits principals with OIDs in either "1.2=Name" or "OID.1.2=Name" form. This patch permits such forms, for unknown OIDs. This patch adds disabled tests which should fail, but do not, and need further cleanup. Original patch courtesy of Miklos Vajna. Differential Revision: https://nss-review.dev.mozaws.net/D310 --HG-- extra : rebase_source : c6a736e2bbd0647c7fbae09157a0fb7d26ac6f2a
- Loading branch information
Showing
9 changed files
with
165 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
#! gmake | ||
# | ||
# This Source Code Form is subject to the terms of the Mozilla Public | ||
# License, v. 2.0. If a copy of the MPL was not distributed with this | ||
# file, You can obtain one at http://mozilla.org/MPL/2.0/. | ||
|
||
####################################################################### | ||
# (1) Include initial platform-independent assignments (MANDATORY). # | ||
####################################################################### | ||
|
||
include manifest.mn | ||
|
||
####################################################################### | ||
# (2) Include "global" configuration information. (OPTIONAL) # | ||
####################################################################### | ||
|
||
include $(CORE_DEPTH)/coreconf/config.mk | ||
|
||
####################################################################### | ||
# (3) Include "component" configuration information. (OPTIONAL) # | ||
####################################################################### | ||
|
||
|
||
####################################################################### | ||
# (4) Include "local" platform-dependent assignments (OPTIONAL). # | ||
####################################################################### | ||
|
||
include ../common/gtest.mk | ||
|
||
####################################################################### | ||
# (5) Execute "global" rules. (OPTIONAL) # | ||
####################################################################### | ||
|
||
include $(CORE_DEPTH)/coreconf/rules.mk | ||
|
||
####################################################################### | ||
# (6) Execute "component" rules. (OPTIONAL) # | ||
####################################################################### | ||
|
||
|
||
####################################################################### | ||
# (7) Execute "local" rules. (OPTIONAL). # | ||
####################################################################### |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ | ||
/* vim: set ts=2 et sw=2 tw=80: */ | ||
/* This Source Code Form is subject to the terms of the Mozilla Public | ||
* License, v. 2.0. If a copy of the MPL was not distributed with this file, | ||
* You can obtain one at http://mozilla.org/MPL/2.0/. */ | ||
|
||
#include <stdint.h> | ||
|
||
#include "gtest/gtest.h" | ||
|
||
#include "nss.h" | ||
#include "scoped_ptrs.h" | ||
|
||
namespace nss_test { | ||
|
||
typedef struct AVATestValuesStr { | ||
std::string avaString; | ||
bool expectedResult; | ||
} AVATestValues; | ||
|
||
class Alg1485Test : public ::testing::Test, | ||
public ::testing::WithParamInterface<AVATestValues> {}; | ||
|
||
static const AVATestValues kAVATestStrings[] = { | ||
{"CN=Marshall T. Rose, O=Dover Beach Consulting, L=Santa Clara, " | ||
"ST=California, C=US", | ||
true}, | ||
{"C=HU,L=Budapest,O=Organization,CN=Example - Qualified Citizen " | ||
"CA,2.5.4.97=VATHU-10", | ||
true}, | ||
{"C=HU,L=Budapest,O=Example,CN=Example - Qualified Citizen " | ||
"CA,OID.2.5.4.97=VATHU-10", | ||
true}, | ||
{"CN=Somebody,L=Set,O=Up,C=US,1=The,2=Bomb", true}, | ||
{"OID.2.5.4.6=😑", true}, | ||
{"2.5.4.6=😑", true}, | ||
{"OID.moocow=😑", false}, // OIDs must be numeric | ||
{"3.2=bad", false}, // OIDs cannot be overly large; 3 is too big | ||
{"256.257=bad", false}, // Still too big | ||
{"YO=LO", false}, // Unknown Tag, 'YO' | ||
{"CN=Tester,ZZ=Top", false}, // Unknown tag, 'ZZ' | ||
// These tests are disabled pending Bug 1363416 | ||
// { "01.02.03=Nope", false }, // Numbers not in minimal form | ||
// { "000001.0000000001=👌", false }, | ||
// { "CN=Somebody,L=Set,O=Up,C=US,01=The,02=Bomb", false }, | ||
}; | ||
|
||
TEST_P(Alg1485Test, TryParsingAVAStrings) { | ||
const AVATestValues& param(GetParam()); | ||
|
||
ScopedCERTName certName(CERT_AsciiToName(param.avaString.c_str())); | ||
ASSERT_EQ(certName != nullptr, param.expectedResult); | ||
} | ||
|
||
INSTANTIATE_TEST_CASE_P(ParseAVAStrings, Alg1485Test, | ||
::testing::ValuesIn(kAVATestStrings)); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
# This Source Code Form is subject to the terms of the Mozilla Public | ||
# License, v. 2.0. If a copy of the MPL was not distributed with this | ||
# file, You can obtain one at http://mozilla.org/MPL/2.0/. | ||
{ | ||
'includes': [ | ||
'../../coreconf/config.gypi', | ||
'../common/gtest.gypi', | ||
], | ||
'targets': [ | ||
{ | ||
'target_name': 'certdb_gtest', | ||
'type': 'executable', | ||
'sources': [ | ||
'alg1485_unittest.cc', | ||
'<(DEPTH)/gtests/common/gtests.cc' | ||
], | ||
'dependencies': [ | ||
'<(DEPTH)/exports.gyp:nss_exports', | ||
'<(DEPTH)/gtests/google_test/google_test.gyp:gtest', | ||
'<(DEPTH)/lib/util/util.gyp:nssutil3', | ||
'<(DEPTH)/lib/ssl/ssl.gyp:ssl3', | ||
'<(DEPTH)/lib/nss/nss.gyp:nss3', | ||
] | ||
} | ||
], | ||
'variables': { | ||
'module': 'nss' | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
# | ||
# This Source Code Form is subject to the terms of the Mozilla Public | ||
# License, v. 2.0. If a copy of the MPL was not distributed with this | ||
# file, You can obtain one at http://mozilla.org/MPL/2.0/. | ||
CORE_DEPTH = ../.. | ||
DEPTH = ../.. | ||
MODULE = nss | ||
|
||
CPPSRCS = \ | ||
alg1485_unittest.cc \ | ||
$(NULL) | ||
|
||
INCLUDES += -I$(CORE_DEPTH)/gtests/google_test/gtest/include \ | ||
-I$(CORE_DEPTH)/gtests/common \ | ||
-I$(CORE_DEPTH)/cpputil | ||
|
||
REQUIRES = nspr nss libdbm gtest | ||
|
||
PROGRAM = certdb_gtest | ||
|
||
EXTRA_LIBS = $(DIST)/lib/$(LIB_PREFIX)gtest.$(LIB_SUFFIX) $(EXTRA_OBJS) \ | ||
../common/$(OBJDIR)/gtests$(OBJ_SUFFIX) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,6 +8,7 @@ DEPTH = .. | |
DIRS = \ | ||
google_test \ | ||
common \ | ||
certdb_gtest \ | ||
certhigh_gtest \ | ||
der_gtest \ | ||
util_gtest \ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters