[Bug fix: omniORB2 rejects IOR with zero length object key][Resent]
Sai-Lai Lo
S.Lo@orl.co.uk
Mon, 16 Mar 1998 10:33:31 GMT
Looks like my previous message have vanished. Here is a repost.
>>>>> Stiehl, Harald writes:
> Since I'm in the process of beta testing Sybase's JaguarCTS, I've tried
> to connect a omniORB client to a Jaguar component via IIOP and the
> stringified IOR.
> The problem is, it fails and my feeling is, that it is related to the
> way omniORB interprets IORs.
> The reason catior does not accept the IOR is the empty object key - I
> guess, however Sybase tells me that this is valid.
> Any comments, hints, suggestions.
You observation is correct. Although it is strange to have a zero length
key, omniORB2 should not reject such an IOR. The following patch against
2.5.0 should fix the problem:
------------------------------------------------------------------------
*** src/lib/omniORB2/tcpSocket.cc Fri Mar 13 17:23:57 1998
--- newsrc/lib/omniORB2/tcpSocket.cc Fri Mar 13 17:19:35 1998
***************
*** 168,176 ****
begin = (end + 3) & ~(3);
// profile.profile_data[begin] object key length
end = begin + 4;
! if (profile.profile_data.length() <= end)
throw CORBA::MARSHAL(0,CORBA::COMPLETED_NO);
! {
CORBA::ULong len;
if (!byteswap) {
len = ((CORBA::ULong &) profile.profile_data[begin]);
--- 168,181 ----
begin = (end + 3) & ~(3);
// profile.profile_data[begin] object key length
end = begin + 4;
! if (profile.profile_data.length() < end)
throw CORBA::MARSHAL(0,CORBA::COMPLETED_NO);
!
! if (profile.profile_data.length() == end) {
! objkeysize = 0;
! objkey = new CORBA::Octet[1];
! }
! else {
CORBA::ULong len;
if (!byteswap) {
len = ((CORBA::ULong &) profile.profile_data[begin]);
***************
*** 187,195 ****
// extract object key
objkeysize = len;
}
- objkey = new CORBA::Octet[objkeysize];
- memcpy((void *)objkey,(void *)&(profile.profile_data[begin]),objkeysize);
addr = new tcpSocketEndpoint(host,port);
return 1;
}
--- 192,200 ----
// extract object key
objkeysize = len;
+ objkey = new CORBA::Octet[objkeysize];
+ memcpy((void *)objkey,(void *)&(profile.profile_data[begin]),objkeysize);
}
addr = new tcpSocketEndpoint(host,port);
return 1;
}
***************
*** 237,245 ****
CORBA::ULong &l = (CORBA::ULong &) profile.profile_data[idx];
l = objkeysize;
}
! idx += 4;
! memcpy((void *)&profile.profile_data[idx],
! (void *)objkey,objkeysize);
}
--- 242,252 ----
CORBA::ULong &l = (CORBA::ULong &) profile.profile_data[idx];
l = objkeysize;
}
! if (objkeysize) {
! idx += 4;
! memcpy((void *)&profile.profile_data[idx],
! (void *)objkey,objkeysize);
! }
}
*** src/appl/utils/catior/catior.cc Tue Jan 20 19:51:01 1998
--- newsrc/appl/utils/catior/catior.cc Fri Mar 13 17:35:42 1998
***************
*** 195,203 ****
begin = (end + 3) & ~(3);
// s[begin] object key length
end = begin + 4;
! if (s.length() <= end)
throw CORBA::MARSHAL(0,CORBA::COMPLETED_NO);
! {
CORBA::ULong len;
if (!byteswap) {
len = ((CORBA::ULong &) s[begin]);
--- 195,207 ----
begin = (end + 3) & ~(3);
// s[begin] object key length
end = begin + 4;
! if (s.length() < end)
throw CORBA::MARSHAL(0,CORBA::COMPLETED_NO);
!
! if (s.length() == end) {
! p.object_key.length(0);
! }
! else {
CORBA::ULong len;
if (!byteswap) {
len = ((CORBA::ULong &) s[begin]);
***************
*** 362,369 ****
cerr << "Exception while processing stringified IOR." << endl;
return -1;
}
-
-
delete[] repoID;
delete profiles;
--- 366,371 ----