Merge branch 'auth'
* auth: fix osdGetRoles oops Add showauth executable getgrouplist() on OSX has different sig. auth fix mingw static fix search PeerInfo PeerInfo in pva/server.h and pva/sharedstate.h make PeerInfo available during search phase auth status void accidental success. minor doc always need to link with netapi32 now authorize with local group lookup Add osdGetRoles() authorization framework pvasr show PeerInfo redo security (aka. access control) remove asCheck # Conflicts: # src/server/pv/responseHandlers.h # src/server/responseHandlers.cpp
This commit is contained in:
@ -11,6 +11,7 @@ USR_CPPFLAGS += -I$(TOP)/src/remoteClient
|
||||
PVACCESS_TEST = $(TOP)/testApp
|
||||
|
||||
PROD_LIBS += pvAccess pvData Com
|
||||
PROD_SYS_LIBS_WIN32 += netapi32 ws2_32
|
||||
|
||||
include $(PVACCESS_TEST)/utils/Makefile
|
||||
include $(PVACCESS_TEST)/remote/Makefile
|
||||
|
@ -10,7 +10,6 @@ TESTS += testChannelAccess
|
||||
TESTPROD_HOST += testCodec
|
||||
testCodec_SRCS = testCodec
|
||||
testHarness_SRCS += testCodec.cpp
|
||||
testCodec_SYS_LIBS_WIN32 += ws2_32
|
||||
TESTS += testCodec
|
||||
|
||||
TESTPROD_HOST += testRPC
|
||||
|
@ -396,13 +396,7 @@ public:
|
||||
|
||||
void aliveNotification() {}
|
||||
|
||||
void authNZMessage(epics::pvData::PVField::shared_pointer const & data) {}
|
||||
|
||||
virtual std::tr1::shared_ptr<SecuritySession> getSecuritySession() const
|
||||
{
|
||||
return std::tr1::shared_ptr<SecuritySession>();
|
||||
}
|
||||
|
||||
void authNZMessage(epics::pvData::PVStructure::shared_pointer const & data) {}
|
||||
|
||||
|
||||
bool isClosed() {
|
||||
|
@ -17,14 +17,11 @@ testInetAddressUtils = testInetAddressUtils.cpp
|
||||
# Avoid errors from inlined htonl() etc. used as template argument
|
||||
# TODO this is gcc only
|
||||
testInetAddressUtils_CXXFLAGS = -O0
|
||||
# needed for 64-bit Windows
|
||||
testInetAddressUtils_SYS_LIBS_WIN32 += ws2_32
|
||||
testHarness_SRCS += testInetAddressUtils.cpp
|
||||
TESTS += testInetAddressUtils
|
||||
|
||||
TESTPROD_HOST += configurationTest
|
||||
configurationTest_SRCS += configurationTest.cpp
|
||||
configurationTest_SYS_LIBS_WIN32 += ws2_32
|
||||
#testHarness_SRCS += configurationTest.cpp
|
||||
TESTS += configurationTest
|
||||
|
||||
@ -36,3 +33,6 @@ TESTPROD_HOST += testWildcard
|
||||
testWildcard = testWildcard.cpp
|
||||
testHarness_SRCS += testWildcard.cpp
|
||||
TESTS += testWildcard
|
||||
|
||||
TESTPROD_HOST += showauth
|
||||
showauth_SRCS += showauth.cpp
|
||||
|
42
testApp/utils/showauth.cpp
Normal file
42
testApp/utils/showauth.cpp
Normal file
@ -0,0 +1,42 @@
|
||||
/**
|
||||
* Copyright - See the COPYRIGHT that is included with this distribution.
|
||||
* pvAccessCPP is distributed subject to a Software License Agreement found
|
||||
* in file LICENSE that is included with this distribution.
|
||||
*/
|
||||
|
||||
#include <vector>
|
||||
#include <stdexcept>
|
||||
#include <iostream>
|
||||
|
||||
#include <osiProcess.h>
|
||||
#include <pv/security.h>
|
||||
|
||||
namespace pva = epics::pvAccess;
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
int ret = 0;
|
||||
try {
|
||||
std::vector<char> name(256u);
|
||||
if(osiGetUserName(&name[0], name.size())!=osiGetUserNameSuccess)
|
||||
throw std::runtime_error("Unable to determine username");
|
||||
|
||||
name[name.size()-1] = '\0';
|
||||
std::cout<<"User: "<<(&name[0])<<"\n";
|
||||
|
||||
pva::PeerInfo::roles_t roles;
|
||||
pva::osdGetRoles(&name[0], roles);
|
||||
|
||||
std::cout<<"Groups: \n";
|
||||
for(pva::PeerInfo::roles_t::const_iterator it(roles.begin()), end(roles.end());
|
||||
it!=end; ++it)
|
||||
{
|
||||
std::cout<<" "<<*it<<"\n";
|
||||
}
|
||||
|
||||
} catch(std::exception& e) {
|
||||
std::cerr<<"Error: "<<e.what()<<"\n";
|
||||
ret = 2;
|
||||
}
|
||||
return ret;
|
||||
}
|
Reference in New Issue
Block a user