21#include "RConfigure.h" 
   53#if !defined(R__WIN32) && !defined(R__MACOSX) && !defined(R__FBSD) && \ 
   60#if defined(R__LINUX) || defined(R__FBSD) || defined(R__OBSD) 
   69extern "C" char *
crypt(
const char *, 
const char *);
 
   74#   include <openssl/bio.h> 
   75#   include <openssl/err.h> 
   76#   include <openssl/pem.h> 
   77#   include <openssl/rand.h> 
   78#   include <openssl/rsa.h> 
   79#   include <openssl/ssl.h> 
   80#   include <openssl/blowfish.h> 
   94                                                "Unsupported", 
"Unsupported", 
"Unsupported" };
 
  142      if (
rs == 
sizeof(
int)) 
return r;
 
  144   Printf(
"+++ERROR+++ : auth_rand: neither /dev/urandom nor /dev/random are available or readable!");
 
  148      memcpy((
void *)&
t1, (
void *)&
tv.tv_sec, 
sizeof(
int));
 
  149      memcpy((
void *)&
t2, (
void *)&
tv.tv_usec, 
sizeof(
int));
 
 
  165                             const char *
proto, 
const char *user)
 
  172   if (
gROOT->IsProofServ())
 
  189      Info(
"TAuthenticate", 
"Enter: local host: %s, user is: %s (proto: %s)",
 
  233            Info(
"TAuthenticate",
 
  234                 "service: %s (remote protocol: %d): fVersion: %d", 
sproto,
 
  244   if (user && 
strlen(user) > 0) {
 
  269      Info(
"TAuthenticate",
"RSA key: default type %d", 
fgRSAKey);
 
  289      Info(
"TAuthenticate",
 
  290           "number of HostAuth Instantiations in memory: %d",
 
  314   tmp.ReplaceAll(
"root",4,
"",0);
 
  315   tmp.ReplaceAll(
"proof",5,
"",0);
 
  316   tmp.ReplaceAll(
"sock",4,
"",0);
 
  317   if (!
strncmp(tmp.Data(),
"up",2))
 
  319   else if (!
strncmp(tmp.Data(),
"s",1))
 
  321   else if (!
strncmp(tmp.Data(),
"k",1))
 
  323   else if (!
strncmp(tmp.Data(),
"g",1))
 
  325   else if (!
strncmp(tmp.Data(),
"h",1))
 
  327   else if (!
strncmp(tmp.Data(),
"ug",2))
 
 
  355   Info(
"CatchTimeOut", 
"%d sec timeout expired (protocol: %s)",
 
 
  394      alarm->SetInterruptSyscalls();
 
  396      alarm->Connect(
"Timeout()", 
"TAuthenticate", 
this, 
"CatchTimeOut()");
 
  404      Info(
"Authenticate", 
"try #: %d", 
ntry);
 
  415           "trying authentication: method:%d, default details:%s",
 
  459         Error(
"Authenticate",
 
  460               "unable to get user name for UsrPwd authentication");
 
  480      Info(
"Authenticate",
"remloc: %d, ntry: %d, meth: %d, fSecurity: %d",
 
  506                 "negotiation not supported remotely: try next method, if any");
 
  524              "after failed attempt: kind= %d, stat= %d", kind, stat);
 
  541                       "strings with accepted methods not received (%d:%d)",
 
  548                    "remotely allowed methods not yet tried: %s",
 
  551         } 
else if (stat == 0) {
 
  553                 "no more methods accepted remotely to be tried");
 
  566         std::string available{};
 
  568         for (i = 0; i < 
remMeth; i++) {
 
  585            Warning(
"Authenticate", 
"no match with those locally available: %s", available.c_str());
 
  602              "method not even started: insufficient or wrong info: %s",
 
  603              "try with next method, if any");
 
  620                    "status code -2 not expected from old daemons");
 
  632         Info(
"Authenticate", 
"got a timeout");
 
  644         Info(
"Authenticate", 
"unknown status code: %d - assume failure",
st);
 
  659         Info(
"Authenticate", 
"attempted methods %s are not supported" 
  662           "failure: list of attempted methods: %s", 
triedMeth);
 
 
  686      Info(
"SetEnvironment",
 
  687           "setting environment: fSecurity:%d, fDetails:%s", 
fSecurity,
 
  698      char pt[5] = { 0 }, 
ru[5] = { 0 };
 
  726      if ((
pd = 
hours.Index(
":")) > -1) {
 
  744            Info(
"SetEnvironment", 
"details:%s, pt:%s, ru:%s, us:%s cp:%s",
 
  750            Info(
"SetEnvironment", 
"details:%s, pt:%s, ru:%s, us:%s",
 
  759      if (!
gROOT->IsProofServ()) {
 
 
  814      Error(
"GetUserPasswd", 
"SRP no longer supported by ROOT");
 
  819      Info(
"GetUserPasswd", 
"Enter: User: '%s' Hash:%d SRP:%d",
 
  823   if (user == 
"" && 
fgUser != 
"")
 
  834      Info(
"GetUserPasswd", 
"In memory: User: '%s' Hash:%d",
 
  844         Info(
"GetUserPasswd", 
"In memory: User: '%s' Hash:%d",
 
  850   if (user == 
"" || 
passwd == 
"") {
 
  852         Info(
"GetUserPasswd", 
"Checking .netrc family ...");
 
  856      Info(
"GetUserPasswd", 
"From .netrc family: User: '%s' Hash:%d",
 
  865         Error(
"GetUserPasswd", 
"user name not set");
 
 
  912      Error(
"CheckNetrc", 
"SRP no longer supported by ROOT");
 
  962               href.ReplaceAll(
"*",
".*");
 
  986                    "file %s exists but has not 0600 permission", net);
 
 
 1044   ::Error(
"Krb5Auth", 
"Kerberos5 is no longer supported by ROOT");
 
 
 1072      ::Error(
"Authenticate::GetAuthMethod", 
"idx out of bounds (%d)", idx);
 
 
 1117                "not tty: cannot prompt for user, returning default");
 
 1127      usr.Remove(
usr.Length() - 1); 
 
 
 1145      ::Warning(
"TAuthenticate::PromptPasswd",
 
 1146                "not tty: cannot prompt for passwd, returning -1");
 
 1147      static char noint[4] = {
"-1"};
 
 1152   const char *
pw = buf;
 
 1157           gROOT->GetPluginManager()->FindHandler(
"TGPasswdDialog"))) {
 
 1161                      "could not load plugin for the password dialog box");
 
 1171      while (
gROOT->IsInterrupted())
 
 1183      if (
spw.EndsWith(
"\n"))
 
 1184         spw.Remove(
spw.Length() - 1);   
 
 
 1204   key = (key >= 0 && key <= 1) ? key : 0;
 
 
 1221   if (key >= 0 && key <= 1)
 
 
 1274      lasterr = 
"(last error only; re-run with gDebug > 0 for more details)";
 
 1283            ::Error(
Form(
"TAuthenticate::%s", 
where),
 
 1284                    "unknown error code: server must be running a newer ROOT version %s",
 
 
 1302   if (user && user[0])
 
 
 1333   ::Error(
"SetGlobalSRPPwd", 
"SRP no longer supported by ROOT");
 
 
 1404   ::Error(
"Krb5Auth", 
"Kerberos5 is no longer supported by ROOT");
 
 
 1413   ::Error(
"GlobusAuth", 
"Globus is no longer supported by ROOT");
 
 
 1421   ::Error(
"SshAuth", 
"SSH is no longer supported by ROOT");
 
 
 1430   ::Error(
"GetSshUser", 
"SSH is no longer supported by ROOT");
 
 
 1477         ::Info(
"TAuthenticate::CheckHost", 
"checking host IP: %s", 
theHost.Data());
 
 
 1500   ::Error(
"RfioAuth", 
"RfioAuth is no longer supported by ROOT");
 
 
 1514      Info(
"ClearAuth", 
"enter: user: %s (passwd hashed?: %d)",
 
 1526      Info(
"ClearAuth", 
"ru:%d pt:%d cp:%d ns:%d rk:%d",
 
 1555      options.
Form(
"%d %ld %s %ld %s", opt,
 
 1577            Info(
"ClearAuth", 
"anonymous user");
 
 1586      char ctag[11] = {0};
 
 1594                       "problems recvn RSA key flag: got message %d, flag: %d",
 
 1600            Info(
"ClearAuth", 
"get key request ...");
 
 1614               Warning(
"ClearAuth", 
"problems secure-receiving salt -" 
 1615                       " may result in corrupted salt");
 
 1616               Warning(
"ClearAuth", 
"switch off reuse for this session");
 
 1647               Info(
"ClearAuth", 
"got salt: '%s' (len: %d)", 
salt.Data(), 
slen);
 
 1650               Info(
"ClearAuth", 
"Salt not required");
 
 1653               Warning(
"ClearAuth", 
"problems secure-receiving rndmtag -" 
 1654                       " may result in corrupted rndmtag");
 
 1691                    "automatically generated anonymous passwd: %s",
 
 1706                  Error(
"ClearAuth", 
"password not set");
 
 1749            Warning(
"ClearAuth", 
"problems secure-sending pass hash" 
 1750                    " - may result in authentication failure");
 
 1757            for (
int i = 0; i < 
passwd.Length(); i++) {
 
 1771         Info(
"ClearAuth", 
"after kROOTD_PASS: kind= %d, stat= %d", kind,
 
 1783                 "problems recvn (user,offset) length (%d:%d bytes:%d)",
 
 1788      int reclen = (stat+1 > 256) ? 256 : stat+1;
 
 1793                 "username and offset not received (%d:%d)", kind,
 
 1802              "received from server: user: %s, offset: %d (%s)", 
lUser,
 
 1814                       "problems secure-receiving token -" 
 1815                       " may result in corrupted token");
 
 1826               Warning(
"ClearAuth", 
"token not received (%d:%d)", kind,
 
 1835            Info(
"ClearAuth", 
"received from server: token: '%s' ",
 
 1897                     "%s@%s does not accept connections from %s@%s",
 
 1904                     "%s@%s does not accept %s authentication from %s@%s",
 
 1921            Error(
"ClearAuth", 
"password not set");
 
 1923      if (
fUser == 
"anonymous" || 
fUser == 
"rootd") {
 
 1924         if (!
passwd.Contains(
"@")) {
 
 1926                    "please use passwd of form: user@host.do.main");
 
 1937         for (
int i = 0; i < 
passwd.Length(); i++) {
 
 1950         Info(
"ClearAuth", 
"after kROOTD_PASS: kind= %d, stat= %d", kind,
 
 
 1979      ::Info(
"TAuthenticate::GetHostAuth", 
"enter ... %s ... %s", host, user);
 
 1985      char *ps = (
char *)
strstr(host,
":");
 
 2013         ai->Print(
"Authenticate::GetHostAuth");
 
 
 2053      ::Info(
"TAuthenticate::HasHostAuth", 
"enter ... %s ... %s", host, user);
 
 2059      char *ps = (
char *)
strstr(host,
":");
 
 
 2100      ::Info(
"TAuthenticate::FileExpand", 
"enter ... '%s' ... 0x%zx", 
fexp, (
size_t)
ftmp);
 
 2113         ::Info(
"TAuthenticate::FileExpand", 
"read line ... '%s'", 
line);
 
 2124         ln.ReplaceAll(
"\"",1,
"",0);
 
 2125         ln.ReplaceAll(
"'",1,
"",0);
 
 2132            if (
edir.Contains(
"/")) {
 
 2160                      "file specified by 'include' cannot be open or read (%s)",
 
 
 2175   const char copt[2][5] = { 
"no", 
"yes" };
 
 2178      ::Info(
"TAuthenticate::GetDefaultDetails",
 
 2179             "enter ... %d ...pt:%d ... '%s'", 
sec, opt, 
usr);
 
 2195      ::Info(
"TAuthenticate::GetDefaultDetails", 
"returning ... %s", temp);
 
 
 2234             " +--------------------------- BEGIN --------------------------------+");
 
 2239                " + List fgProofAuthInfo has %4d members                            +",
 
 2244                " +------------------------------------------------------------------+");
 
 2252                " + List fgAuthInfo has %4d members                                 +",
 
 2257                " +------------------------------------------------------------------+");
 
 2262            ai->PrintEstablished();
 
 2266             " +---------------------------- END ---------------------------------+");
 
 
 2282      Info(
"AuthExists",
"%d: enter: msg: %d options: '%s'",
 
 2283           method,*message, options);
 
 2325              "found valid TSecContext: offset: %d token: '%s'",
 
 2347      Int_t stat = 1, kind;
 
 2352            Warning(
"AuthExists",
"protocol error: expecting %d got %d" 
 2358            Info(
"AuthExists",
"offset OK");
 
 2378               Warning(
"AuthExists", 
"problems secure-sending token %s",
 
 2379                       "- may trigger problems in proofing Id ");
 
 2384            for (
int i = 0; i < 
token.Length(); i++) {
 
 2393            Info(
"AuthExists",
"offset not OK - rerun authentication");
 
 2404      Info(
"AuthExists",
"%d: after msg %d: kind= %d, stat= %d",
 
 2405           method,*message, kind, stat);
 
 2418         Error(
"AuthExists",
"%s@%s does not accept connections from %s@%s",
 
 2424                 "%s@%s does not accept %s authentication from %s@%s",
 
 2442            Info(
"AuthExists", 
"valid authentication exists");
 
 2444            Info(
"AuthExists", 
"valid authentication exists: offset changed");
 
 2446            Info(
"AuthExists", 
"remote access authorized by /etc/hosts.equiv");
 
 2448            Info(
"AuthExists", 
"no authentication required remotely");
 
 
 2478      const char *
randdev = 
"/dev/urandom";
 
 2484         if (read(fd, &seed, 
sizeof(seed)) != 
sizeof(seed))
 
 2489            ::Info(
"InitRandom", 
"%s not available: using time()", 
randdev);
 
 
 2504      Info(
"GenRSAKeys", 
"enter");
 
 2508         Info(
"GenRSAKeys", 
"Keys prviously generated - return");
 
 2530         Info(
"GenRSAKeys",
"SSL: Generate Blowfish key");
 
 2600            Info(
"GenRSAKeys", 
"equal primes: regenerate (%d times)",
nPrimes);
 
 2608         Info(
"GenRSAKeys", 
"local: p1: '%s' ", buf);
 
 2610         Info(
"GenRSAKeys", 
"local: p2: '%s' ", buf);
 
 2616            Info(
"GenRSAKeys",
" genrsa: unable to generate keys (%d)",
 
 2633         Info(
"GenRSAKeys", 
"local: n: '%s' length: %d", 
buf_n, 
l_n);
 
 2634         Info(
"GenRSAKeys", 
"local: e: '%s' length: %d", 
buf_e, 
l_e);
 
 2635         Info(
"GenRSAKeys", 
"local: d: '%s' length: %d", 
buf_d, 
l_d);
 
 2651         Info(
"GenRSAKeys", 
"local: test string: '%s' ", 
test);
 
 2660              "local: length of crypted string: %d bytes", 
lout);
 
 2666         Info(
"GenRSAKeys", 
"local: after private/public : '%s' ", buf);
 
 2677         Info(
"GenRSAKeys", 
"local: length of crypted string: %d bytes ",
 
 2684         Info(
"GenRSAKeys", 
"local: after public/private : '%s' ", buf);
 
 2703      Info(
"GenRSAKeys", 
"local: generated keys are:");
 
 2704      Info(
"GenRSAKeys", 
"local: n: '%s' length: %d", 
buf_n, 
l_n);
 
 2705      Info(
"GenRSAKeys", 
"local: e: '%s' length: %d", 
buf_e, 
l_e);
 
 2706      Info(
"GenRSAKeys", 
"local: d: '%s' length: %d", 
buf_d, 
l_d);
 
 
 2747   unsigned int iimx[4][4] = {
 
 2748      {0x0, 0xffffff08, 0xafffffff, 0x2ffffffe}, 
 
 2749      {0x0, 0x3ff0000, 0x7fffffe, 0x7fffffe},    
 
 2750      {0x0, 0x3ff0000, 0x7e, 0x7e},              
 
 2751      {0x0, 0x3ffc000, 0x7fffffe, 0x7fffffe}     
 
 2754   const char *
cOpt[4] = { 
"Any", 
"LetNum", 
"Hex", 
"Crypt" };
 
 2760         Info(
"GetRandString", 
"unknown option: %d : assume 0", opt);
 
 2763      Info(
"GetRandString", 
"enter ... len: %d %s", 
len, 
cOpt[opt]);
 
 2766   char *buf = 
new char[
len + 1];
 
 2776      for (
m = 7; 
m < 32; 
m += 7) {
 
 2777         i = 0x7F & (
frnd >> 
m);
 
 2780         if ((
iimx[opt][
j] & (1 << 
l))) {
 
 2792      Info(
"GetRandString", 
"got '%s' ", buf);
 
 
 2804                                Int_t key, 
const char *str)
 
 2810      ::Info(
"TAuthenticate::SecureSend", 
"local: enter ... (enc: %d)", 
enc);
 
 2827   } 
else if (key == 1) {
 
 2833      unsigned char iv[8];
 
 2839         ::Info(
"TAuthenticate::SecureSend",
"not compiled with SSL support:" 
 2840                " you should not have got here!");
 
 2844         ::Info(
"TAuthenticate::SecureSend",
"unknown key type (%d)",key);
 
 2853      ::Info(
"TAuthenticate::SecureSend",
 
 2854             "local: sent %d bytes (expected: %d)", 
nsen,
ttmp);
 
 
 2876   if (sock->
Recv(buflen, 20, kind) < 0)
 
 2880      ::Info(
"TAuthenticate::SecureRecv", 
"got len '%s' %d (msg kind: %d)",
 
 2885   if (!
strncmp(buflen, 
"-1", 2))
 
 2902      if (*str == 
nullptr) {
 
 2904            ::Info(
"TAuthenticate::SecureRecv",
"Memory allocation error size (%ld)", (
long) 
strSize);
 
 2909   } 
else if (key == 1) {
 
 2911      unsigned char iv[8];
 
 2913      *str = 
new char[
nrec + 1];
 
 2916      (*str)[
nrec] = 
'\0';
 
 2919         ::Info(
"TAuthenticate::SecureRecv",
"not compiled with SSL support:" 
 2920                " you should not have got here!");
 
 2924         ::Info(
"TAuthenticate::SecureRecv",
"unknown key type (%d)",key);
 
 
 2943      ::Info(
"TAuthenticate::DecodeRSAPublic",
 
 2949      ::Info(
"TAuthenticate::DecodeRSAPublic",
 
 2962      while (str[k] == 32) k++;
 
 2964      if (str[k] == 
'#') {
 
 2978               ::Info(
"TAuthenticate::DecodeRSAPublic",
 
 2985               ::Info(
"TAuthenticate::DecodeRSAPublic",
 
 2995            ::Info(
"TAuthenticate::DecodeRSAPublic",
"bad format for input string");
 
 3012               ::Info(
"TAuthenticate::DecodeRSAPublic",
 
 3013                        "unable to read pub key from bio");
 
 3018               ::Info(
"TAuthenticate::DecodeRSAPublic",
 
 3019                        "no space allocated for output variable");
 
 3026            ::Info(
"TAuthenticate::DecodeRSAPublic",
"not compiled with SSL support:" 
 3027                   " you should not have got here!");
 
 
 3042      ::Info(
"TAuthenticate::SetRSAPublic",
 
 3085         ::Info(
"TAuthenticate::SetRSAPublic",
" Key type: %d",
rsakey);
 
 3103            ::Info(
"TAuthenticate::SetRSAPublic",
 
 3104                   "not compiled with SSL support:" 
 3105                   " you should not have got here!");
 
 
 3125      ::Info(
"TAuthenticate::SendRSAPublicKey",
 
 3146   char buflen[20] = {0};
 
 3153   } 
else if (key == 1) {
 
 3167            ::Info(
"TAuthenticate::SendRSAPublicKey",
"SSL: error: '%s' ",
errstr);
 
 3177         ::Info(
"TAuthenticate::SendRSAPublicKey",
"not compiled with SSL support:" 
 3178                " you should not have got here!");
 
 3183         ::Info(
"TAuthenticate::SendRSAPublicKey",
"unknown key type (%d)",key);
 
 3197      ::Info(
"TAuthenticate::SendRSAPublicKey",
 
 3198             "local: sent %d bytes (expected: %d)", 
nsen,
ttmp);
 
 
 3223      ::Info(
"TAuthenticate::ReadRootAuthrc", 
"Checking file: %s", 
authrc);
 
 3226         ::Info(
"TAuthenticate::ReadRootAuthrc",
 
 3227                "file %s cannot be read (errno: %d)", 
authrc, 
errno);
 
 3231         ::Info(
"TAuthenticate::ReadRootAuthrc", 
"Checking system file: %s", 
authrc);
 
 3234            ::Info(
"TAuthenticate::ReadRootAuthrc",
 
 3235                   "file %s cannot be read (errno: %d)", 
authrc, 
errno);
 
 3248            ::Info(
"TAuthenticate::ReadRootAuthrc",
 
 3249                   "file %s already read", 
authrc);
 
 3268      ::Info(
"TAuthenticate::ReadRootAuthrc", 
"got tmp file: %s open at 0x%zx",
 
 3284            ::Info(
"TAuthenticate::ReadRootAuthrc",
 
 3285                   "file %s cannot be open (errno: %d)", 
authrc, 
errno);
 
 3312      char *tmp = 
new char[
tmpSize];
 
 3314         ::Error(
"TAuthenticate::ReadRootAuthrc",
 
 3315                 "could not allocate temporary buffer");
 
 3377            if (host == 
ha->GetHost() && user == 
ha->GetUser() &&
 
 3397                     ::Info(
"TAuthenticate::ReadRootAuthrc",
 
 3398                            "unrecognized method (%s): ", 
mth);
 
 3418                  ::Info(
"TAuthenticate::ReadRootAuthrc",
 
 3419                         "unrecognized method (%s): ", 
mth);
 
 3424               const char *
det = 0;
 
 3429               if (
ha->HasMethod(
met))
 
 3436      if (tmp) 
delete [] tmp;
 
 3464         if ((
pdd = tmp.Index(
":")) == -1) {
 
 3471            tmp.Remove(0,
pdd+1);
 
 3475         if ((
pdd = tmp.Index(
":")) == -1) {
 
 3482            tmp.Remove(0,
pdd+1);
 
 3487         while (tmp.Length() > 0) {
 
 3489            if ((
pdd = tmp.Index(
":")) > -1)
 
 3491            if (
meth.Length() > 1) {
 
 3495                  ::Info(
"TAuthenticate::ReadRootAuthrc",
 
 3496                         "unrecognized method (%s): ",
meth.Data());
 
 3497            } 
else if (
meth.Length() == 1) {
 
 3503               tmp.Remove(0,
pdd+1);
 
 
 3544   const char netrc[2][20] = { 
"/.netrc", 
"/.rootnetrc" };
 
 3554             "not properly logged on (getpwuid unable to find relevant info)!");
 
 3562      for (; i < 2; i++) {
 
 3568         out.Form(
"pt:0 ru:1 us:%s",user.
Data());
 
 3574                "meth: %d ... is available: details: %s", 
cSec, out.Data());
 
 3576         ::Info(
"CheckProofAuth",
 
 3577                "meth: %d ... is NOT available", 
cSec);
 
 
 3617      if (!
ha->IsActive()) {
 
 3627      if (
hanew->NumMethods()) {
 
 3636            hanew->DeActivate();
 
 3643         hanew->DeActivate();
 
 3649      if (!
hanew->IsActive()) {
 
 
 3668      TIter next(
ha->Established());
 
 3672            ha->Established()->Remove(ctx);
 
 3681      TIter next(
ha->Established());
 
 3685            ha->Established()->Remove(ctx);
 
 
 3712         Info(
"ProofAuthSetup",
"Buffer not found: nothing to do");
 
 3743         Info(
"ProofAuthSetup",
"List of THostAuth not found");
 
 3789            for (; i < 
haex->NumMethods(); i++) {
 
 3791               if (!
ha->HasMethod(
met))
 
 
 3860      ::Info(
"ProofAuthSetup",
"sending %d bytes", 
messb64.Length());
 
 3865         ::Error(
"ProofAuthSetup",
"problems secure-sending message buffer");
 
 3873         ::Error(
"ProofAuthSetup",
"plain: problems sending message length");
 
 3877         ::Error(
"ProofAuthSetup",
"problems sending message buffer");
 
 
 3913      Error(
"SendHostAuth",
"invalid input: socket undefined");
 
 3928         Info(
"SendHostAuth",
"sent %d bytes (%s)",ns,buf.
Data());
 
 3935      Info(
"SendHostAuth",
"sent %d bytes for closing",ns);
 
 
 3949      Error(
"RecvHostAuth",
"invalid input: socket undefined");
 
 3964      Error(
"RecvHostAuth", 
"received: kind: %d (%d bytes)", kind, 
nr);
 
 3968      Info(
"RecvHostAuth",
"received %d bytes (%s)",
nr,buf);
 
 3970   while (
strcmp(buf, 
"END")) {
 
 4015            for (; i < 
haex->NumMethods(); i++) {
 
 4017               if (!
ha->HasMethod(
met))
 
 4040         Info(
"RecvHostAuth",
"Error: received: kind: %d (%d bytes)", kind, 
nr);
 
 4044         Info(
"RecvHostAuth",
"received %d bytes (%s)",
nr,buf);
 
 
 4084         Error(
"OldAuthSetup", 
"failed to send offset in RSA key");
 
 4096            Warning(
"OldAuthSetup",
"problems secure-sending pass hash %s",
 
 4097                    "- may result in failures");
 
 4100            for (
int i = 0; i < 
passwd.Length(); i++) {
 
 4107               Error(
"OldAuthSetup", 
"failed to send inverted password");
 
 4117         Error(
"OldAuthSetup", 
"failed to send no offset notification in RSA key");
 
 4127      Error(
"OldAuthSetup", 
"failed to send ordinal and config info");
 
 4137         Error(
"OldAuthSetup", 
"failed to send HostAuth info");
 
 
 4158      Info(
"OldProofServAuthSetup",
 
 4159           "socket has been closed due to protocol mismatch - Exiting");
 
 4179                     Error(
"OldProofServAuthSetup",
 
 4180                           "failed to read public key from '%s'", 
keyfile.Data());
 
 4189                  Error(
"OldProofServAuthSetup", 
"failed to open '%s'", 
keyfile.Data());
 
 4198            Error(
"OldProofServAuthSetup", 
"failed to receive password");
 
 4204      } 
else if (
retval == -1) {
 
 4209            Error(
"OldProofServAuthSetup", 
"failed to receive inverted password");
 
 4226      Error(
"OldProofServAuthSetup", 
"failed to receive ordinal and config info");
 
 4267      Error(
"OldProofServAuthSetup", 
"failed to receive HostAuth info");
 
 
const Int_t kAUTH_SSALT_MSK
 
const Int_t kAUTH_CRYPT_MSK
 
const Int_t kAUTH_REUSE_MSK
 
const Int_t kAUTH_RSATY_MSK
 
R__EXTERN const char * gRootdErrStr[]
 
TVirtualMutex * gAuthenticateMutex
 
static Int_t SendHostAuth(TSocket *s)
Sends the list of the relevant THostAuth objects to the master or to the active slaves,...
 
Int_t OldProofServAuthSetup(TSocket *sock, Bool_t master, Int_t protocol, TString &user, TString &ord, TString &conf)
Authentication related setup in TProofServ run after successful startup.
 
Int_t StdCheckSecCtx(const char *, TRootSecContext *)
Standard version of CheckSecCtx to be passed to TAuthenticate::AuthExists Check if User is matches th...
 
Int_t OldSlaveAuthSetup(TSocket *sock, Bool_t, TString ord, TString conf)
Setup of authetication in PROOF run after successful opening of the socket.
 
static Int_t RecvHostAuth(TSocket *s, Option_t *opt)
Receive from client/master directives for authentications, create related THostAuth and add them to t...
 
R__rsa_KEY_export R__fgRSAPubExport[2]
 
static int auth_rand()
rand() implementation using /udev/random or /dev/random, if available
 
R__EXTERN TVirtualMutex * gAuthenticateMutex
 
Int_t(* Krb5Auth_t)(TAuthenticate *auth, TString &user, TString &det, Int_t version)
 
Int_t(* SecureAuth_t)(TAuthenticate *auth, const char *user, const char *passwd, const char *remote, TString &det, Int_t version)
 
Int_t(* GlobusAuth_t)(TAuthenticate *auth, TString &user, TString &det)
 
Int_t(* CheckSecCtx_t)(const char *subj, TRootSecContext *ctx)
 
ROOT::Detail::TRangeCast< T, true > TRangeDynCast
TRangeDynCast is an adapter class that allows the typed iteration through a TCollection.
 
void Info(const char *location, const char *msgfmt,...)
Use this function for informational messages.
 
void Error(const char *location, const char *msgfmt,...)
Use this function in case an error occurred.
 
void Warning(const char *location, const char *msgfmt,...)
Use this function in warning situations.
 
winID h TVirtualViewer3D TVirtualGLPainter p
 
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char ColorStruct_t color const char Pixmap_t Pixmap_t PictureAttributes_t attr const char char ret_data h unsigned char height h offset
 
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t r
 
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t result
 
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char ColorStruct_t color const char Pixmap_t Pixmap_t PictureAttributes_t attr const char char ret_data h unsigned char height h Atom_t Int_t ULong_t ULong_t unsigned char prop_list Atom_t Atom_t Atom_t Time_t UChar_t len
 
char * Form(const char *fmt,...)
Formats a string in a circular formatting buffer.
 
void Printf(const char *fmt,...)
Formats a string in a circular formatting buffer and prints the string.
 
char * StrDup(const char *str)
Duplicate the string str.
 
Bool_t R_ISREG(Int_t mode)
 
Bool_t R_ISDIR(Int_t mode)
 
R__EXTERN TSystem * gSystem
 
#define R__LOCKGUARD2(mutex)
 
static void RemoveHostAuth(THostAuth *ha, Option_t *opt="")
Remove THostAuth instance from the list.
 
static Int_t SetRSAPublic(const char *rsapubexport, Int_t klen)
Store RSA public keys from export string rsaPubExport.
 
static TPluginHandler * fgPasswdDialog
 
static void SetGlobalSRPPwd(Bool_t srppwd)
Set global SRP passwd flag to be used for authentication to rootd or proofd.
 
static Bool_t fgPromptUser
 
TRootSecContext * fSecContext
 
static void FileExpand(const char *fin, FILE *ftmp)
Expands include directives found in fexp files The expanded, temporary file, is pointed to by 'ftmp' ...
 
static const char * GetGlobalUser()
Static method returning the global user.
 
static void SetGlobalUser(const char *user)
Set global user name to be used for authentication to rootd or proofd.
 
static void SetPromptUser(Bool_t promptuser)
Set global PromptUser flag.
 
Int_t RfioAuth(TString &user)
RFIO authentication (no longer supported)
 
static void Show(Option_t *opt="S")
Print info about the authentication sector.
 
const char * GetSshUser(TString user) const
Method returning the user to be used for the ssh login (no longer supported)
 
static const char * GetDefaultUser()
Static method returning the default user information.
 
static Bool_t GetPromptUser()
Static method returning the prompt user settings.
 
static Int_t SecureRecv(TSocket *Socket, Int_t dec, Int_t KeyType, char **Out)
Receive str from sock and decode it using key indicated by key type Return number of received bytes o...
 
static const char * GetKrb5Principal()
Static method returning the principal to be used to init Krb5 tickets.
 
THostAuth * GetHostAuth() const
 
static void SetAuthReUse(Bool_t authreuse)
Set global AuthReUse flag.
 
static R__rsa_KEY_export * fgRSAPubExport
 
char * GetRandString(Int_t Opt, Int_t Len)
Allocates and fills a 0 terminated buffer of length len+1 with len random characters.
 
static TList * GetProofAuthInfo()
Static method returning the list with authentication directives to be sent to proof.
 
Int_t SshAuth(TString &user)
SSH client authentication code (no longer supported)
 
static char * PromptPasswd(const char *prompt="Password: ")
Static method to prompt for the user's passwd to be used for authentication to rootd or proofd.
 
static void SetDefaultUser(const char *defaultuser)
Set default user name.
 
static void SetGlobalPwHash(Bool_t pwhash)
Set global passwd hash flag to be used for authentication to rootd or proofd.
 
static void SetGlobalExpDate(TDatime expdate)
Set default expiring date for new validity contexts.
 
static Int_t GetRSAInit()
Static method returning the RSA initialization flag.
 
static void SetSecureAuthHook(SecureAuth_t func)
Set secure authorization function.
 
static Int_t GetClientProtocol()
Static method returning supported client protocol.
 
static Int_t ReadRootAuthrc()
Read authentication directives from $ROOTAUTHRC, $HOME/.rootauthrc or <Root_etc_dir>/system....
 
static Bool_t fgReadHomeAuthrc
 
static Int_t SecureSend(TSocket *Socket, Int_t enc, Int_t KeyType, const char *In)
Encode null terminated str using the session private key indicated by enc and sends it over the netwo...
 
Int_t GenRSAKeys()
Generate a valid pair of private/public RSA keys to protect for authentication token exchange.
 
Bool_t CheckNetrc(TString &user, TString &passwd)
Try to get user name and passwd from the ~/.rootnetrc or ~/.netrc files.
 
static const char * GetRSAPubExport(Int_t key=0)
Static method returning the RSA public keys.
 
static void SetReadHomeAuthrc(Bool_t readhomeauthrc)
Set flag controlling the reading of $HOME/.rootauthrc.
 
static void InitRandom()
Initialize random machine using seed from /dev/urandom (or current time if /dev/urandom not available...
 
static TList * fgProofAuthInfo
 
static R__rsa_KEY fgRSAPubKey
 
static Bool_t fgAuthReUse
 
static Bool_t GetGlobalPwHash()
Static method returning the global password hash flag.
 
static void SetKrb5AuthHook(Krb5Auth_t func)
Set kerberos5 authorization function.
 
static void SetGlobusAuthHook(GlobusAuth_t func)
Set Globus authorization function.
 
static void SetRSAInit(Int_t init=1)
Static method setting RSA initialization flag.
 
static void SetGlobalPasswd(const char *passwd)
Set global passwd to be used for authentication to rootd or proofd.
 
void SetEnvironment()
Set default authentication environment.
 
static Int_t SendRSAPublicKey(TSocket *Socket, Int_t key=0)
Receives server RSA Public key Sends local RSA public key encoded.
 
static Bool_t CheckProofAuth(Int_t cSec, TString &det)
Check if the authentication method can be attempted for the client.
 
static TDatime fgLastAuthrc
 
static TList * fgAuthInfo
 
static TString fgAuthMeth[kMAXSEC]
 
void CatchTimeOut()
Called in connection with a timer timeout.
 
Bool_t GetUserPasswd(TString &user, TString &passwd, Bool_t &pwhash, Bool_t srppwd)
Try to get user name and passwd from several sources.
 
Bool_t Authenticate()
Authenticate to remote rootd or proofd server.
 
static R__rsa_KEY fgRSAPriKey
 
static TString fgRootAuthrc
 
Int_t AuthExists(TString User, Int_t method, const char *Options, Int_t *Message, Int_t *Rflag, CheckSecCtx_t funcheck)
Check if we have a valid established sec context in memory Retrieves relevant info and negotiates wit...
 
static TList * GetAuthInfo()
Static method returning the list with authentication details.
 
static GlobusAuth_t GetGlobusAuthHook()
Static method returning the globus authorization hook (no longer supported)
 
Int_t ProofAuthSetup()
Authentication related stuff setup in TProofServ.
 
Int_t ClearAuth(TString &user, TString &passwd, Bool_t &pwhash)
UsrPwd client authentication code.
 
static void AuthError(const char *where, Int_t error)
Print error string depending on error code.
 
static char * GetDefaultDetails(Int_t method, Int_t opt, const char *user)
Determine default authentication details for method 'sec' and user 'usr'.
 
static void MergeHostAuthList(TList *Std, TList *New, Option_t *Opt="")
Tool for updating fgAuthInfo or fgProofAuthInfo 'nin' contains list of last input information through...
 
static TString fgDefaultUser
 
static Int_t GetAuthMethodIdx(const char *meth)
Static method returning the method index (which can be used to find the method in GetAuthMethod()).
 
static Int_t DecodeRSAPublic(const char *rsapubexport, R__rsa_NUMBER &n, R__rsa_NUMBER &d, char **rsassl=nullptr)
Store RSA public keys from export string rsaPubExport.
 
static void SetTimeOut(Int_t to)
Set timeout (active if > 0)
 
static Bool_t fgUsrPwdCrypt
 
TAuthenticate(TSocket *sock, const char *remote, const char *proto, const char *user="")
Create authentication object.
 
static void RemoveSecContext(TRootSecContext *ctx)
Tool for removing SecContext ctx from THostAuth listed in fgAuthInfo or fgProofAuthInfo.
 
static TDatime GetGlobalExpDate()
Static method returning default expiring date for new validity contexts.
 
static Bool_t GetGlobalSRPPwd()
Static method returning the global SRP password flag.
 
static SecureAuth_t fgSecAuthHook
 
static char * PromptUser(const char *remote)
Static method to prompt for the user name to be used for authentication to rootd or proofd.
 
static Bool_t CheckHost(const char *Host, const char *host)
Check if 'host' matches 'href': this means either equal or "containing" it, even with wild cards * in...
 
static void SetDefaultRSAKeyType(Int_t key)
Static method setting the default type of RSA key.
 
static const char * GetAuthMethod(Int_t idx)
Static method returning the method corresponding to idx.
 
static Bool_t GetAuthReUse()
Static method returning the authentication reuse settings.
 
static THostAuth * HasHostAuth(const char *host, const char *user, Option_t *opt="R")
Checks if a THostAuth with exact match for {host,user} exists in the fgAuthInfo list If opt = "P" use...
 
static TString Decode(const char *data)
Decode a base64 string date into a generic TString.
 
static TString Encode(const char *data)
Transform data into a null terminated base64 string.
 
This class stores the date and time with a precision of one second in an unsigned 32 bit word (950130...
 
virtual Int_t GetValue(const char *name, Int_t dflt) const
Returns the integer value for a resource.
 
TRootSecContext * CreateSecContext(const char *user, const char *host, Int_t meth, Int_t offset, const char *details, const char *token, TDatime expdate=kROOTTZERO, void *ctx=nullptr, Int_t key=-1)
Create a Security context and add it to local list Return pointer to it to be stored in TAuthenticate...
 
const char * GetHost() const
 
void SetUser(const char *user)
 
void SetHost(const char *host)
 
void SetFirst(Int_t level)
Set 'method' to be the first used (if in the list ...).
 
void SetServer(Int_t server)
 
void RemoveMethod(Int_t level)
Remove method 'meth' from the list, if there ...
 
void CountFailure(Int_t level)
Count failures for 'method'.
 
void AddFirst(Int_t level, const char *details=nullptr)
Add new method in first position If already in the list, set as first method 'level' with authenticat...
 
Int_t GetMethod(Int_t idx) const
 
Bool_t HasMethod(Int_t level, Int_t *pos=nullptr)
Return kTRUE if method 'level' is in the list.
 
TList * Established() const
 
const char * GetDetails(Int_t level)
Return authentication details for specified level or "" if the specified level does not exist for thi...
 
void SetLast(Int_t level)
Set 'method' to be the last used (if in the list ...).
 
void CountSuccess(Int_t level)
Count successes for 'method'.
 
This class represents an Internet Protocol (IP) address.
 
void Add(TObject *obj) override
 
TObject * Remove(TObject *obj) override
Remove object from the list.
 
virtual void Warning(const char *method, const char *msgfmt,...) const
Issue warning message.
 
virtual void Error(const char *method, const char *msgfmt,...) const
Issue error message.
 
virtual void Info(const char *method, const char *msgfmt,...) const
Issue info message.
 
static const TString & GetEtcDir()
Get the sysconfig directory in the installation. Static utility function.
 
static RSA_encode_t RSA_encode()
 
static RSA_genprim_t RSA_genprim()
 
static RSA_assign_t RSA_assign()
 
static RSA_cmp_t RSA_cmp()
 
static RSA_decode_t RSA_decode()
 
static RSA_genrsa_t RSA_genrsa()
 
static RSA_num_sput_t RSA_num_sput()
 
static RSA_num_sget_t RSA_num_sget()
 
Regular expression class.
 
void Print(Option_t *option="F") const override
If opt is "F" (default) print object content.
 
Bool_t IsActive() const
Check remote OffSet and expiring Date.
 
const char * GetID() const
 
void SetID(const char *id)
 
void AddForCleanup(Int_t port, Int_t proto, Int_t type)
Create a new TSecContextCleanup Internally is added to the list.
 
const char * GetUser() const
 
virtual Int_t Recv(TMessage *&mess)
Receive a TMessage object.
 
static Int_t GetClientProtocol()
Static method returning supported client protocol.
 
Int_t GetRemoteProtocol() const
 
virtual void Close(Option_t *opt="")
Close the socket.
 
virtual Int_t RecvRaw(void *buffer, Int_t length, ESendRecvOptions opt=kDefault)
Receive a raw buffer of specified length bytes.
 
TSecContext * GetSecContext() const
 
virtual Int_t SendRaw(const void *buffer, Int_t length, ESendRecvOptions opt=kDefault)
Send a raw buffer of specified length.
 
Int_t GetServType() const
 
virtual Int_t Send(const TMessage &mess)
Send a TMessage object.
 
const char * Data() const
 
void Resize(Ssiz_t n)
Resize the string. Truncate or add blanks as necessary.
 
Bool_t BeginsWith(const char *s, ECaseCompare cmp=kExact) const
 
TString & Remove(Ssiz_t pos)
 
static TString Format(const char *fmt,...)
Static method which formats a string using a printf style format descriptor and return a TString.
 
void Form(const char *fmt,...)
Formats a string using a printf style format descriptor.
 
Bool_t Contains(const char *pat, ECaseCompare cmp=kExact) const
 
Ssiz_t Index(const char *pat, Ssiz_t i=0, ECaseCompare cmp=kExact) const
 
virtual FILE * TempFileName(TString &base, const char *dir=nullptr, const char *suffix=nullptr)
Create a secure temporary file by appending a unique 6 letter string to base.
 
virtual int GetPid()
Get process id.
 
virtual const char * Getenv(const char *env)
Get environment variable.
 
virtual char * ConcatFileName(const char *dir, const char *name)
Concatenate a directory and a file name. User must delete returned string.
 
virtual int Load(const char *module, const char *entry="", Bool_t system=kFALSE)
Load a shared library.
 
int GetPathInfo(const char *path, Long_t *id, Long_t *size, Long_t *flags, Long_t *modtime)
Get info about a file: id, size, flags, modification time.
 
virtual Bool_t AccessPathName(const char *path, EAccessMode mode=kFileExists)
Returns FALSE if one can access a file using the specified access mode.
 
virtual void DispatchOneEvent(Bool_t pendingOnly=kFALSE)
Dispatch a single event.
 
virtual const char * HostName()
Return the system's host name.
 
virtual Int_t GetEffectiveUid()
Returns the effective user id.
 
virtual TInetAddress GetHostByName(const char *server)
Get Internet Protocol (IP) address of host.
 
virtual const char * HomeDirectory(const char *userName=nullptr)
Return the user's home directory.
 
virtual int Unlink(const char *name)
Unlink, i.e.
 
virtual UserGroup_t * GetUserInfo(Int_t uid)
Returns all user info in the UserGroup_t structure.
 
char * DynamicPathName(const char *lib, Bool_t quiet=kFALSE)
Find a dynamic library called lib using the system search paths.
 
Handles synchronous and a-synchronous timer events.
 
This class implements a mutex interface.
 
void inv(rsa_NUMBER *, rsa_NUMBER *, rsa_NUMBER *)