xrootd
XrdSecProtocolsss.hh
Go to the documentation of this file.
1 #ifndef _SECPROTOCOLSSS_
2 #define _SECPROTOCOLSSS_
3 /******************************************************************************/
4 /* */
5 /* X r d S e c P r o t o c o l s s s . h h */
6 /* */
7 /* (c) 2008 by the Board of Trustees of the Leland Stanford, Jr., University */
8 /* All Rights Reserved */
9 /* Produced by Andrew Hanushevsky for Stanford University under contract */
10 /* DE-AC02-76-SFO0515 with the Department of Energy */
11 /* */
12 /* This file is part of the XRootD software suite. */
13 /* */
14 /* XRootD is free software: you can redistribute it and/or modify it under */
15 /* the terms of the GNU Lesser General Public License as published by the */
16 /* Free Software Foundation, either version 3 of the License, or (at your */
17 /* option) any later version. */
18 /* */
19 /* XRootD is distributed in the hope that it will be useful, but WITHOUT */
20 /* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or */
21 /* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public */
22 /* License for more details. */
23 /* */
24 /* You should have received a copy of the GNU Lesser General Public License */
25 /* along with XRootD in a file called COPYING.LESSER (LGPL license) and file */
26 /* COPYING (GPL license). If not, see <http://www.gnu.org/licenses/>. */
27 /* */
28 /* The copyright holder's institutional names and contributor's names may not */
29 /* be used to endorse or promote products derived from this software without */
30 /* specific prior written permission of the institution or contributor. */
31 /******************************************************************************/
32 
34 #include "XrdNet/XrdNetAddrInfo.hh"
36 #include "XrdSecsss/XrdSecsssID.hh"
37 #include "XrdSecsss/XrdSecsssKT.hh"
38 #include "XrdSecsss/XrdSecsssRR.hh"
39 
40 class XrdOucErrInfo;
41 
42 struct XrdSecsssEnt;
43 
45 {
46 public:
47 friend class XrdSecProtocolDummy; // Avoid stupid gcc warnings about destructor
48 
49 
51  XrdSecParameters **parms,
52  XrdOucErrInfo *einfo=0);
53 
54  void Delete();
55 
56 static int eMsg(const char *epn, int rc, const char *txt1,
57  const char *txt2=0, const char *txt3=0,
58  const char *txt4=0);
59 
60 static int Fatal(XrdOucErrInfo *erP, const char *epn, int rc,
61  const char *etxt);
62 
64  XrdOucErrInfo *einfo=0);
65 
66  int Init_Client(XrdOucErrInfo *erp, const char *Parms);
67 
68  int Init_Server(XrdOucErrInfo *erp, const char *Parms);
69 
70 static char *Load_Client(XrdOucErrInfo *erp, const char *Parms);
71 
72 static char *Load_Server(XrdOucErrInfo *erp, const char *Parms);
73 
74  XrdSecProtocolsss(const char *hname, XrdNetAddrInfo &endPoint)
75  : XrdSecProtocol("sss"),
76  keyTab(0), Crypto(0), idBuff(0), dataOpts(0),
77  Sequence(0), v2EndPnt(false)
78  {urName = strdup(hname); setIP(endPoint);}
79 
80 struct Crypto {const char *cName; char cType;};
81 
82 private:
83  ~XrdSecProtocolsss() {} // Delete() does it all
84 
86  char *iBuff, XrdSecsssRR_DataHdr *rrDHdr, int iSize);
88  XrdSecsssRR_Hdr *rrHdr, XrdSecsssRR_DataHdr *rrDHdr,
89  int dLen);
90 
92  const char *, const char *);
94  const char *, const char *, XrdSecParameters *);
95 
96 char *getLID(char *buff, int blen);
97 static
98 XrdCryptoLite *Load_Crypto(XrdOucErrInfo *erp, const char *eN);
99 static
101 int myClock();
102 char *setID(char *id, char **idP);
103 void setIP(XrdNetAddrInfo &endPoint);
104 
105 static struct Crypto CryptoTab[];
106 
107  char *urName;
108  char urIP[48]; // New format
109  char urIQ[48]; // Old format
110 static int deltaTime;
111 static bool isMutual;
112 static bool isMapped;
113 static bool ktFixed;
115 
116 static XrdSecsssKT *ktObject; // Both: Default Key Table object
117  XrdSecsssKT *keyTab; // Both: Active Key Table
118 
119 static XrdCryptoLite *CryptObj; // Both: Default Cryptogrophy object
120  XrdCryptoLite *Crypto; // Both: Active Cryptogrophy object
121 
122 static XrdSecsssID *idMap; // Client: Registry
123 static char *aProts; // Server: Allowable cloned auth protocols
124  char *idBuff; // Server: Underlying buffer for XrdSecEntity
125 static XrdSecsssEnt *staticID; // Client: Static identity
126  int dataOpts; // Client: idMap Find() options
127  char Sequence; // Client: Check for sequencing
128  bool v2EndPnt; // Server: Client is version 2
129  // Client: Server is version 2
130 };
131 #endif
XrdSecInterface.hh
XrdSecProtocolsss::getCred
int getCred(XrdOucErrInfo *, XrdSecsssRR_DataHdr *&, const char *, const char *, XrdSecParameters *)
XrdSecProtocolsss::Load_Crypto
static XrdCryptoLite * Load_Crypto(XrdOucErrInfo *erp, const char *eN)
XrdSecProtocolsss::aProts
static char * aProts
Definition: XrdSecProtocolsss.hh:123
XrdSecProtocolsss::ktObject
static XrdSecsssKT * ktObject
Definition: XrdSecProtocolsss.hh:116
XrdSecsssKT::ktEnt
Definition: XrdSecsssKT.hh:45
XrdSecsssEnt
Definition: XrdSecsssEnt.hh:43
XrdSecProtocolsss::Load_Crypto
static XrdCryptoLite * Load_Crypto(XrdOucErrInfo *erp, const char eT)
XrdSecProtocolsss::Crypto
Definition: XrdSecProtocolsss.hh:80
XrdSecProtocolsss::urIP
char urIP[48]
Definition: XrdSecProtocolsss.hh:108
XrdSecProtocolsss::Init_Server
int Init_Server(XrdOucErrInfo *erp, const char *Parms)
XrdSecProtocolsss::Sequence
char Sequence
Definition: XrdSecProtocolsss.hh:127
XrdSecProtocolsss::Init_Client
int Init_Client(XrdOucErrInfo *erp, const char *Parms)
XrdSecsssRR_Hdr
Definition: XrdSecsssRR.hh:42
XrdSecProtocolsss::getCred
int getCred(XrdOucErrInfo *, XrdSecsssRR_DataHdr *&, const char *, const char *)
XrdSecProtocolsss::eMsg
static int eMsg(const char *epn, int rc, const char *txt1, const char *txt2=0, const char *txt3=0, const char *txt4=0)
XrdNetAddrInfo
Definition: XrdNetAddrInfo.hh:54
XrdSecProtocolsss::urIQ
char urIQ[48]
Definition: XrdSecProtocolsss.hh:109
XrdSecProtocolsss::getCredentials
XrdSecCredentials * getCredentials(XrdSecParameters *parms=0, XrdOucErrInfo *einfo=0)
XrdNetAddrInfo.hh
XrdSecProtocolsss::dataOpts
int dataOpts
Definition: XrdSecProtocolsss.hh:126
XrdSecProtocolsss::Decode
int Decode(XrdOucErrInfo *error, XrdSecsssKT::ktEnt &decKey, char *iBuff, XrdSecsssRR_DataHdr *rrDHdr, int iSize)
XrdSecProtocolsss::v2EndPnt
bool v2EndPnt
Definition: XrdSecProtocolsss.hh:128
XrdSecProtocolsss::staticID
static XrdSecsssEnt * staticID
Definition: XrdSecProtocolsss.hh:125
XrdSecProtocolsss::isMutual
static bool isMutual
Definition: XrdSecProtocolsss.hh:111
XrdSecProtocolsss::CryptObj
static XrdCryptoLite * CryptObj
Definition: XrdSecProtocolsss.hh:119
XrdCryptoLite.hh
XrdSecProtocolsss::Load_Server
static char * Load_Server(XrdOucErrInfo *erp, const char *Parms)
XrdSecProtocolsss::Authenticate
int Authenticate(XrdSecCredentials *cred, XrdSecParameters **parms, XrdOucErrInfo *einfo=0)
XrdSecProtocolsss::Crypto::cName
const char * cName
Definition: XrdSecProtocolsss.hh:80
XrdSecProtocolsss::CryptoTab
static struct Crypto CryptoTab[]
Definition: XrdSecProtocolsss.hh:105
XrdSecProtocolsss::epAddr
XrdNetAddrInfo * epAddr
Definition: XrdSecProtocolsss.hh:114
XrdSecProtocolsss::Crypto::cType
char cType
Definition: XrdSecProtocolsss.hh:80
XrdSecProtocolsss::deltaTime
static int deltaTime
Definition: XrdSecProtocolsss.hh:110
XrdSecProtocolsss::myClock
int myClock()
XrdSecProtocolsss::~XrdSecProtocolsss
~XrdSecProtocolsss()
Definition: XrdSecProtocolsss.hh:83
XrdSecProtocolsss::Delete
void Delete()
Delete the protocol object. DO NOT use C++ delete() on this object.
XrdSecsssID.hh
XrdSecProtocolsss::XrdSecProtocolDummy
friend class XrdSecProtocolDummy
Definition: XrdSecProtocolsss.hh:47
XrdSecProtocolsss::ktFixed
static bool ktFixed
Definition: XrdSecProtocolsss.hh:113
XrdSecProtocolsss::keyTab
XrdSecsssKT * keyTab
Definition: XrdSecProtocolsss.hh:117
XrdSecsssKT
Definition: XrdSecsssKT.hh:41
XrdSecsssRR.hh
XrdSecBuffer
Generic structure to pass security information back and forth.
Definition: XrdSecInterface.hh:51
XrdSecsssID
Definition: XrdSecsssID.hh:54
XrdSecProtocolsss::idBuff
char * idBuff
Definition: XrdSecProtocolsss.hh:124
XrdSecProtocolsss::Encode
XrdSecCredentials * Encode(XrdOucErrInfo *error, XrdSecsssKT::ktEnt &encKey, XrdSecsssRR_Hdr *rrHdr, XrdSecsssRR_DataHdr *rrDHdr, int dLen)
XrdSecProtocol
Definition: XrdSecInterface.hh:131
XrdSecProtocolsss::urName
char * urName
Definition: XrdSecProtocolsss.hh:107
XrdSecProtocolsss::Fatal
static int Fatal(XrdOucErrInfo *erP, const char *epn, int rc, const char *etxt)
XrdSecProtocolsss::Crypto
XrdCryptoLite * Crypto
Definition: XrdSecProtocolsss.hh:120
XrdSecProtocolsss::idMap
static XrdSecsssID * idMap
Definition: XrdSecProtocolsss.hh:122
XrdSecProtocolsss
Definition: XrdSecProtocolsss.hh:45
XrdSecsssKT.hh
XrdSecProtocolsss::isMapped
static bool isMapped
Definition: XrdSecProtocolsss.hh:112
XrdOucErrInfo
Definition: XrdOucErrInfo.hh:99
XrdCryptoLite
Definition: XrdCryptoLite.hh:40
XrdSecProtocolsss::getLID
char * getLID(char *buff, int blen)
XrdSecProtocolsss::setIP
void setIP(XrdNetAddrInfo &endPoint)
XrdSecsssRR_DataHdr
Definition: XrdSecsssRR.hh:66
XrdSecProtocolsss::Load_Client
static char * Load_Client(XrdOucErrInfo *erp, const char *Parms)
XrdSecProtocolsss::XrdSecProtocolsss
XrdSecProtocolsss(const char *hname, XrdNetAddrInfo &endPoint)
Definition: XrdSecProtocolsss.hh:74
XrdSecProtocolsss::setID
char * setID(char *id, char **idP)