Channel access security is better achieved by usnig the EPICS access
security API. If you follow that path, at some point in your pcas code
you will call asAddClient(&client, member, asl, pUserName, pHostName),
to which you pass the pUserName and pHostName, as illustrated bellow:
casChannel *exPV::createChannel (const casCtx &ctx,
const char * const pUserName, const char * const pHostName)
{
...
exChannel *pCH = new exChannel(ctx, pUserName, pHostName);
...
}
exChannel::exChannel(const casCtx &ctx, const char* user, const char*
host) : casChannel(ctx)
{
...
long status = asAddClient(&client, member, asl, const_cast<char*> (user),
const_cast<char*> (host));
...
}
bool exChannel::readAccess () const
{
return asCheckGet(client);
}
bool exChannel::writeAccess () const
{
return asCheckPut(client);
}
You will use the access security configuration file to control the
channel access. You may want to refer to the Access Security chapter of
the EPICS Application Developer's Guide for detailed information about
the access security API.
Hope this helps.
Best regards,
William
张玉亮 wrote:
> Hi all,
> Here is my question. I want to add access control to my PCAS, but I do
> not know what the pUserName and pHostName in the following function
> refer to clearly.
> virtual casChannel *createChannel ( const casCtx &ctx,const char *
> const pUserName,const char * const pHostName);
> In "Channel Access Protable Server API Tutorial" it said that points
> to a string representing the user's name and pHostName points to a
> string representing the server tool's host. For example, I have two
> EDM clients application run on the same linux PC, does the user's name
> refer to the PC name or something else.
> I have implemented the createChannel function and writeAccess function
> like this:
> casChannel *exPV::createChannel ( const casCtx &ctx,
> const char * const /*pUserName*/,
> const char * const /*pHostName*/)
> {
> return new exChannel ( ctx,"zhangyul","Administrator");
> }
> ///////////////////////////////////////////////////////////////////
> bool exChannel::writeAccess () const
> {
> if (strcmp(User.string(), "zhangyul") == 0)
> return aitFalse;
> else
> return aitTrue;
> }
> However, I found that any client could not write the PCAS's PV, I
> think my understanding is totally wrong about user's name and the host
> name!!
> Thank you!
> Zhang Yuliang
--
Weiwei Lu
757-269-7476
[email protected]
- References:
- About PCAS Access Control 张玉亮
- Navigate by Date:
- Prev:
Re: asyn re-connect problem Benjamin Franksen
- Next:
24-bit DAC Eric Berryman
- Index:
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
<2010>
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
- Navigate by Thread:
- Prev:
About PCAS Access Control 张玉亮
- Next:
RE: About PCAS Access Control Jeff Hill
- Index:
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
<2010>
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
|