00001 #ifndef __XRDOFSTPC_HH__
00002 #define __XRDOFSTPC_HH__
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033 #include <stdlib.h>
00034 #include <string.h>
00035
00036 #include "XrdOfs/XrdOfsTPCInfo.hh"
00037
00038 class XrdAccAuthorize;
00039 class XrdOfsTPCAllow;
00040 class XrdOfsTPCJob;
00041 class XrdOucEnv;
00042 class XrdOucErrInfo;
00043 class XrdOucPListAnchor;
00044 class XrdOucTList;
00045 class XrdSecEntity;
00046
00047 class XrdOfsTPC
00048 {
00049 public:
00050
00051 struct Facts
00052 {const char *Key;
00053 const char *Lfn;
00054 const char *Pfn;
00055 const char *Org;
00056 const char *Dst;
00057 const XrdSecEntity *Usr;
00058 XrdOucErrInfo *eRR;
00059 XrdOucEnv *Env;
00060
00061 Facts(const XrdSecEntity *vEnt, XrdOucErrInfo *vInf, XrdOucEnv *vEnv,
00062 const char *vKey, const char *vLfn, const char *vPfn=0)
00063 : Key(vKey), Lfn(vLfn), Pfn(vPfn), Org(0), Dst(0),
00064 Usr(vEnt), eRR(vInf), Env(vEnv) {}
00065 };
00066
00067 static
00068 const char *AddAuth(const char *auth, const char *avar);
00069
00070 static void Allow(char *vDN, char *vGN, char *vHN, char *vVO);
00071
00072 static int Authorize(XrdOfsTPC **theTPC,
00073 Facts &Args,
00074 int isPLE=0);
00075
00076 static
00077 const char *credPath() {return cPath;}
00078
00079 virtual void Del() {}
00080
00081 struct iParm {char *Pgm;
00082 char *Ckst;
00083 char *cpath;
00084 int fCreds;
00085 int Dflttl;
00086 int Maxttl;
00087 int Logok;
00088 int Strm;
00089 int SMax;
00090 int Xmax;
00091 signed char Grab;
00092 signed char xEcho;
00093 signed char autoRM;
00094 signed char oidsOK;
00095 iParm() : Pgm(0), Ckst(0), cpath(0), fCreds(0),
00096 Dflttl(-1), Maxttl(-1),
00097 Logok(-1), Strm(-1), SMax(64), Xmax(-1), Grab(0),
00098 xEcho(-1), autoRM(-1), oidsOK(0) {}
00099 };
00100
00101 static void Init(iParm &Parms);
00102
00103 static void Init(XrdAccAuthorize *accP) {fsAuth = accP;}
00104
00105 static const int reqALL = 0;
00106 static const int reqDST = 1;
00107 static const int reqORG = 2;
00108
00109 static void Require(const char *Auth, int RType);
00110
00111 static int Restrict(const char *Path);
00112
00113 static int Start();
00114
00115 virtual int Sync(XrdOucErrInfo *error) {return 0;}
00116
00117 static int Validate (XrdOfsTPC **theTPC, Facts &Args);
00118
00119 XrdOfsTPC() : Refs(1), inQ(0) {}
00120
00121 XrdOfsTPC(const char *Url, const char *Org,
00122 const char *Lfn, const char *Pfn, const char *Cks=0,
00123 const char *Spr=0, const char *Tpr=0)
00124 : Info(Url, Org, Lfn, Pfn, Cks, Spr, Tpr),
00125 Refs(1), inQ(0) {}
00126
00127 virtual ~XrdOfsTPC() {}
00128
00129 XrdOfsTPCInfo Info;
00130
00131 protected:
00132
00133 static int Death(Facts &Args, const char *eMsg, int eCode, int nomsg=0);
00134 static int Fatal(Facts &Args, const char *eMsg, int eCode, int nomsg=0);
00135 static int genOrg(const XrdSecEntity *client, char *Buff, int Blen);
00136 static int getTTL(XrdOucEnv *Env);
00137 static int Screen(Facts &Args, XrdOucTList *tP, int wasEnc=0);
00138 static char *Verify(const char *Who,const char *Name,char *Buf,int Blen);
00139
00140 static XrdAccAuthorize *fsAuth;
00141
00142 static XrdOucTList *AuthDst;
00143 static XrdOucTList *AuthOrg;
00144 static char *cPath;
00145
00146 static XrdOfsTPCAllow *ALList;
00147 static XrdOucPListAnchor *RPList;
00148 static int maxTTL;
00149 static int dflTTL;
00150
00151 char Refs;
00152 char inQ;
00153 };
00154 #endif