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 
15 #include "XrdSecsss/XrdSecsssID.hh"
16 #include "XrdSecsss/XrdSecsssKT.hh"
17 #include "XrdSecsss/XrdSecsssRR.hh"
18 
19 class XrdOucErrInfo;
20 
21 class XrdSecProtocolsss : public XrdSecProtocol
22 {
23 public:
24 friend class XrdSecProtocolDummy; // Avoid stupid gcc warnings about destructor
25 
26 
28  XrdSecParameters **parms,
29  XrdOucErrInfo *einfo=0);
30 
31  void Delete();
32 
33 static int eMsg(const char *epn, int rc, const char *txt1,
34  const char *txt2=0, const char *txt3=0,
35  const char *txt4=0);
36 
37 static int Fatal(XrdOucErrInfo *erP, const char *epn, int rc,
38  const char *etxt);
39 
41  XrdOucErrInfo *einfo=0);
42 
43  int Init_Client(XrdOucErrInfo *erp, const char *Parms);
44 
45  int Init_Server(XrdOucErrInfo *erp, const char *Parms);
46 
47 static char *Load_Client(XrdOucErrInfo *erp, const char *Parms);
48 
49 static char *Load_Server(XrdOucErrInfo *erp, const char *Parms);
50 
51 static void setOpts(int opts) {options = opts;}
52 
53  XrdSecProtocolsss(const char *hname,
54  const struct sockaddr *ipadd)
55  : XrdSecProtocol("sss"),
56  keyTab(0), Crypto(0), idBuff(0), Sequence(0)
57  {urName = strdup(hname); setIP(ipadd);}
58 
59 struct Crypto {const char *cName; char cType;};
60 
61 private:
62  ~XrdSecProtocolsss() {} // Delete() does it all
63 
64 int Decode(XrdOucErrInfo *error, XrdSecsssKT::ktEnt &decKey,
65  char *iBuff, XrdSecsssRR_Data *rrData, int iSize);
67  XrdSecsssRR_Hdr *rrHdr, XrdSecsssRR_Data *rrData,
68  int dLen);
71 char *getLID(char *buff, int blen);
72 static
73 XrdCryptoLite *Load_Crypto(XrdOucErrInfo *erp, const char *eN);
74 static
75 XrdCryptoLite *Load_Crypto(XrdOucErrInfo *erp, const char eT);
76 int myClock();
77 char *setID(char *id, char **idP);
78 void setIP(const struct sockaddr *sockP);
79 
80 static struct Crypto CryptoTab[];
81 
82 static const char *myName;
83 static int myNLen;
84  char *urName;
85  char urIP[64];
86 static int options;
87 static int isMutual;
88 static int deltaTime;
89 static int ktFixed;
90 
91 static XrdSecsssKT *ktObject; // Both: Default Key Table object
92  XrdSecsssKT *keyTab; // Both: Active Key Table
93 
94 static XrdCryptoLite *CryptObj; // Both: Default Cryptogrophy object
95  XrdCryptoLite *Crypto; // Both: Active Cryptogrophy object
96 
97 static XrdSecsssID *idMap; // Client: Registry
98  char *idBuff; // Server: Underlying buffer for XrdSecEntity
99 static char *staticID; // Client: Static identity
100 static int staticIDsz;// Client: Static identity length
101  int Sequence; // Client: Check for sequencing
102 };
103 #endif