xrootd
XrdSecProtocolgsi.hh
Go to the documentation of this file.
00001 /******************************************************************************/
00002 /*                                                                            */
00003 /*                 X r d S e c P r o t o c o l g s i . h h                    */
00004 /*                                                                            */
00005 /* (c) 2005 G. Ganis / CERN                                                   */
00006 /*                                                                            */
00007 /* This file is part of the XRootD software suite.                            */
00008 /*                                                                            */
00009 /* XRootD is free software: you can redistribute it and/or modify it under    */
00010 /* the terms of the GNU Lesser General Public License as published by the     */
00011 /* Free Software Foundation, either version 3 of the License, or (at your     */
00012 /* option) any later version.                                                 */
00013 /*                                                                            */
00014 /* XRootD is distributed in the hope that it will be useful, but WITHOUT      */
00015 /* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or      */
00016 /* FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public       */
00017 /* License for more details.                                                  */
00018 /*                                                                            */
00019 /* You should have received a copy of the GNU Lesser General Public License   */
00020 /* along with XRootD in a file called COPYING.LESSER (LGPL license) and file  */
00021 /* COPYING (GPL license).  If not, see <http://www.gnu.org/licenses/>.        */
00022 /*                                                                            */
00023 /* The copyright holder's institutional names and contributor's names may not */
00024 /* be used to endorse or promote products derived from this software without  */
00025 /* specific prior written permission of the institution or contributor.       */
00026 /*                                                                            */
00027 /******************************************************************************/
00028 #include <time.h>
00029 
00030 #include "XrdOuc/XrdOucErrInfo.hh"
00031 #include "XrdOuc/XrdOucHash.hh"
00032 #include "XrdSys/XrdSysPthread.hh"
00033 #include "XrdOuc/XrdOucString.hh"
00034 #include "XrdOuc/XrdOucTokenizer.hh"
00035 
00036 #include "XrdSec/XrdSecInterface.hh"
00037 #include "XrdSecgsi/XrdSecgsiTrace.hh"
00038 
00039 #include "XrdSut/XrdSutPFEntry.hh"
00040 #include "XrdSut/XrdSutPFile.hh"
00041 #include "XrdSut/XrdSutBuffer.hh"
00042 #include "XrdSut/XrdSutRndm.hh"
00043 
00044 #include "XrdCrypto/XrdCryptoAux.hh"
00045 #include "XrdCrypto/XrdCryptoCipher.hh"
00046 #include "XrdCrypto/XrdCryptoFactory.hh"
00047 #include "XrdCrypto/XrdCryptoX509Crl.hh"
00048 
00049 #include "XrdCrypto/XrdCryptosslgsiX509Chain.hh"
00050 
00051 /******************************************************************************/
00052 /*                               D e f i n e s                                */
00053 /******************************************************************************/
00054 
00055 typedef XrdOucString String;
00056 typedef XrdCryptosslgsiX509Chain X509Chain;
00057   
00058 #define XrdSecPROTOIDENT    "gsi"
00059 #define XrdSecPROTOIDLEN    sizeof(XrdSecPROTOIDENT)
00060 #define XrdSecgsiVERSION    10300
00061 #define XrdSecNOIPCHK       0x0001
00062 #define XrdSecDEBUG         0x1000
00063 #define XrdCryptoMax        10
00064 
00065 #define kMAXBUFLEN          1024
00066 
00067 //
00068 // Message codes either returned by server or included in buffers
00069 enum kgsiStatus {
00070    kgST_error    = -1,      // error occured
00071    kgST_ok       =  0,      // ok
00072    kgST_more     =  1       // need more info
00073 };
00074 
00075 // Client steps
00076 enum kgsiClientSteps {
00077    kXGC_none = 0,
00078    kXGC_certreq     = 1000, // 1000: request server certificate
00079    kXGC_cert,               // 1001: packet with (proxy) certificate
00080    kXGC_sigpxy,             // 1002: packet with signed proxy certificate
00081    kXGC_reserved            // 
00082 };
00083 
00084 // Server steps
00085 enum kgsiServerSteps {
00086    kXGS_none = 0,
00087    kXGS_init       = 2000,   // 2000: fake code used the first time 
00088    kXGS_cert,                // 2001: packet with certificate 
00089    kXGS_pxyreq,              // 2002: packet with proxy req to be signed 
00090    kXGS_reserved             //
00091 };
00092 
00093 // Handshake options
00094 enum kgsiHandshakeOpts {
00095    kOptsDlgPxy     = 1,      // 0x0001: Ask for a delegated proxy
00096    kOptsFwdPxy     = 2,      // 0x0002: Forward local proxy
00097    kOptsSigReq     = 4,      // 0x0004: Accept to sign delegated proxy
00098    kOptsSrvReq     = 8,      // 0x0008: Server request for delegated proxy
00099    kOptsPxFile     = 16,     // 0x0010: Save delegated proxies in file
00100    kOptsDelChn     = 32      // 0x0020: Delete chain
00101 };
00102 
00103 // Error codes
00104 enum kgsiErrors {
00105    kGSErrParseBuffer = 10000,       // 10000
00106    kGSErrDecodeBuffer,              // 10001
00107    kGSErrLoadCrypto,                // 10002
00108    kGSErrBadProtocol,               // 10003
00109    kGSErrCreateBucket,              // 10004
00110    kGSErrDuplicateBucket,           // 10005
00111    kGSErrCreateBuffer,              // 10006
00112    kGSErrSerialBuffer,              // 10007
00113    kGSErrGenCipher,                 // 10008
00114    kGSErrExportPuK,                 // 10009
00115    kGSErrEncRndmTag,                // 10010
00116    kGSErrBadRndmTag,                // 10011
00117    kGSErrNoRndmTag,                 // 10012
00118    kGSErrNoCipher,                  // 10013
00119    kGSErrNoCreds,                   // 10014
00120    kGSErrBadOpt,                    // 10015
00121    kGSErrMarshal,                   // 10016
00122    kGSErrUnmarshal,                 // 10017
00123    kGSErrSaveCreds,                 // 10018
00124    kGSErrNoBuffer,                  // 10019
00125    kGSErrRefCipher,                 // 10020
00126    kGSErrNoPublic,                  // 10021
00127    kGSErrAddBucket,                 // 10022
00128    kGSErrFinCipher,                 // 10023
00129    kGSErrInit,                      // 10024
00130    kGSErrBadCreds,                  // 10025
00131    kGSErrError                      // 10026  
00132 };
00133 
00134 #define REL1(x)     { if (x) delete x; }
00135 #define REL2(x,y)   { if (x) delete x; if (y) delete y; }
00136 #define REL3(x,y,z) { if (x) delete x; if (y) delete y; if (z) delete z; }
00137 
00138 #define SafeDelete(x) { if (x) delete x ; x = 0; }
00139 #define SafeDelArray(x) { if (x) delete [] x ; x = 0; }
00140 #define SafeFree(x) { if (x) free(x) ; x = 0; }
00141 
00142 // External functions for generic mapping
00143 typedef char *(*XrdSecgsiGMAP_t)(const char *, int);
00144 typedef int (*XrdSecgsiAuthz_t)(XrdSecEntity &);
00145 typedef int (*XrdSecgsiAuthzInit_t)(const char *);
00146 typedef int (*XrdSecgsiAuthzKey_t)(XrdSecEntity &, char **);
00147 // VOMS extraction
00148 typedef XrdSecgsiAuthz_t XrdSecgsiVOMS_t;
00149 typedef XrdSecgsiAuthzInit_t XrdSecgsiVOMSInit_t;
00150 //
00151 // This a small class to set the relevant options in one go
00152 //
00153 class XrdOucTrace;
00154 class gsiOptions {
00155 public:
00156    short  debug;  // [cs] debug flag
00157    char   mode;   // [cs] 'c' or 's'
00158    char  *clist;  // [s] list of crypto modules ["ssl" ]
00159    char  *certdir;// [cs] dir with CA info [/etc/grid-security/certificates]
00160    char  *crldir; // [cs] dir with CRL info [/etc/grid-security/certificates]
00161    char  *crlext; // [cs] extension of CRL files [.r0]
00162    char  *cert;   // [s] server certificate [/etc/grid-security/root/rootcert.pem]
00163                   // [c] user certificate [$HOME/.globus/usercert.pem]
00164    char  *key;    // [s] server private key [/etc/grid-security/root/rootkey.pem]
00165                   // [c] user private key [$HOME/.globus/userkey.pem]
00166    char  *cipher; // [s] list of ciphers [aes-128-cbc:bf-cbc:des-ede3-cbc]
00167    char  *md;     // [s] list of MDs [sha1:md5]
00168    int    crl;    // [cs] check level of CRL's [1] 
00169    int    ca;     // [cs] verification level of CA's [1] 
00170    int    crlrefresh; // [cs] CRL refresh or expiration period in secs [1 day] 
00171    char  *proxy;  // [c] user proxy  [/tmp/x509up_u<uid>]
00172    char  *valid;  // [c] proxy validity  [12:00]
00173    int    deplen; // [c] depth of signature path for proxies [0] 
00174    int    bits;   // [c] bits in PKI for proxies [512] 
00175    char  *gridmap;// [s] gridmap file [/etc/grid-security/gridmap]
00176    int    gmapto; // [s] validity in secs of grid-map cache entries [-1 => unlimited]
00177    char  *gmapfun;// [s] file with the function to map DN to usernames [0]
00178    char  *gmapfunparms;// [s] parameters for the function to map DN to usernames [0]
00179    char  *authzfun;// [s] file with the function to fill entities [0]
00180    char  *authzfunparms;// [s] parameters for the function to fill entities [0]
00181    int    authzto; // [s] validity in secs of authz cache entries [-1 => unlimited]
00182    int    ogmap;  // [s] gridmap file checking option 
00183    int    dlgpxy; // [c] explicitely ask the creation of a delegated proxy 
00184                   // [s] ask client for proxies
00185    int    sigpxy; // [c] accept delegated proxy requests 
00186    char  *srvnames;// [c] '|' separated list of allowed server names
00187    char  *exppxy; // [s] template for the exported file with proxies (dlgpxy == 3)
00188    int    authzpxy; // [s] if 1 make proxy available in exported form in the 'endorsement'
00189                     //     field of the XrdSecEntity object for use in XrdAcc
00190    int    vomsat; // [s] 0 do not look for; 1 extract if any
00191    char  *vomsfun;// [s] file with the function to fill VOMS [0]
00192    char  *vomsfunparms;// [s] parameters for the function to fill VOMS [0]
00193    int    moninfo; // [s] 0 do not look for; 1 use DN as default
00194    int    hashcomp; // [cs] 1 send hash names with both algorithms; 0 send only the default [1]
00195 
00196    gsiOptions() { debug = -1; mode = 's'; clist = 0; 
00197                   certdir = 0; crldir = 0; crlext = 0; cert = 0; key = 0;
00198                   cipher = 0; md = 0; ca = 1 ; crl = 1; crlrefresh = 86400;
00199                   proxy = 0; valid = 0; deplen = 0; bits = 512;
00200                   gridmap = 0; gmapto = -1;
00201                   gmapfun = 0; gmapfunparms = 0; authzfun = 0; authzfunparms = 0; authzto = -1;
00202                   ogmap = 1; dlgpxy = 0; sigpxy = 1; srvnames = 0;
00203                   exppxy = 0; authzpxy = 0;
00204                   vomsat = 1; vomsfun = 0; vomsfunparms = 0; moninfo = 0; hashcomp = 1; }
00205    virtual ~gsiOptions() { } // Cleanup inside XrdSecProtocolgsiInit
00206    void Print(XrdOucTrace *t); // Print summary of gsi option status
00207 };
00208 
00209 class XrdSecProtocolgsi;
00210 class gsiHSVars;
00211 
00212 // From a proxy query
00213 typedef struct {
00214    X509Chain        *chain;
00215    XrdCryptoRSA     *ksig;
00216    XrdSutBucket     *cbck;
00217 } ProxyOut_t;
00218 
00219 // To query proxies
00220 typedef struct {
00221    const char *cert;
00222    const char *key;
00223    const char *certdir;
00224    const char *out;
00225    const char *valid;
00226    int         deplen;
00227    int         bits;
00228 } ProxyIn_t;
00229 
00230 
00231 class GSICrlStack {
00232 public:
00233    void Add(XrdCryptoX509Crl *crl) {
00234       char k[40]; snprintf(k, 40, "%p", crl); 
00235       mtx.Lock();
00236       if (!stack.Find(k)) stack.Add(k, crl, 0, Hash_count);
00237       stack.Add(k, crl, 0, Hash_count);
00238       mtx.UnLock();
00239    }
00240    void Del(XrdCryptoX509Crl *crl) {
00241       char k[40]; snprintf(k, 40, "%p", crl); 
00242       mtx.Lock();
00243       if (stack.Find(k)) stack.Del(k, Hash_count);
00244       mtx.UnLock();
00245    }
00246 private:
00247    XrdSysMutex                  mtx;
00248    XrdOucHash<XrdCryptoX509Crl> stack;
00249 };
00250 
00251 
00252 /******************************************************************************/
00253 /*              X r d S e c P r o t o c o l g s i   C l a s s                 */
00254 /******************************************************************************/
00255 
00256 class XrdSecProtocolgsi : public XrdSecProtocol
00257 {
00258 friend class gsiOptions;
00259 friend class gsiHSVars;
00260 public:
00261         int                Authenticate  (XrdSecCredentials *cred,
00262                                           XrdSecParameters **parms,
00263                                           XrdOucErrInfo     *einfo=0);
00264 
00265         XrdSecCredentials *getCredentials(XrdSecParameters  *parm=0,
00266                                           XrdOucErrInfo     *einfo=0);
00267 
00268         XrdSecProtocolgsi(int opts, const char *hname,
00269                           const struct sockaddr *ipadd, const char *parms = 0);
00270         virtual ~XrdSecProtocolgsi() {} // Delete() does it all
00271 
00272         // Initialization methods
00273         static char      *Init(gsiOptions o, XrdOucErrInfo *erp);
00274 
00275         void              Delete();
00276 
00277         // Encrypt / Decrypt methods
00278         int               Encrypt(const char *inbuf, int inlen,
00279                                   XrdSecBuffer **outbuf);
00280         int               Decrypt(const char *inbuf, int inlen,
00281                                   XrdSecBuffer **outbuf);
00282         // Sign / Verify methods
00283         int               Sign(const char *inbuf, int inlen,
00284                                XrdSecBuffer **outbuf);
00285         int               Verify(const char *inbuf, int inlen,
00286                                  const char *sigbuf, int siglen);
00287 
00288         // Export session key
00289         int               getKey(char *kbuf=0, int klen=0);
00290         // Import a key
00291         int               setKey(char *kbuf, int klen);
00292 
00293         // Enable tracing
00294         static XrdOucTrace *EnableTracing();
00295 
00296 private:
00297 
00298    // Static members initialized at startup
00299    static XrdSysMutex      gsiContext;
00300    static String           CAdir;
00301    static String           CRLdir;
00302    static String           DefCRLext;
00303    static String           SrvCert;
00304    static String           SrvKey;
00305    static String           UsrProxy;
00306    static String           UsrCert;
00307    static String           UsrKey;
00308    static String           PxyValid;
00309    static int              DepLength;
00310    static int              DefBits;
00311    static int              CACheck;
00312    static int              CRLCheck;
00313    static int              CRLDownload;
00314    static int              CRLRefresh;
00315    static String           DefCrypto;
00316    static String           DefCipher;
00317    static String           DefMD;
00318    static String           DefError;
00319    static String           GMAPFile;
00320    static int              GMAPOpt;
00321    static bool             GMAPuseDNname;
00322    static int              GMAPCacheTimeOut;
00323    static XrdSysPlugin    *GMAPPlugin;
00324    static XrdSecgsiGMAP_t  GMAPFun;
00325    static XrdSysPlugin    *AuthzPlugin;
00326    static XrdSecgsiAuthz_t AuthzFun; 
00327    static XrdSecgsiAuthzKey_t AuthzKey; 
00328    static int              AuthzCertFmt; 
00329    static int              AuthzCacheTimeOut;
00330    static int              PxyReqOpts;
00331    static int              AuthzPxyWhat;
00332    static int              AuthzPxyWhere;
00333    static String           SrvAllowedNames;
00334    static int              VOMSAttrOpt; 
00335    static XrdSysPlugin    *VOMSPlugin;
00336    static XrdSecgsiVOMS_t  VOMSFun;
00337    static int              VOMSCertFmt; 
00338    static int              MonInfoOpt;
00339    static bool             HashCompatibility;
00340    //
00341    // Crypto related info
00342    static int              ncrypt;                  // Number of factories
00343    static XrdCryptoFactory *cryptF[XrdCryptoMax];   // their hooks 
00344    static int              cryptID[XrdCryptoMax];   // their IDs 
00345    static String           cryptName[XrdCryptoMax]; // their names 
00346    static XrdCryptoCipher *refcip[XrdCryptoMax];    // ref for session ciphers 
00347    //
00348    // Caches 
00349    static XrdSutCache      cacheCA;   // Info about trusted CA's
00350    static XrdSutCache      cacheCert; // Cache for available server certs
00351    static XrdSutCache      cachePxy;  // Cache for client proxies
00352    static XrdSutCache      cacheGMAP; // Cache for gridmap entries
00353    static XrdSutCache      cacheGMAPFun; // Cache for entries mapped by GMAPFun
00354    static XrdSutCache      cacheAuthzFun; // Cache for entities filled by AuthzFun
00355    //
00356    // CRL stack
00357    static GSICrlStack      stackCRL; // Stack of CRL in use
00358    //
00359    // GMAP control vars
00360    static time_t           lastGMAPCheck; // time of last check on GMAP
00361    static XrdSysMutex      mutexGMAP;     // mutex to control GMAP reloads
00362    //
00363    // Running options / settings
00364    static int              Debug;          // [CS] Debug level
00365    static bool             Server;         // [CS] If server mode 
00366    static int              TimeSkew;       // [CS] Allowed skew in secs for time stamps 
00367    //
00368    // for error logging and tracing
00369    static XrdSysLogger     Logger;
00370    static XrdSysError      eDest;
00371    static XrdOucTrace     *GSITrace;
00372 
00373    // Information local to this instance
00374    int              options;
00375    struct sockaddr  hostaddr;      // Client-side only
00376    XrdCryptoFactory *sessionCF;    // Chosen crypto factory
00377    XrdCryptoCipher *sessionKey;    // Session Key (result of the handshake)
00378    XrdSutBucket    *bucketKey;     // Bucket with the key in export form
00379    XrdCryptoMsgDigest *sessionMD;  // Message Digest instance
00380    XrdCryptoRSA    *sessionKsig;   // RSA key to sign
00381    XrdCryptoRSA    *sessionKver;   // RSA key to verify
00382    X509Chain       *proxyChain;    // Chain with the delegated proxy on servers
00383    bool             srvMode;       // TRUE if server mode 
00384 
00385    // Temporary Handshake local info
00386    gsiHSVars     *hs;
00387 
00388    // Parsing received buffers: client
00389    int            ParseClientInput(XrdSutBuffer *br, XrdSutBuffer **bm,
00390                                    String &emsg);
00391    int            ClientDoInit(XrdSutBuffer *br, XrdSutBuffer **bm,
00392                                String &cmsg);
00393    int            ClientDoCert(XrdSutBuffer *br,  XrdSutBuffer **bm,
00394                                String &cmsg);
00395    int            ClientDoPxyreq(XrdSutBuffer *br,  XrdSutBuffer **bm,
00396                                  String &cmsg);
00397 
00398    // Parsing received buffers: server
00399    int            ParseServerInput(XrdSutBuffer *br, XrdSutBuffer **bm,
00400                                    String &cmsg);
00401    int            ServerDoCertreq(XrdSutBuffer *br, XrdSutBuffer **bm,
00402                                   String &cmsg);
00403    int            ServerDoCert(XrdSutBuffer *br,  XrdSutBuffer **bm,
00404                                String &cmsg);
00405    int            ServerDoSigpxy(XrdSutBuffer *br,  XrdSutBuffer **bm,
00406                                  String &cmsg);
00407 
00408    // Auxilliary functions
00409    int            ParseCrypto(String cryptlist);
00410    int            ParseCAlist(String calist);
00411 
00412    // Load CA certificates
00413    static int     GetCA(const char *cahash,
00414                         XrdCryptoFactory *cryptof, gsiHSVars *hs = 0);
00415    static String  GetCApath(const char *cahash);
00416    static bool    VerifyCA(int opt, X509Chain *cca, XrdCryptoFactory *cf);
00417    bool           ServerCertNameOK(const char *subject, String &e);
00418    static XrdSutPFEntry *GetSrvCertEnt(XrdSutCacheRef   &pfeRef,
00419                                        XrdCryptoFactory *cf,
00420                                        time_t timestamp, String &cal);
00421 
00422    // Load CRLs
00423    static XrdCryptoX509Crl *LoadCRL(XrdCryptoX509 *xca, const char *sjhash,
00424                                     XrdCryptoFactory *CF, int dwld);
00425 
00426    // Updating proxies
00427    static int     QueryProxy(bool checkcache, XrdSutCache *cache, const char *tag,
00428                              XrdCryptoFactory *cf, time_t timestamp,
00429                              ProxyIn_t *pi, ProxyOut_t *po);
00430    static int     InitProxy(ProxyIn_t *pi,
00431                             X509Chain *ch = 0, XrdCryptoRSA **key = 0);
00432 
00433    // Error functions
00434    static void    ErrF(XrdOucErrInfo *einfo, kXR_int32 ecode,
00435                        const char *msg1, const char *msg2 = 0,
00436                        const char *msg3 = 0);
00437    XrdSecCredentials *ErrC(XrdOucErrInfo *einfo, XrdSutBuffer *b1,
00438                            XrdSutBuffer *b2,XrdSutBuffer *b3,
00439                            kXR_int32 ecode, const char *msg1 = 0,
00440                            const char *msg2 = 0, const char *msg3 = 0);
00441    int            ErrS(String ID, XrdOucErrInfo *einfo, XrdSutBuffer *b1,
00442                        XrdSutBuffer *b2, XrdSutBuffer *b3,
00443                        kXR_int32 ecode, const char *msg1 = 0,
00444                        const char *msg2 = 0, const char *msg3 = 0);
00445 
00446    // Check Time stamp
00447    bool           CheckTimeStamp(XrdSutBuffer *b, int skew, String &emsg);
00448 
00449    // Check random challenge
00450    bool           CheckRtag(XrdSutBuffer *bm, String &emsg);
00451 
00452    // Auxilliary methods
00453    int            AddSerialized(char opt, kXR_int32 step, String ID, 
00454                                 XrdSutBuffer *bls, XrdSutBuffer *buf,
00455                                 kXR_int32 type, XrdCryptoCipher *cip);
00456    // Grid map cache handling
00457    static int     LoadGMAP(int now); // Init or refresh the cache
00458    static XrdSecgsiGMAP_t            // Load alternative function for mapping
00459                   LoadGMAPFun(const char *plugin, const char *parms);
00460    static XrdSecgsiAuthz_t           // Load alternative function to fill XrdSecEntity
00461                   LoadAuthzFun(const char *plugin, const char *parms, int &fmt);
00462    static XrdSecgsiVOMS_t           // Load alternative function to extract VOMS
00463                   LoadVOMSFun(const char *plugin, const char *parms, int &fmt);
00464    static void    QueryGMAP(XrdCryptoX509Chain* chain, int now, String &name); //Lookup info for DN
00465    
00466    // Entity handling
00467    void CopyEntity(XrdSecEntity *in, XrdSecEntity *out, int *lout = 0);
00468    void FreeEntity(XrdSecEntity *in);
00469 
00470    // VOMS parsing
00471    int ExtractVOMS(X509Chain *c, XrdSecEntity &ent);
00472 };
00473 
00474 class gsiHSVars {
00475 public:
00476    int               Iter;          // iteration number
00477    time_t            TimeStamp;     // Time of last call
00478    String            CryptoMod;     // crypto module in use
00479    int               RemVers;       // Version run by remote counterpart
00480    XrdCryptoCipher  *Rcip;          // reference cipher
00481    XrdSutBucket     *Cbck;          // Bucket with the certificate in export form
00482    String            ID;            // Handshake ID (dummy for clients)
00483    XrdSutPFEntry    *Cref;          // Cache reference
00484    XrdSutPFEntry    *Pent;          // Pointer to relevant file entry 
00485    X509Chain        *Chain;         // Chain to be eventually verified 
00486    XrdCryptoX509Crl *Crl;           // Pointer to CRL, if required 
00487    X509Chain        *PxyChain;      // Proxy Chain on clients
00488    bool              RtagOK;        // Rndm tag checked / not checked
00489    bool              Tty;           // Terminal attached / not attached
00490    int               LastStep;      // Step required at previous iteration
00491    int               Options;       // Handshake options;
00492    int               HashAlg;       // Hash algorithm of peer hash name;
00493    XrdSutBuffer     *Parms;         // Buffer with server parms on first iteration 
00494 
00495    gsiHSVars() { Iter = 0; TimeStamp = -1; CryptoMod = "";
00496                  RemVers = -1; Rcip = 0;
00497                  Cbck = 0;
00498                  ID = ""; Cref = 0; Pent = 0; Chain = 0; Crl = 0; PxyChain = 0;
00499                  RtagOK = 0; Tty = 0; LastStep = 0; Options = 0; HashAlg = 0; Parms = 0;}
00500 
00501    ~gsiHSVars() { SafeDelete(Cref);
00502                   if (Options & kOptsDelChn) {
00503                      // Do not delete the CA certificate in the cached reference
00504                      if (Chain) Chain->Cleanup(1);
00505                      SafeDelete(Chain);
00506                   }
00507                   if (Crl) {
00508                      // This decreases the counter and actually deletes the object only
00509                      // when no instance is using it
00510                      XrdSecProtocolgsi::stackCRL.Del(Crl);
00511                      Crl = 0;
00512                   }
00513                   // The proxy chain is owned by the proxy cache; invalid proxies are
00514                   // detected (and eventually removed) by QueryProxy
00515                   PxyChain = 0;
00516                   SafeDelete(Parms); }
00517    void Dump(XrdSecProtocolgsi *p = 0);
00518 };