XRootD
XrdSecClient.cc File Reference
#include <unistd.h>
#include <cctype>
#include <cerrno>
#include <netdb.h>
#include <cstdlib>
#include <cstring>
#include <cstdio>
#include <iomanip>
#include <sys/param.h>
#include <sys/types.h>
#include "XrdNet/XrdNetAddrInfo.hh"
#include "XrdOuc/XrdOucErrInfo.hh"
#include "XrdSys/XrdSysHeaders.hh"
#include "XrdSys/XrdSysPthread.hh"
#include "XrdSec/XrdSecPManager.hh"
#include "XrdSec/XrdSecInterface.hh"
+ Include dependency graph for XrdSecClient.cc:

Go to the source code of this file.

Classes

class  XrdSecProtNone
 

Macros

#define DEBUG(x)   {if (DebugON) std::cerr <<"sec_Client: " <<x <<std::endl;}
 

Functions

XrdSecProtocolXrdSecGetProtocol (const char *hostname, XrdNetAddrInfo &endPoint, XrdSecParameters &parms, XrdOucErrInfo *einfo)
 

Macro Definition Documentation

◆ DEBUG

#define DEBUG (   x)    {if (DebugON) std::cerr <<"sec_Client: " <<x <<std::endl;}

Definition at line 53 of file XrdSecClient.cc.

Function Documentation

◆ XrdSecGetProtocol()

XrdSecProtocol* XrdSecGetProtocol ( const char *  hostname,
XrdNetAddrInfo endPoint,
XrdSecParameters parms,
XrdOucErrInfo einfo 
)

Definition at line 86 of file XrdSecClient.cc.

90 {
91  static int DebugON = ((getenv("XrdSecDEBUG") &&
92  strcmp(getenv("XrdSecDEBUG"), "0")) ? 1 : 0);
93  static XrdSecProtNone ProtNone;
94  static XrdSecPManager PManager(DebugON, getenv("XrdSecPROXY") != 0,
95  getenv("XrdSecPROXYCREDS") != 0);
96  const char *noperr = "XrdSec: No authentication protocols are available.";
97 
98  XrdSecProtocol *protp;
99 
100 // Perform any required debugging
101 //
102  DEBUG("protocol request for host " <<hostname <<" token='"
103  <<(parms.size > 0 ? std::setw(parms.size) : std::setw(1))
104  <<(parms.size > 0 ? parms.buffer : "") <<"'");
105 
106 // Check if the server wants no security.
107 //
108  if (!parms.size || !parms.buffer[0]) return (XrdSecProtocol *)&ProtNone;
109 
110 // Find a supported protocol.
111 //
112  if (!(protp = PManager.Get(hostname, endPoint, parms, einfo)))
113  {if (einfo) einfo->setErrInfo(ENOPROTOOPT, noperr);
114  else std::cerr <<noperr <<std::endl;
115  }
116 
117 // All done
118 //
119  return protp;
120 }
int DebugON
#define DEBUG(x)
Definition: XrdSecClient.cc:53
int setErrInfo(int code, const char *emsg)
char * buffer
Pointer to the buffer.
int size
Size of the buffer or length of data in the buffer.

References XrdSecBuffer::buffer, DEBUG, DebugON, XrdSecPManager::Get(), XrdOucErrInfo::setErrInfo(), and XrdSecBuffer::size.

Referenced by main().

+ Here is the call graph for this function:
+ Here is the caller graph for this function: