summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorkumpf <kumpf>2005-08-03 17:15:14 +0000
committerkumpf <kumpf>2005-08-03 17:15:14 +0000
commit0fcb4cb713bd44deb5eb1ada8ab6a07feb5d3e8c (patch)
tree0104c2b6bd0a99911d0150172951185811974279 /src
parenta2100d50e3dfd86ac96e070485a4bfd8cfe376c8 (diff)
downloadtog-pegasus-0fcb4cb713bd44deb5eb1ada8ab6a07feb5d3e8c.zip
tog-pegasus-0fcb4cb713bd44deb5eb1ada8ab6a07feb5d3e8c.tar.gz
tog-pegasus-0fcb4cb713bd44deb5eb1ada8ab6a07feb5d3e8c.tar.xz
BUG#: 4016
TITLE: CIMObjectPath hostname validation should allow leading '_' character DESCRIPTION: Allow hostnames that begin with a '_' character.
Diffstat (limited to 'src')
-rw-r--r--src/Pegasus/Common/CIMObjectPath.cpp3
-rw-r--r--src/Pegasus/Common/tests/Reference/Reference.cpp22
2 files changed, 10 insertions, 15 deletions
diff --git a/src/Pegasus/Common/CIMObjectPath.cpp b/src/Pegasus/Common/CIMObjectPath.cpp
index 204ed48..493a319 100644
--- a/src/Pegasus/Common/CIMObjectPath.cpp
+++ b/src/Pegasus/Common/CIMObjectPath.cpp
@@ -535,7 +535,8 @@ public:
expectHostSegment = false;
hostSegmentIsNumeric = true; // assume all-numeric host segment
- if (!(isascii(hostname[i]) && isalnum(hostname[i])))
+ if (!(isascii(hostname[i]) &&
+ (isalnum(hostname[i]) || (hostname[i] == '_'))))
{
return false;
}
diff --git a/src/Pegasus/Common/tests/Reference/Reference.cpp b/src/Pegasus/Common/tests/Reference/Reference.cpp
index 93d4cc1..2697e3c 100644
--- a/src/Pegasus/Common/tests/Reference/Reference.cpp
+++ b/src/Pegasus/Common/tests/Reference/Reference.cpp
@@ -207,9 +207,14 @@ void test01()
"TennisPlayer.first=\"Chris\",last=\"Evert\"");
// Hostname with '_' character support checks, see bug#2556.
- CIMObjectPath h18("//a_tp:9999/_root/_cimv25:_TennisPlayer");
- CIMObjectPath h19("//atp_:9999/_root/_cimv25:_TennisPlayer");
- CIMObjectPath h20("//a_t_p_-9:9999/_root/_cimv25:_TennisPlayer");
+ CIMObjectPath h18("//_atp:9999/_root/_cimv25:_TennisPlayer");
+ CIMObjectPath h19("//a_tp/_root/_cimv25:_TennisPlayer");
+ CIMObjectPath h20("//atp_:9999/_root/_cimv25:_TennisPlayer");
+ CIMObjectPath h21("//atp_-9:9999/_root/_cimv25:_TennisPlayer");
+ CIMObjectPath h22(
+ "//_a_t_p_-9.ustA-1-a.org:9999/_root/_cimv25:_TennisPlayer");
+ CIMObjectPath h23("//_/root/cimv25:_TennisPlayer");
+ CIMObjectPath h24("//_______/root/cimv25:_TennisPlayer");
// try IPAddress as hostname which should be good
CIMObjectPath h_ip0("//192.168.1.80:77/root/cimv25:"
@@ -217,18 +222,7 @@ void test01()
CIMObjectPath h_ip1("//192.168.0.255/root/cimv25:"
"TennisPlayer.first=\"Chris\",last=\"Evert\"");
- // Now, try some bad object paths.
Boolean errorDetected = false;
- try
- {
- // first character in hostname is '_' char.
- CIMObjectPath h5("//_a_t_p_-9:9999/_root/_cimv25:_TennisPlayer");
- } catch (const Exception&)
- {
- errorDetected = true;
- }
- assert(errorDetected);
-
errorDetected = false;
try
{