xrootd
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
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 
43 {
44 public:
45 friend class XrdSecProtocolDummy; // Avoid stupid gcc warnings about destructor
46 
47 
49  XrdSecParameters **parms,
50  XrdOucErrInfo *einfo=0);
51 
52  void Delete();
53 
54 static int eMsg(const char *epn, int rc, const char *txt1,
55  const char *txt2=0, const char *txt3=0,
56  const char *txt4=0);
57 
58 static int Fatal(XrdOucErrInfo *erP, const char *epn, int rc,
59  const char *etxt);
60 
62  XrdOucErrInfo *einfo=0);
63 
64  int Init_Client(XrdOucErrInfo *erp, const char *Parms);
65 
66  int Init_Server(XrdOucErrInfo *erp, const char *Parms);
67 
68 static char *Load_Client(XrdOucErrInfo *erp, const char *Parms);
69 
70 static char *Load_Server(XrdOucErrInfo *erp, const char *Parms);
71 
72 static void setOpts(int opts) {options = opts;}
73 
74  XrdSecProtocolsss(const char *hname, XrdNetAddrInfo &endPoint)
75  : XrdSecProtocol("sss"),
76  keyTab(0), Crypto(0), idBuff(0), Sequence(0)
77  {urName = strdup(hname); setIP(endPoint);}
78 
79 struct Crypto {const char *cName; char cType;};
80 
81 private:
82  ~XrdSecProtocolsss() {} // Delete() does it all
83 
84 int Decode(XrdOucErrInfo *error, XrdSecsssKT::ktEnt &decKey,
85  char *iBuff, XrdSecsssRR_Data *rrData, int iSize);
87  XrdSecsssRR_Hdr *rrHdr, XrdSecsssRR_Data *rrData,
88  int dLen);
91 char *getLID(char *buff, int blen);
92 static
93 XrdCryptoLite *Load_Crypto(XrdOucErrInfo *erp, const char *eN);
94 static
95 XrdCryptoLite *Load_Crypto(XrdOucErrInfo *erp, const char eT);
96 int myClock();
97 char *setID(char *id, char **idP);
98 void setIP(XrdNetAddrInfo &endPoint);
99 
100 static struct Crypto CryptoTab[];
101 
102 static const char *myName;
103 static int myNLen;
104  char *urName;
105  char urIP[48]; // New format
106  char urIQ[48]; // Old format
107 static int options;
108 static int isMutual;
109 static int deltaTime;
110 static int ktFixed;
112 
113 static XrdSecsssKT *ktObject; // Both: Default Key Table object
114  XrdSecsssKT *keyTab; // Both: Active Key Table
115 
116 static XrdCryptoLite *CryptObj; // Both: Default Cryptogrophy object
117  XrdCryptoLite *Crypto; // Both: Active Cryptogrophy object
118 
119 static XrdSecsssID *idMap; // Client: Registry
120  char *idBuff; // Server: Underlying buffer for XrdSecEntity
121 static char *staticID; // Client: Static identity
122 static int staticIDsz;// Client: Static identity length
123  int Sequence; // Client: Check for sequencing
124 };
125 #endif
int Init_Server(XrdOucErrInfo *erp, const char *Parms)
Definition: XrdSecsssRR.hh:38
char cType
Definition: XrdSecProtocolsss.hh:79
Definition: XrdSecProtocolsss.hh:42
Definition: XrdSecProtocolsss.hh:79
char * setID(char *id, char **idP)
static char * staticID
Definition: XrdSecProtocolsss.hh:121
static void setOpts(int opts)
Definition: XrdSecProtocolsss.hh:72
Definition: XrdSecInterface.hh:130
static int Fatal(XrdOucErrInfo *erP, const char *epn, int rc, const char *etxt)
static int isMutual
Definition: XrdSecProtocolsss.hh:108
XrdSecProtocolsss(const char *hname, XrdNetAddrInfo &endPoint)
Definition: XrdSecProtocolsss.hh:74
char * getLID(char *buff, int blen)
void setIP(XrdNetAddrInfo &endPoint)
static int ktFixed
Definition: XrdSecProtocolsss.hh:110
static XrdSecsssID * idMap
Definition: XrdSecProtocolsss.hh:119
char * urName
Definition: XrdSecProtocolsss.hh:104
char urIQ[48]
Definition: XrdSecProtocolsss.hh:106
static int options
Definition: XrdSecProtocolsss.hh:107
char urIP[48]
Definition: XrdSecProtocolsss.hh:105
static const char * myName
Definition: XrdSecProtocolsss.hh:102
static char * Load_Client(XrdOucErrInfo *erp, const char *Parms)
Definition: XrdSecsssKT.hh:40
static int deltaTime
Definition: XrdSecProtocolsss.hh:109
static int eMsg(const char *epn, int rc, const char *txt1, const char *txt2=0, const char *txt3=0, const char *txt4=0)
Definition: XrdSecsssRR.hh:51
Definition: XrdSecsssID.hh:56
Definition: XrdOucErrInfo.hh:99
static int myNLen
Definition: XrdSecProtocolsss.hh:103
XrdSecCredentials * Encode(XrdOucErrInfo *error, XrdSecsssKT::ktEnt &encKey, XrdSecsssRR_Hdr *rrHdr, XrdSecsssRR_Data *rrData, int dLen)
friend class XrdSecProtocolDummy
Definition: XrdSecProtocolsss.hh:45
int Authenticate(XrdSecCredentials *cred, XrdSecParameters **parms, XrdOucErrInfo *einfo=0)
static XrdCryptoLite * Load_Crypto(XrdOucErrInfo *erp, const char *eN)
XrdSecCredentials * getCredentials(XrdSecParameters *parms=0, XrdOucErrInfo *einfo=0)
static struct Crypto CryptoTab[]
Definition: XrdSecProtocolsss.hh:100
Definition: XrdNetAddrInfo.hh:53
int Init_Client(XrdOucErrInfo *erp, const char *Parms)
char * idBuff
Definition: XrdSecProtocolsss.hh:120
Definition: XrdSecsssKT.hh:44
XrdNetAddrInfo epAddr
Definition: XrdSecProtocolsss.hh:111
XrdSecsssKT * keyTab
Definition: XrdSecProtocolsss.hh:114
~XrdSecProtocolsss()
Definition: XrdSecProtocolsss.hh:82
static XrdSecsssKT * ktObject
Definition: XrdSecProtocolsss.hh:113
void Delete()
Delete the protocol object. DO NOT use C++ delete() on this object.
static int staticIDsz
Definition: XrdSecProtocolsss.hh:122
int Decode(XrdOucErrInfo *error, XrdSecsssKT::ktEnt &decKey, char *iBuff, XrdSecsssRR_Data *rrData, int iSize)
static XrdCryptoLite * CryptObj
Definition: XrdSecProtocolsss.hh:116
int Sequence
Definition: XrdSecProtocolsss.hh:123
Generic structure to pass security information back and forth.
Definition: XrdSecInterface.hh:50
static char * Load_Server(XrdOucErrInfo *erp, const char *Parms)
int getCred(XrdOucErrInfo *, XrdSecsssRR_Data &)
Definition: XrdCryptoLite.hh:39
XrdCryptoLite * Crypto
Definition: XrdSecProtocolsss.hh:117
const char * cName
Definition: XrdSecProtocolsss.hh:79