principal usage

Sai-Lai Lo S.Lo@orl.co.uk
Mon, 6 Oct 1997 18:06:27 +0100


>>>>> Renzo Tomaselli writes:

> I need suggestions from the OmniORB implementors. I need to identify the
> principal as the method invocation responsible. As far as I can see
> BOA::get_principal is unimplemented yet; however the client ORB initializes
> its own per-process principal as "nobody" and as such it should be
> transferred to the server as part of IIOP messaging. So I would like to
> apply the following changes to OmniORB:
> 1. Implementing get_principal in order to fetch the above value at server
> level.
> 2. Adding some way to set that value at client level; to my knowledge this
> issue is uncovered by OMG core specs, excluding COSS security concerns. So
> this point would need a non standard, dirty addition to the ORB
> functionalities.

I wouldn't recommend doing anything more to support the BOA API
because it is quite broken. In particular, the get_prinicpal() call is not
designed to be used in a multi-threaded ORB. Because there are potentially
multiple concurrent upcalls from different clients into the same object
implementation, there is no way in the get_principal() call to specify
which client (server thread) to get the principal ID from.

Things are much improved with the POA spec as there is a Current object
which can be called to fetch the information related to the calling
thread. I'm going to address this issue when I start working on a POA
implementation. 

In the meantime, I suggest you extract the principal ID from the GIOP
request and attached it to a per-thread data structure. Then implement your
own  get_current() to get to the per-thread data structure of the calling
thread and get the principal ID from there. 

Have a look at GIOP_S::HandleRequest() (src/lib/omniORB2/giopServer.cc), 
that is where the principal ID is extracted from a GIOP message.

The global variable omni::myPrincipalID (type sequence<octet>) is the
principal ID that is inserted into all outgoing GIOP requests.


Regards,

Sai-Lai

-- 
E-mail:         S.Lo@orl.co.uk          |       Olivetti & Oracle Research Lab
                                        |       24a Trumpington Street
Tel:            +44 223 343000          |       Cambridge CB2 1QA
Fax:            +44 223 313542          |       ENGLAND