00001 /******************************************************************************/ 00002 /* */ 00003 /* X r d S e c P r o t o c o l h o s t . c c */ 00004 /* */ 00005 /* (c) 2005 by the Board of Trustees of the Leland Stanford, Jr., University */ 00006 /* All Rights Reserved */ 00007 /* Produced by Andrew Hanushevsky for Stanford University under contract */ 00008 /* DE-AC02-76-SFO0515 with the Department of Energy */ 00009 /******************************************************************************/ 00010 00011 // $Id: XrdSecProtocolhost.cc 30949 2009-11-02 16:37:58Z ganis $ 00012 00013 const char *XrdSecProtocolhostCVSID = "$Id: XrdSecProtocolhost.cc 30949 2009-11-02 16:37:58Z ganis $"; 00014 00015 #include <strings.h> 00016 #include <stdlib.h> 00017 00018 #include "XrdSec/XrdSecProtocolhost.hh" 00019 00020 /******************************************************************************/ 00021 /* A u t h e n t i c a t e */ 00022 /******************************************************************************/ 00023 00024 int XrdSecProtocolhost::Authenticate(XrdSecCredentials *cred, 00025 XrdSecParameters **parms, 00026 XrdOucErrInfo *einfo) 00027 { 00028 strcpy(Entity.prot, "host"); 00029 Entity.host = theHost; 00030 return 0; 00031 } 00032 00033 /******************************************************************************/ 00034 /* g e t C r e d e n t i a l s */ 00035 /******************************************************************************/ 00036 00037 XrdSecCredentials *XrdSecProtocolhost::getCredentials(XrdSecParameters *parm, 00038 XrdOucErrInfo *einfo) 00039 {XrdSecCredentials *cp = new XrdSecCredentials; 00040 00041 cp->size = 5; cp->buffer = (char *)"host"; 00042 return cp; 00043 } 00044 00045 /******************************************************************************/ 00046 /* X r d S e c P r o t o c o l h o s t I n i t */ 00047 /******************************************************************************/ 00048 00049 // This is a builtin protocol so we don't define an Init method. Anyway, this 00050 // protocol need not be initialized. It works as is. 00051 00052 /******************************************************************************/ 00053 /* X r d S e c P r o t o c o l h o s t O b j e c t */ 00054 /******************************************************************************/ 00055 00056 // Normally this would be defined as an extern "C", however, this function is 00057 // statically linked into the shared library as a native protocol so there is 00058 // no reason to define it as such. Imitators, beware! Read the comments in 00059 // XrdSecInterface.hh 00060 // 00061 XrdSecProtocol *XrdSecProtocolhostObject(const char who, 00062 const char *hostname, 00063 const struct sockaddr &netaddr, 00064 const char *parms, 00065 XrdOucErrInfo *einfo) 00066 { 00067 00068 // Simply return an instance of the host protocol object 00069 // 00070 return new XrdSecProtocolhost(hostname); 00071 }