summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--TAO/ChangeLog13
-rw-r--r--TAO/tao/Object_KeyC.cpp22
-rw-r--r--TAO/tao/Object_KeyC.h1
3 files changed, 33 insertions, 3 deletions
diff --git a/TAO/ChangeLog b/TAO/ChangeLog
index 0d04ee1a054..f60e71509c3 100644
--- a/TAO/ChangeLog
+++ b/TAO/ChangeLog
@@ -1,3 +1,16 @@
+Fri Aug 01 14:37:23 2003 Simon McQueen <sm@prismtechnologies.com>
+
+ * tao/Object_KeyC.h:
+ * tao/Object_KeyC.cpp:
+
+ Changed tao_encode_sequence_to_string and
+ decode_string_to_sequence methods to use '%' instead of '\'
+ for escaping. Restricted unescaped characters to those
+ permitted in a URI by RFC 2396.
+
+ Thanks to Dan Halbert <halbert@bbn.com> for reporting the
+ problem. This closes Bug #1330.
+
Fri Aug 1 13:07:12 UTC 2003 Johnny Willemsen <jwillemsen@remedy.nl>
* orbsvcs/orbsvcs/Event/EC_Gateway_IIOP.{h,cpp}:
diff --git a/TAO/tao/Object_KeyC.cpp b/TAO/tao/Object_KeyC.cpp
index f5b45a666c5..957f43bb2b3 100644
--- a/TAO/tao/Object_KeyC.cpp
+++ b/TAO/tao/Object_KeyC.cpp
@@ -118,13 +118,13 @@ TAO::ObjectKey::encode_sequence_to_string (char * &str,
// here.
#undef byte
u_char byte = seq[i];
- if (isprint (byte) && byte != '\\')
+ if (is_legal (byte))
{
*cp++ = (char) byte;
continue;
}
- *cp++ = '\\';
+ *cp++ = '%';
*cp++ = ACE::nibble2hex ((byte >> 4) & 0x0f);
*cp++ = ACE::nibble2hex (byte & 0x0f);
}
@@ -132,6 +132,22 @@ TAO::ObjectKey::encode_sequence_to_string (char * &str,
*cp = '\0';
}
+int TAO::ObjectKey::is_legal (u_char & c)
+{
+ if (isalnum(c))
+ {
+ return 1;
+ }
+ else
+ {
+ return ( c == ';' || c == '/' ||c == ':' || c == '?' ||
+ c == '@' || c == '&' ||c == '=' || c == '+' ||
+ c == '$' || c == ',' ||c == '_' || c == '.' ||
+ c == '!' || c == '~' ||c == '*' || c == '\'' ||
+ c == '-' || c == '(' || c == ')' );
+ }
+}
+
void
TAO::ObjectKey::decode_string_to_sequence (TAO_Unbounded_Sequence<CORBA::Octet> &seq,
const char *str)
@@ -156,7 +172,7 @@ TAO::ObjectKey::decode_string_to_sequence (TAO_Unbounded_Sequence<CORBA::Octet>
cp < eos && i < seq.length ();
i++)
{
- if (*cp == '\\')
+ if (*cp == '%')
{
// This is an escaped non-printable,
// so we decode the hex values into
diff --git a/TAO/tao/Object_KeyC.h b/TAO/tao/Object_KeyC.h
index 044bb42b81b..de9292253d3 100644
--- a/TAO/tao/Object_KeyC.h
+++ b/TAO/tao/Object_KeyC.h
@@ -131,6 +131,7 @@ TAO_NAMESPACE TAO
TAO_Unbounded_Sequence<CORBA::Octet> &seq,
const char *str
);
+ static int is_legal (u_char & c);
};