xrootd
|
00001 #ifndef _SECPROTOCOLSSS_ 00002 #define _SECPROTOCOLSSS_ 00003 /******************************************************************************/ 00004 /* */ 00005 /* X r d S e c P r o t o c o l s s s . h h */ 00006 /* */ 00007 /* (c) 2008 by the Board of Trustees of the Leland Stanford, Jr., University */ 00008 /* All Rights Reserved */ 00009 /* Produced by Andrew Hanushevsky for Stanford University under contract */ 00010 /* DE-AC02-76-SFO0515 with the Department of Energy */ 00011 /******************************************************************************/ 00012 00013 #include "XrdCrypto/XrdCryptoLite.hh" 00014 #include "XrdSec/XrdSecInterface.hh" 00015 #include "XrdSecsss/XrdSecsssID.hh" 00016 #include "XrdSecsss/XrdSecsssKT.hh" 00017 #include "XrdSecsss/XrdSecsssRR.hh" 00018 00019 class XrdOucErrInfo; 00020 00021 class XrdSecProtocolsss : public XrdSecProtocol 00022 { 00023 public: 00024 friend class XrdSecProtocolDummy; // Avoid stupid gcc warnings about destructor 00025 00026 00027 int Authenticate (XrdSecCredentials *cred, 00028 XrdSecParameters **parms, 00029 XrdOucErrInfo *einfo=0); 00030 00031 void Delete(); 00032 00033 static int eMsg(const char *epn, int rc, const char *txt1, 00034 const char *txt2=0, const char *txt3=0, 00035 const char *txt4=0); 00036 00037 static int Fatal(XrdOucErrInfo *erP, const char *epn, int rc, 00038 const char *etxt); 00039 00040 XrdSecCredentials *getCredentials(XrdSecParameters *parms=0, 00041 XrdOucErrInfo *einfo=0); 00042 00043 int Init_Client(XrdOucErrInfo *erp, const char *Parms); 00044 00045 int Init_Server(XrdOucErrInfo *erp, const char *Parms); 00046 00047 static char *Load_Client(XrdOucErrInfo *erp, const char *Parms); 00048 00049 static char *Load_Server(XrdOucErrInfo *erp, const char *Parms); 00050 00051 static void setOpts(int opts) {options = opts;} 00052 00053 XrdSecProtocolsss(const char *hname, 00054 const struct sockaddr *ipadd) 00055 : XrdSecProtocol("sss"), 00056 keyTab(0), Crypto(0), idBuff(0), Sequence(0) 00057 {urName = strdup(hname);} 00058 00059 struct Crypto {const char *cName; char cType;}; 00060 00061 private: 00062 ~XrdSecProtocolsss() {} // Delete() does it all 00063 00064 int Decode(XrdOucErrInfo *error, XrdSecsssKT::ktEnt &decKey, 00065 char *iBuff, XrdSecsssRR_Data *rrData, int iSize); 00066 XrdSecCredentials *Encode(XrdOucErrInfo *error, XrdSecsssKT::ktEnt &encKey, 00067 XrdSecsssRR_Hdr *rrHdr, XrdSecsssRR_Data *rrData, 00068 int dLen); 00069 int getCred(XrdOucErrInfo *, XrdSecsssRR_Data &); 00070 int getCred(XrdOucErrInfo *, XrdSecsssRR_Data &, XrdSecParameters *); 00071 char *getLID(char *buff, int blen); 00072 static 00073 XrdCryptoLite *Load_Crypto(XrdOucErrInfo *erp, const char *eN); 00074 static 00075 XrdCryptoLite *Load_Crypto(XrdOucErrInfo *erp, const char eT); 00076 int myClock(); 00077 char *setID(char *id, char **idP); 00078 00079 static struct Crypto CryptoTab[]; 00080 00081 static const char *myName; 00082 static int myNLen; 00083 char *urName; 00084 static int options; 00085 static int isMutual; 00086 static int deltaTime; 00087 static int ktFixed; 00088 00089 static XrdSecsssKT *ktObject; // Both: Default Key Table object 00090 XrdSecsssKT *keyTab; // Both: Active Key Table 00091 00092 static XrdCryptoLite *CryptObj; // Both: Default Cryptogrophy object 00093 XrdCryptoLite *Crypto; // Both: Active Cryptogrophy object 00094 00095 static XrdSecsssID *idMap; // Client: Registry 00096 char *idBuff; // Server: Underlying buffer for XrdSecEntity 00097 static char *staticID; // Client: Static identity 00098 static int staticIDsz;// Client: Static identity length 00099 int Sequence; // Client: Check for sequencing 00100 }; 00101 #endif