This is Unofficial EPICS BASE Doxygen Site
ASCred Struct Reference

#include "pvif.h"

Public Member Functions

void update (const std::tr1::shared_ptr< epics::pvAccess::ChannelRequester > &request)
 

Public Attributes

std::vector< char > user
 
std::vector< char > host
 
std::vector< std::vector< char > > groups
 

Detailed Description

Definition at line 91 of file pvif.h.

Member Function Documentation

void ASCred::update ( const std::tr1::shared_ptr< epics::pvAccess::ChannelRequester > &  request)

Definition at line 72 of file pvif.cpp.

73 {
74  pva::PeerInfo::const_shared_pointer info(req->getPeerInfo());
75  std::string usertemp, hosttemp;
76 
77  if(info && info->identified) {
78  hosttemp = info->peer;
79  if(info->authority=="ca") {
80  usertemp = info->account;
81  size_t sep = usertemp.find_last_of('/');
82  if(sep != std::string::npos) {
83  // prevent CA auth from claiming to be eg. "krb/someone.special"
84  usertemp = usertemp.substr(sep+1);
85  }
86 
87  } else {
88  usertemp = info->authority + "/" + info->account;
89  }
90 
91  const char role[] = "role/";
92 
93  groups.resize(info->roles.size());
94  size_t idx = 0u;
95  for(pva::PeerInfo::roles_t::const_iterator it(info->roles.begin()), end(info->roles.end()); it!=end; ++it, idx++) {
96  groups[idx].resize((*it).size()+sizeof(role)); // sizeof(role) includes trailing nil
97  std::copy(role,
98  role+sizeof(role)-1,
99  groups[idx].begin());
100  std::copy(it->begin(),
101  it->end(),
102  groups[idx].begin()+sizeof(role)-1);
103  groups[idx][groups[idx].size()-1] = '\0';
104  }
105 
106  } else {
107  // legacy and anonymous
108  hosttemp = req->getRequesterName();
109  }
110 
111  // remote names have the form "IP:port"
112  size_t sep = hosttemp.find_first_of(':');
113  if(sep == std::string::npos) {
114  sep = hosttemp.size();
115  }
116  hosttemp.resize(sep);
117 
118  host.resize(hosttemp.size()+1);
119  std::copy(hosttemp.begin(),
120  hosttemp.end(),
121  host.begin());
122  host[hosttemp.size()] = '\0';
123 
124  user.resize(usertemp.size()+1);
125  std::copy(usertemp.begin(),
126  usertemp.end(),
127  user.begin());
128  user[usertemp.size()] = '\0';
129 }
std::vector< char > host
Definition: pvif.h:93
epicsTime begin
Definition: caConnTest.cpp:22
void copy(PVValueArray< T > &pvFrom, size_t fromOffset, size_t fromStride, PVValueArray< T > &pvTo, size_t toOffset, size_t toStride, size_t count)
Copy a subarray from one scalar array to another.
std::vector< std::vector< char > > groups
Definition: pvif.h:94
std::vector< char > user
Definition: pvif.h:93

Member Data Documentation

std::vector<std::vector<char> > ASCred::groups

Definition at line 94 of file pvif.h.

std::vector<char> ASCred::host

Definition at line 93 of file pvif.h.

std::vector<char> ASCred::user

Definition at line 93 of file pvif.h.


The documentation for this struct was generated from the following files: