00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013 const char *XrdXrootdLoadLibCVSID = "$Id: XrdXrootdLoadLib.cc 29874 2009-08-21 16:56:04Z ganis $";
00014
00015
00016
00017 #ifdef __solaris__
00018 #include <sys/isa_defs.h>
00019 #if defined(_ILP32) && (_FILE_OFFSET_BITS != 32)
00020 #undef _FILE_OFFSET_BITS
00021 #define _FILE_OFFSET_BITS 32
00022 #undef _LARGEFILE_SOURCE
00023 #endif
00024 #endif
00025
00026 #include <dlfcn.h>
00027 #ifndef __macos__
00028 #include <link.h>
00029 #endif
00030
00031 #include "XrdOuc/XrdOucEnv.hh"
00032 #include "XrdSec/XrdSecInterface.hh"
00033 #include "XrdSfs/XrdSfsInterface.hh"
00034 #include "XrdSys/XrdSysError.hh"
00035
00036
00037
00038
00039
00040 XrdSecProtocol *(*XrdXrootdSecGetProtocol)(const char *hostname,
00041 const struct sockaddr &netaddr,
00042 const XrdSecParameters &parms,
00043 XrdOucErrInfo *einfo) = 0;
00044
00045
00046
00047
00048
00049 XrdSfsFileSystem *XrdXrootdloadFileSystem(XrdSysError *eDest,
00050 char *fslib, const char *cfn)
00051 {
00052 void *libhandle;
00053 XrdSfsFileSystem *(*ep)(XrdSfsFileSystem *, XrdSysLogger *, const char *);
00054 XrdSfsFileSystem *FS;
00055
00056
00057
00058 XrdOucEnv::Export("XRDOFSLIB", fslib);
00059
00060
00061
00062 if (!(libhandle = dlopen(fslib, RTLD_NOW)))
00063 {eDest->Emsg("Config",dlerror(),"opening shared library",fslib);
00064 return 0;
00065 }
00066
00067
00068
00069 if (!(ep = (XrdSfsFileSystem *(*)(XrdSfsFileSystem *,XrdSysLogger *,const char *))
00070 dlsym(libhandle,"XrdSfsGetFileSystem")))
00071 {eDest->Emsg("Config", dlerror(),
00072 "finding XrdSfsGetFileSystem() in", fslib);
00073 return 0;
00074 }
00075
00076
00077
00078 if (!(FS = (*ep)(0, eDest->logger(), cfn)))
00079 {eDest->Emsg("Config", "Unable to create file system object via",fslib);
00080 return 0;
00081 }
00082
00083
00084
00085 return FS;
00086 }
00087
00088
00089
00090
00091
00092 XrdSecService *XrdXrootdloadSecurity(XrdSysError *eDest, char *seclib, char *cfn)
00093 {
00094 void *libhandle;
00095 XrdSecService *(*ep)(XrdSysLogger *, const char *cfn);
00096 XrdSecService *CIA;
00097
00098
00099
00100 if (!(libhandle = dlopen(seclib, RTLD_NOW)))
00101 {eDest->Emsg("Config",dlerror(),"opening shared library",seclib);
00102 return 0;
00103 }
00104
00105
00106
00107 if (!(ep = (XrdSecService *(*)(XrdSysLogger *, const char *cfn))dlsym(libhandle,
00108 "XrdSecgetService")))
00109 {eDest->Emsg("Config", dlerror(),
00110 "finding XrdSecgetService() in", seclib);
00111 return 0;
00112 }
00113
00114
00115
00116 if (!(CIA = (*ep)(eDest->logger(), cfn)))
00117 {eDest->Emsg("Config", "Unable to create security service object via",seclib);
00118 return 0;
00119 }
00120
00121
00122
00123 if (!(XrdXrootdSecGetProtocol =
00124 (XrdSecProtocol *(*)(const char *,
00125 const struct sockaddr &,
00126 const XrdSecParameters &,
00127 XrdOucErrInfo *))
00128 dlsym(libhandle, "XrdSecGetProtocol")))
00129 {eDest->Emsg("Config", dlerror(),
00130 "finding XrdSecGetProtocol() in", seclib);
00131 return 0;
00132 }
00133
00134
00135
00136 return CIA;
00137 }