rpdp.h

Go to the documentation of this file.
00001 // @(#)root/rpdutils:$Id: rpdp.h 25629 2008-09-30 16:48:14Z ganis $
00002 // Author: Gerardo Ganis   7/4/2003
00003 
00004 /*************************************************************************
00005  * Copyright (C) 1995-2000, Rene Brun and Fons Rademakers.               *
00006  * All rights reserved.                                                  *
00007  *                                                                       *
00008  * For the licensing terms see $ROOTSYS/LICENSE.                         *
00009  * For the list of contributors see $ROOTSYS/README/CREDITS.             *
00010  *************************************************************************/
00011 
00012 #ifndef ROOT_rpdp
00013 #define ROOT_rpdp
00014 
00015 
00016 //////////////////////////////////////////////////////////////////////////
00017 //                                                                      //
00018 // rpdp                                                                 //
00019 //                                                                      //
00020 // This header file contains private definitions and declarations       //
00021 // used by modules in rpdutils/src.                                     //
00022 //                                                                      //
00023 //////////////////////////////////////////////////////////////////////////
00024 
00025 #ifndef ROOT_VarArgs
00026 #include "Varargs.h"
00027 #endif
00028 #ifndef ROOT_MessageTypes
00029 #include "MessageTypes.h"
00030 #endif
00031 #ifndef ROOT_rpderr
00032 #include "rpderr.h"
00033 #endif
00034 #include <string>
00035 #ifdef R__GLOBALSTL
00036 namespace std { using ::string; }
00037 #endif
00038 
00039 /////////////////////////////////////////////////////////////////////
00040 //                                                                 //
00041 // Definition used by daemons                                      //
00042 //                                                                 //
00043 /////////////////////////////////////////////////////////////////////
00044 
00045 #ifndef ROOT_rpddefs
00046 #include "rpddefs.h"
00047 #endif
00048 
00049 const int  kMAXPATHLEN = kMAXSECBUF;
00050 
00051 /////////////////////////////////////////////////////////////////////
00052 //                                                                 //
00053 // Prototypes used by daemons                                      //
00054 //                                                                 //
00055 /////////////////////////////////////////////////////////////////////
00056 
00057 //
00058 // rpdutils globals
00059 namespace ROOT {
00060 
00061 // Utility functions
00062 int SPrintf(char *buf, size_t size, const char *va_(fmt), ...);
00063 
00064 // error handling functions
00065 void Error(ErrorHandler_t ErrHand,int code,const char *va_(fmt), ...);
00066 void ErrorInfo(const char *va_(fmt), ...);
00067 void ErrorInit(const char *ident);
00068 int  GetErrno();
00069 void Perror(char *buf, int size = kMAXPATHLEN);
00070 void ResetErrno();
00071 
00072 // network functions
00073 void   NetClose();
00074 double NetGetBytesRecv();
00075 double NetGetBytesSent();
00076 void   NetGetRemoteHost(std::string &host);
00077 int    NetGetSockFd();
00078 int    NetInit(EService service, int port1, int port2, int tcpwindowsize);
00079 int    NetParOpen(int port, int size);
00080 int    NetOpen(int inetdflag, EService service);
00081 int    NetRecv(char *msg, int len, EMessageTypes &kind);
00082 int    NetRecvAllocate(void *&buf, int &len, EMessageTypes &kind);
00083 int    NetRecvRaw(void *buf, int len);
00084 void   NetResetByteCount();
00085 int    NetSend(int code, EMessageTypes kind);
00086 int    NetSend(const char *msg, EMessageTypes kind = kMESS_STRING);
00087 int    NetSendError(ERootdErrors err);
00088 int    NetSendRaw(const void *buf, int len);
00089 void   NetSetSigPipeHook(SigPipe_t hook);
00090 
00091 // fork functionality
00092 void DaemonStart(int ignsigcld, int fdkeep, EService service);
00093 
00094 // rpdutils.cxx
00095 void RpdAuthCleanup(const char *sstr, int opt);
00096 int  RpdGenRSAKeys(int);
00097 int  RpdGetAuthProtocol();
00098 const char *RpdGetKeyRoot();
00099 int  RpdGetClientProtocol();
00100 int  RpdGetOffSet();
00101 #ifdef R__GLBS
00102 int  RpdGetShmIdCred();
00103 #endif
00104 int  RpdInitSession(int, std::string &, int &);
00105 int  RpdInitSession(int, std::string &, int &, int &, std::string &);
00106 int  RpdInitSession(int, std::string &, int &, int &, int &, std::string &);
00107 void RpdInit(EService serv, int pid, int sproto,
00108              unsigned int opts, int rumsk, int sshp,
00109              const char *tmpd, const char *asrpp, int login = 0);
00110 void RpdSetErrorHandler(ErrorHandler_t Err, ErrorHandler_t Sys,
00111                         ErrorHandler_t Fatal);
00112 #ifdef R__KRB5
00113 void RpdSetKeytabFile(const char *keytabfile);
00114 #endif
00115 void RpdSetSysLogFlag(int syslog);
00116 void RpdSetMethInitFlag(int methinit);
00117 int  RpdUpdateAuthTab(int opt, const char *line, char **token, int ilck = 0);
00118 
00119 } // namespace ROOT
00120 
00121 
00122 /////////////////////////////////////////////////////////////////////
00123 //                                                                 //
00124 // Internal Definition and prototypes used by modules in rpdutils  //
00125 //                                                                 //
00126 /////////////////////////////////////////////////////////////////////
00127 
00128 //
00129 // type of authentication method
00130 enum ESecurity { kClear, kSRP, kKrb5, kGlobus, kSSH, kRfio };
00131 
00132 //
00133 // Prototypes
00134 //
00135 namespace ROOT {
00136 
00137 //
00138 // Utility functions
00139 char *ItoA(int i);
00140 
00141 //
00142 // net.cxx
00143 int  NetRecv(char *msg, int max);
00144 int  NetRecvRaw(int sock, void *buf, int len);
00145 int  NetSend(const void *buf, int len, EMessageTypes kind);
00146 int  NetSendAck();
00147 void NetSetOptions(EService service, int sock, int tcpwindowsize);
00148 
00149 //
00150 // netpar.cxx
00151 void NetParClose();
00152 int  NetParRecv(void *buf, int len);
00153 int  NetParSend(const void *buf, int len);
00154 
00155 //
00156 // rpdutils.cxx
00157 int  RpdAuthenticate();
00158 int  RpdCheckAuthAllow(int Sec, const char *Host);
00159 int  RpdCheckAuthTab(int Sec, const char *User, const char *Host,
00160                      int RemId, int *OffSet);
00161 int  RpdCheckDaemon(const char *daemon);
00162 int  RpdCheckHost(const char *Host, const char *host);
00163 int  RpdCheckOffSet(int Sec, const char *User, const char *Host, int RemId,
00164                     int *OffSet, char **tkn, int *shmid, char **glbsuser);
00165 int  RpdCheckSpecialPass(const char *passwd);
00166  int RpdRetrieveSpecialPass(const char *usr, const char *fpw, char *pwd, int lmx);
00167 int  RpdCheckSshd(int opt);
00168 bool RpdCheckToken(char *tknin, char *tknref);
00169 int  RpdCleanupAuthTab(const char *crypttoken);
00170 int  RpdCleanupAuthTab(const char *Host, int RemId, int OffSet);
00171 void RpdDefaultAuthAllow();
00172 int  RpdDeleteKeyFile(int ofs);
00173 void RpdFreeKeys();
00174 int  RpdGetAuthMethod(int kind);
00175 char *RpdGetIP(const char *host);
00176 char *RpdGetRandString(int Opt, int Len);
00177 int  RpdGetRSAKeys(const char *PubKey, int Opt);
00178 int  RpdGlobusAuth(const char *sstr);
00179 int  RpdGuessClientProt(const char *buf, EMessageTypes kind);
00180 void RpdInitAuth();
00181 void RpdInitRand();
00182 int  RpdKrb5Auth(const char *sstr);
00183 int  RpdLogin(int,int);
00184 int  RpdNoAuth(int);
00185 int  RpdPass(const char *pass, int errheq = 0);
00186 int  RpdProtocol(int);
00187 int  RpdRecvClientRSAKey();
00188 int  RpdRenameKeyFile(int oofs, int nofs);
00189 int  RpdReUseAuth(const char *sstr, int kind);
00190 int  RpdRfioAuth(const char *sstr);
00191 int  RpdSavePubKey(const char *PubKey, int OffSet, char *User);
00192 int  RpdSecureRecv(char **Str);
00193 int  RpdSecureSend(char *Str);
00194 void RpdSendAuthList();
00195 int  RpdSetUid(int uid);
00196 int  RpdSRPUser(const char *user);
00197 int  RpdSshAuth(const char *sstr);
00198 int  RpdUser(const char *sstr);
00199 
00200 //
00201 // Ssh Utility Function prototypes ...
00202 int  SshToolAllocateSocket(unsigned int, unsigned int, char **);
00203 void SshToolDiscardSocket(const char *, int);
00204 int  SshToolGetAuth(int);
00205 int  SshToolGetAuth(int, const char *);
00206 int  SshToolNotifyFailure(const char *);
00207 
00208 } // namespace ROOT
00209 
00210 //
00211 // Globus stuff ...
00212 //
00213 #ifdef R__GLBS
00214 #define HAVE_MEMMOVE 1
00215 extern "C" {
00216 #ifdef IOV_MAX
00217 #undef IOV_MAX
00218 #endif
00219 #ifdef R__GLBS22
00220    #include <globus_gsi_credential.h>
00221 #else
00222    #include <sslutils.h>
00223 #endif
00224    #include <globus_gss_assist.h>
00225    #include <openssl/x509.h>
00226    #include <openssl/pem.h>
00227    #include <sys/ipc.h>
00228    #include <sys/shm.h>
00229 }
00230 // Globus Utility Function prototypes ...
00231 namespace ROOT {
00232 
00233 void  GlbsToolError(char *, int, int, int);
00234 int   GlbsToolCheckCert(char **);
00235 int   GlbsToolCheckContext(int);
00236 int   GlbsToolCheckProxy(char **);
00237 int   GlbsToolStoreContext(gss_ctx_id_t, char *);
00238 int   GlbsToolStoreToShm(gss_buffer_t, int *);
00239 char *GlbsToolExpand(char *);
00240 
00241 } // namespace ROOT
00242 #endif  // Globus ...
00243 
00244 #endif

Generated on Tue Jul 5 14:26:29 2011 for ROOT_528-00b_version by  doxygen 1.5.1